/* ============================================
   MoveSpell - Magic Hand Edition
   Child-Friendly Theme System & Core Styles
   ============================================ */

/* Google Fonts - Child-friendly fonts */
@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800&display=swap");

/* ============================================
   CSS Variables - Child-Friendly Theme Tokens
   ============================================ */

/* Theme: Ocean Adventure (Default) - Bright, friendly blues and oranges */
:root {
  --bg-color: #e8f4fc;
  --bg-gradient: linear-gradient(180deg, #87ceeb 0%, #e8f4fc 50%, #fff9e6 100%);
  --primary-color: #4fc3f7;
  --primary-glow: rgba(79, 195, 247, 0.5);
  --secondary-color: #ff9800;
  --accent-color: #66bb6a;
  --text-color: #2c3e50;
  --text-muted: #607d8b;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(79, 195, 247, 0.5);
  --orb-gradient: linear-gradient(135deg, #4fc3f7, #29b6f6);
  --orb-shadow: 0 8px 25px rgba(79, 195, 247, 0.4);
  --slot-bg: rgba(79, 195, 247, 0.15);
  --slot-border: #4fc3f7;
  --correct-color: #66bb6a;
  --wrong-color: #ef5350;
  --font-primary: "Fredoka", "Comic Sans MS", cursive;
  --font-secondary: "Nunito", sans-serif;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Sizing for responsiveness */
  --orb-size: clamp(80px, 10vw, 120px);
  --slot-width: clamp(70px, 9vw, 110px);
  --slot-height: clamp(80px, 10vw, 120px);
  --font-size-large: clamp(2rem, 5vw, 4rem);
  --font-size-medium: clamp(1.2rem, 3vw, 2rem);
  --spacing-unit: clamp(10px, 2vw, 20px);
}

/* Theme: Magic Forest - Warm purples and greens for fantasy feel */
body.theme-fantasy {
  --bg-color: #f3e5f5;
  --bg-gradient: linear-gradient(180deg, #ce93d8 0%, #f3e5f5 50%, #fff8e1 100%);
  --primary-color: #ab47bc;
  --primary-glow: rgba(171, 71, 188, 0.5);
  --secondary-color: #ff7043;
  --accent-color: #81c784;
  --text-color: #4a148c;
  --text-muted: #7b1fa2;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(171, 71, 188, 0.5);
  --orb-gradient: linear-gradient(135deg, #ce93d8, #ab47bc);
  --orb-shadow: 0 8px 25px rgba(171, 71, 188, 0.4);
  --slot-bg: rgba(171, 71, 188, 0.15);
  --slot-border: #ab47bc;
  --correct-color: #81c784;
  --wrong-color: #ff7043;
  --font-primary: "Fredoka", "Comic Sans MS", cursive;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Main Container
   ============================================ */

#game-container {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1; /* Above camera overlay */
}

/* Video (Camera) Element - Full-page background */
#camera-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror the video */
  z-index: -1;
  pointer-events: none;
}

/* Camera overlay - Semi-transparent dark layer for better visibility */
.camera-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(
    0,
    0,
    0,
    0.9
  ); /* Very dark overlay - only show faint silhouette */
  z-index: 0;
  pointer-events: none;
}

/* Debug camera preview - smaller and less intrusive */
#camera-preview {
  position: absolute;
  top: var(--spacing-unit);
  right: var(--spacing-unit);
  width: clamp(120px, 15vw, 180px);
  height: clamp(90px, 11vw, 135px);
  border: 3px solid var(--primary-color);
  border-radius: 15px;
  overflow: hidden;
  opacity: 0.9;
  z-index: 100;
  transform: scaleX(-1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#camera-preview.hidden {
  display: none;
}

/* Phaser Canvas */
#game-canvas {
  display: block;
}

/* ============================================
   Loading Screen
   ============================================ */

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--primary-color);
  text-shadow: 2px 2px 0 var(--secondary-color);
  margin-bottom: 2rem;
  animation: wiggle 2s ease-in-out infinite;
}

.loading-spinner {
  width: clamp(50px, 10vw, 80px);
  height: clamp(50px, 10vw, 80px);
  border: 6px solid var(--card-border);
  border-top-color: var(--secondary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin-top: 1.5rem;
  font-size: var(--font-size-medium);
  font-weight: 600;
  color: var(--text-muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(2deg);
  }
}

/* ============================================
   Landing Page / Camera Permission Request
   ============================================ */

#permission-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: clamp(20px, 5vw, 60px);
  overflow-y: auto; /* Allow scrolling if content is too tall for viewport */
  scroll-behavior: smooth;
}

#permission-overlay.hidden {
  display: none;
}

.landing-header {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landing-logo {
  width: clamp(120px, 20vw, 280px);
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

.landing-title {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800;
  color: var(--primary-color);
  text-shadow: 3px 3px 0 var(--secondary-color), 6px 6px 20px rgba(0, 0, 0, 0.1);
  animation: wiggle 2s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

.landing-tagline {
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.2rem;
  text-transform: uppercase;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1000px;
  width: 100%;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.feature-card {
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  border-radius: 30px;
  padding: clamp(20px, 3vw, 30px);
  text-align: center;
  transition: all var(--transition-normal);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.feature-card:hover {
  transform: translateY(-10px);
  border-color: var(--secondary-color);
  box-shadow: 0 15px 40px rgba(255, 152, 0, 0.2);
}

.feature-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.feature-card p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.landing-action {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.permission-btn {
  padding: clamp(1.2rem, 3vw, 1.8rem) clamp(2.5rem, 6vw, 4.5rem);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-family: var(--font-primary);
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--secondary-color), #fb8c00);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
}

.permission-btn:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 15px 40px rgba(255, 152, 0, 0.5);
}

.privacy-warning {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ef5350; /* Red color as requested */
  max-width: 400px;
  line-height: 1.4;
}

.landing-footer {
  margin-top: auto;
  padding-top: clamp(2rem, 4vw, 3rem);
  text-align: center;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--text-muted);
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.footer-links a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

.footer-dot {
  color: var(--text-muted);
  opacity: 0.5;
}

.permission-btn:active {
  transform: scale(1.02);
}

.permission-error {
  max-width: 600px;
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-top: 1.5rem;
  background: rgba(239, 83, 80, 0.1);
  border: 3px solid var(--wrong-color);
  border-radius: 20px;
  color: var(--text-color);
  text-align: center;
  animation: errorSlideIn 0.3s ease forwards;
}

.permission-error strong {
  color: var(--wrong-color);
  font-size: clamp(1.1rem, 2.8vw, 1.5rem);
}

.permission-error small {
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--text-muted);
  display: block;
  margin-top: 0.5rem;
}

@keyframes errorSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Hand Cursor
   ============================================ */

#hand-cursor {
  position: fixed;
  width: clamp(50px, 8vw, 80px);
  height: clamp(50px, 8vw, 80px);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--secondary-color) 0%,
    transparent 70%
  );
  border: 4px solid var(--secondary-color);
  pointer-events: none;
  z-index: 500;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s;
  box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
}

/* Breathing animation when hand is detected */
#hand-cursor.detected {
  animation: breathing 1.5s ease-in-out infinite;
}

@keyframes breathing {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 0 40px rgba(255, 152, 0, 0.8), 0 0 60px rgba(255, 152, 0, 0.4);
  }
}

#hand-cursor.grabbing {
  width: clamp(60px, 10vw, 100px);
  height: clamp(60px, 10vw, 100px);
  background: radial-gradient(circle, var(--correct-color) 0%, transparent 70%);
  border-color: var(--correct-color);
  box-shadow: 0 0 30px rgba(102, 187, 106, 0.6);
  animation: grabPulse 0.8s ease-in-out infinite;
}

@keyframes grabPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 30px rgba(102, 187, 106, 0.6);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 50px rgba(102, 187, 106, 0.9),
      0 0 70px rgba(102, 187, 106, 0.5);
  }
}

#hand-cursor.hidden {
  opacity: 0;
}

/* ============================================
   UI Overlays
   ============================================ */

.ui-overlay {
  position: absolute;
  pointer-events: none;
}

.ui-overlay > * {
  pointer-events: auto;
}

/* Top HUD */
#hud-top {
  top: var(--spacing-unit);
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--spacing-unit);
}

.hud-item {
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  border-radius: 20px;
  padding: clamp(8px, 2vw, 15px) clamp(15px, 3vw, 25px);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hud-icon {
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.hud-value {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: var(--primary-color);
}

/* Word Display */
#word-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-large);
  font-weight: 700;
  letter-spacing: 0.3rem;
  color: var(--text-color);
  text-shadow: 2px 2px 0 white;
}

/* Slot Container - Positioned higher for less hand travel */
#slot-container {
  position: absolute;
  bottom: 25%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--spacing-unit);
}

.letter-slot {
  width: var(--slot-width);
  height: var(--slot-height);
  background: var(--slot-bg);
  border: 4px dashed var(--slot-border);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.letter-slot.filled {
  border-style: solid;
  background: rgba(102, 187, 106, 0.25);
  border-color: var(--correct-color);
}

.letter-slot.hint {
  color: var(--text-muted);
}

/* ============================================
   Letter Orbs - Larger and positioned closer to slots
   ============================================ */

.letter-orb {
  width: var(--orb-size);
  height: var(--orb-size);
  border-radius: 50%;
  background: var(--orb-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: white;
  box-shadow: var(--orb-shadow);
  cursor: grab;
  transition: transform var(--transition-fast);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.letter-orb:hover {
  transform: scale(1.15);
}

.letter-orb.grabbed {
  cursor: grabbing;
  transform: scale(1.25);
}

/* ============================================
   Portal Selection (Setup Scene)
   ============================================ */

.portal-container {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-unit);
  gap: clamp(30px, 5vw, 80px);
}

.portal {
  width: clamp(200px, 30vw, 350px);
  height: clamp(250px, 40vh, 450px);
  background: var(--card-bg);
  border: 5px solid var(--card-border);
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.portal:hover,
.portal.active {
  transform: scale(1.08) translateY(-10px);
  border-color: var(--secondary-color);
  box-shadow: 0 15px 50px rgba(255, 152, 0, 0.3);
}

.portal-icon {
  font-size: clamp(4rem, 10vw, 7rem);
  margin-bottom: 1rem;
}

.portal-title {
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.portal-desc {
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  color: var(--text-muted);
  text-align: center;
  padding: 0 20px;
}

/* ============================================
   Difficulty Selector
   ============================================ */

.difficulty-container {
  display: flex;
  gap: clamp(20px, 4vw, 40px);
  justify-content: center;
  align-items: flex-end;
}

.difficulty-step {
  background: var(--card-bg);
  border: 4px solid var(--card-border);
  border-radius: 25px;
  padding: clamp(20px, 4vw, 40px);
  text-align: center;
  transition: all var(--transition-normal);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.difficulty-step:nth-child(1) {
  height: clamp(120px, 18vh, 180px);
}
.difficulty-step:nth-child(2) {
  height: clamp(160px, 24vh, 240px);
}
.difficulty-step:nth-child(3) {
  height: clamp(200px, 30vh, 300px);
}

.difficulty-step:hover,
.difficulty-step.active {
  border-color: var(--secondary-color);
  box-shadow: 0 10px 35px rgba(255, 152, 0, 0.25);
  transform: translateY(-10px);
}

.difficulty-label {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-color);
}

.difficulty-example {
  font-size: clamp(1.2rem, 3vw, 2rem);
  letter-spacing: 5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ============================================
   Results Screen
   ============================================ */

.results-container {
  text-align: center;
  padding: var(--spacing-unit);
}

.results-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--secondary-color);
  text-shadow: 2px 2px 0 var(--primary-color);
}

.stars-container {
  font-size: clamp(3rem, 10vw, 6rem);
  margin-bottom: 2rem;
}

.star {
  display: inline-block;
  margin: 0 clamp(5px, 2vw, 15px);
  opacity: 0.3;
  transition: all var(--transition-slow);
  filter: grayscale(1);
}

.star.earned {
  opacity: 1;
  filter: grayscale(0);
  animation: starPop 0.5s ease forwards;
}

@keyframes starPop {
  0% {
    transform: scale(0) rotate(-30deg);
  }
  50% {
    transform: scale(1.4) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.results-stats {
  font-size: var(--font-size-medium);
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-weight: 600;
}

.play-again-btn {
  padding: clamp(1rem, 3vw, 1.8rem) clamp(2rem, 5vw, 4rem);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-family: var(--font-primary);
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--correct-color), #4caf50);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 6px 25px rgba(102, 187, 106, 0.4);
}

.play-again-btn:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 12px 40px rgba(102, 187, 106, 0.5);
}

/* ============================================
   Particle Effects (CSS Fallback)
   ============================================ */

.particle {
  position: absolute;
  width: 15px;
  height: 15px;
  background: var(--secondary-color);
  border-radius: 50%;
  pointer-events: none;
  animation: particleFade 1s ease forwards;
}

@keyframes particleFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0) translateY(-60px);
  }
}

/* ============================================
   Responsive Design - 2K, 4K, iPad Support
   ============================================ */

/* Large screens (2K+) */
@media (min-width: 2560px) {
  :root {
    --orb-size: 150px;
    --slot-width: 130px;
    --slot-height: 150px;
    --spacing-unit: 30px;
  }
}

/* 4K screens */
@media (min-width: 3840px) {
  :root {
    --orb-size: 200px;
    --slot-width: 180px;
    --slot-height: 200px;
    --spacing-unit: 40px;
  }

  .loading-title {
    font-size: 6rem;
  }
}

/* iPad landscape (1024px - 1366px) */
@media (min-width: 1024px) and (max-width: 1400px) and (orientation: landscape) {
  :root {
    --orb-size: 100px;
    --slot-width: 90px;
    --slot-height: 100px;
  }

  #slot-container {
    bottom: 20%;
  }

  /* Compact landing for tablet landscape */
  .landing-logo {
    width: 150px;
    margin-bottom: 1rem;
  }
  .landing-title {
    display: none; /* Hide text title on iPad as requested */
  }
  .landing-header {
    margin-bottom: 1.5rem;
  }
  .features-grid {
    margin-bottom: 1.5rem;
    gap: 15px;
  }
  .feature-card {
    padding: 15px;
  }
  .feature-icon {
    font-size: 2.5rem;
  }
}

/* Tablet / iPad Portrait & Small Desktop */
@media (max-width: 1024px) {
  .landing-logo {
    width: clamp(100px, 15vw, 200px);
    margin-bottom: 1rem;
  }

  .landing-header {
    margin-bottom: 1.5rem;
  }

  .features-grid {
    gap: 12px;
    margin-bottom: 2rem;
  }

  .feature-card {
    padding: 15px;
  }

  .feature-icon {
    font-size: 2.5rem;
  }

  .feature-card h3 {
    font-size: 1.2rem;
  }

  .feature-card p {
    font-size: 0.9rem;
  }
  
  .landing-title {
    display: none; /* Hide text title on iPad as requested */
  }
}

/* Mobile adjustments for landing page */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 1.5rem;
  }

  .landing-title {
    display: none; /* Hide text title on mobile as requested */
  }

  .landing-logo {
    width: 120px;
    margin-bottom: 0.5rem;
  }

  .feature-card {
    padding: 12px 20px;
    flex-direction: row;
    text-align: left;
    gap: 15px;
  }

  .feature-icon {
    font-size: 2rem;
    margin-bottom: 0;
  }

  .feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0;
  }

  .feature-card p {
    font-size: 0.85rem;
  }

  .landing-footer {
    padding-top: 1.5rem;
  }
}

/* Tablets in portrait */
@media (max-width: 1024px) and (orientation: portrait) {
  .portal-container {
    flex-direction: column;
    gap: 20px;
  }

  .portal {
    width: 80%;
    max-width: 350px;
    height: 180px;
    flex-direction: row;
    padding: 20px;
  }

  .portal-icon {
    font-size: 4rem;
    margin-bottom: 0;
    margin-right: 20px;
  }

  .difficulty-container {
    flex-direction: column;
    align-items: center;
  }

  .difficulty-step {
    width: 80%;
    height: auto !important;
    padding: 25px;
  }
}

/* Small tablets and large phones */
@media (max-width: 768px) {
  :root {
    --orb-size: 70px;
    --slot-width: 60px;
    --slot-height: 70px;
  }

  #slot-container {
    bottom: 15%;
  }

  #camera-preview {
    width: 100px;
    height: 75px;
  }
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
  .portal:hover {
    transform: none;
  }

  .portal:active {
    transform: scale(1.05);
  }

  .permission-btn:hover {
    transform: none;
  }

  .permission-btn:active {
    transform: scale(0.98);
  }
}

/* Fullscreen mode adjustments */
:fullscreen #game-container,
:-webkit-full-screen #game-container {
  width: 100vw;
  height: 100vh;
}
