/* ==========================================================================
   Job Fair Explorer – Meet the Jobs
   Storybook Watercolor & Graphite Theme
   ========================================================================== */

:root {
  --paper: #FBF8F1;
  --paper-deep: #F3ECE0;
  --paper-card: #FFFDF8;
  --ink: #35322E;
  --ink-soft: #59534B;
  --navy: #2F4562;
  --navy-light: #4A668A;
  --red: #B85D57;
  --red-soft: #EED9D6;
  --teal: #5D8E86;
  --teal-soft: #DFECE9;
  --ochre: #D4963F;
  --ochre-soft: #F8EBD4;
  --warm-gray: #7D766D;
  --border-ink: #47433D;
  --shadow-sketch: 3px 4px 0 rgba(53, 50, 46, 0.14);
  --radius-sketch: 18px 22px 19px 24px / 22px 18px 23px 19px;
  --radius-pill: 26px 22px 24px 20px / 20px 24px 22px 26px;
  --font-display: "Baloo 2", "Nunito", ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  --font-body: "Nunito", "Baloo 2", ui-rounded, system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(180, 164, 136, 0.12) 1px, transparent 1px),
    radial-gradient(rgba(165, 148, 120, 0.08) 1px, transparent 1px);
  background-size: 28px 28px, 44px 44px;
  background-position: 0 0, 14px 18px;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   App Layout Shell
   ========================================================================== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  padding: 10px 16px 12px;
  gap: 10px;
}

/* ==========================================================================
   Top Storybook Header & Job Passport Bar
   ========================================================================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  box-shadow: var(--shadow-sketch);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-block {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 1.8vw, 26px);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.title-sep {
  color: var(--warm-gray);
  font-weight: 600;
}

.title-accent {
  color: var(--red);
}

.fair-subtitle {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--teal);
  margin-top: 1px;
}

.star-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 12px;
  background: var(--ochre-soft);
  border: 2px solid var(--border-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(53, 50, 46, 0.12);
  transition: transform 0.25s ease;
}

.star-counter.pop {
  transform: scale(1.18) rotate(-3deg);
}

.star-icon {
  color: var(--ochre);
  font-size: 22px;
  text-shadow: 0 1px 0 rgba(53, 50, 46, 0.25);
}

.star-total {
  font-size: 14px;
  color: var(--warm-gray);
}

/* Passport Bar */
.passport-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 2px dashed rgba(71, 67, 61, 0.45);
  border-radius: 16px 20px 17px 19px;
  padding: 5px 10px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 280px;
}

.passport-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--navy);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.passport-slots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.passport-slot {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px dashed rgba(71, 67, 61, 0.42);
  background: var(--paper-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--warm-gray);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  padding: 0;
}

.passport-slot:hover {
  transform: translateY(-2px) scale(1.06);
  border-color: var(--navy);
}

.passport-slot.stamped {
  border: 2px solid var(--red);
  background: #FFF9F3;
}

.passport-slot img.slot-stamp-img {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  object-fit: contain;
  opacity: 0.92;
  pointer-events: none;
  animation: stampPop 0.45s cubic-bezier(0.2, 1.35, 0.4, 1);
}

.passport-slot .slot-num {
  position: relative;
  z-index: 2;
  font-size: 13px;
  line-height: 1;
}

.passport-slot.stamped .slot-num {
  display: none;
}

.passport-slot .slot-tooltip {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 20;
}

.passport-slot:hover .slot-tooltip {
  opacity: 1;
}

/* Header Utility Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  padding: 0 12px;
  background: var(--paper);
  border: 2px solid var(--border-ink);
  border-radius: 14px 17px 15px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 2px 2px 0 rgba(53, 50, 46, 0.14);
  transition: transform 0.14s ease, background 0.15s ease, box-shadow 0.14s ease;
}

.tool-btn:hover {
  background: var(--ochre-soft);
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 rgba(53, 50, 46, 0.14);
}

.tool-btn.icon-btn {
  width: 40px;
  padding: 0;
  font-size: 19px;
}

.teacher-btn[aria-pressed="true"] {
  background: var(--navy);
  color: #FFFDF8;
}

#btn-sound[aria-pressed="false"] {
  background: var(--red-soft);
  opacity: 0.82;
}

/* ==========================================================================
   Hanoi Job Fair Map Workspace
   ========================================================================== */
.map-workspace {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 2px 0 4px;
}

.map-frame {
  position: relative;
  width: min(100%, calc((100vh - 104px) * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100%;
  background: var(--paper);
  border: 2.5px solid var(--border-ink);
  border-radius: 22px 26px 24px 20px / 20px 24px 22px 26px;
  box-shadow: 5px 6px 0 rgba(53, 50, 46, 0.12);
  overflow: hidden;
  user-select: none;
}

.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

/* Interactive Booths aligned on map_bg.png */
.booths-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.booth-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.18s ease;
}

.booth-hotspot:hover {
  transform: translate(-50%, -52%) scale(1.03);
}

.booth-hotspot:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 4px;
  border-radius: 14px;
}

/* Wooden Signboard Overlay positioned cleanly on top of each booth's blank signboard */
.booth-sign {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 68%;
  min-height: 19%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 6px;
  background: rgba(255, 250, 236, 0.9);
  border: 2px solid var(--border-ink);
  border-radius: 9px 11px 10px 8px;
  box-shadow: 1px 2px 0 rgba(53, 50, 46, 0.18);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(13px, 1.3vw, 20px);
  color: var(--navy);
  line-height: 1.05;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.booth-hotspot:hover .booth-sign {
  background: var(--ochre-soft);
  transform: translateX(-50%) scale(1.05);
}

.booth-hotspot.is-stamped .booth-sign {
  background: #EDF6F1;
  border-color: var(--teal);
  color: #28574E;
}

.booth-hotspot.teacher-peek .booth-sign {
  background: #EDF1F8;
  border-color: var(--navy);
  color: var(--navy);
}

.booth-qmark {
  color: var(--red);
  font-weight: 800;
}

.booth-check {
  color: var(--teal);
  font-size: 0.92em;
}

/* Subtle clickable hover glow around the booth awning/counter */
.booth-hit-glow {
  position: absolute;
  inset: 18% 5% 3% 5%;
  border-radius: 14px;
  border: 2.5px dashed transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.booth-hotspot:hover .booth-hit-glow {
  border-color: rgba(212, 150, 63, 0.85);
  background: rgba(248, 235, 212, 0.22);
}

.booth-stamp-mini {
  position: absolute;
  right: 5%;
  bottom: 7%;
  width: 28%;
  aspect-ratio: 1;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(53, 50, 46, 0.2));
  animation: stampPop 0.45s ease;
}

/* Walking Player Explorer */
.player-sprite {
  position: absolute;
  width: 11.2%;
  aspect-ratio: 1;
  transform: translate(-50%, -84%);
  z-index: 12;
  pointer-events: none;
  transition: filter 0.2s ease;
  will-change: left, top;
}

.player-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 3px rgba(53, 50, 46, 0.22));
  transform-origin: bottom center;
  transition: transform 0.12s ease;
}

.player-sprite.facing-left img {
  transform: scaleX(-1);
}

.player-sprite.walking img {
  animation: playerStep 0.34s ease-in-out infinite;
}

.player-sprite.walking.facing-left img {
  animation: playerStepLeft 0.34s ease-in-out infinite;
}

@keyframes playerStep {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(2.5deg); }
}

@keyframes playerStepLeft {
  0%, 100% { transform: scaleX(-1) translateY(0) rotate(0deg); }
  50% { transform: scaleX(-1) translateY(-5px) rotate(2.5deg); }
}

/* Map Hint */
.map-hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 14;
  padding: 6px 13px;
  background: rgba(255, 253, 248, 0.92);
  border: 2px solid var(--border-ink);
  border-radius: 14px 18px 15px 16px;
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 700;
  color: var(--ink-soft);
  box-shadow: 2px 3px 0 rgba(53, 50, 46, 0.12);
  pointer-events: none;
}

/* On-Screen Touch / Projector D-Pad */
.dpad {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 15;
  display: grid;
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(3, 38px);
  gap: 3px;
  opacity: 0.92;
}

.dpad-btn {
  border: 2px solid var(--border-ink);
  border-radius: 11px 13px 12px 10px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--navy);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 2px 2px 0 rgba(53, 50, 46, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: background 0.1s ease, transform 0.1s ease;
}

.dpad-btn:hover,
.dpad-btn.active {
  background: var(--ochre-soft);
  transform: scale(0.95);
}

.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }

.celebration-pill {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  padding: 8px 20px;
  background: var(--ochre);
  color: #FFFDF8;
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 1.3vw, 20px);
  box-shadow: 3px 4px 0 rgba(53, 50, 46, 0.2);
  animation: gentleFloat 2.4s ease-in-out infinite;
}

/* ==========================================================================
   Full-Screen Storybook Modals (Booth, Celebration, Reset)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(47, 69, 98, 0.42);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: fadeIn 0.24s ease;
}

.modal-card {
  background: var(--paper);
  border: 3px solid var(--border-ink);
  border-radius: 24px 28px 26px 22px / 22px 26px 24px 28px;
  box-shadow: 7px 9px 0 rgba(35, 32, 28, 0.22);
  overflow: hidden;
  animation: modalRise 0.28s cubic-bezier(0.2, 0.95, 0.3, 1);
}

.booth-card {
  width: min(96vw, 1320px);
  height: min(94vh, 840px);
  display: flex;
  flex-direction: column;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--paper-card);
  border-bottom: 2.5px solid rgba(71, 67, 61, 0.28);
  flex-shrink: 0;
}

.booth-badge-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.booth-number-pill {
  background: var(--navy);
  color: #FFFDF8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  padding: 4px 13px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-ink);
}

.booth-modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 800;
  color: var(--ink);
}

.step-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-pill {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 2px solid rgba(71, 67, 61, 0.28);
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--warm-gray);
  transition: all 0.2s ease;
}

.step-pill.active {
  background: var(--ochre-soft);
  border-color: var(--border-ink);
  color: var(--ink);
  transform: scale(1.04);
}

.step-pill.done {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: #28574E;
}

.close-btn {
  width: 40px;
  padding: 0;
  font-size: 20px;
}

/* ==========================================================================
   Booth Step 1 & Step 2: Live Animated Storybook Scene Stage
   ========================================================================== */
.booth-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  animation: fadeIn 0.28s ease;
}

.scene-stage {
  position: relative;
  width: min(100%, calc((94vh - 172px) * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100%;
  background: var(--paper);
  border: 2.5px solid var(--border-ink);
  border-radius: 20px 24px 22px 18px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.scene-props {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.scene-prop {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), clip-path 1.1s ease;
}

/* Kids A and B standing in every booth scene */
.scene-kid {
  position: absolute;
  bottom: 1.5%;
  height: 41%;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.scene-kid img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 4px rgba(53, 50, 46, 0.16));
}

.scene-kid.kid-a {
  left: 3.5%;
}

.scene-kid.kid-b {
  right: 3.5%;
}

.kid-tag {
  position: absolute;
  bottom: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #FFFDF8;
  border: 2px solid var(--border-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 2px 0 rgba(53, 50, 46, 0.2);
}

.scene-kid.kid-b .kid-tag {
  background: var(--red);
}

.scene-kid.speaking {
  transform: translateY(-6px) scale(1.04);
  animation: kidTalkBounce 0.65s ease-in-out infinite;
}

@keyframes kidTalkBounce {
  0%, 100% { transform: translateY(-5px) scale(1.04) rotate(0deg); }
  50% { transform: translateY(-10px) scale(1.05) rotate(1.2deg); }
}

/* Hand-Drawn Speech Bubble (at least 28px for projectors!) */
.speech-bubble {
  position: absolute;
  top: 2.2%;
  max-width: 66%;
  min-width: 34%;
  z-index: 14;
  background: rgba(255, 253, 248, 0.97);
  border: 3px solid var(--border-ink);
  border-radius: 24px 28px 26px 22px / 22px 26px 24px 28px;
  padding: 13px 22px 15px;
  box-shadow: 4px 5px 0 rgba(53, 50, 46, 0.18);
  animation: bubblePop 0.3s cubic-bezier(0.2, 1.25, 0.4, 1);
}

.speech-bubble.speaker-a {
  left: 5%;
  right: auto;
  border-color: var(--navy);
}

.speech-bubble.speaker-b {
  right: 5%;
  left: auto;
  border-color: var(--red);
}

/* Hand-drawn pointer triangle toward Kid A or Kid B */
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -16px;
  width: 24px;
  height: 24px;
  background: rgba(255, 253, 248, 0.97);
  border-right: 3px solid var(--border-ink);
  border-bottom: 3px solid var(--border-ink);
  transform: rotate(45deg);
}

.speech-bubble.speaker-a::after {
  left: 56px;
  border-color: var(--navy);
}

.speech-bubble.speaker-b::after {
  right: 56px;
  border-color: var(--red);
}

.bubble-speaker {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  padding: 1px 11px;
  border-radius: 12px;
  margin-bottom: 4px;
  color: #FFFDF8;
  background: var(--navy);
}

.speech-bubble.speaker-b .bubble-speaker {
  background: var(--red);
}

.bubble-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 2.3vw, 37px);
  font-weight: 700;
  line-height: 1.28;
  color: var(--ink);
  position: relative;
  z-index: 2;
}

.blank-slot {
  display: inline;
  padding: 0 7px;
  border-bottom: 3px solid var(--red);
  background: var(--ochre-soft);
  border-radius: 8px;
  color: var(--red);
  font-weight: 800;
}

/* "Who is it? 🤔" eliciting badge after Line 4 */
.who-badge {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  padding: 10px 26px;
  background: var(--ochre);
  color: #FFFDF8;
  border: 3px solid var(--border-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 2vw, 32px);
  box-shadow: 4px 5px 0 rgba(53, 50, 46, 0.22);
  animation: gentleBounceIn 0.45s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.scene-cue {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 7px 18px;
  background: rgba(255, 253, 248, 0.94);
  border: 2px solid var(--border-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: clamp(16px, 1.35vw, 22px);
  font-weight: 700;
  color: var(--navy);
  box-shadow: 2px 3px 0 rgba(53, 50, 46, 0.14);
  white-space: nowrap;
}

/* ==========================================================================
   Per-Booth Soft Storybook Prop Animations
   ========================================================================== */

/* BOOTH 1: ACTOR (Cinema screen laugh -> cry on line 3) */
.prop-actor-laugh,
.prop-actor-cry {
  left: 29%;
  top: 17.5%;
  width: 42%;
  height: 43%;
}

.prop-actor-laugh {
  animation: actorLaugh 1.6s ease-in-out infinite;
}

.prop-actor-cry {
  opacity: 0;
  transform: scale(0.92);
}

.scene-stage.is-crying .prop-actor-laugh {
  opacity: 0;
  transform: scale(0.92);
}

.scene-stage.is-crying .prop-actor-cry {
  opacity: 1;
  transform: scale(1);
  animation: actorCry 0.9s ease-in-out infinite;
}

@keyframes actorLaugh {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-6px) rotate(1.8deg); }
}

@keyframes actorCry {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(2px) rotate(-1.2deg); }
  75% { transform: translateY(2px) rotate(1.2deg); }
}

/* BOOTH 2: ATHLETE (Runner loops across track; finish ribbon on line 4) */
.prop-runner {
  top: 41%;
  left: 0;
  height: 41%;
  width: auto;
  animation: runnerLoop 4.6s linear infinite;
}

@keyframes runnerLoop {
  0%   { transform: translateX(-180px) translateY(0px); }
  12%  { transform: translateX(0px) translateY(-9px); }
  25%  { transform: translateX(180px) translateY(0px); }
  37%  { transform: translateX(360px) translateY(-9px); }
  50%  { transform: translateX(540px) translateY(0px); }
  62%  { transform: translateX(720px) translateY(-9px); }
  75%  { transform: translateX(900px) translateY(0px); }
  87%  { transform: translateX(1080px) translateY(-9px); }
  100% { transform: translateX(1260px) translateY(0px); }
}

.prop-ribbon {
  right: 17%;
  top: 41%;
  height: 40%;
  opacity: 0;
  transform: scale(0.75) translateY(14px);
}

.scene-stage.show-ribbon .prop-ribbon {
  opacity: 1;
  transform: scale(1) translateY(0);
  animation: gentleWobble 2.6s ease-in-out infinite 0.55s;
}

/* BOOTH 3: FIREFIGHTER (Flames flicker; truck slides in line 3; water + flames shrink line 4) */
.prop-flames {
  left: 20%;
  top: 15%;
  width: 24%;
  transform-origin: bottom center;
  animation: flameFlicker 0.85s ease-in-out infinite;
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(-1.5deg); }
  50% { transform: scale(1.07, 1.12) rotate(2deg); }
}

.prop-truck {
  right: 5%;
  bottom: 4%;
  width: 39%;
  opacity: 0;
  transform: translateX(115%);
}

.scene-stage.truck-in .prop-truck {
  opacity: 1;
  transform: translateX(0);
  animation: truckIdle 0.9s ease-in-out infinite 0.8s;
}

@keyframes truckIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}

.prop-water {
  left: 28%;
  top: 24%;
  width: 38%;
  opacity: 0;
  transform: scaleX(0.3);
  transform-origin: right center;
}

.scene-stage.water-on .prop-water {
  opacity: 0.96;
  transform: scaleX(1);
  animation: waterPulse 0.7s ease-in-out infinite 0.45s;
}

.scene-stage.water-on .prop-flames {
  animation: none;
  opacity: 0;
  transform: scale(0.18) translateY(24px);
  transition: opacity 1.1s ease 0.25s, transform 1.1s ease 0.25s;
}

@keyframes waterPulse {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.03, 0.95); }
}

/* BOOTH 4: SOLDIER (Flag waves gently; soldier switches to salute on line 3) */
.prop-flag-wave {
  position: absolute;
  left: 24.8%;
  top: 6.5%;
  width: 19.5%;
  height: 29%;
  border-radius: 6px;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 250, 235, 0.24) 48%, rgba(53, 50, 46, 0.08) 64%, transparent 82%);
  background-size: 220% 100%;
  animation: flagRipple 2.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes flagRipple {
  0%   { background-position: 110% 0; transform: skewY(-1deg) scaleX(0.99); }
  50%  { background-position: -10% 0; transform: skewY(2.2deg) scaleX(1.02); }
  100% { background-position: 110% 0; transform: skewY(-1deg) scaleX(0.99); }
}

.prop-soldier-stand,
.prop-soldier-salute {
  left: 48%;
  bottom: 9%;
  height: 61%;
}

.prop-soldier-stand {
  opacity: 1;
  animation: gentleBreathe 3s ease-in-out infinite;
}

.prop-soldier-salute {
  opacity: 0;
  transform: scale(0.97);
}

.scene-stage.is-saluting .prop-soldier-stand {
  opacity: 0;
}

.scene-stage.is-saluting .prop-soldier-salute {
  opacity: 1;
  transform: scale(1);
}

/* BOOTH 5: HAIRDRESSER (Scissors snip; hair bits drift down on line 4) */
.prop-scissors {
  left: 40%;
  top: 23%;
  width: 19%;
  transform-origin: center center;
  animation: gentleFloat 2.8s ease-in-out infinite;
}

.scene-stage.is-snipping .prop-scissors {
  animation: scissorsSnip 0.65s ease-in-out infinite;
}

@keyframes scissorsSnip {
  0%, 100% { transform: rotate(-16deg) scale(1); }
  50% { transform: rotate(15deg) scale(1.06); }
}

.prop-hair-bits {
  left: 40%;
  top: 41%;
  width: 19%;
  opacity: 0;
  transform: translateY(-18px);
}

.scene-stage.hair-falling .prop-hair-bits {
  opacity: 0.95;
  animation: hairDrift 2.6s ease-in-out infinite;
}

@keyframes hairDrift {
  0%   { opacity: 0; transform: translateY(-14px) rotate(-4deg); }
  25%  { opacity: 1; }
  85%  { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(72px) rotate(10deg); }
}

/* BOOTH 6: COOK (Steam rises; kitchen door swings open & cook stirs pot on line 4) */
.prop-steam {
  left: 16.5%;
  top: 46%;
  width: 17%;
  animation: steamRise 2.8s ease-in-out infinite;
}

@keyframes steamRise {
  0%   { opacity: 0.22; transform: translateY(14px) scale(0.94); }
  45%  { opacity: 0.92; }
  100% { opacity: 0.14; transform: translateY(-28px) scale(1.06); }
}

.prop-kitchen-door {
  position: absolute;
  left: 50%;
  top: 13.5%;
  width: 25.5%;
  height: 59.5%;
  background: linear-gradient(180deg, #C9A278 0%, #B3895D 100%);
  border: 3px solid var(--border-ink);
  border-radius: 50% 50% 6px 6px / 18% 18% 4px 4px;
  transform-origin: left center;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  box-shadow: inset 0 0 0 4px rgba(255, 245, 226, 0.25);
}

.prop-kitchen-door::before {
  content: "";
  width: 56%;
  height: 26%;
  border-radius: 50%;
  background: #DCE7EC;
  border: 2.5px solid var(--border-ink);
}

.prop-kitchen-door::after {
  content: "";
  width: 66%;
  height: 32%;
  border: 2px solid rgba(53, 50, 46, 0.35);
  border-radius: 6px;
}

.scene-stage.kitchen-open .prop-kitchen-door {
  transform: perspective(600px) rotateY(-84deg);
  opacity: 0.35;
}

.prop-cook {
  left: 48%;
  top: 26%;
  height: 48%;
  opacity: 0;
  transform: scale(0.88);
  z-index: 4;
}

.scene-stage.kitchen-open .prop-cook {
  opacity: 1;
  transform: scale(1);
  animation: cookStir 1.2s ease-in-out infinite 0.4s;
}

@keyframes cookStir {
  0%, 100% { transform: rotate(-2.5deg) translateY(0); }
  50% { transform: rotate(2.5deg) translateY(-4px); }
}

/* BOOTH 7: LIBRARIAN (Librarian walks in on line 3; animal book floats to kid on line 4) */
.prop-librarian {
  right: 22%;
  bottom: 9%;
  height: 59%;
  opacity: 0;
  transform: translateX(135%);
}

.scene-stage.librarian-in .prop-librarian {
  opacity: 1;
  transform: translateX(0);
  animation: gentleBreathe 2.8s ease-in-out infinite 0.8s;
}

.prop-animal-book {
  left: 74%;
  top: 24%;
  width: 13.5%;
  opacity: 0;
  transform: scale(0.65) rotate(-8deg);
  z-index: 9;
}

.scene-stage.book-floating .prop-animal-book {
  opacity: 1;
  left: 16%;
  top: 49%;
  transform: scale(1.06) rotate(6deg);
  transition: left 1.25s cubic-bezier(0.22, 1, 0.36, 1), top 1.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease, transform 1.25s ease;
  animation: gentleFloat 2.2s ease-in-out infinite 1.25s;
}

/* BOOTH 8: ARCHITECT (Building reveals bottom-up via clip-path; blueprint unrolls on line 3) */
.prop-building {
  left: 24%;
  bottom: 13%;
  width: 50%;
  clip-path: inset(100% 0 0 0);
  opacity: 1;
}

.scene-stage.building-rise .prop-building {
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.5s cubic-bezier(0.25, 0.9, 0.3, 1);
}

.prop-blueprint {
  right: 17%;
  bottom: 10%;
  width: 31%;
  clip-path: inset(0 100% 0 0);
  opacity: 0;
  z-index: 7;
}

.scene-stage.blueprint-unroll .prop-blueprint {
  clip-path: inset(0 0 0 0);
  opacity: 1;
  transition: clip-path 1.15s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

/* Shared Gentle Storybook Motion Keyframes */
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes gentleBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes gentleBounceIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.7); }
  70% { opacity: 1; transform: translateX(-50%) scale(1.06); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes stampPop {
  0% { opacity: 0; transform: scale(2.1) rotate(-18deg); }
  65% { opacity: 1; transform: scale(0.92) rotate(-6deg); }
  100% { opacity: 0.94; transform: scale(1) rotate(-9deg); }
}

/* ==========================================================================
   Step 3: Vocabulary Reveal Slide
   ========================================================================== */
.reveal-view {
  padding: 14px 22px;
  overflow-y: auto;
}

.reveal-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 0.88fr 1.32fr;
  gap: 22px;
  align-items: center;
}

.reveal-portrait-col {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.portrait-frame {
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 0.92;
  background: var(--paper-card);
  border: 3px solid var(--border-ink);
  border-radius: 26px 32px 28px 24px / 24px 28px 32px 26px;
  box-shadow: 5px 6px 0 rgba(53, 50, 46, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.reveal-portrait-img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  animation: gentleFloat 3.4s ease-in-out infinite;
}

.reveal-stamp-fx {
  position: absolute;
  right: -12px;
  bottom: -12px;
  width: 138px;
  height: 138px;
  object-fit: contain;
  pointer-events: none;
  transform: rotate(-10deg);
  filter: drop-shadow(0 3px 4px rgba(53, 50, 46, 0.25));
  animation: stampPop 0.48s cubic-bezier(0.2, 1.35, 0.35, 1);
}

.reveal-info-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.word-hero {
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  padding: 12px 20px;
  box-shadow: var(--shadow-sketch);
}

.word-main {
  font-family: var(--font-display);
  font-size: clamp(36px, 3.6vw, 54px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.08;
}

.pronunciation-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.stress-display {
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.stress-cap {
  color: var(--red);
  font-weight: 800;
  background: var(--red-soft);
  padding: 0 6px;
  border-radius: 8px;
}

.ipa-display {
  font-family: "Nunito", "Lucida Sans Unicode", "DejaVu Sans", sans-serif;
  font-size: clamp(20px, 1.7vw, 26px);
  font-weight: 700;
  color: var(--teal);
}

.meaning-box {
  padding: 10px 18px;
  background: var(--ochre-soft);
  border: 2px solid rgba(71, 67, 61, 0.45);
  border-radius: 16px 20px 18px 15px;
}

.meaning-en {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 1.75vw, 26px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.meaning-vi {
  margin: 3px 0 0;
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 700;
  color: var(--warm-gray);
}

.audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Completed Dialogue Box on Reveal Slide */
.filled-dialogue {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper-card);
  border: 2px dashed rgba(71, 67, 61, 0.4);
  border-radius: 16px 20px 18px 16px;
  padding: 10px 14px;
}

.filled-line-btn {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: clamp(15px, 1.25vw, 19px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  transition: background 0.15s ease;
}

.filled-line-btn:hover,
.filled-line-btn.playing {
  background: var(--teal-soft);
}

.filled-speaker {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--navy);
}

.filled-speaker.sp-b {
  background: var(--red);
}

.filled-word-hl {
  color: var(--red);
  background: var(--ochre-soft);
  padding: 0 5px;
  border-radius: 6px;
  font-weight: 800;
}

/* ==========================================================================
   Storybook Buttons & Modal Footer
   ========================================================================== */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--paper-card);
  border-top: 2.5px solid rgba(71, 67, 61, 0.28);
  flex-shrink: 0;
}

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

.dialogue-counter {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--warm-gray);
}

.storybook-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border: 2.5px solid var(--border-ink);
  border-radius: 16px 20px 17px 19px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 1.3vw, 20px);
  box-shadow: 3px 3px 0 rgba(53, 50, 46, 0.16);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.storybook-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.storybook-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 rgba(53, 50, 46, 0.16);
}

.storybook-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-big {
  padding: 11px 28px;
  font-size: clamp(18px, 1.5vw, 24px);
}

.btn-primary {
  background: var(--ochre);
  color: #FFFDF8;
}

.btn-stamp {
  background: var(--red);
  color: #FFFDF8;
}

.btn-teal {
  background: var(--teal);
  color: #FFFDF8;
}

.btn-navy {
  background: var(--navy);
  color: #FFFDF8;
}

.btn-cream {
  background: var(--paper);
  color: var(--ink);
}

/* ==========================================================================
   Celebration Modal (All 8 Stamps)
   ========================================================================== */
.celebration-card {
  width: min(95vw, 1180px);
  max-height: 92vh;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.celebration-banner {
  text-align: center;
}

.celebration-stars {
  font-size: clamp(22px, 2.2vw, 32px);
  color: var(--ochre);
  letter-spacing: 6px;
  margin-bottom: 4px;
}

.celebration-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.8vw, 40px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
}

.celebration-sub {
  margin: 6px 0 0;
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 700;
  color: var(--warm-gray);
}

.celebration-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.job-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 10px;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  box-shadow: var(--shadow-sketch);
  transition: transform 0.18s ease, background 0.18s ease;
}

.job-card-btn:hover {
  background: var(--ochre-soft);
  transform: translateY(-4px) rotate(-0.8deg);
}

.job-card-btn.speaking-now {
  background: var(--teal-soft);
  border-color: var(--teal);
  transform: scale(1.04);
}

.job-card-btn img {
  height: clamp(114px, 16vh, 162px);
  width: auto;
  object-fit: contain;
}

.job-card-word {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.45vw, 23px);
  font-weight: 800;
  color: var(--navy);
}

.job-card-vi {
  font-size: 13px;
  font-weight: 700;
  color: var(--warm-gray);
}

.celebration-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* Reset Confirmation Card */
.reset-card {
  width: min(92vw, 460px);
  padding: 24px 26px;
  text-align: center;
}

.reset-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--navy);
}

.reset-desc {
  margin: 0 0 20px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.reset-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ==========================================================================
   Responsive Adjustments (Laptop, Tablet & Touch)
   ========================================================================== */
@media (max-width: 1080px) {
  .passport-bar {
    order: 3;
    width: 100%;
  }
  .app-shell {
    height: auto;
    min-height: 100vh;
  }
  .map-frame {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .reveal-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .portrait-frame {
    width: 220px;
  }
  .celebration-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .speech-bubble {
    max-width: 88%;
    padding: 12px 16px;
  }
  .bubble-text {
    font-size: 28px;
  }
  .step-dots {
    display: none;
  }
}
