/* ==========================================================================
   MONSTER MUNCH KITCHEN: ADDITION TO 10
   Style Sheet - Optimized for iPad, iPhone & Desktop Co-Play
   ========================================================================== */

:root {
  --font-display: 'Nunito', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Nunito', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Palette: Warm Kitchen & Cheerful Monster Colors */
  --primary-coral: #FF7043;
  --primary-orange: #FFA726;
  --primary-yellow: #FFD54F;
  --primary-purple: #9C27B0;
  --purple-light: #BA68C8;
  --purple-soft: #F3E5F5;
  --kitchen-bg: #FFF8E7;
  --wood-brown: #8D6E63;
  --wood-dark: #5D4037;
  --wood-light: #D7CCC8;
  --mint-green: #66BB6A;
  --sky-blue: #42A5F5;
  --text-dark: #37474F;
  --shadow-warm: 0 8px 24px rgba(93, 64, 55, 0.15);
  --shadow-button: 0 6px 0 rgba(0, 0, 0, 0.2);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  font-family: var(--font-body);
  color: var(--text-dark);
  background-color: var(--kitchen-bg);
}

/* Base Kitchen Backdrop */
.kitchen-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(180deg, #FFE0B2 0%, #FFF3E0 45%, #FFE082 100%);
  pointer-events: none;
  overflow: hidden;
}

.kitchen-backdrop::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.4) 12%, transparent 13%),
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.3) 12%, transparent 13%);
  background-size: 40px 40px;
  opacity: 0.8;
}

/* Shelf at top */
.kitchen-shelf-top {
  position: absolute;
  top: 60px;
  left: 5%;
  right: 5%;
  height: 14px;
  background: #A1887F;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding-bottom: 14px;
}

.shelf-item {
  font-size: 26px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  opacity: 0.85;
}

/* ==========================================================================
   APP CONTAINER & VIEWPORT BOUNDARIES
   ========================================================================== */

.game-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 12px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 12px) env(safe-area-inset-left, 16px);
}

/* ==========================================================================
   TOP NAVIGATION
   ========================================================================== */

.top-nav {
  height: 60px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  z-index: 100;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 16px;
  border-radius: 30px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
  border: 2px solid #FFE0B2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.brand-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(255, 112, 67, 0.25);
}

.brand-badge:active {
  transform: scale(0.94);
}

.brand-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

.btn-icon-pill {
  background: #FFFFFF;
  border: 2px solid #FFE0B2;
  border-radius: 24px;
  padding: 6px 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--wood-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, background 0.15s;
}

.btn-icon-pill:active {
  transform: scale(0.92);
}

.btn-pill-tip {
  background: linear-gradient(135deg, #FFB74D, #FFA726);
  border: 2px solid #FFFFFF;
  border-radius: 24px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(255, 167, 38, 0.35);
  animation: pulse-tip 2.5s infinite;
}

@keyframes pulse-tip {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Progress Tracker */
.progress-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px 16px;
  border-radius: 20px;
  border: 2px solid #FFD54F;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.progress-text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--wood-dark);
}

.star-track {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.track-star {
  font-size: 16px;
  filter: grayscale(100%);
  opacity: 0.4;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.track-star.filled {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.2);
}

/* ==========================================================================
   SCREENS WRAPPER
   ========================================================================== */

.game-screen {
  flex: 1;
  display: none;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.game-screen.active {
  display: flex;
}

/* ==========================================================================
   SCREEN 1: START SCREEN
   ========================================================================== */

#start-screen {
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.start-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-xl);
  border: 4px solid #FFE082;
  box-shadow: 0 16px 40px rgba(93, 64, 55, 0.18);
  max-width: 680px;
  width: 95%;
  padding: 24px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.chef-badge {
  background: #FFF3E0;
  border: 2px solid #FFB74D;
  border-radius: 30px;
  padding: 4px 16px;
}

.badge-tag {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #E65100;
}

.game-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.title-sub {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: #7E57C2;
  letter-spacing: 0.5px;
}

.title-main {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  color: var(--wood-dark);
}

.title-highlight {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #FF7043;
}

/* Hero Monster Preview */
.hero-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-bubble {
  background: #FFFFFF;
  border: 2px solid #CE93D8;
  border-radius: 18px;
  padding: 8px 16px;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.12);
  position: relative;
}

.preview-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #FFFFFF transparent;
}

.bubble-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--purple-primary, #6A1B9A);
}

.preview-monster {
  width: 140px;
  height: 140px;
  filter: drop-shadow(0 8px 14px rgba(123, 31, 162, 0.25));
}

/* Level Selector */
.level-selector {
  width: 100%;
}

.level-heading {
  font-family: var(--font-display);
  color: var(--wood-dark);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lvl-heading-en {
  font-size: 15px;
  font-weight: 700;
  color: var(--wood-dark);
}

.lvl-heading-vn {
  font-size: 12px;
  font-weight: 600;
  color: #7B1FA2;
  font-style: italic;
}

.level-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-level {
  flex: 1;
  min-width: 140px;
  max-width: 190px;
  background: #FAFAFA;
  border: 3px solid #E0E0E0;
  border-radius: var(--radius-md);
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-level .lvl-icon {
  font-size: 24px;
}

.btn-level .lvl-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.btn-level .lvl-desc {
  font-size: 11px;
  color: #78909C;
  font-weight: 600;
}

.btn-level.active {
  background: #FFF8E1;
  border-color: #FFA000;
  box-shadow: 0 6px 14px rgba(255, 160, 0, 0.25);
  transform: translateY(-2px);
}

.btn-level.active .lvl-name {
  color: #E65100;
}

/* Big Play Bounce Button */
.btn-play-bounce {
  background: linear-gradient(180deg, #FF7043 0%, #F4511E 100%);
  border: none;
  border-bottom: 5px solid #BF360C;
  border-radius: 40px;
  padding: 14px 44px;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 10px 25px rgba(244, 81, 30, 0.4);
  transition: transform 0.1s ease, border-bottom 0.1s ease;
  animation: start-bounce 2s infinite ease-in-out;
}

.btn-play-bounce:active {
  transform: translateY(4px);
  border-bottom-width: 1px;
}

.btn-play-icon {
  font-size: 18px;
  display: none;
}

.btn-play-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
}

.btn-play-sub {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}

@keyframes start-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ==========================================================================
   SCREEN 2: MAIN GAME PLAY
   ========================================================================== */

#game-screen {
  justify-content: space-between;
  gap: 8px;
}

/* TOP HUD: Target Recipe & Ten Frame */
.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  border: 3px solid #FFE082;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.recipe-target-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.target-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.target-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--wood-dark);
}

.btn-audio-speak {
  background: #FFF3E0;
  border: 2px solid #FFB74D;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-audio-speak:active {
  transform: scale(0.9);
}

.target-goal-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: #FFF8E1;
  border: 2px dashed #FFA000;
  border-radius: 14px;
  padding: 4px 14px;
}

.target-number-label {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: #E65100;
  line-height: 1;
}

.target-food-name {
  font-size: 14px;
  font-weight: 700;
  color: #795548;
}

/* Montessori Ten-Frame (2 rows x 5 cols) */
.ten-frame-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 2px solid #8D6E63;
  border-radius: 12px;
  padding: 4px 8px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.ten-frame-grid {
  display: grid;
  grid-template-columns: repeat(5, 26px);
  grid-template-rows: repeat(2, 26px);
  gap: 3px;
}

.ten-frame-cell {
  background: #F5F5F5;
  border: 1.5px solid #BDBDBD;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ten-frame-cell.in-goal {
  border-color: #FFA726;
  background: #FFFDE7;
}

.ten-frame-cell.out-of-goal {
  opacity: 0.35;
  border-style: dashed;
  background: #EEEEEE;
}

.ten-frame-cell.filled-a {
  background: #FFEBEE;
  border-color: #E53935;
  color: #E53935;
  transform: scale(1.08);
}

.ten-frame-cell.filled-b {
  background: #E3F2FD;
  border-color: #1E88E5;
  color: #1E88E5;
  transform: scale(1.08);
}

.ten-frame-counter {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--wood-dark);
}

/* Live Equation Strip */
.equation-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
}

.eq-slot {
  min-width: 50px;
  height: 42px;
  padding: 0 10px;
  background: #FFFFFF;
  border: 2px dashed #BDBDBD;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 18px;
  transition: all 0.2s;
}

.eq-slot.active-a {
  border-color: #E53935;
  background: #FFEBEE;
  color: #C62828;
  border-style: solid;
}

.eq-slot.active-b {
  border-color: #1E88E5;
  background: #E3F2FD;
  color: #1565C0;
  border-style: solid;
}

.eq-slot.slot-total {
  background: #FFF8E1;
  border: 2px solid #FFA000;
  color: #E65100;
  font-size: 22px;
}

.eq-operator {
  color: #795548;
  font-size: 24px;
}

/* ==========================================================================
   STAGE: MONSTER & FEEDING DISH
   ========================================================================== */

.kitchen-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: relative;
  min-height: 200px;
  padding: 6px 12px;
}

/* Monster Character & Dialogue */
.monster-character-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.monster-dialogue {
  background: #FFFFFF;
  border: 3px solid #BA68C8;
  border-radius: 20px;
  padding: 8px 18px;
  max-width: 280px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #4A148C;
  box-shadow: 0 4px 14px rgba(156, 39, 176, 0.15);
  margin-bottom: 6px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.monster-dialogue.speaking {
  border-color: #FF9800;
  box-shadow: 0 0 16px rgba(255, 152, 0, 0.45);
  animation: dialoguePulse 0.7s ease-in-out infinite alternate;
}

@keyframes dialoguePulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.monster-dialogue::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: #FFFFFF transparent;
}

/* Dual Language Subtitle Typography (Natural Parent-to-Child Voice) */
.speech-en {
  font-size: 14px;
  font-weight: 800;
  color: #4A148C;
  line-height: 1.3;
}

.speech-vn {
  font-size: 11.5px;
  font-weight: 600;
  color: #7B1FA2;
  font-style: italic;
  margin-top: 3px;
  line-height: 1.25;
}

.hint-en {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #5D4037;
}

.hint-vn {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: #8D6E63;
  font-style: italic;
  margin-top: 2px;
}

.shelf-instruction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.shelf-instruction .shelf-en {
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
}

.shelf-instruction .shelf-vn {
  font-size: 11px;
  font-weight: 500;
  color: #FFE082;
  font-style: italic;
}

.bubble-sub {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #7B1FA2;
  font-style: italic;
  margin-top: 3px;
}

.btn-play-sub, .btn-sub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.92;
  margin-top: 2px;
}

.victory-title-sub {
  font-size: 15px;
  font-weight: 700;
  color: #7B1FA2;
  font-style: italic;
  margin-top: -4px;
  margin-bottom: 4px;
}

.victory-subtitle-sub {
  font-size: 12px;
  font-weight: 600;
  color: #6D4C41;
  font-style: italic;
  margin-top: -6px;
  margin-bottom: 12px;
}

.facts-title-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: #8D6E63;
  font-style: italic;
  margin-bottom: 8px;
}

.clear-en {
  display: block;
  font-weight: 700;
}

.clear-vn {
  display: block;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.9;
}

.monster-body-svg {
  width: 200px;
  height: 200px;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 10px 18px rgba(123, 31, 162, 0.35));
}

.monster-body-svg.mouth-open {
  transform: scale(1.08) translateY(-4px);
}

.monster-body-svg.chewing {
  animation: monster-chew 0.5s infinite alternate ease-in-out;
}

.monster-body-svg.celebrate {
  animation: monster-dance 0.6s 3 ease-in-out;
}

@keyframes monster-chew {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.04, 0.96) translateY(2px); }
}

@keyframes monster-dance {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-6deg); }
  75% { transform: translateY(-12px) rotate(6deg); }
}

/* Feeding Counter & Pot */
.feeding-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.counter-surface {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pot-dropzone {
  position: relative;
  width: 220px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dish-plate {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 40%, #FFFFFF 50%, #ECEFF1 85%, #CFD8DC 100%);
  border: 4px solid #B0BEC5;
  border-bottom: 8px solid #90A4AE;
  border-radius: 50% / 40%;
  box-shadow: 0 12px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  transition: all 0.2s;
  position: relative;
}

.dish-plate.hover-target {
  border-color: #FFA726;
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(255, 167, 38, 0.5);
}

.dish-inner-zone {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.drop-hint {
  font-size: 13px;
  font-weight: 700;
  color: #78909C;
  text-align: center;
  pointer-events: none;
  line-height: 1.3;
}

.placed-foods-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
}

.btn-clear-dish {
  background: #FFECB3;
  border: 2px solid #FFA000;
  border-radius: 20px;
  padding: 4px 14px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #E65100;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-clear-dish:active {
  transform: scale(0.92);
}

/* ==========================================================================
   BOTTOM SHELF: FOOD SELECTION PLATES
   ========================================================================== */

.food-shelf-container {
  width: 100%;
  margin-top: auto;
}

.shelf-wooden-plank {
  background: linear-gradient(180deg, #A1887F 0%, #8D6E63 40%, #6D4C41 100%);
  border-top: 4px solid #BCAAA4;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 16px 14px 16px;
  box-shadow: 0 -6px 20px rgba(93, 64, 55, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.shelf-instruction {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #FFF8E1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.food-plates-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Individual Food Plate (Interactive / Draggable) */
.food-plate-item {
  width: 100px;
  height: 100px;
  min-width: 90px;
  background: radial-gradient(circle at 50% 35%, #FFFFFF 55%, #F5F5F5 80%, #E0E0E0 100%);
  border: 3px solid #FFFFFF;
  border-bottom: 6px solid #CFD8DC;
  border-radius: 50%;
  box-shadow: 0 8px 16px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
  touch-action: none;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.food-plate-item:active {
  cursor: grabbing;
}

.food-plate-item.selected {
  opacity: 0.35;
  filter: grayscale(80%);
  pointer-events: none;
  transform: scale(0.9);
}

.food-plate-item.dragging {
  opacity: 0.9;
  transform: scale(1.15);
  box-shadow: 0 16px 30px rgba(0,0,0,0.3);
  z-index: 1000;
}

/* Number Badge on plate */
.plate-num-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #FF7043, #F4511E);
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.plate-items-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  max-width: 75px;
  max-height: 65px;
  gap: 2px;
}

.plate-food-icon {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}

/* ==========================================================================
   SCREEN 3: VICTORY & SUMMARY SCREEN
   ========================================================================== */

#victory-screen {
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.victory-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-xl);
  border: 5px solid #FFD54F;
  box-shadow: 0 16px 45px rgba(93, 64, 55, 0.22);
  max-width: 580px;
  width: 95%;
  padding: 24px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.victory-trophy {
  font-size: 54px;
  animation: trophy-wobble 1.5s infinite ease-in-out;
}

@keyframes trophy-wobble {
  0%, 100% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.1) rotate(-8deg); }
  75% { transform: scale(1.1) rotate(8deg); }
}

.victory-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: #E65100;
}

.victory-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: #5D4037;
}

.victory-stars {
  display: flex;
  gap: 8px;
  font-size: 36px;
  margin: 4px 0;
}

.v-star {
  animation: star-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.v-star.star-1 { animation-delay: 0.1s; }
.v-star.star-2 { animation-delay: 0.3s; }
.v-star.star-3 { animation-delay: 0.5s; }

@keyframes star-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1.2); opacity: 1; }
}

.mastered-facts-card {
  width: 100%;
  background: #FFF8E1;
  border: 2px dashed #FFA000;
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.facts-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #795548;
  margin-bottom: 6px;
}

.facts-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.fact-chip {
  background: #FFFFFF;
  border: 2px solid #FFB74D;
  border-radius: 14px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #E65100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.victory-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-secondary-pill {
  background: #ECEFF1;
  border: 2px solid #CFD8DC;
  border-radius: 30px;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #455A64;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-secondary-pill:active {
  transform: scale(0.94);
}

/* ==========================================================================
   PARENT TIP MODAL
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  border: 4px solid #FFB74D;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #FFF8E1;
  border-bottom: 2px solid #FFE082;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-icon {
  font-size: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #E65100;
}

.btn-close-modal {
  background: #F5F5F5;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  color: #757575;
  cursor: pointer;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tip-section h4 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--wood-dark);
  margin-bottom: 4px;
}

.tip-section p {
  font-size: 13px;
  line-height: 1.5;
  color: #455A64;
  margin-bottom: 4px;
}

.modal-footer {
  padding: 12px 20px;
  background: #FAFAFA;
  border-top: 1px solid #EEEEEE;
  display: flex;
  justify-content: flex-end;
}

.btn-modal-ok {
  background: linear-gradient(135deg, #FF7043, #F4511E);
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
}

/* ==========================================================================
   CONFETTI FX
   ========================================================================== */

.confetti-cannon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: confetti-fall 2.8s linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(500px) rotate(720deg); opacity: 0; }
}

/* Pop In Animation */
.pop-in {
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS & MID-SIZE SCREENS <= 768px)
   ========================================================================== */

@media (max-width: 768px) {
  .target-title {
    font-size: 14px;
  }
  
  .target-number-label {
    font-size: 26px;
  }
  
  .ten-frame-grid {
    grid-template-columns: repeat(5, 20px);
    grid-template-rows: repeat(2, 20px);
  }
  
  .ten-frame-cell {
    font-size: 12px;
  }
  
  .equation-strip {
    font-size: 18px;
    gap: 4px;
  }
  
  .eq-slot {
    min-width: 38px;
    height: 36px;
    font-size: 15px;
  }
  
  .monster-body-svg {
    width: 140px;
    height: 140px;
  }
  
  .pot-dropzone {
    width: 160px;
    height: 105px;
  }
  
  .food-plate-item {
    width: 70px;
    height: 70px;
    min-width: 65px;
  }
  
  .plate-num-badge {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }
  
  .plate-food-icon {
    font-size: 14px;
  }
  
  .title-main {
    font-size: 28px;
  }
  
  .title-highlight {
    font-size: 18px;
  }
  
  .start-card {
    padding: 16px 20px;
    gap: 12px;
  }
}

/* ==========================================================================
   PHONE PORTRAIT OPTIMIZATION (< 600px)
   Unclusters the UI, gives generous breathing room on phone screens
   ========================================================================== */
@media (max-width: 600px) {
  /* Hide background clutter behind HUD */
  .kitchen-shelf-top {
    display: none !important;
  }

  .game-container {
    padding: env(safe-area-inset-top, 4px) env(safe-area-inset-right, 6px) env(safe-area-inset-bottom, 6px) env(safe-area-inset-left, 6px);
    gap: 4px;
    height: 100dvh;
    max-width: 100vw;
  }

  /* Compact Top Navigation */
  .top-nav {
    height: 42px;
    min-height: 40px;
    padding: 2px 6px;
  }

  .nav-left, .nav-right {
    gap: 6px;
  }

  .btn-icon-pill {
    padding: 4px 8px;
    font-size: 15px;
    border-radius: 18px;
  }

  .brand-badge {
    padding: 3px 8px;
    border-radius: 18px;
  }

  .brand-logo {
    height: 24px;
  }

  .progress-badge {
    padding: 3px 8px;
    border-radius: 14px;
  }

  .progress-text {
    font-size: 10.5px;
  }

  .star-track {
    gap: 2px;
  }

  .track-star {
    font-size: 12px;
  }

  .btn-pill-tip {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
  }

  /* Game HUD: Streamlined compact row */
  .game-hud {
    padding: 5px 8px;
    border-radius: 14px;
    border-width: 2px;
    gap: 6px;
    justify-content: space-between;
  }

  .recipe-target-card {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .target-header {
    gap: 4px;
  }

  .target-title {
    font-size: 12.5px;
  }

  .btn-audio-speak {
    width: 28px;
    height: 28px;
    font-size: 13px;
    border-width: 1.5px;
  }

  .target-goal-display {
    padding: 2px 8px;
    border-radius: 10px;
    gap: 4px;
  }

  .target-number-label {
    font-size: 22px;
  }

  .target-food-name {
    display: none; /* Hide on mobile to keep HUD on a single clean row */
  }

  /* Ten-Frame: Crisp, readable 2x5 grid */
  .ten-frame-container {
    padding: 2px 5px;
    gap: 4px;
    border-radius: 8px;
    border-width: 1.5px;
  }

  .ten-frame-grid {
    grid-template-columns: repeat(5, 17px);
    grid-template-rows: repeat(2, 17px);
    gap: 2px;
  }

  .ten-frame-cell {
    font-size: 10px;
    border-radius: 4px;
    border-width: 1px;
  }

  .ten-frame-counter {
    font-size: 11.5px;
  }

  /* Equation Strip: Sleek and readable */
  .equation-strip {
    font-size: 14px;
    gap: 3px;
  }

  .eq-slot {
    min-width: 33px;
    height: 31px;
    padding: 0 4px;
    font-size: 13.5px;
    border-radius: 8px;
    border-width: 1.5px;
  }

  .eq-slot.slot-total {
    font-size: 16px;
  }

  .eq-operator {
    font-size: 14px;
  }

  /* Kitchen Stage: Scaled Up for Parents & Kids */
  .kitchen-stage {
    flex: 1 1 auto;
    min-height: 0;
    padding: 4px 6px;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    gap: 8px;
  }

  .monster-character-wrap {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .monster-dialogue {
    padding: 5px 10px;
    max-width: 190px;
    border-radius: 14px;
    border-width: 2px;
    margin-bottom: 4px;
  }

  .monster-dialogue::after {
    bottom: -6px;
    border-width: 6px 6px 0;
  }

  .monster-dialogue .speech-en {
    font-size: 12px;
    line-height: 1.25;
  }

  .monster-dialogue .speech-vn {
    font-size: 10px;
    line-height: 1.2;
    margin-top: 1.5px;
  }

  /* Scaled up Monster SVG (~40% bigger on phone) */
  .monster-body-svg {
    width: clamp(130px, 35vw, 150px);
    height: clamp(130px, 35vw, 150px);
  }

  /* Counter & Pot (Scaled up for easy touch & drop) */
  .counter-surface {
    gap: 4px;
  }

  .pot-dropzone {
    width: clamp(145px, 38vw, 170px);
    height: clamp(92px, 24vw, 110px);
  }

  .dish-plate {
    border-width: 3.5px;
    border-bottom-width: 6px;
    padding: 4px;
  }

  .drop-hint {
    font-size: 10px;
    line-height: 1.2;
  }

  .drop-hint .hint-en {
    font-size: 10.5px;
  }

  .drop-hint .hint-vn {
    font-size: 9px;
  }

  .food-plate-item.mini {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }

  .food-plate-item.mini .plate-num-badge {
    width: 18px;
    height: 18px;
    font-size: 11px;
    top: -3px;
    right: -3px;
  }

  .food-plate-item.mini .plate-food-icon {
    font-size: 11px;
  }

  .btn-clear-dish {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 12px;
  }

  /* Food Shelf: 4 plates spread comfortably across the phone width */
  .shelf-wooden-plank {
    padding: 6px 6px max(14px, env(safe-area-inset-bottom)) 6px;
    border-radius: 18px 18px 0 0;
    border-top-width: 3px;
    gap: 4px;
  }

  .shelf-instruction .shelf-en {
    font-size: 12px;
  }

  .shelf-instruction .shelf-vn {
    font-size: 10px;
  }

  .food-plates-row {
    gap: 6px;
    justify-content: space-evenly;
    overflow-x: visible;
  }

  /* Scaled up plates (~20% bigger, comfortable finger tap) */
  .food-plate-item {
    width: clamp(66px, 19.5vw, 76px);
    height: clamp(66px, 19.5vw, 76px);
    min-width: 60px;
    border-width: 3px;
    border-bottom-width: 5px;
  }

  .plate-num-badge {
    width: 22px;
    height: 22px;
    font-size: 13px;
    font-weight: 800;
    top: -5px;
    right: -5px;
  }

  .plate-items-cluster {
    max-width: 48px;
    max-height: 42px;
    gap: 1.5px;
  }

  /* Clearer, bolder treat icons */
  .plate-food-icon {
    font-size: 15px;
  }

  /* Start Screen on Phone */
  .start-card {
    padding: 16px 14px;
    gap: 8px;
    border-radius: 20px;
    border-width: 3px;
  }

  .badge-tag {
    font-size: 11px;
    padding: 2px 8px;
  }

  .title-main {
    font-size: 24px;
  }

  .title-highlight {
    font-size: 16px;
  }

  .preview-bubble {
    padding: 5px 12px;
    margin-bottom: 4px;
  }

  .bubble-text {
    font-size: 11.5px;
  }

  .bubble-sub {
    font-size: 10px;
  }

  .preview-monster {
    width: 95px;
    height: 95px;
  }

  .level-heading {
    margin-bottom: 4px;
    gap: 1px;
  }

  .lvl-heading-en {
    font-size: 12.5px;
  }

  .lvl-heading-vn {
    font-size: 10px;
  }

  .level-buttons {
    gap: 6px;
  }

  .btn-level {
    min-width: 82px;
    padding: 6px 3px;
    border-width: 2px;
  }

  .btn-level .lvl-icon {
    font-size: 18px;
  }

  .btn-level .lvl-name {
    font-size: 11.5px;
  }

  .btn-level .lvl-desc {
    font-size: 9px;
  }

  .btn-play-bounce {
    padding: 11px 30px;
    border-bottom-width: 4px;
  }

  .btn-play-text {
    font-size: 17px;
  }

  .btn-play-sub {
    font-size: 10px;
  }

  /* Victory Card on Phone */
  .victory-card {
    padding: 16px 14px;
    gap: 8px;
  }

  .victory-trophy {
    font-size: 38px;
  }

  .victory-title {
    font-size: 24px;
  }

  .victory-title-sub {
    font-size: 13.5px;
  }

  .victory-subtitle {
    font-size: 12.5px;
  }

  .victory-subtitle-sub {
    font-size: 10.5px;
  }

  .victory-stars {
    font-size: 26px;
  }

  .facts-title {
    font-size: 12px;
  }

  .facts-title-sub {
    font-size: 10px;
  }

  .fact-chip {
    font-size: 11px;
    padding: 2px 6px;
  }

  .btn-secondary-pill {
    padding: 8px 16px;
    font-size: 13px;
  }
}

/* ==========================================================================
   SMALL PHONE LANDSCAPE (< 500px height)
   ========================================================================== */
@media (max-height: 500px) {
  .top-nav {
    height: 38px;
  }
  .brand-badge {
    padding: 2px 6px;
  }
  .brand-logo {
    height: 20px;
  }
  .game-hud {
    padding: 3px 8px;
    gap: 4px;
  }
  .target-number-label {
    font-size: 18px;
  }
  .ten-frame-grid {
    grid-template-columns: repeat(5, 14px);
    grid-template-rows: repeat(2, 14px);
  }
  .monster-body-svg {
    width: 85px;
    height: 85px;
  }
  .pot-dropzone {
    width: 120px;
    height: 70px;
  }
  .food-plate-item {
    width: 54px;
    height: 54px;
    min-width: 48px;
  }
  .shelf-wooden-plank {
    padding: 2px 8px 6px 8px;
  }
}
