/* ============================================================================
 * Cranky Bin's School Storyboard — SmartBins.ie Primary School Presentation
 * Inspired by wlwa/index.html presentation polish + SmartBins eco-storybook craft.
 * Responsive across interactive whiteboards, laptops, iPads & mobiles.
 * ========================================================================== */

:root {
  --bg-mint: #EAF5EF;
  --bg-sky: #F4F9F7;
  --surface: #FFFFFF;
  --surface-soft: #F8FAFC;
  --ink: #0F172A;
  --ink-muted: #475569;
  --border: #CBD5E1;
  --green: #059669;
  --green-dark: #047857;
  --green-soft: #ECFDF5;
  --blue: #0284C7;
  --blue-dark: #0369A1;
  --blue-soft: #EFF6FF;
  --brown: #8B5A2B;
  --brown-dark: #6B421D;
  --brown-soft: #FEF7ED;
  --red: #DC2626;
  --red-dark: #991B1B;
  --red-soft: #FEF2F2;
  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --purple: #7C3AED;
  --purple-soft: #F5F3FF;
  --cranky-body: #2B3445;
  --cranky-rim: #374151;
  --cranky-btn-top: #334155;
  --cranky-btn-bot: #1E293B;
  --cranky-btn-fg: #FFFFFF;
  --marty-body: #0284C7;
  --marty-rim: #0369A1;
  --marty-btn-top: #0EA5E9;
  --marty-btn-bot: #0284C7;
  --marty-btn-fg: #FFFFFF;
  --marty-tint: #DBEAFE;
  --marty-tray-bg: #F0F9FF;
  --marty-border: #93C5FD;
  --marty-accent-text: #1E40AF;
  --topbar-h: 56px;
  --bottombar-h: 54px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: 'Fredoka', 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --font-comic: 'Bangers', 'Fredoka', Impact, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-mint);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, input, a {
  font-family: inherit;
}

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid #10B981;
  outline-offset: 2px;
}

/* ============================================================================
 * TOP HEADER BAR (#topbar)
 * ========================================================================== */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  z-index: 100;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-home-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  border-radius: 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.home-link {
  font-size: 11px;
  font-weight: 800;
  color: var(--green-dark);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.home-link:hover {
  color: var(--green);
  text-decoration: underline;
}

/* 12 Act-Grouped Step Pills */
.step-pills {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
}

.step-pills::-webkit-scrollbar {
  display: none;
}

.step-pill {
  height: 28px;
  padding: 0 8.5px;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.step-pill:hover {
  border-color: var(--green);
  color: var(--green-dark);
  background: var(--green-soft);
  transform: translateY(-1px);
}

.step-pill.active.act-1 {
  background: #059669;
  border-color: #047857;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(5, 150, 105, 0.34);
}

.step-pill.active.act-2 {
  background: #0284C7;
  border-color: #0369A1;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.34);
}

.step-pill.active.act-3 {
  background: #D97706;
  border-color: #B45309;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.34);
}

.step-pill.active.act-4 {
  background: #7C3AED;
  border-color: #6D28D9;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.34);
}

.act-divider {
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: #CBD5E1;
  margin: 0 3px;
  flex-shrink: 0;
}

/* Right Topbar Controls */
.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.top-ctrl-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.top-ctrl-btn:hover {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.top-ctrl-btn.class-pill.has-class {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

.top-ctrl-btn.voice-pill.on {
  background: var(--green-soft);
  border-color: #10B981;
  color: var(--green-dark);
}

.top-ctrl-btn.voice-pill.muted {
  background: var(--red-soft);
  border-color: #FCA5A5;
  color: var(--red-dark);
}

/* ============================================================================
 * MAIN CENTRED PRESENTATION STAGE (#stage & #deck-frame)
 * ========================================================================== */
#stage {
  position: fixed;
  top: var(--topbar-h);
  bottom: var(--bottombar-h);
  left: 0;
  right: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background:
    radial-gradient(circle at 12% 16%, rgba(16, 185, 129, 0.11), transparent 36%),
    radial-gradient(circle at 88% 82%, rgba(2, 132, 199, 0.10), transparent 38%),
    linear-gradient(180deg, #E5F4EC 0%, #F4FAF7 100%);
}

.deck-frame {
  position: relative;
  width: min(1340px, 100%);
  height: 100%;
  max-height: 780px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid #CBD5E1;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.13);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.slide-root {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 260;
}

/* ============================================================================
 * SLIDE HEADER & COMMON PRIMITIVES
 * ========================================================================== */
.slide {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px 22px 16px;
  gap: 12px;
  min-height: 100%;
  min-width: 0;
  animation: slideEnter 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  border-bottom: 2.5px solid #E2E8F0;
  padding-bottom: 9px;
  flex-shrink: 0;
}

.slide-header.theme-green { border-bottom-color: #10B981; }
.slide-header.theme-blue { border-bottom-color: #0EA5E9; }
.slide-header.theme-amber { border-bottom-color: #F59E0B; }
.slide-header.theme-red { border-bottom-color: #EF4444; }
.slide-header.theme-purple { border-bottom-color: #8B5CF6; }

.slide-hdr-text {
  min-width: 0;
}

.slide-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.kicker-act1 { background: #DCFCE7; color: #065F46; }
.kicker-act2 { background: #E0F2FE; color: #075985; }
.kicker-act3 { background: #FEF3C7; color: #92400E; }
.kicker-danger { background: #FEE2E2; color: #991B1B; }
.kicker-act4 { background: #EDE9FE; color: #5B21B6; }

.slide-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.25vw, 29px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

.slide-sub {
  font-size: clamp(12.5px, 1.1vw, 14.5px);
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: 2px;
}

.slide-hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Tactile Character Voice Button */
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2.5px solid #0B1220;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 #0B1220;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  white-space: nowrap;
}

.voice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #0B1220;
  filter: brightness(1.06);
}

.voice-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #0B1220;
}

.voice-btn.sm {
  padding: 5px 11px;
  font-size: 12px;
  border-width: 2px;
  box-shadow: 0 2px 0 #0B1220;
}

.voice-btn.cranky { background: linear-gradient(135deg, var(--cranky-btn-top), var(--cranky-btn-bot)); color: var(--cranky-btn-fg); }
.voice-btn.marty { background: linear-gradient(135deg, var(--marty-btn-top), var(--marty-btn-bot)); color: var(--marty-btn-fg); }
.voice-btn.brown { background: linear-gradient(135deg, #A16207, #8B5A2B); }
.voice-btn.dr-lion { background: linear-gradient(135deg, #EF4444, #B91C1C); }
.voice-btn.weee { background: linear-gradient(135deg, #6D28D9, #4C1D95); }
.voice-btn.amber { background: linear-gradient(135deg, #F59E0B, #D97706); color: #0B1220; }

.voice-btn.is-speaking {
  animation: voicePulse 0.7s ease-in-out infinite alternate;
  outline: 3px solid #FACC15;
}

@keyframes voicePulse {
  from { transform: scale(1); }
  to { transform: scale(1.045); }
}

/* ============================================================================
 * ACT 1: STORYBOOK ILLUSTRATED SCENES (Steps 1, 2, 3)
 * ========================================================================== */
.story-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1.28fr 0.92fr;
  gap: 16px;
  min-height: 0;
  align-items: stretch;
}

.scene-canvas-box {
  position: relative;
  border-radius: 16px;
  border: 3px solid #0B1220;
  overflow: hidden;
  background: #DCEEF8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
}

.scene-canvas-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.scene-pan {
  width: 100%;
  height: 100%;
  animation: kenBurnsGentle 12s ease-in-out infinite alternate;
  transform-origin: center center;
}

@keyframes kenBurnsGentle {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.035) translate(-0.8%, -0.5%); }
}

.story-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: space-between;
  min-height: 0;
}

.speech-hero-card {
  background: #FFFBEB;
  border: 3px solid #0B1220;
  border-radius: 16px;
  padding: 13px 15px;
  box-shadow: 4px 4px 0 #0B1220;
}

.speech-hero-card.blue { background: #EFF6FF; }
.speech-hero-card.brown { background: #FEF7ED; }
.speech-hero-card.red { background: #FEF2F2; }
.speech-hero-card.green { background: #ECFDF5; }

.speech-quote {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.55vw, 20.5px);
  font-weight: 700;
  line-height: 1.25;
  color: #0F172A;
  margin-bottom: 8px;
}

.speech-who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.who-tag {
  font-size: 12px;
  font-weight: 900;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.story-facts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.story-facts-list li {
  background: var(--surface-soft);
  border: 1.5px solid #CBD5E1;
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: clamp(13px, 1.08vw, 14.5px);
  line-height: 1.38;
  color: #1E293B;
}

.fact-ico {
  font-size: 19px;
  line-height: 1.1;
  flex-shrink: 0;
}

.story-facts-list strong {
  color: var(--ink);
}

/* Step 2: Two Hero Cards Below Panoramic Scene */
.step2-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 0;
}

.step2-scene {
  flex: 1.05;
  min-height: 215px;
}

.duo-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex-shrink: 0;
}

.hero-bio-card {
  border-radius: 14px;
  border: 2.5px solid #0B1220;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 3px 3px 0 #0B1220;
}

.hero-bio-card.marty {
  background: linear-gradient(135deg, var(--marty-tray-bg), var(--marty-tint));
}

.hero-bio-card.brown {
  background: linear-gradient(135deg, #FEF7ED, #FDE68A);
}

.hero-bio-card h3 {
  font-family: var(--font-display);
  font-size: clamp(15.5px, 1.35vw, 19px);
  color: #0F172A;
  margin-bottom: 3px;
}

.hero-bio-card p {
  font-size: clamp(12.2px, 1vw, 13.8px);
  line-height: 1.35;
  color: #1E293B;
  font-weight: 700;
}

/* Step 3: Two Big Problems Cards */
.problem-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.problem-card {
  border-radius: 13px;
  padding: 10px 13px;
  border: 2px solid #CBD5E1;
  background: #FFFFFF;
}

.problem-card.warn {
  border-color: #F59E0B;
  background: #FFFBEB;
}

.problem-card.danger {
  border-color: #EF4444;
  background: #FEF2F2;
}

.problem-card h4 {
  font-family: var(--font-display);
  font-size: 15px;
  margin-bottom: 3px;
  color: #0F172A;
}

.problem-card p {
  font-size: 13.2px;
  line-height: 1.38;
  color: #334155;
  font-weight: 700;
}

/* ============================================================================
 * ACT 2: REAL DOCUMENTARY PHOTOS + EMBEDDED VIDEOS (Steps 4, 5, 6)
 * ========================================================================== */
.doc-grid-2 {
  flex: 1;
  display: grid;
  grid-template-columns: 1.16fr 0.96fr;
  gap: 14px;
  min-height: 0;
}

.doc-photos-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  min-height: 0;
}

.doc-photos-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  flex-shrink: 0;
}

.doc-bottom-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1.08fr 0.96fr;
  gap: 13px;
  min-height: 0;
}

.photo-card {
  position: relative;
  border-radius: 13px;
  border: 2px solid #CBD5E1;
  background: #FFFFFF;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.photo-card:hover {
  transform: translateY(-3px);
  border-color: var(--green);
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.18);
}

.photo-thumb-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 122px;
  max-height: 230px;
  overflow: hidden;
  background: #0F172A;
}

.doc-photos-row-3 .photo-thumb-wrap {
  height: 156px;
  flex: 0 0 auto;
}

.photo-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.photo-card:hover .photo-thumb-wrap img {
  transform: scale(1.05);
}

.photo-zoom-pill {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(15, 23, 42, 0.82);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.photo-card-body {
  padding: 8px 10px 9px;
  background: #FFFFFF;
}

.photo-card-title {
  font-family: var(--font-display);
  font-size: 13.8px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.photo-card-cap {
  font-size: 11.6px;
  color: #475569;
  font-weight: 700;
  line-height: 1.32;
  margin-top: 3px;
}

.photo-card-credit {
  font-size: 10px;
  color: #64748B;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Video Card (Click-to-Load YouTube No-Cookie Embed + Native Fallback) */
.video-card {
  border-radius: 14px;
  border: 2px solid #0284C7;
  background: linear-gradient(180deg, #F0F9FF 0%, #FFFFFF 100%);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  box-shadow: 0 5px 18px rgba(2, 132, 199, 0.11);
}

.video-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-badge {
  background: #0284C7;
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.video-duration {
  font-size: 11px;
  font-weight: 800;
  color: #0369A1;
}

.video-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.2;
}

.video-channel {
  font-size: 11.5px;
  font-weight: 800;
  color: #475569;
}

.video-player-slot {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 142px;
  border-radius: 10px;
  overflow: hidden;
  background: #0F172A;
  border: 1.5px solid #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-poster-btn {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 142px;
  border: none;
  padding: 12px;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 42%, rgba(56, 189, 248, 0.25), rgba(15, 23, 42, 0.88)),
    #0F172A;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background-size: cover;
  background-position: center;
}

.video-poster-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.42) 0%, rgba(15, 23, 42, 0.78) 100%);
  pointer-events: none;
}

.video-play-circle {
  position: relative;
  z-index: 2;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #EF4444;
  border: 3px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38);
  transition: transform 0.16s ease, background 0.16s ease;
}

.video-poster-btn:hover .video-play-circle {
  transform: scale(1.1);
  background: #DC2626;
}

.video-poster-label {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.video-iframe,
.video-native {
  width: 100%;
  height: 100%;
  min-height: 165px;
  border: 0;
  display: block;
  background: #000000;
}

.video-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.video-summary {
  font-size: 11.8px;
  font-weight: 700;
  color: #334155;
  flex: 1;
  min-width: 150px;
  line-height: 1.3;
}

.video-ext-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ext-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #0284C7;
  color: #0369A1;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.ext-link-pill:hover {
  background: #0284C7;
  color: #FFFFFF;
}

/* Reaction Strip (Step 4) */
.cranky-reaction-bar {
  background: linear-gradient(90deg, #FEF3C7 0%, #FFFBEB 100%);
  border: 2.5px solid #0B1220;
  border-radius: 14px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 3px 3px 0 #0B1220;
}

.reaction-avatar {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.reaction-body {
  flex: 1;
  font-size: 13px;
  line-height: 1.36;
  color: #1E293B;
  font-weight: 700;
}

.reaction-body strong {
  color: #0F172A;
}

/* Step 5: Microplastic Breakdown Diagram */
.diagram-panel {
  border-radius: 14px;
  border: 2px solid #0EA5E9;
  background: linear-gradient(180deg, #F0F9FF 0%, #ECFEFF 100%);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.diagram-panel h3 {
  font-family: var(--font-display);
  font-size: 15.5px;
  color: #075985;
}

.micro-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.micro-step {
  background: #FFFFFF;
  border: 1.5px solid #BAE6FD;
  border-radius: 11px;
  padding: 8px 7px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.micro-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0284C7;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.micro-step-ico {
  font-size: 24px;
  line-height: 1;
}

.micro-step-title {
  font-family: var(--font-display);
  font-size: 12.2px;
  color: #0F172A;
  line-height: 1.15;
}

.micro-step-desc {
  font-size: 11px;
  color: #475569;
  font-weight: 700;
  line-height: 1.25;
}

.micro-fix-strip {
  background: #ECFDF5;
  border: 1.5px solid #10B981;
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 12.4px;
  font-weight: 800;
  color: #065F46;
}

/* Step 6: Resource & Climate Comparison Bars */
.impact-panel {
  border-radius: 14px;
  border: 2px solid #10B981;
  background: linear-gradient(180deg, #F0FDF4 0%, #FFFFFF 100%);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 9px;
}

.impact-panel h3 {
  font-family: var(--font-display);
  font-size: 15.5px;
  color: #065F46;
}

.impact-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.impact-item {
  background: #FFFFFF;
  border: 1.5px solid #D1FAE5;
  border-radius: 10px;
  padding: 8px 10px;
}

.impact-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.6px;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 5px;
}

.impact-stat {
  color: #047857;
  font-weight: 900;
  white-space: nowrap;
}

.impact-track {
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
}

.impact-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.impact-fill.green { background: linear-gradient(90deg, #10B981, #059669); }
.impact-fill.blue { background: linear-gradient(90deg, #38BDF8, #0284C7); }
.impact-fill.amber { background: linear-gradient(90deg, #F59E0B, #B45309); }

.impact-note {
  font-size: 11.4px;
  color: #475569;
  font-weight: 700;
  margin-top: 4px;
}

/* ============================================================================
 * ACT 3: RECYCLING MAGIC, SPECIAL PLACES & DR. LI-ON (Steps 7, 8, 9)
 * ========================================================================== */
.magic-grid-2 {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  min-height: 0;
}

.magic-col {
  border-radius: 16px;
  border: 3px solid #0B1220;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 4px 4px 0 #0B1220;
  min-height: 0;
}

.magic-col.marty {
  background: linear-gradient(180deg, var(--marty-tray-bg) 0%, #FFFFFF 100%);
}

.magic-col.brown {
  background: linear-gradient(180deg, #FEF7ED 0%, #F0FDF4 100%);
}

.magic-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.magic-col-hdr h3 {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.45vw, 20px);
  color: #0F172A;
}

.pipeline-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 12px;
  padding: 8px 10px;
}

.pipe-node {
  flex: 1;
  text-align: center;
  font-size: 11.8px;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.25;
}

.pipe-node span {
  display: block;
  font-size: 20px;
  margin-bottom: 2px;
}

.pipe-arrow {
  font-size: 16px;
  font-weight: 900;
  color: var(--green);
  flex-shrink: 0;
}

.magic-visual-box {
  flex: 1;
  min-height: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #0B1220;
  background: #FFFFFF;
  position: relative;
}

.magic-col .photo-card {
  flex: 1;
  min-height: 160px;
}

.magic-col .photo-thumb-wrap {
  max-height: none;
  flex: 1;
  min-height: 120px;
}

.magic-visual-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.treasures-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.treasure-chip {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #0F172A;
}

/* Interactive Step 7 MRF & Composting Tours */
.tour-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.tour-step-pill {
  border: 2px solid #0B1220;
  border-radius: 10px;
  background: #FFFFFF;
  color: #334155;
  font-family: var(--font-display);
  font-size: 11.4px;
  font-weight: 700;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  line-height: 1.15;
  transition: transform 0.14s ease, background 0.14s ease, color 0.14s ease;
  box-shadow: 0 2px 0 #0B1220;
  overflow-wrap: break-word;
}

.tour-step-pill:hover {
  transform: translateY(-1px);
  background: #F8FAFC;
}

.tour-step-pill.marty.active {
  background: var(--marty-body);
  color: var(--marty-btn-fg);
}

.tour-step-pill.brown.active {
  background: #8B5A2B;
  color: #FEF3C7;
}

.tour-visual-box {
  width: 100%;
  aspect-ratio: 560 / 220;
  border-radius: 13px;
  overflow: hidden;
  border: 2.5px solid #0B1220;
  background: #FFFFFF;
  box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.14);
  flex-shrink: 0;
}

.tour-visual-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tour-info-box {
  background: #FFFFFF;
  border: 2px solid #CBD5E1;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 0 auto;
}

.tour-info-box.marty {
  border-color: var(--marty-border);
}

.tour-info-box.brown {
  border-color: #FCD34D;
}

.tour-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.tour-info-top strong {
  font-family: var(--font-display);
  font-size: 14.5px;
  color: #0F172A;
  line-height: 1.2;
}

.tour-badge {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.tour-badge.marty {
  background: var(--marty-tint);
  color: var(--marty-accent-text);
  border: 1.5px solid var(--marty-border);
}

.tour-badge.brown {
  background: #FEF3C7;
  color: #92400E;
  border: 1.5px solid #F59E0B;
}

.tour-info-box p {
  font-size: 12.6px;
  font-weight: 700;
  color: #334155;
  line-height: 1.38;
  margin: 0;
}

.tour-fact {
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11.8px;
  font-weight: 800;
  line-height: 1.3;
}

.tour-fact.marty {
  background: var(--marty-tray-bg);
  color: var(--marty-accent-text);
  border: 1.5px solid var(--marty-border);
}

.tour-fact.brown {
  background: #ECFDF5;
  color: #065F46;
  border: 1.5px solid #A7F3D0;
}

.tour-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

.tour-nav-btn,
.tour-photo-btn {
  border: 2px solid #0B1220;
  border-radius: 10px;
  background: #FFFFFF;
  color: #0F172A;
  font-family: var(--font-display);
  font-size: 12.2px;
  font-weight: 700;
  padding: 6px 11px;
  cursor: pointer;
  box-shadow: 0 2px 0 #0B1220;
  transition: transform 0.12s ease, background 0.12s ease;
}

.tour-nav-btn:hover:not(:disabled),
.tour-photo-btn:hover {
  transform: translateY(-1px);
  background: #F8FAFC;
}

.tour-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.tour-nav-btn.primary.marty {
  background: var(--marty-body);
  color: var(--marty-btn-fg);
}

.tour-nav-btn.primary.brown {
  background: #059669;
  color: #FFFFFF;
}

.tour-photo-btn {
  background: #FEF3C7;
  color: #92400E;
}

.tour-progress-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #64748B;
}

/* Step 8: 4 Special Recycling Places Flip/Tap Cards */
.places-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  min-height: 0;
}

.flip-card {
  perspective: 1100px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  min-height: 248px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  border: 3px solid #0B1220;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  box-shadow: 4px 4px 0 #0B1220;
}

.flip-front.place-glass { background: linear-gradient(135deg, #DCFCE7, #BBF7D0); }
.flip-front.place-return { background: linear-gradient(135deg, #DBEAFE, #BAE6FD); }
.flip-front.place-civic { background: linear-gradient(135deg, #FEF3C7, #FDE68A); }
.flip-front.place-battery { background: linear-gradient(135deg, #FEE2E2, #FECACA); }

.flip-back {
  transform: rotateY(180deg);
  background: #FFFFFF;
}

.place-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.place-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.place-ico {
  font-size: 24px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.place-photo-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 162px;
  border-radius: 11px;
  overflow: hidden;
  border: 2px solid #0B1220;
  background: #0F172A;
}

.place-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.place-photo-zoom {
  position: absolute;
  right: 7px;
  bottom: 7px;
  background: rgba(15, 23, 42, 0.88);
  color: #FEF08A;
  border: 1.5px solid #FFFFFF;
  border-radius: 999px;
  padding: 3px 9px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.14s ease, background 0.14s ease;
}

.place-photo-zoom:hover {
  transform: scale(1.04);
  background: #059669;
  color: #FFFFFF;
}

.place-photo-zoom.inline {
  position: static;
  background: #0F172A;
}

.place-back-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.flip-hint {
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid #0B1220;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10.8px;
  font-weight: 900;
  color: #0F172A;
  white-space: nowrap;
  flex-shrink: 0;
}

.flip-face h3 {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.45vw, 19.5px);
  color: #0F172A;
  line-height: 1.15;
}

.place-lead {
  font-size: clamp(12px, 1.02vw, 13.6px);
  font-weight: 800;
  color: #1E293B;
  line-height: 1.3;
  margin: 0;
}

.place-back-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
}

.place-tip {
  background: #ECFDF5;
  border: 1.5px solid #10B981;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12.2px;
  font-weight: 800;
  color: #065F46;
}

/* Step 9: Dr. Li-on & The 4 WEEE-sels */
.villains-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 0.92fr 1.28fr;
  gap: 14px;
  min-height: 0;
}

.boss-panel {
  border-radius: 16px;
  border: 3px solid #0B1220;
  background: radial-gradient(circle at 50% 24%, #450A0A 0%, #1E1B4B 68%, #0F172A 100%);
  color: #FFFFFF;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 4px 4px 0 #DC2626;
  position: relative;
  overflow: visible;
  min-height: auto;
}

.boss-tag {
  display: inline-block;
  align-self: flex-start;
  background: #FACC15;
  color: #0B1220;
  font-family: var(--font-comic);
  font-size: 15px;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 6px;
  border: 2px solid #0B1220;
}

.boss-art-wrap {
  flex: 1;
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boss-art-wrap svg {
  width: 100%;
  max-width: 240px;
  height: auto;
  max-height: 185px;
}

.boss-panel h3 {
  font-family: var(--font-comic);
  font-size: 27px;
  letter-spacing: 0.05em;
  color: #FEF08A;
  text-shadow: 2px 2px 0 #0B1220;
}

.boss-panel p {
  font-size: 12.8px;
  line-height: 1.35;
  color: #E2E8F0;
  font-weight: 700;
}

.boss-voice-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.weeesel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.weeesel-card {
  border-radius: 14px;
  border: 2.5px solid #0B1220;
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF2FF 100%);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  box-shadow: 3px 3px 0 #0B1220;
}

.weeesel-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weeesel-svg-box {
  width: 78px;
  height: 68px;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 2px solid #0B1220;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.weeesel-svg-box svg {
  width: 100%;
  height: 100%;
}

.weeesel-info h4 {
  font-family: var(--font-display);
  font-size: 16px;
  color: #0F172A;
}

.weeesel-role {
  font-size: 11px;
  font-weight: 900;
  color: #6D28D9;
  text-transform: uppercase;
}

.weeesel-desc {
  font-size: 12.2px;
  font-weight: 700;
  color: #334155;
  line-height: 1.3;
}

.safety-rule-banner {
  background: linear-gradient(90deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  border: 3px solid #0B1220;
  border-radius: 13px;
  padding: 9px 15px;
  font-size: clamp(12.8px, 1.12vw, 14.8px);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 3px 3px 0 #0B1220;
}

.safety-rule-banner strong {
  color: #FEF08A;
}

/* ============================================================================
 * ACT 4: INTERACTIVE GAMES 1 & 2 + FINALE (Steps 10, 11, 12)
 * ========================================================================== */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: #F5F3FF;
  border: 2px solid #C4B5FD;
  border-radius: 12px;
  padding: 8px 14px;
  flex-shrink: 0;
}

.score-pill {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #5B21B6;
  background: #FFFFFF;
  border: 2px solid #8B5CF6;
  border-radius: 999px;
  padding: 3px 13px;
}

.game-progress-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.prog-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #E2E8F0;
  border: 1.5px solid #94A3B8;
  transition: all 0.2s ease;
}

.prog-dot.current {
  background: #8B5CF6;
  border-color: #4C1D95;
  transform: scale(1.25);
}

.prog-dot.ok {
  background: #10B981;
  border-color: #047857;
}

.prog-dot.miss {
  background: #EF4444;
  border-color: #991B1B;
}

/* Game 1 Stage */
.sorter-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
}

.sorter-item-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 55%, #ECFDF5 100%);
  border: 3px solid #0B1220;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  box-shadow: 4px 4px 0 #0B1220;
  flex: 1;
  min-height: 120px;
}

.sorter-item-art {
  width: 112px;
  height: 112px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2.5px solid #0B1220;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 3px 3px 0 #CBD5E1;
}

.sorter-item-art svg {
  width: 94px;
  height: 94px;
}

.sorter-item-copy {
  max-width: 560px;
}

.sorter-item-num {
  font-size: 11.5px;
  font-weight: 900;
  color: #6D28D9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sorter-item-name {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.3vw, 31px);
  color: #0F172A;
  line-height: 1.15;
}

.sorter-item-hint {
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
}

.bin-choices-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  flex-shrink: 0;
}

.bin-choice-btn {
  border-radius: 14px;
  border: 3px solid #0B1220;
  padding: 11px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  color: #FFFFFF;
  box-shadow: 0 4px 0 #0B1220;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.18s ease;
}

.bin-choice-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 #0B1220;
}

.bin-choice-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #0B1220;
}

.bin-choice-btn:disabled {
  cursor: default;
  opacity: 0.62;
}

.bin-choice-btn.b-cranky { background: linear-gradient(180deg, var(--cranky-btn-top), var(--cranky-btn-bot)); color: var(--cranky-btn-fg); }
.bin-choice-btn.b-marty { background: linear-gradient(180deg, var(--marty-btn-top), var(--marty-btn-bot)); color: var(--marty-btn-fg); }
.bin-choice-btn.b-brown { background: linear-gradient(180deg, #A16207, #8B5A2B); }
.bin-choice-btn.b-special { background: linear-gradient(180deg, #10B981, #047857); }
.bin-choice-btn.b-battery { background: linear-gradient(180deg, #EF4444, #B91C1C); }

.bin-choice-btn.is-correct {
  opacity: 1 !important;
  outline: 4px solid #FACC15;
  transform: scale(1.04);
}

.bin-choice-btn.is-wrong {
  opacity: 0.9 !important;
  animation: shakeX 0.35s ease;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.bin-choice-ico {
  font-size: 27px;
  line-height: 1;
}

.bin-choice-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.15;
}

.bin-choice-sub {
  font-size: 10.8px;
  font-weight: 800;
  opacity: 0.92;
  line-height: 1.15;
}

.sorter-feedback {
  border-radius: 14px;
  border: 2.5px solid #CBD5E1;
  background: #F8FAFC;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  flex-shrink: 0;
}

.sorter-feedback.ok {
  border-color: #059669;
  background: #ECFDF5;
}

.sorter-feedback.err {
  border-color: #DC2626;
  background: #FEF2F2;
}

.fb-copy {
  flex: 1;
  font-size: 13.6px;
  font-weight: 700;
  line-height: 1.34;
  color: #0F172A;
}

.fb-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 2px;
}

.sorter-summary {
  flex: 1;
  border-radius: 16px;
  border: 3px solid #0B1220;
  background: linear-gradient(135deg, #ECFDF5 0%, #FFFBEB 55%, #EFF6FF 100%);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  box-shadow: 5px 5px 0 #0B1220;
}

.sorter-summary h3 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.5vw, 34px);
  color: #047857;
}

.sorter-summary-stars {
  font-size: 32px;
  letter-spacing: 4px;
}

/* Game 2: Spot the Sneaky Contaminants */
.spot-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  min-height: 0;
}

.open-bin-tray {
  border-radius: 18px;
  border: 3px solid #0B1220;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 4px 4px 0 #0B1220;
  min-height: 0;
}

.open-bin-tray.blue-bin {
  background: linear-gradient(180deg, var(--marty-body) 0%, var(--marty-rim) 16%, var(--marty-tint) 16%, var(--marty-tray-bg) 100%);
}

.open-bin-tray.blue-bin .open-bin-hdr,
.open-bin-tray.blue-bin .open-bin-hdr h3 {
  color: var(--marty-btn-fg);
  text-shadow: none;
}

.open-bin-tray.brown-bin {
  background: linear-gradient(180deg, #8B5A2B 0%, #6B421D 16%, #FEF3C7 16%, #FFFBEB 100%);
}

.open-bin-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #FFFFFF;
}

.open-bin-hdr h3 {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.45vw, 19.5px);
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.bin-found-tag {
  background: rgba(255, 255, 255, 0.94);
  color: #0F172A;
  font-size: 11.5px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 999px;
}

.bin-items-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  align-content: center;
}

.spot-item-btn {
  position: relative;
  border-radius: 13px;
  border: 2.5px solid #0B1220;
  background: #FFFFFF;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  box-shadow: 0 3px 0 #0B1220;
  transition: transform 0.14s ease, background 0.16s ease;
  min-height: 98px;
}

.spot-item-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #FFFBEB;
}

.spot-item-btn svg {
  width: 52px;
  height: 52px;
}

.spot-item-name {
  font-size: 11.8px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.15;
}

.spot-item-btn.rescued {
  background: #DCFCE7;
  border-color: #059669;
  box-shadow: none;
  opacity: 0.9;
}

.spot-item-btn.safe-checked {
  background: #EFF6FF;
  border-color: #38BDF8;
}

.spot-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid #0B1220;
}

.spot-badge.rescued { background: #10B981; color: #FFFFFF; }
.spot-badge.keep { background: #38BDF8; color: #0B1220; }

.spot-toast {
  border-radius: 12px;
  border: 2px solid #CBD5E1;
  background: #F8FAFC;
  padding: 9px 14px;
  font-size: 13.4px;
  font-weight: 800;
  color: #0F172A;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.spot-toast.win {
  background: #ECFDF5;
  border-color: #059669;
  color: #065F46;
}

/* Step 12: Finale Panorama + Pledge + Universe Launch */
.finale-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.finale-panorama {
  flex: 1;
  min-height: 162px;
  max-height: 225px;
  border-radius: 15px;
  border: 3px solid #0B1220;
  overflow: hidden;
  background: #DCEEF8;
  box-shadow: 4px 4px 0 #0B1220;
}

.finale-panorama svg {
  width: 100%;
  height: 100%;
  display: block;
}

.finale-lower {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr;
  gap: 13px;
  flex-shrink: 0;
}

.pledge-card {
  border-radius: 15px;
  border: 2.5px solid #059669;
  background: linear-gradient(135deg, #ECFDF5 0%, #FFFBEB 100%);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pledge-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  color: #065F46;
}

.pledge-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.6px;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.3;
}

.pledge-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.launch-card {
  border-radius: 15px;
  border: 2.5px solid #0B1220;
  background: #FFFFFF;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 3px 3px 0 #0B1220;
}

.launch-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  color: #0F172A;
}

.launch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.launch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 11px;
  border: 2px solid #0B1220;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  text-align: center;
  box-shadow: 0 3px 0 #0B1220;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #0B1220;
}

.launch-btn.games { background: linear-gradient(135deg, #059669, #047857); }
.launch-btn.talk { background: linear-gradient(135deg, #0284C7, #0369A1); }
.launch-btn.comics { background: linear-gradient(135deg, #D97706, #B45309); }
.launch-btn.merch { background: linear-gradient(135deg, #7C3AED, #5B21B6); }

.finale-brand-footer {
  text-align: center;
  font-size: 11.2px;
  font-weight: 700;
  color: #475569;
  padding-top: 2px;
}

/* ============================================================================
 * TEACHER SPEAKER CUE STRIP (#speaker-cue)
 * ========================================================================== */
#speaker-cue {
  position: fixed;
  bottom: var(--bottombar-h);
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  max-width: 960px;
  width: calc(100% - 28px);
  background: #FFFBEB;
  border: 2px solid #F59E0B;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 9px 14px;
  font-size: 13px;
  color: #78350F;
  font-weight: 700;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.12);
  display: none;
  align-items: center;
  gap: 10px;
  line-height: 1.38;
}

#speaker-cue.visible {
  display: flex;
}

.cue-badge {
  background: #F59E0B;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cue-text {
  flex: 1;
}

.cue-close {
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  color: #92400E;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-weight: 900;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================================
 * BOTTOM NAVIGATION BAR (#bottombar)
 * ========================================================================== */
#bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottombar-h);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border-top: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  z-index: 100;
}

.nav-controls,
.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  height: 36px;
  padding: 0 13px;
  border-radius: 9px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  color: var(--ink);
  font-size: 12.8px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.nav-btn:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav-btn.primary {
  background: var(--green);
  border-color: var(--green-dark);
  color: #FFFFFF;
}

.nav-btn.primary:hover:not(:disabled) {
  background: #10B981;
  color: #FFFFFF;
}

.nav-btn.active {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

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

.act-badge {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.act-badge.act-1 { background: #DCFCE7; color: #065F46; }
.act-badge.act-2 { background: #E0F2FE; color: #075985; }
.act-badge.act-3 { background: #FEF3C7; color: #92400E; }
.act-badge.act-4 { background: #EDE9FE; color: #5B21B6; }

.step-readout {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.voice-now-playing {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--green-dark);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
 * MODALS (#photo-modal & #class-modal)
 * ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-inner {
  background: #FFFFFF;
  border: 3px solid var(--green);
  border-radius: 18px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 22px;
  box-shadow: 0 26px 64px rgba(15, 23, 42, 0.38);
}

.photo-modal-inner {
  max-width: 960px;
}

.class-modal-inner {
  max-width: 460px;
}

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-hdr-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-cat-badge {
  align-self: flex-start;
  background: #E0F2FE;
  color: #075985;
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 999px;
}

.modal-hdr h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
}

.close-btn {
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  color: #0F172A;
  padding: 6px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.close-btn:hover {
  background: #E2E8F0;
}

.modal-photo-stage {
  background: #0F172A;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.modal-photo-stage img {
  width: 100%;
  max-height: 54vh;
  object-fit: contain;
  display: block;
}

.modal-caption {
  font-size: 14.5px;
  font-weight: 700;
  color: #1E293B;
  line-height: 1.45;
  margin-bottom: 10px;
}

.modal-kid-fact {
  background: #ECFDF5;
  border: 2px solid #10B981;
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 800;
  color: #065F46;
  margin-bottom: 10px;
  line-height: 1.4;
}

.modal-credit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  padding-top: 8px;
  border-top: 1px solid #E2E8F0;
}

.modal-source-link {
  color: #0369A1;
  font-weight: 800;
  text-decoration: none;
}

.modal-source-link:hover {
  text-decoration: underline;
}

/* Class Name Form */
.class-modal-desc {
  font-size: 13.5px;
  color: #475569;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 12px;
}

.class-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.class-label {
  font-size: 12.5px;
  font-weight: 900;
  color: #0F172A;
}

.class-input {
  height: 42px;
  border-radius: 10px;
  border: 2px solid #CBD5E1;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
}

.class-input:focus {
  border-color: var(--green);
}

.class-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ============================================================================
 * PRINT-ONLY ECO-HERO CERTIFICATE
 * ========================================================================== */
.print-certificate {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  html, body {
    overflow: visible !important;
    height: auto !important;
    background: #FFFFFF !important;
  }

  #topbar,
  #stage,
  #speaker-cue,
  #bottombar,
  #photo-modal,
  #class-modal {
    display: none !important;
  }

  #print-certificate {
    display: block !important;
    width: 100%;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    color: #0F172A;
  }

  .cert-border {
    border: 6px double #059669;
    border-radius: 18px;
    padding: 20px 28px;
    text-align: center;
    background: #FFFFFF;
  }

  .cert-logo {
    height: 36px;
    margin-bottom: 6px;
  }

  .cert-kicker {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #047857;
  }

  .cert-header h1 {
    font-size: 28px;
    margin: 4px 0 6px;
    color: #0F172A;
  }

  .cert-sub {
    font-size: 14px;
    color: #475569;
    font-weight: 700;
  }

  .cert-class-name {
    font-size: 26px;
    font-weight: 900;
    color: #059669;
    border-bottom: 2px dashed #10B981;
    display: inline-block;
    padding: 4px 28px;
    margin: 8px 0 14px;
  }

  .cert-pledge-box {
    text-align: left;
    background: #ECFDF5;
    border: 2px solid #10B981;
    border-radius: 12px;
    padding: 12px 18px;
    margin: 0 auto 14px;
    max-width: 780px;
  }

  .cert-pledge-box h2 {
    font-size: 16px;
    color: #065F46;
    margin-bottom: 6px;
  }

  .cert-pledge-box ol {
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.5;
  }

  .cert-art-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 14px;
  }

  .cert-art-row svg {
    height: 82px;
    width: auto;
  }

  .cert-footer-row {
    display: flex;
    justify-content: space-around;
    gap: 40px;
    max-width: 680px;
    margin: 12px auto 10px;
  }

  .cert-line {
    display: block;
    width: 220px;
    border-bottom: 1.5px solid #0F172A;
    height: 20px;
    margin-bottom: 4px;
  }

  .cert-date-val {
    display: block;
    font-size: 14px;
    font-weight: 800;
    border-bottom: 1.5px solid #0F172A;
    min-width: 180px;
    padding-bottom: 2px;
    margin-bottom: 4px;
  }

  .cert-brand-note {
    font-size: 10.5px;
    color: #475569;
    margin-top: 8px;
  }
}

/* ============================================================================
 * RESPONSIVE BREAKPOINTS (iPads, Narrow Laptops & Mobile)
 * ========================================================================== */
@media (max-width: 1120px) {
  .brand-title { font-size: 12px; }
  .ctrl-hide-sm { display: none; }
  .step-pills { justify-content: flex-start; }
  .story-split,
  .doc-grid-2,
  .doc-bottom-split,
  .villains-layout,
  .finale-lower {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
    min-height: auto;
  }
  .doc-photos-col,
  .weeesel-grid,
  .spot-grid,
  .magic-grid-2,
  .places-grid {
    flex: 0 0 auto;
    min-height: auto;
  }
  .photo-card {
    height: auto;
    flex: 0 0 auto;
  }
  .photo-thumb-wrap {
    height: 155px;
    flex: 0 0 auto;
  }
  .bin-choices-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .voice-now-playing {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-h: 52px;
    --bottombar-h: 50px;
  }
  #stage {
    padding: 6px;
  }
  .slide {
    padding: 12px 13px 16px;
    gap: 10px;
  }
  .slide-header {
    align-items: flex-start;
  }
  .slide-hdr-text {
    width: 100%;
  }
  .slide-title {
    overflow-wrap: break-word;
    word-break: normal;
  }
  .duo-cards,
  .doc-photos-col,
  .doc-photos-row-3,
  .magic-grid-2,
  .places-grid,
  .spot-grid,
  .weeesel-grid {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
    min-height: auto;
  }
  .magic-col,
  .open-bin-tray,
  .boss-panel,
  .photo-card,
  .video-card {
    min-width: 0;
    max-width: 100%;
    height: auto;
    flex: 0 0 auto;
  }
  .magic-col {
    padding: 11px 11px;
  }
  .tour-stepper {
    gap: 4px;
  }
  .tour-step-pill {
    font-size: 9.8px;
    padding: 5px 2px;
  }
  .tour-nav-btn,
  .tour-photo-btn {
    font-size: 11.4px;
    padding: 5px 8px;
  }
  .pipeline-strip {
    padding: 7px 6px;
    gap: 4px;
    flex-wrap: nowrap;
    max-width: 100%;
  }
  .pipe-node {
    font-size: 10.2px;
    min-width: 0;
    overflow-wrap: break-word;
  }
  .pipe-node span {
    font-size: 16px;
  }
  .pipe-arrow {
    font-size: 13px;
  }
  .bin-items-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
  }
  .micro-flow {
    grid-template-columns: repeat(2, 1fr);
  }
  .bin-choices-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .brand-text {
    display: none;
  }
  .act-badge {
    display: none;
  }
  .nav-btn {
    padding: 0 9px;
    font-size: 12px;
  }
  .sorter-item-card {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  .launch-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================================
 * START-OF-PRESENTATION BIN COLOUR PICKER (Cranky Waste Bin & Marty Recycling)
 * Gardener Brown is ALWAYS Brown!
 * ========================================================================== */
.colours-pill {
  background: #FEF3C7;
  color: #92400E;
  border-color: #F59E0B;
}

.colours-pill:hover {
  background: #FDE68A;
}

.bin-colour-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  background: #FFFFFF;
  border: 2.5px solid #0B1220;
  border-radius: 14px;
  padding: 7px 12px;
  box-shadow: 3px 3px 0 rgba(15, 23, 42, 0.14);
  flex-shrink: 0;
}

.bin-colour-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bin-colour-label {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
}

.bin-swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.bin-swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2.5px solid #0B1220;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  color: #FFFFFF;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 1px 0 #0B1220;
}

.bin-swatch-btn:hover {
  transform: scale(1.14);
}

.bin-swatch-btn.active {
  outline: 3px solid #FACC15;
  outline-offset: 1px;
  transform: scale(1.12);
}

.bin-swatch-btn.light-swatch {
  color: #0B1220;
}

.bin-locked-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FEF3C7;
  border: 2px solid #8B5A2B;
  color: #78350F;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.8px;
  font-weight: 800;
  white-space: nowrap;
}

.colours-modal-inner {
  max-width: 720px;
  width: 100%;
  padding: 18px 20px;
}

.colours-modal-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.colour-preview-card {
  background: #F8FAFC;
  border: 2.5px solid #0B1220;
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.colour-preview-card h4 {
  font-family: var(--font-display);
  font-size: 15px;
  color: #0F172A;
}

.colour-preview-card .cp-role {
  font-size: 11.5px;
  font-weight: 800;
  color: #475569;
}

.colour-preview-svg {
  width: 96px;
  height: 96px;
}

.colour-preview-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.colour-preview-card .bin-swatch-row {
  justify-content: center;
}

@media (max-width: 720px) {
  .bin-colour-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .colours-modal-body {
    grid-template-columns: 1fr;
  }
}

@media print {
  #colours-modal {
    display: none !important;
  }
}
