/* ==========================================================================
 * Talk to Cranky — Interactive Schoolroom Recycling Stage Styles
 * SmartBins.ie Eco-Arcade Theme (Projector, Whiteboard, iPad & Mobile Ready)
 * ========================================================================== */

:root {
  --green: #059669;
  --green-dark: #047857;
  --green-soft: #D1FAE5;
  --green-pale: #ECFDF5;
  --gold: #FEF3C7;
  --gold-border: #F59E0B;
  --gold-ink: #92400E;
  --blue: #0284C7;
  --blue-dark: #0369A1;
  --blue-soft: #E0F2FE;
  --brown: #92400E;
  --brown-soft: #FEF3C7;
  --cranky: #334155;
  --cranky-dark: #1E293B;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --purple: #7C3AED;
  --ink: #0F172A;
  --muted: #475569;
  --paper: #FFFFFF;
  --arcade: 'Press Start 2P', 'Courier New', monospace;
  --round: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--round);
  color: var(--ink);
  background-color: #ECFDF5;
  background-image:
    radial-gradient(rgba(15, 23, 42, 0.045) 1.2px, transparent 1.2px),
    linear-gradient(180deg, #ECFDF5 0%, #F4F7F6 46%, #E0F2FE 100%);
  background-size: 18px 18px, 100% 100%;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button,
input,
select,
textarea {
  font-family: var(--round);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #F59E0B;
  outline-offset: 2px;
}

/* ==========================================================================
 * STICKY COMPACT TOP NAVIGATION BAR
 * ========================================================================== */
.bar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 16px;
  background: #FFFFFF;
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 3px 0 rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}

.bar-left,
.bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bar a.back {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-pale);
  border: 2px solid var(--green-soft);
  transition: transform 0.1s ease, background 0.12s ease;
  white-space: nowrap;
}

.bar a.back:hover {
  background: var(--green-soft);
  transform: translateY(-1px);
}

.bar-links {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.bar-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: #F8FAFC;
  border: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  white-space: nowrap;
}

.bar-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
}

.bar-pill:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.bar-pill.games { background: #DCFCE7; color: #065F46; }
.bar-pill.story { background: #E0F2FE; color: #075985; }
.bar-pill.merch { background: #FEF3C7; color: #92400E; }

.school-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #F0FDF4;
  border: 2px solid var(--green);
  color: #065F46;
  font-size: 0.84rem;
  font-weight: 700;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  white-space: nowrap;
}

.mode-pill.mode-live {
  background: #DCFCE7;
  color: #065F46;
  border-color: #059669;
}

.mode-pill.mode-story {
  background: #FEF3C7;
  color: #92400E;
  border-color: #D97706;
}

.bar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  background: #FFFFFF;
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.1s ease, background 0.12s ease;
  white-space: nowrap;
}

.bar-action-btn:hover {
  background: #F1F5F9;
  transform: translateY(-1px);
}

.bar-action-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.bar-action-btn.muted {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #991B1B;
}

.bar-action-btn.setup-btn {
  background: #E0F2FE;
  color: #075985;
}

/* ==========================================================================
 * VIEW 1: SCHOOLROOM SETUP SCREEN
 * ========================================================================== */
.setup-view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 2.5rem;
  flex: 1 0 auto;
}

.setup-hero {
  text-align: center;
  margin-bottom: 1.4rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FEF3C7;
  color: #92400E;
  border: 2px solid #F59E0B;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.setup-hero h1 {
  margin: 0.55rem 0 0.45rem;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.06;
  color: var(--ink);
}

.setup-lead {
  margin: 0 auto;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.cast-preview-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 900px;
  margin: 1.1rem auto 0;
}

.cast-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 rgba(15, 23, 42, 0.14);
}

.cast-chip.cranky { border-left: 7px solid #334155; }
.cast-chip.mickey { border-left: 7px solid #0284C7; }
.cast-chip.brown  { border-left: 7px solid #B45309; }

.cast-dot {
  font-size: 1.55rem;
  line-height: 1;
  flex-shrink: 0;
}

.cast-chip strong {
  display: block;
  font-size: 0.98rem;
  color: var(--ink);
}

.cast-chip span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.setup-card {
  background: #FFFFFF;
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 8px 0 rgba(15, 23, 42, 0.14);
  padding: 1.4rem 1.5rem 1.6rem;
}

.setup-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px dashed #CBD5E1;
}

.setup-card-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.setup-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.setup-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-group label {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.opt-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--muted);
  border: 1px solid #CBD5E1;
}

.field-group input[type="text"],
.field-group input[type="password"],
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 1rem;
  color: var(--ink);
  background: #F8FAFC;
  border: 2.5px solid #CBD5E1;
  border-radius: 13px;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--green);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
  outline: none;
}

.field-hint {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.teacher-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.teacher-input-row input {
  flex: 1 1 auto;
}

.teacher-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 8px;
}

.teacher-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
  background: #DCFCE7;
  border: 2px solid #059669;
  color: #065F46;
  font-size: 0.88rem;
  font-weight: 700;
}

.teacher-chip-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #065F46;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.teacher-chip-remove:hover {
  background: #DC2626;
}

/* Buttons */
.arcade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border-radius: 13px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease;
}

.arcade-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--ink);
}

.arcade-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.arcade-btn.secondary { background: #ECFDF5; color: #065F46; }
.arcade-btn.blue { background: #E0F2FE; color: #075985; }
.arcade-btn.gold { background: #FEF3C7; color: #92400E; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 2px solid #CBD5E1;
  background: #F8FAFC;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #FFFFFF;
}

.ghost-btn.small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* Optional Gemini 3.8 Flash API Key Collapsible Card */
.ai-key-box {
  border: 2.5px solid #CBD5E1;
  border-radius: 16px;
  background: #F8FAFC;
  overflow: hidden;
}

.ai-key-box[open] {
  border-color: var(--green);
  background: #F0FDF4;
}

.ai-key-summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.ai-key-summary::-webkit-details-marker {
  display: none;
}

.ai-key-summary code,
.ai-key-explain code,
.field-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: rgba(15, 23, 42, 0.08);
  padding: 1px 5px;
  border-radius: 6px;
}

.key-status-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.key-status-badge.story {
  background: #FEF3C7;
  color: #92400E;
  border: 1.5px solid #F59E0B;
}

.key-status-badge.live {
  background: #DCFCE7;
  color: #065F46;
  border: 1.5px solid #059669;
}

.ai-key-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-key-explain {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.48;
  color: #1E293B;
}

.key-input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.key-input-row input {
  flex: 1 1 auto;
  padding: 9px 12px;
  border-radius: 10px;
  border: 2px solid #94A3B8;
  background: #FFFFFF;
  font-size: 0.92rem;
}

.icon-btn {
  padding: 0 12px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #FFFFFF;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.icon-btn.danger {
  color: var(--red);
  background: #FEF2F2;
  border-color: #DC2626;
}

/* Google Map Panel */
.map-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-action-row .arcade-btn {
  flex: 1 1 170px;
}

.coords-readout {
  font-size: 0.82rem;
  color: var(--muted);
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  padding: 7px 11px;
  line-height: 1.35;
}

.coords-readout.active {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #065F46;
  font-weight: 600;
}

.map-frame-wrap {
  position: relative;
  width: 100%;
  height: 300px;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid var(--ink);
  background: #E2E8F0;
  box-shadow: 0 4px 0 rgba(15, 23, 42, 0.12);
}

#schoolMapFrame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.map-empty-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ECFDF5 0%, #E0F2FE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
}

.map-empty-inner {
  max-width: 340px;
}

.map-pin-big {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.35rem;
}

.map-empty-inner strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.map-empty-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.nearby-helpers {
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: 16px;
  padding: 11px 12px;
}

.nearby-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.nearby-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding: 9px 8px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #FFFFFF;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.1s ease, background 0.12s ease;
}

.nearby-btn:hover {
  background: #ECFDF5;
  transform: translateY(-1px);
}

/* Activate Primary CTA */
.activate-bar {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed #CBD5E1;
  text-align: center;
}

.activate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 520px);
  padding: 16px 26px;
  font-size: clamp(1.18rem, 2.5vw, 1.48rem);
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(180deg, #10B981 0%, #059669 100%);
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.12s ease;
}

.activate-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--ink);
}

.activate-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--ink);
}

.activate-note {
  margin: 0.65rem auto 0;
  max-width: 620px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ==========================================================================
 * VIEW 2: LIVE CLASSROOM STAGE (Projector & Interactive Whiteboard Ready)
 * ========================================================================== */
.stage-view {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 0.95rem 1.1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  flex: 1 0 auto;
}

.stage-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 0.95rem;
  align-items: stretch;
}

/* --------------------------------------------------------------------------
 * The 3 Sleeping Friends Theatre Stage
 * -------------------------------------------------------------------------- */
.stage {
  position: relative;
  border: 3.5px solid var(--ink);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 400px;
  box-shadow: 0 8px 0 rgba(15, 23, 42, 0.16);
  transition: background 0.7s ease, border-color 0.5s ease;
}

/* Cosy Dimmed Sleep Mode */
.stage.sleeping {
  background:
    radial-gradient(circle at 50% 18%, rgba(253, 224, 71, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, #0F172A 0%, #1E293B 46%, #1E3A5F 74%, #334155 74%, #1E293B 100%);
}

/* Bright Joyful Daytime Eco-Classroom Mode */
.stage.awake {
  background:
    radial-gradient(circle at 86% 16%, rgba(254, 240, 138, 0.75) 0%, transparent 32%),
    linear-gradient(180deg, #38BDF8 0%, #BAE6FD 48%, #E0F2FE 68%, #4ADE80 68%, #22C55E 82%, #15803D 100%);
}

/* Theatre Curtain Valence */
.stage-curtain {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 18px;
  background: repeating-linear-gradient(
    90deg,
    #047857 0 28px,
    #059669 28px 56px
  );
  border-bottom: 3px solid var(--ink);
  z-index: 3;
  transition: opacity 0.4s ease;
}

.stage.sleeping .stage-curtain {
  background: repeating-linear-gradient(
    90deg,
    #1E293B 0 28px,
    #312E81 28px 56px
  );
}

/* Sky decorations (stars/moon in sleep mode, sun/clouds in awake mode) */
.stage-sky-decor {
  position: absolute;
  inset: 18px 0 90px 0;
  pointer-events: none;
  z-index: 1;
}

.sky-star,
.sky-moon,
.sky-sun,
.sky-cloud {
  position: absolute;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.sky-star { color: #FEF08A; font-size: 1.2rem; animation: twinkle 2.8s ease-in-out infinite; }
.sky-star.s1 { top: 14px; left: 8%; animation-delay: 0s; }
.sky-star.s2 { top: 38px; left: 26%; animation-delay: 0.9s; font-size: 0.95rem; }
.sky-star.s3 { top: 20px; right: 22%; animation-delay: 1.5s; }
.sky-moon { top: 14px; right: 7%; font-size: 2.2rem; }
.sky-sun { top: 12px; right: 6%; font-size: 2.8rem; }
.sky-cloud { font-size: 2.3rem; opacity: 0.9; }
.sky-cloud.c1 { top: 18px; left: 8%; }
.sky-cloud.c2 { top: 32px; left: 48%; font-size: 1.9rem; }

.stage.sleeping .sky-sun,
.stage.sleeping .sky-cloud {
  opacity: 0;
  transform: translateY(-16px) scale(0.8);
}

.stage.awake .sky-star,
.stage.awake .sky-moon {
  opacity: 0;
  transform: translateY(-16px) scale(0.8);
}

/* Sleep Instruction Ribbon */
.sleep-ribbon {
  position: relative;
  z-index: 4;
  margin: 28px auto 4px;
  padding: 10px 20px;
  max-width: 92%;
  text-align: center;
  border-radius: 999px;
  background: rgba(254, 243, 199, 0.96);
  color: #78350F;
  border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 rgba(15, 23, 42, 0.35);
  font-weight: 700;
  font-size: clamp(0.95rem, 1.5vw, 1.14rem);
  animation: gentlePulse 2.6s ease-in-out infinite;
}

.stage.awake .sleep-ribbon {
  display: none;
}

/* 3 Interactive Friend Cards */
.stage-characters {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 28px 16px 10px;
  align-items: end;
  flex: 1 1 auto;
}

.stage.sleeping .stage-characters {
  padding-top: 6px;
}

.friend-card {
  position: relative;
  appearance: none;
  border: 3px solid transparent;
  border-radius: 22px;
  padding: 10px 8px 10px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.stage.sleeping .friend-card {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(148, 163, 184, 0.35);
}

.stage.awake .friend-card {
  background: rgba(255, 255, 255, 0.48);
  border-color: rgba(15, 23, 42, 0.22);
}

.friend-card:hover {
  transform: translateY(-5px);
}

.friend-card.is-active {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--ink);
  box-shadow: 0 0 0 4px #FACC15, 0 8px 0 rgba(15, 23, 42, 0.28);
  transform: translateY(-6px);
}

.friend-card.is-active[data-char="cranky"] { box-shadow: 0 0 0 4px #F59E0B, 0 8px 0 rgba(15, 23, 42, 0.28); }
.friend-card.is-active[data-char="mickey"] { box-shadow: 0 0 0 4px #38BDF8, 0 8px 0 rgba(15, 23, 42, 0.28); }
.friend-card.is-active[data-char="brown"]  { box-shadow: 0 0 0 4px #4ADE80, 0 8px 0 rgba(15, 23, 42, 0.28); }

.friend-state-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  margin-bottom: 4px;
  white-space: nowrap;
}

.friend-card.is-sleeping .friend-state-pill {
  background: #334155;
  color: #E2E8F0;
  border-color: #94A3B8;
}

.friend-card.is-awake .friend-state-pill {
  background: #ECFDF5;
  color: #065F46;
}

.friend-card.is-speaking .friend-state-pill {
  background: #FEF08A;
  color: #78350F;
  animation: speakBadgePop 0.65s ease-in-out infinite alternate;
}

.friend-svg-wrap {
  width: 100%;
  max-width: 215px;
  aspect-ratio: 260 / 300;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.friend-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 8px 8px rgba(15, 23, 42, 0.22));
}

.friend-card.just-woke .friend-svg-wrap {
  animation: wakeBounce 0.68s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.friend-label {
  margin-top: 4px;
  padding: 5px 10px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 2px solid var(--ink);
  width: 100%;
}

.friend-name {
  display: block;
  font-size: clamp(0.96rem, 1.4vw, 1.15rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

.friend-role {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.friend-tap-cue {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #047857;
}

.friend-card.is-sleeping .friend-tap-cue {
  color: #B45309;
}

/* Stage Quick-Controls Bar */
.stage-floor {
  position: relative;
  z-index: 4;
  background: rgba(15, 23, 42, 0.82);
  border-top: 3px solid var(--ink);
  padding: 9px 14px;
}

.stage-quick-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, filter 0.12s ease;
}

.stage-ctrl-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.stage-ctrl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stage-ctrl-btn.wake   { background: #FEF08A; color: #78350F; }
.stage-ctrl-btn.sleep  { background: #E2E8F0; color: #1E293B; }
.stage-ctrl-btn.replay { background: #A7F3D0; color: #065F46; }

/* --------------------------------------------------------------------------
 * Live Device Camera PIP Card
 * -------------------------------------------------------------------------- */
.camera-card {
  background: #FFFFFF;
  border: 3.5px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 8px 0 rgba(15, 23, 42, 0.14);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.camera-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.cam-status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  border: 1.5px solid var(--ink);
}

.cam-status.live {
  background: #DCFCE7;
  color: #065F46;
  border-color: #059669;
}

.cam-status.off {
  background: #F1F5F9;
  color: var(--muted);
  border-color: #94A3B8;
}

.camera-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  background: #0F172A;
}

#classroomVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#classroomVideo.mirror-selfie {
  transform: scaleX(-1);
}

.camera-flash {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
}

.camera-flash.flash-go {
  animation: shutterFlash 0.35s ease-out;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  gap: 6px;
}

.cam-off-icon {
  font-size: 2rem;
}

.camera-overlay p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #CBD5E1;
}

.camera-seen-note {
  padding: 6px 10px;
  border-radius: 11px;
  background: #ECFDF5;
  border: 1.5px solid #6EE7B7;
  color: #065F46;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.camera-controls {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.camera-btn-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.cam-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 9px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #F8FAFC;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.1s ease, background 0.12s ease;
}

.cam-btn:hover:not(:disabled) {
  background: #E2E8F0;
  transform: translateY(-1px);
}

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

.cam-btn.snap-primary {
  width: 100%;
  padding: 11px 12px;
  font-size: 0.9rem;
  background: linear-gradient(180deg, #FDE047 0%, #FACC15 100%);
  color: var(--ink);
  border-width: 2.5px;
  box-shadow: 0 3px 0 var(--ink);
}

.cam-btn.snap-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #FEF08A 0%, #FDE047 100%);
}

.camera-privacy {
  margin: auto 0 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Big Classroom Speech Bubble (Ultra-readable from back of classroom)
 * -------------------------------------------------------------------------- */
.speech-bubble {
  background: #FFFFFF;
  border: 3.5px solid var(--ink);
  border-left-width: 12px;
  border-radius: 22px;
  box-shadow: 0 7px 0 rgba(15, 23, 42, 0.14);
  padding: 1rem 1.35rem 1.15rem;
  transition: border-left-color 0.25s ease;
}

.speech-bubble.char-cranky { border-left-color: #334155; }
.speech-bubble.char-mickey { border-left-color: #0284C7; }
.speech-bubble.char-brown  { border-left-color: #B45309; }

.speech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.55rem;
}

.speaker-id-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.speaker-name {
  font-size: clamp(1.1rem, 2vw, 1.38rem);
  font-weight: 700;
  color: var(--ink);
}

.speaker-mood {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  background: #64748B;
  color: #FFFFFF;
  border: 2px solid var(--ink);
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.35);
}

.reply-source-pill {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--muted);
  border: 1.5px solid #CBD5E1;
}

.reply-source-pill.live {
  background: #DCFCE7;
  color: #065F46;
  border-color: #059669;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin-bottom: 0.55rem;
  border-radius: 999px;
  background: #E0F2FE;
  border: 2px solid #0284C7;
  color: #075985;
  font-weight: 700;
  font-size: 0.92rem;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0284C7;
  animation: dotBounce 0.9s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

.handoff-banner {
  padding: 7px 12px;
  margin-bottom: 0.55rem;
  border-radius: 12px;
  background: #FEF3C7;
  border: 2px solid #F59E0B;
  color: #78350F;
  font-weight: 700;
  font-size: 0.92rem;
}

.speech-text {
  margin: 0;
  font-size: clamp(1.24rem, 2.35vw, 1.82rem);
  line-height: 1.44;
  font-weight: 600;
  color: var(--ink);
  word-wrap: break-word;
}

.api-notice {
  margin-top: 0.65rem;
  padding: 7px 12px;
  border-radius: 10px;
  background: #FEF2F2;
  border: 1.5px solid #FCA5A5;
  color: #991B1B;
  font-size: 0.82rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Classroom Conversation Controls
 * -------------------------------------------------------------------------- */
.controls-panel {
  background: #FFFFFF;
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 7px 0 rgba(15, 23, 42, 0.12);
  padding: 1rem 1.2rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.talk-input-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.mic-cluster {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  font-size: 1.04rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  white-space: nowrap;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.1s ease;
}

.mic-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--ink);
}

.mic-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.mic-btn.listening {
  background: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
  animation: micPulse 1.1s ease-in-out infinite;
}

.mic-btn:disabled {
  background: #94A3B8;
  cursor: not-allowed;
  box-shadow: none;
}

.interim-transcript {
  padding: 6px 12px;
  border-radius: 11px;
  background: #FEF2F2;
  border: 2px solid #EF4444;
  color: #991B1B;
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 340px;
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

#chatInput {
  flex: 1 1 auto;
  padding: 12px 15px;
  font-size: 1.02rem;
  border-radius: 15px;
  border: 2.5px solid #94A3B8;
  background: #F8FAFC;
  color: var(--ink);
}

#chatInput:focus {
  border-color: var(--green);
  background: #FFFFFF;
  outline: none;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
}

.send-btn {
  padding: 12px 20px;
  border-radius: 15px;
  border: 3px solid var(--ink);
  background: #0284C7;
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  white-space: nowrap;
}

.send-btn:hover {
  background: #0369A1;
}

.send-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

/* Topic & Prop Chips */
.chips-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chips-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.chips-head h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.chips-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-chip,
.prop-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.1s ease, background 0.12s ease, box-shadow 0.1s ease;
}

.topic-chip {
  background: #ECFDF5;
  color: #065F46;
}

.topic-chip:hover {
  background: #D1FAE5;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
}

.prop-chip {
  background: #FEF3C7;
  color: #78350F;
}

.prop-chip:hover {
  background: #FDE68A;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
}

.topic-chip:active,
.prop-chip:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.catchphrase-chip.char-cranky {
  background: #F1F5F9;
  color: #0F172A;
  border-color: #0F172A;
}

.catchphrase-chip.char-cranky:hover {
  background: #E2E8F0;
}

.catchphrase-chip.char-mickey {
  background: #E0F2FE;
  color: #075985;
  border-color: #0369A1;
}

.catchphrase-chip.char-mickey:hover {
  background: #BAE6FD;
}

.catchphrase-chip.char-brown {
  background: #DCFCE7;
  color: #166534;
  border-color: #15803D;
}

.catchphrase-chip.char-brown:hover {
  background: #BBF7D0;
}

/* Collapsible Class Conversation Log */
.transcript-box {
  border: 2px solid #CBD5E1;
  border-radius: 16px;
  background: #F8FAFC;
  overflow: hidden;
}

.transcript-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--ink);
}

.transcript-summary::-webkit-details-marker {
  display: none;
}

.transcript-summary-right {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.log-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--green);
  color: #FFFFFF;
  font-size: 0.76rem;
}

.transcript-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 8px;
  border-bottom: 1px solid #E2E8F0;
}

.transcript-note {
  font-size: 0.8rem;
  color: var(--muted);
}

.transcript-log {
  max-height: 280px;
  overflow-y: auto;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.log-entry {
  padding: 9px 12px;
  border-radius: 13px;
  border: 2px solid #CBD5E1;
  background: #FFFFFF;
}

.log-entry.role-user {
  background: #EFF6FF;
  border-color: #93C5FD;
  align-self: flex-end;
  max-width: 88%;
}

.log-entry.role-character {
  align-self: flex-start;
  max-width: 92%;
}

.log-entry.char-cranky { border-left: 6px solid #334155; }
.log-entry.char-mickey { border-left: 6px solid #0284C7; }
.log-entry.char-brown  { border-left: 6px solid #B45309; }

.log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 3px;
}

.log-text {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.42;
  color: var(--ink);
}

/* ==========================================================================
 * TOAST REGION & FOOTER
 * ========================================================================== */
.toast-region {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  border: 2px solid #10B981;
  border-radius: 14px;
  padding: 10px 15px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.25);
  max-width: 340px;
  animation: toastIn 0.22s ease;
}

.site-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  background: #FFFFFF;
  border-top: 2px solid var(--green-soft);
  line-height: 1.6;
}

.site-footer a {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
 * ANIMATIONS (Stage, Sleeping Zzz, Bounce, Talk & Mic)
 * ========================================================================== */
@keyframes sleepBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(3px) scale(0.985); }
}

@keyframes wakeBounce {
  0%   { transform: translateY(0) scale(0.94); }
  35%  { transform: translateY(-20px) scale(1.08); }
  65%  { transform: translateY(4px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes talkBob {
  0%   { transform: translateY(0) rotate(-0.8deg); }
  100% { transform: translateY(-5px) rotate(0.8deg); }
}

@keyframes speakBadgePop {
  0%   { transform: scale(1); }
  100% { transform: scale(1.06); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50%      { opacity: 1; transform: scale(1.18); }
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.015); }
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 4px 0 var(--ink), 0 0 0 0 rgba(220, 38, 38, 0.55); }
  50%      { box-shadow: 0 4px 0 var(--ink), 0 0 0 12px rgba(220, 38, 38, 0); }
}

@keyframes shutterFlash {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

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

/* Floating Zzz CSS helper classes for SVG sleeping bubbles */
@keyframes floatZzz {
  0%   { opacity: 0; transform: translate(0, 6px) scale(0.85); }
  25%  { opacity: 1; }
  85%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(10px, -18px) scale(1.12); }
}

.zzz-float,
.zzz-bubble,
.zzz-1,
.zzz-2,
.zzz-3 {
  animation: floatZzz 2.6s ease-in-out infinite;
}

.zzz-2 { animation-delay: 0.65s; }
.zzz-3 { animation-delay: 1.3s; }

/* ==========================================================================
 * RESPONSIVE BREAKPOINTS (iPads, Laptops & Mobile Phones)
 * ========================================================================== */
@media (max-width: 1040px) {
  .stage-top-grid {
    grid-template-columns: 1fr;
  }

  .camera-card {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "view ctrl"
      "seen seen"
      "priv priv";
    align-items: center;
    gap: 8px 14px;
  }

  .camera-head { grid-area: head; }
  .camera-viewport { grid-area: view; }
  .camera-controls { grid-area: ctrl; }
  .camera-seen-note { grid-area: seen; }
  .camera-privacy { grid-area: priv; text-align: left; }
}

@media (max-width: 860px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .cast-preview-strip {
    grid-template-columns: 1fr;
  }

  .talk-input-bar {
    grid-template-columns: 1fr;
  }

  .mic-btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .bar {
    padding: 8px 10px;
  }

  .setup-view {
    padding: 1rem 0.75rem 2rem;
  }

  .setup-card {
    padding: 1rem;
    border-radius: 18px;
  }

  .nearby-btns {
    grid-template-columns: 1fr;
  }

  .stage-view {
    padding: 0.65rem 0.65rem 1.5rem;
  }

  .stage-characters {
    gap: 6px;
    padding: 24px 6px 8px;
  }

  .friend-card {
    padding: 6px 4px 7px;
    border-radius: 15px;
  }

  .friend-label {
    padding: 4px 5px;
  }

  .friend-role {
    display: none;
  }

  .camera-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "view"
      "seen"
      "ctrl"
      "priv";
  }

  .speech-bubble {
    padding: 0.85rem 1rem;
  }

  .chat-form {
    flex-direction: column;
  }

  .send-btn {
    width: 100%;
  }
}

/* ==========================================================================
 * PANTOMIME CORNER AMBUSH OVERLAY: DR. LI-ON, 4 WEEE-SELS & SUPER BIN RESCUE
 * ========================================================================== */

.stage-ctrl-btn.watch-on {
  background: linear-gradient(180deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  box-shadow: 0 0 0 2px #FEF08A, 0 2px 0 rgba(0, 0, 0, 0.45);
}

.stage-ctrl-btn.watch-off {
  background: #475569;
  color: #E2E8F0;
}

.stage-ctrl-btn.sneak {
  background: #FACC15;
  color: #0F172A;
}

.stage-ctrl-btn.superbin {
  background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
  color: #FEF08A;
}

.shout-meter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 13px;
  background: #0F172A;
  border: 2.5px solid #334155;
  color: #F8FAFC;
  font-size: 0.78rem;
  font-weight: 700;
}

.shout-meter-label {
  white-space: nowrap;
  color: #FEF08A;
}

.shout-meter-track {
  width: 82px;
  height: 11px;
  border-radius: 999px;
  background: #1E293B;
  overflow: hidden;
  border: 1.5px solid #475569;
}

.shout-meter-fill {
  height: 100%;
  width: 4%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22C55E 0%, #FACC15 62%, #EF4444 100%);
  transition: width 0.08s ease;
}

.villain-ambush-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  overflow: hidden;
}

.ambush-alert-banner {
  display: none !important;
}

@keyframes ambushBannerPulse {
  0% { transform: translateX(-50%) scale(0.99); }
  100% { transform: translateX(-50%) scale(1.015); }
}

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

.ambush-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  background: #FEF08A;
  color: #7F1D1D;
  font-weight: 900;
  font-size: 0.86rem;
  border: 2px solid #0F172A;
}

.ambush-cue {
  font-weight: 800;
  font-size: 0.88rem;
  color: #FEF9C3;
}

.ambush-progress-track {
  margin-top: 7px;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  border: 1.5px solid #FEF08A;
  overflow: hidden;
}

.ambush-progress-bar {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #FACC15 0%, #FB923C 55%, #EF4444 100%);
  transition: width 0.25s linear;
}

.ambush-action-btns {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ambush-btn {
  appearance: none;
  border: 2.5px solid #0F172A;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #0F172A;
  transition: transform 0.1s ease, filter 0.12s ease;
}

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

.ambush-btn.chase {
  background: #FEF08A;
  color: #78350F;
}

.ambush-btn.superbin {
  background: #2563EB;
  color: #FFFFFF;
}

/* Creeping Villain Sprite in the 4 Corners */
.ambush-villain-sprite {
  pointer-events: auto;
  position: absolute;
  width: clamp(135px, 18vw, 185px);
  z-index: 14;
  cursor: pointer;
  transition: top 0.35s ease, bottom 0.35s ease, left 0.35s ease, right 0.35s ease, transform 0.35s ease, opacity 0.35s ease;
  filter: drop-shadow(0 10px 14px rgba(15, 23, 42, 0.55));
}

.ambush-villain-sprite.corner-top-left {
  top: 28px;
  left: 8px;
}

.ambush-villain-sprite.corner-top-right {
  top: 28px;
  right: 8px;
}

.ambush-villain-sprite.corner-bottom-left {
  bottom: 58px;
  left: 8px;
}

.ambush-villain-sprite.corner-bottom-right {
  bottom: 58px;
  right: 8px;
}

.ambush-villain-svg-wrap {
  width: 100%;
  animation: villainCreepWobble 0.9s ease-in-out infinite alternate;
}

@keyframes villainCreepWobble {
  0% { transform: rotate(-6deg) scale(0.97); }
  100% { transform: rotate(6deg) scale(1.04); }
}

.ambush-villain-bubble {
  background: #0F172A;
  color: #FEF08A;
  border: 2.5px solid #FACC15;
  border-radius: 14px;
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}

.ambush-villain-sprite.is-chased-away {
  transform: translate(260px, -240px) rotate(540deg) scale(0.15) !important;
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.75s ease !important;
}

/* Super Bin Flying Rescue Overlay */
.superbin-flyer {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: superBinSwoopIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes superBinSwoopIn {
  0% {
    transform: translate(-120%, 80%) rotate(-18deg) scale(0.5);
    opacity: 0;
  }
  60% {
    transform: translate(4%, -6%) rotate(4deg) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translate(0%, 0%) rotate(0deg) scale(1);
    opacity: 1;
  }
}

.superbin-pow-badge {
  background: linear-gradient(135deg, #FACC15 0%, #EF4444 100%);
  color: #FFFFFF;
  border: 3.5px solid #0F172A;
  border-radius: 999px;
  padding: 6px 18px;
  font-weight: 900;
  font-size: clamp(0.95rem, 1.8vw, 1.28rem);
  text-shadow: 0 2px 0 #0F172A;
  box-shadow: 0 6px 0 #0F172A;
  margin-bottom: -6px;
  z-index: 2;
}

.superbin-svg-wrap {
  width: clamp(220px, 32vw, 310px);
  filter: drop-shadow(0 14px 18px rgba(15, 23, 42, 0.6));
}

/* ==========================================================================
 * THE GARAGE: BIN COLOUR CUSTOMISER (CRANKY WASTE BIN & MARTY D.R. RECYCLING BIN)
 * ========================================================================== */

.stage-ctrl-btn.garage-btn {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
}

.garage-box {
  background: #FFFBEB;
  border: 2.5px solid #F59E0B;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.garage-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.garage-box-head strong {
  font-size: 0.98rem;
  color: var(--ink);
}

.garage-box-sub {
  font-size: 0.78rem;
  color: #92400E;
  font-weight: 600;
  margin: 0;
}

.garage-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
}

.garage-row-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.garage-swatch-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.garage-swatch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid #CBD5E1;
  background: #F8FAFC;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.garage-swatch-btn:hover {
  transform: translateY(-1px);
  border-color: var(--ink);
}

.garage-swatch-btn.active {
  border-color: var(--ink);
  background: #FEF3C7;
  box-shadow: 0 2px 0 var(--ink);
}

.garage-swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #0F172A;
  flex-shrink: 0;
}

.garage-stage-drawer {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.92);
  border: 2.5px solid #FACC15;
  border-radius: 16px;
  padding: 10px 14px;
  color: #FFFFFF;
}

.garage-stage-drawer .garage-row {
  background: rgba(30, 41, 59, 0.95);
  border-color: #475569;
}

.garage-stage-drawer .garage-row-title {
  color: #F8FAFC;
}

.garage-stage-drawer .garage-swatch-btn {
  background: #1E293B;
  color: #F8FAFC;
  border-color: #475569;
}

.garage-stage-drawer .garage-swatch-btn.active {
  background: #FACC15;
  color: #0F172A;
  border-color: #FFFFFF;
}

