/* =============================================================
   Comparing Fractions Visually – Main Stylesheet
   Inherits the responsive 1920x1080 wrapper pattern from the
   reference Tally Marks applet, themed for chocolate fractions.
   ============================================================= */

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

:root {
  --scaleFactor: 1;
  --base-width: 1920px;
  --base-height: 1080px;

  /* State colors (mandated palette) */
  --color-correct-base: #219150;
  --color-correct-light: #58D98B;
  --color-correct-dark: #0d803d;
  --color-wrong-base: #FF6F61;
  --color-wrong-light: #FF8F83;
  --color-wrong-dark: #D4574C;
  --color-active: #FF9F1A;
  --color-active-dark: #E5780A;
  --color-inactive: #6b7280;

  /* Theme accents */
  --color-orange-text: #FFAB40;
  /* Semantic dialogue word colors (match storyboard) */
  --color-green-text: #3FA34D;
  --color-pink-text: #E91E8C;
  --color-blue-text: #1565D8;
  --color-purple-base: #9B59B6;
  --color-purple-dark: #7E3E99;
  --color-yellow-base: #F1C40F;

  /* Surfaces */
  --color-white-base: #FFFFFF;
  --color-panel: #1d5f8f;
  --color-panel-border: rgba(169, 214, 255, 0.65);

  /* Chocolate palette */
  --choc-light: #C68642;
  --choc-mid: #8B4513;
  --choc-dark: #5D2D0F;
  --choc-shade: #3A1B07;
  --choc-shaded-tint: rgba(255, 159, 26, 0.55);

  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 20px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Typography */
  --font-family-primary: Arial, sans-serif;

  --transition: all 0.3s ease;
  --shadow: 0 4px 8px rgba(0,0,0,0.3);
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-family-primary);
  background: #000000;
}

/* ===== RESPONSIVE 1920x1080 WRAPPER ===== */
.responsive-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: transparent;
}

.responsive-wrapper {
  width: var(--base-width);
  height: var(--base-height);
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: top left;
  transform: scale(var(--scaleFactor)) translate(-50%, -50%);
  background: transparent;
}

/* ===== INTRO / FINAL / TRANSITION SCREENS ===== */
.intro-screen,
.final-screen,
.transition-screen {
  width: 1920px;
  height: 1080px;
  display: grid;
  grid-template-rows: 16% 68% 16%;
  grid-template-columns: 1fr;
  position: relative;
  background: #0b4f7a;
}

.intro-screen::before,
.final-screen::before,
.transition-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 57, 92, 0.62);
  border: 1px solid var(--color-panel-border);
  z-index: 0;
  pointer-events: none;
}

.intro-header,
.final-header,
.transition-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--spacing-xl);
  position: relative;
  z-index: 1;
}

.header-title,
.final-title {
  color: var(--color-orange-text);
  font-size: 76px;
  font-weight: bold;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  font-family: var(--font-family-primary);
}

.intro-body,
.final-body,
.transition-body {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 60px;
  position: relative;
  z-index: 1;
}

.intro-center,
.final-center,
.transition-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  max-width: 1700px;
  gap: 60px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.intro-message,
.final-message,
.transition-message {
  text-align: center;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  align-items: center;
}

.intro-text,
.final-text {
  color: var(--color-white-base);
  font-size: 46px;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  line-height: 1.4;
  font-family: var(--font-family-primary);
}

.intro-text strong,
.final-text strong { color: var(--color-orange-text); }

.final-text-orange {
  color: var(--color-orange-text);
  font-weight: bold;
}

.intro-characters {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 40px;
  margin-top: 24px;
}

.intro-character-image {
  width: 240px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.start-button-container {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  position: relative;
  margin-top: 30px;
}

/* Style AppletButton in start/final screens like a primary CTA */
.start-button-container .applet-button {
  background: linear-gradient(to bottom, #FFC36A 0%, #F5A623 100%) !important;
  color: #000 !important;
  border: none !important;
  border-radius: 18px !important;
  padding: 14px 40px !important;
  font-size: 38px !important;
  font-weight: 700 !important;
  width: 360px !important;
  height: 100px !important;
  min-width: 360px !important;
  min-height: 100px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
  animation: none !important;
}

.start-button-container .applet-button .applet-button-text {
  color: #000 !important;
  font-size: 38px !important;
  font-weight: 700 !important;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.start-button-container .applet-button.applet-button--clickNext::before {
  right: -28px !important;
  bottom: -38px !important;
  width: 100px !important;
  height: 100px !important;
}

.final-screen > .footer { grid-row: 3; }

.intro-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* ===== ACTIVITY SCREEN (32 screens use this) ===== */
.activity-screen {
  width: 1920px;
  height: 1080px;
  display: flex;
  flex-direction: column;
  background: #0b4f7a;
  position: relative;
}

.activity-body {
  display: grid;
  grid-template-columns: 30% 70%;
  grid-template-rows: 1fr;
  gap: 0;
  padding: 0;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* ===== LEFT CHARACTER PANEL ===== */
.left-character-section {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 24px 18px 0 24px;
  background: transparent;
  height: 100%;
  box-sizing: border-box;
}

.character-speech-bubble {
  background: var(--color-white-base);
  color: #000000;
  padding: 18px 24px;
  border-radius: 18px;
  border: 5px solid var(--color-active);
  margin-bottom: var(--spacing-lg);
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 240px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.character-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 22px solid var(--color-active);
}

.character-speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 16px solid var(--color-white-base);
  z-index: 1;
}

@keyframes bubbleAppear {
  0% { transform: translateY(8px) scale(0.96); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.speech-text {
  font-size: 39px;
  font-weight: 500;
  text-align: left;
  text-shadow: none;
  pointer-events: none;
  line-height: 1.48;
  letter-spacing: 0.2px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: #000000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speech-line {
  display: block;
  width: 100%;
  text-align: left;
}

/* Plain emphasis = bold black (storyboard default for non-colored emphasis) */
.speech-text strong, .speech-text b { font-weight: 800; color: #1a1a2e; }
/* Semantic word colors */
.speech-text .w-orange { font-weight: 800; color: var(--color-orange-text); }
.speech-text .w-green  { font-weight: 800; color: var(--color-green-text); }
.speech-text .w-pink   { font-weight: 800; color: var(--color-pink-text); }
.speech-text .w-blue   { font-weight: 800; color: var(--color-blue-text); }

.character-display {
  width: 360px;
  height: 480px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.left-character-section--no-bubble {
  justify-content: flex-end;
}

.left-character-section--no-bubble .character-display {
  width: 460px;
  height: 620px;
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* ===== RIGHT ACTIVITY SECTION ===== */
.right-activity-section {
  display: grid;
  grid-template-rows: 1fr 120px;
  gap: var(--spacing-xs);
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  padding: 24px 28px 0 12px;
  overflow: hidden;
  min-height: 0;
}

.activity-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: #1d5f8f;
  border: 1px solid var(--color-panel-border);
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  width: 100%;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  min-height: 0;
  overflow: hidden;
  grid-row: 1;
  position: relative;
}

/* Full-area text display for narrative-only screens (no speech bubble) */
.narrative-text-box {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 60px;
  box-sizing: border-box;
}

.narrative-text-card {
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  padding: 50px 70px;
}

.activity-controls--try-again {
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.try-again-label {
  color: #ffffff;
  font-weight: 700;
  font-size: 28px;
}

.narrative-text-box p {
  font-size: 52px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

.narrative-text-card p + p {
  margin-top: 28px;
}

.narrative-text-box p strong {
  color: #ffd86b;
  font-weight: 800;
}

.activity-stage {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  background: #1d5f8f;
  border-radius: 14px;
}

/* Segment overlap crosses grid columns — default hidden overflows clip the motion mid-screen */
.activity-overlap-visible {
  overflow: visible;
}

.flying-half-overlay {
  position: absolute;
  z-index: 80;
  pointer-events: none;
  background: #4A2510;
  box-shadow:
    inset 0 0 0 6px rgba(255, 214, 112, 0.95),
    0 0 10px rgba(255, 255, 255, 0.95),
    0 0 24px rgba(255, 214, 112, 0.9),
    0 10px 24px rgba(0, 0, 0, 0.45);
  animation: flyingHalfToTarget var(--fly-duration, 6.8s) ease-in-out both;
}

.selected-half-overlay {
  position: absolute;
  z-index: 60;
  pointer-events: none;
  background: #4A2510;
  box-shadow:
    inset 0 0 0 4px rgba(255, 214, 112, 0.85),
    0 0 14px rgba(255, 214, 112, 0.7);
}

.flying-half-overlay::after,
.selected-half-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.16) 0,
      rgba(255, 255, 255, 0.16) 4px,
      transparent 4px,
      transparent 16px
    ),
    rgba(58, 27, 7, 0.38);
}

@keyframes flyingHalfToTarget {
  0% { transform: translate(0, 0); }
  25% { transform: translate(var(--fly-dx, 0), var(--fly-dy, 0)); }
  70% { transform: translate(var(--fly-dx, 0), var(--fly-dy, 0)); }
  100% { transform: translate(0, 0); }
}

.activity-prompt {
  color: var(--color-white-base);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.activity-prompt strong { color: var(--color-orange-text); }

.activity-controls {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  z-index: 2;
  pointer-events: auto;
}

/* Two-column bar layout: left 50% = chocolate 1, right 50% = chocolate 2 */
.bars-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  width: 100%;
  align-items: stretch;
  position: relative;
}

/* Ex2 single-bar 60/20/20 layout */
.ex2-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
}

.ex2-bar-zone {
  flex: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding-bottom: 8px;
}

.ex2-frac-zone {
  flex: 2;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ex2-ctrl-zone {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Bar size inside ex2-layout — width wider, height same as part-1 large bar */
.ex2-bar-zone .chocolate-bar--large,
.ex2-bar-zone .chocolate-bar--small {
  width: 560px;
  height: 460px;
}

.ex2-bar-zone .chocolate-bar-svg {
  width: 560px;
  height: 460px;
}

/* Segment numbers: override inline width set by JS so they span the full bar */
.ex2-bar-zone .segment-numbers {
  width: 560px !important;
}

/* Give labels row a fixed height so badges don't overlap the bar */
.ex2-bar-zone .bar-chocolate-area {
  grid-template-rows: 60px 1fr;
  height: auto;
}

/* Hide entire fraction area (top chip + bottom controls) inside ex2-layout */
.ex2-bar-zone .bar-fraction-area {
  display: none;
}

/* Single-bar layout — one wide centred bar (legacy, kept for any remaining uses) */
.bars-stack--single {
  grid-template-columns: 1fr;
  justify-items: center;
}


/* Three-column layout for screens with a symbol between the two bars */
.bars-stack--with-symbol {
  grid-template-columns: 1fr auto 1fr;
  flex: 1;
  width: 100%;
  justify-items: center;
  align-items: stretch;
  column-gap: 10px;
}

.symbol-strip-slot {
  height: 60%;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  position: relative;
  z-index: 8;
  transform: translateY(30px);
}

/* Wrapper for a plain symbol between bars — occupies top 60% and centers text within it */
.plain-symbol-slot {
  height: 60%;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}

/* Vertical > = < pill between chocolates (storyboard) */
.symbol-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 14px;
  background: rgba(135, 206, 250, 0.38);
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  box-shadow:
    inset 0 2px 10px rgba(255, 255, 255, 0.2),
    0 4px 14px rgba(0, 0, 0, 0.28);
  align-self: center;
  flex-shrink: 0;
}

.symbol-strip--single {
  min-height: 130px;
}

.symbol-eq-display {
  font-size: 52px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1;
  padding: 8px 0;
}

.symbol-strip .symbol-button {
  width: 88px;
  height: 88px;
  min-width: 88px;
  min-height: 88px;
  border-radius: 50%;
  font-size: 44px;
  background: linear-gradient(180deg, #fffde7 0%, #ffeb3b 45%, #fbc02d 100%);
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.symbol-strip .symbol-button--collapsed {
  display: none;
}

.bars-row { /* horizontal pair (used for S27 1/2 vs 1/3 same-size compare) */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 60px;
  width: 100%;
}

.bar-with-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 100%; /* fills its 50% grid column */
}

/* Top 65%: labels row (10%) + SVG zone (90%) — grid keeps the 10% row even when empty
   so segment numbers appearing never shifts the chocolate bar downward. */
.bar-chocolate-area {
  height: 65%;
  width: 100%;
  display: grid;
  grid-template-rows: 10% 1fr;
  grid-template-columns: 1fr;
  align-items: stretch;
  justify-items: center;
}

/* Top 10% of the chocolate area: segment number badges (slot always reserved) */
.bar-labels-row {
  grid-row: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Remaining space: the SVG bar, top-aligned */
.bar-svg-zone {
  grid-row: 2;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

/* Keep bar pixel size stable when optional text below appears */
.bar-svg-zone > .chocolate-bar {
  flex-shrink: 0;
}

/* Bottom 35%: top half = fraction label, bottom half = per-bar controls */
.bar-fraction-area {
  height: 35%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.bar-fraction-top {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-fraction-bottom {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-lg);
}


/* S7 answered: full-height slot with = in bar zone (top 65%) and = in fraction zone (bottom 35%) */
.symbol-strip-slot--with-frac-eq {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  align-self: stretch;
}
.symbol-strip-slot--with-frac-eq .symbol-eq-bar {
  flex: 65;
  display: flex;
  align-items: center;
  justify-content: center;
}
.symbol-strip-slot--with-frac-eq .symbol-eq-frac {
  flex: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  transform: none;
}
.symbol-strip-slot--with-frac-eq .symbol-eq-frac .plain-symbol {
  transform: translateY(-100px);
}

.segment-numbers {
  display: flex;
  align-items: center;
  justify-content: space-around;
  transition: width 1.2s ease-in-out;
}

.segment-number {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a5f2a;
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.bar-label {
  color: var(--color-white-base);
  font-size: 26px;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Smaller / Bigger half callouts (S17) */
.half-callout {
  position: absolute;
  background: rgba(255, 159, 26, 0.95);
  color: #1a1a1a;
  border-radius: 12px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 22px;
  text-shadow: none;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  animation: bubbleAppear 0.4s ease-out;
}
.half-callout--smaller { background: #FFD27A; }
.half-callout--bigger { background: #FFAB40; }


/* Big floating fraction labels (1/2, 1/3) */
.fraction-floating {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(126, 62, 153, 0.85);
  color: var(--color-white-base);
  border-radius: 14px;
  padding: 6px 18px;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.fraction-floating--lg { font-size: 84px; padding: 6px 33px; }
.fraction-floating--md { font-size: 63px; padding: 5px 24px; }
.fraction-floating--sm { font-size: 48px; padding: 3px 18px; }

.fraction-floating .frac-num {
  border-bottom: 5px solid var(--color-white-base);
  padding-bottom: 3px;
  line-height: 1;
}

.fraction-floating .frac-den {
  padding-top: 2px;
  line-height: 1;
}

.fraction-floating--pulse {
  animation: fractionPulse 1.2s ease-in-out infinite;
}

.plain-symbol--pulse {
  animation: fractionPulse 1.2s ease-in-out infinite;
}

@keyframes fractionPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.7), 0 4px 10px rgba(0, 0, 0, 0.4);
  }
}

/* Inline fraction (used inside dialogue) */
.frac-inline {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0 4px;
  font-weight: 800;
  color: var(--color-purple-dark);
  font-size: 0.95em;
  line-height: 1;
}
.frac-inline .frac-num { border-bottom: 4px solid currentColor; padding: 0 4px 3px; }
.frac-inline .frac-den { padding: 3px 4px 0; }

/* Fractions inside eq-badge inherit white */
.eq-badge .frac-inline { color: inherit; }

/* ===== OPTION & SYMBOL ROWS ===== */
.option-row,
.symbol-row {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
}

.option-button,
.symbol-button {
  width: 130px;
  height: 130px;
  border-radius: 22px;
  border: 3px solid rgba(255, 255, 255, 0.6);
  background: linear-gradient(145deg, #ffb84d 0%, #FF9F1A 35%, #e68a00 65%, #b36b00 100%);
  color: var(--color-white-base);
  font-size: 64px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.25),
    0 6px 16px rgba(0, 0, 0, 0.4);
  text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.45);
  font-family: var(--font-family-primary);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.option-button > span,
.symbol-button > span {
  pointer-events: none;
  display: inline-block;
}

.option-button--frac {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 46px;
  line-height: 1;
}
.option-button--frac .frac-num {
  border-bottom: 4px solid rgba(255,255,255,0.85);
  padding-bottom: 4px;
  line-height: 1;
  pointer-events: none;
}
.option-button--frac .frac-den {
  padding-top: 4px;
  line-height: 1;
  pointer-events: none;
}

.option-button.option--yes-no {
  width: 200px;
  height: 110px;
  font-size: 44px;
  border-radius: 18px;
}

.option-button:hover:not(:disabled),
.symbol-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.25),
    0 8px 22px rgba(0, 0, 0, 0.5);
}

.option-button:active:not(:disabled),
.symbol-button:active:not(:disabled) {
  transform: scale(0.96);
}

.option-button.is-pulsate,
.symbol-button.is-pulsate {
  animation: optionPulse 1.4s ease-in-out infinite;
}

.option-button.is-correct,
.symbol-button.is-correct {
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 35%, #16a34a 65%, #15803d 100%);
  border-color: rgba(255, 255, 255, 0.85);
  animation: correctGlow 1.6s ease-in-out infinite;
}

.option-button.is-wrong,
.symbol-button.is-wrong {
  background: linear-gradient(145deg, #fca5a5 0%, #f87171 35%, #ef4444 65%, #dc2626 100%);
  animation:
    teeter 0.45s ease-in-out 0s 3,
    wrongGlow 0.9s ease-in-out 0.8s infinite;
}

@keyframes wrongGlow {
  0%, 100% { box-shadow: 0 0 4px 2px rgba(220, 38, 38, 0.4); }
  50%      { box-shadow: 0 0 18px 6px rgba(239, 68, 68, 0.85); }
}

.option-button.is-disabled,
.symbol-button.is-disabled,
.option-button:disabled,
.symbol-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.5);
}

.option-button.is-correct:disabled,
.symbol-button.is-correct:disabled {
  opacity: 1;
  filter: none;
  cursor: default;
}

@keyframes optionPulse {
  0%, 100% {
    box-shadow:
      inset 0 3px 6px rgba(255, 255, 255, 0.3),
      inset 0 -3px 8px rgba(0, 0, 0, 0.25),
      0 6px 16px rgba(0, 0, 0, 0.4),
      0 0 0 rgba(255, 159, 26, 0);
  }
  50% {
    box-shadow:
      inset 0 3px 6px rgba(255, 255, 255, 0.3),
      inset 0 -3px 8px rgba(0, 0, 0, 0.25),
      0 8px 24px rgba(255, 159, 26, 0.6),
      0 0 26px rgba(255, 159, 26, 0.55);
  }
}

@keyframes correctGlow {
  0%, 100% { box-shadow: 0 0 18px rgba(33, 145, 80, 0.6); }
  50% { box-shadow: 0 0 36px rgba(33, 145, 80, 0.95); }
}

@keyframes teeter {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-7deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(4deg); }
}

/* ===== APPLET BUTTON (CTA) ===== */
.applet-button {
  border-radius: 16px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(145deg, #ffb84d 0%, #FF9F1A 35%, #e68a00 65%, #b36b00 100%);
  font-family: var(--font-family-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 80px;
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.25),
    0 4px 12px rgba(0, 0, 0, 0.35);
}

.applet-button-text {
  color: var(--color-white-base);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  text-align: center;
}

.applet-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.25),
    0 8px 20px rgba(0, 0, 0, 0.5);
}

.applet-button:active:not(:disabled) { transform: scale(0.96); }

.applet-button:disabled,
.applet-button.applet-button--inactive {
  opacity: 0.5;
  cursor: not-allowed;
  filter: saturate(0.5);
}

.applet-button--clickNext {
  border: 3px solid rgba(255, 255, 255, 0.85);
  animation: accentGlow 1s ease-in-out infinite, borderPulse 0.8s ease-in-out infinite;
  position: relative;
  overflow: visible;
}

.applet-button--clickNext::before {
  content: '';
  position: absolute;
  right: -22px;
  bottom: -32px;
  width: 90px;
  height: 90px;
  background-image: url('../assets/images/fingerTap.gif');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1;
  pointer-events: none;
  z-index: 5;
}

@keyframes accentGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 159, 26, 0.5); }
  50%      { box-shadow: 0 0 26px rgba(255, 159, 26, 0.9); }
}

@keyframes borderPulse {
  0%, 100% { border-color: rgba(255, 255, 255, 0.6); }
  50%      { border-color: rgba(255, 255, 255, 1); }
}

/* ===== FOOTER NAV ===== */
.footer {
  grid-row: 2;
  height: 120px;
  min-height: 120px;
  max-height: 120px;
  background: transparent;
  display: grid;
  grid-template-columns: 15% 70% 15%;
  align-items: center;
  padding: var(--spacing-xs) 0;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

.footer-left { display: flex; justify-content: flex-start; }
.footer-center { display: flex; justify-content: center; align-items: center; min-height: 40px; }
.footer-right { display: flex; justify-content: flex-end; }

.footer-center .footer-text {
  color: #ffffff;
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-family-primary);
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  pointer-events: none;
}

.nav-btn {
  width: 110px;
  height: 65px;
  min-width: 110px;
  min-height: 65px;
  background: linear-gradient(to bottom, #FFC36A 0%, #F5A623 100%);
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 50px;
  font-weight: bold;
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
  pointer-events: auto;
}

.nav-btn .nav-btn-text { display: inline-block; transform: translateY(-4px); }

.nav-btn.prev-btn { background: linear-gradient(to bottom, #FFC36A 0%, #F5A623 100%); }

.nav-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #FFCD7A 0%, #FFB033 100%);
  transform: scale(1.05);
}

.nav-btn.prev-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #FFCD7A 0%, #FFB033 100%);
}

.nav-btn:active:not(:disabled) { transform: scale(0.95); }

.nav-btn:disabled,
.nav-btn.disabled {
  background: linear-gradient(to bottom, #d6d6d6 0%, #c9c9c9 100%) !important;
  color: #666 !important;
  cursor: not-allowed !important;
  transform: none !important;
  opacity: 0.6 !important;
}

.nav-btn.glow {
  animation: navPulse 1.6s infinite;
  box-shadow: 0 0 14px rgba(241, 196, 15, 0.6);
}

.nav-btn.applet-button--clickNext {
  background: linear-gradient(to bottom, #FFC36A 0%, #F5A623 100%) !important;
  border: 3px solid rgba(255, 255, 255, 0.85);
  position: relative;
  overflow: visible;
}

.nav-btn.applet-button--clickNext::before {
  width: 80px;
  height: 80px;
  right: -22px;
  bottom: -32px;
  opacity: 1;
}

@keyframes navPulse {
  0%   { box-shadow: 0 0 14px rgba(241, 196, 15, 0.6); }
  50%  { box-shadow: 0 0 26px rgba(241, 196, 15, 0.95); }
  100% { box-shadow: 0 0 14px rgba(241, 196, 15, 0.6); }
}

/* ===== INTERACTIVE TEXT ===== */
.interactive-text {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ===== ACTION BUTTON ===== */
.action-button { transition: transform 0.2s ease; }
.action-button:active { transform: scale(0.95); }

/* ===== CONFETTI ===== */
.confetti-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confettiFall 3.5s linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(1200px) rotate(720deg); opacity: 0.6; }
}

/* ===== FEEDBACK BANNER ===== */
.feedback-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 16px;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.feedback-banner--correct { background: rgba(33, 145, 80, 0.85); border: 2px solid var(--color-correct-light); }
.feedback-banner--wrong { background: rgba(255, 111, 97, 0.85); border: 2px solid #ffb6b0; }

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== APPLET 2 — EQUIVALENT FRACTIONS ===== */

/* Color palette */
.color-palette {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
}

.color-swatch {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch--selected {
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.6), 0 4px 12px rgba(0,0,0,0.3);
  transform: scale(1.1);
}

/* Two-bar layout */
.two-bars-row {
  display: flex;
  gap: calc(32px * var(--scaleFactor));
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  flex: 1;
}
.bar-slot {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.bar-slot--interactive { cursor: pointer; }
.bar-slot--chosen .chocolate-bar { filter: drop-shadow(0 0 calc(8px * var(--scaleFactor)) rgba(255,159,26,0.7)); }

/* Guide SVG rendered inside .chocolate-bar (position:relative, 460×460) — perfectly overlays bar */
.split-guide-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 10;
}
.split-wrap { position: relative; }

/* Single bar centred */
.single-bar-center {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Comparison row (S15) */
.comparison-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex: 1;
  width: 100%;
}
.symbol-strip-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sym-btn {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  border: 3px solid rgba(255,255,255,0.6);
  background: linear-gradient(145deg, #ffb84d 0%, #FF9F1A 35%, #e68a00 65%, #b36b00 100%);
  color: var(--color-white-base);
  font-size: 52px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: inset 0 3px 6px rgba(255,255,255,0.3), inset 0 -3px 8px rgba(0,0,0,0.25), 0 6px 16px rgba(0,0,0,0.4);
  font-family: var(--font-family-primary);
  user-select: none;
}
.sym-btn:hover { transform: translateY(-3px); }
.sym-btn--correct {
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 35%, #16a34a 65%, #15803d 100%);
  border-color: rgba(255,255,255,0.85);
  animation: correctGlow 1.6s ease-in-out infinite;
}
.sym-btn--wrong {
  background: linear-gradient(145deg, #fca5a5 0%, #f87171 35%, #ef4444 65%, #dc2626 100%);
  animation: teeter 0.45s ease-in-out 0s 3, wrongGlow 0.9s ease-in-out 0.8s infinite;
}
.sym-btn--teeter { animation: symTeeter 0.35s ease-in-out; }
@keyframes symTeeter {
  0%,100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

/* Equality badge */
.eq-badge {
  display: inline-block;
  margin: 16px auto 0;
  padding: 10px 32px;
  background: rgba(33,145,80,0.2);
  border: 3px solid var(--color-correct-base);
  border-radius: 14px;
  font-size: 40px;
  font-weight: bold;
  color: #58D98B;
  text-align: center;
}
.eq-badge--result { font-size: 48px; margin-top: 24px; }

/* Ex2 single-bar: fraction chip row  1/3  =  2/6 */
.ex2-frac-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.ex2-sym-chip {
  width: 72px;
  height: 72px;
  background: #5D4B10;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 900;
  color: #ffffff;
}

.ex2-sym-chip--qmark {
  background: #7a6020;
}

.fraction-floating--dim {
  opacity: 0.5;
  filter: saturate(0.3) brightness(0.7);
}

/* Fraction chips inside ex2-frac-row: white background, dark text */
.ex2-frac-row .fraction-floating {
  background: #ffffff;
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.15);
}

.ex2-frac-row .fraction-floating .frac-num {
  border-bottom-color: #1a1a2e;
}

/* S28 layout: frac row + Yes/No side by side */
/* ex2-ctrl-zone: Yes/No buttons stay in a row */
.ex2-ctrl-zone .option-row {
  flex-direction: row;
  gap: 28px;
}

.eq-badge--inline {
  margin: 0 16px;
  padding: 8px 20px;
  font-size: 44px;
  align-self: center;
}

/* S16 shaded-region slide: allow animated segment to travel past bar bounds */
.bars-stack--slide-overflow {
  overflow: visible;
}
.bars-stack--slide-overflow .bar-with-label,
.bars-stack--slide-overflow .bar-chocolate-area,
.bars-stack--slide-overflow .bar-svg-zone,
.bars-stack--slide-overflow .chocolate-bar {
  overflow: visible;
}

/* Segment slide animation: moves one segment to target, holds briefly, returns */
@keyframes seg-slide-and-return {
  0%   { transform: translate(0, 0); }
  35%  { transform: translate(var(--seg-slide-dx), var(--seg-slide-dy)); }
  65%  { transform: translate(var(--seg-slide-dx), var(--seg-slide-dy)); }
  100% { transform: translate(0, 0); }
}

.chocolate-segment-body--slide {
  animation: seg-slide-and-return var(--seg-slide-duration, 4.8s) ease-in-out forwards;
}

/* SVG <g> elements need will-change for smooth GPU compositing */
.bars-stack--slide-overflow .chocolate-segment-body--slide {
  will-change: transform;
}

/* Summary pairs (S31) — 50/50 split, each pair fills its half */
.summary-pairs {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* Each pair: 3-column flex row — left col / = / right col
   Each col is itself a flex column split 80% bar / 20% chip */
.summary-pair {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  padding: 8px 60px;
  box-sizing: border-box;
  gap: 0;
}

/* Each bar column: flex column, bar top 80%, chip bottom 20% */
.sum-bar-col {
  flex: 1;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sum-bar-top {
  flex: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.sum-bar-bot {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* = symbol column: flex column mirroring bar-col structure,
   = lives in the top 80% zone, bottom 20% is empty spacer */
.sum-eq-sym {
  flex-shrink: 0;
  width: 72px;
  display: flex;
  flex-direction: column;
}

.sum-eq-sym::before {
  content: '=';
  flex: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  font-weight: 900;
  color: #58D98B;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.4);
  line-height: 1;
}

.sum-eq-sym::after {
  content: '';
  flex: 2;
}

/* Bar fills sum-bar-top */
.sum-bar-top .bar-with-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.sum-bar-top .bar-labels-row,
.sum-bar-top .bar-fraction-area {
  display: none;
}

.sum-bar-top .bar-chocolate-area {
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sum-bar-top .bar-svg-zone {
  justify-content: center;
}

/* Bar dimensions */
.sum-bar-top .chocolate-bar--small {
  width: 240px;
  height: 200px;
}

.sum-bar-top .chocolate-bar-svg {
  width: 240px;
  height: 200px;
}

/* Fraction chip size — smaller */
.sum-bar-bot .fraction-floating {
  font-size: 40px;
  padding: 4px 16px;
}

/* Hint text */
.hint-text {
  text-align: center;
  font-size: 30px;
  color: rgba(255,255,255,0.8);
  margin-top: 12px;
  font-weight: 600;
  min-height: 36px;
}

/* Options row */
.options-row {
  display: flex;
  gap: 28px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 0;
}

/* Color option buttons (S5) */
.color-option-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 5px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.color-option-btn:hover { transform: scale(1.08); }
.color-option-btn--chosen {
  border-color: #ffffff;
  border-width: 6px;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.4), 0 8px 24px rgba(0,0,0,0.4);
  transform: scale(1.12);
}
.color-option-btn--disabled {
  opacity: 0.4;
  filter: grayscale(0.5);
  cursor: default;
  pointer-events: none;
}
/* Selected colour stays fully vivid even when disabled */
.color-option-btn--disabled.color-option-btn--chosen {
  opacity: 1;
  filter: none;
}
/* Pulse glow on colour swatches before selection */
@keyframes swatchPulse {
  0%   { box-shadow: 0 0 0 0px rgba(255,255,255,0.7), 0 6px 20px rgba(0,0,0,0.35); transform: scale(1); }
  50%  { box-shadow: 0 0 0 10px rgba(255,255,255,0.0), 0 8px 28px rgba(0,0,0,0.45); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0px rgba(255,255,255,0.7), 0 6px 20px rgba(0,0,0,0.35); transform: scale(1); }
}
.color-option-btn--pulse {
  animation: swatchPulse 1.1s ease-in-out infinite;
}
.color-option-btn--pulse:nth-child(2) { animation-delay: 0.18s; }
.color-option-btn--pulse:nth-child(3) { animation-delay: 0.36s; }

/* ===== S1 START SCREEN — custom 25/75 split layout ===== */
.s1-screen {
  width: 1920px;
  height: 1080px;
  display: grid;
  grid-template-rows: 15% 70% 15%;
  grid-template-columns: 1fr;
  background: #0b4f7a;
  position: relative;
}

.s1-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 57, 92, 0.62);
  border: 1px solid var(--color-panel-border);
  z-index: 0;
  pointer-events: none;
}

/* Top bar — title strip */
.s1-topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-bottom: none;
  position: relative;
  z-index: 1;
}

.s1-topbar-title {
  color: var(--color-orange-text);
  font-size: 72px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: var(--font-family-primary);
}

/* S33 end screen — smaller white title */
.s33-screen .s1-topbar-title {
  color: #ffffff;
  font-size: 52px;
}

/* Body — left 25% character, right 75% content */
.s1-body {
  grid-row: 2;
  display: grid;
  grid-template-columns: 25% 75%;
  align-items: center;
  padding: 0 60px 0 40px;
  gap: 40px;
  position: relative;
  z-index: 1;
}

.s1-left {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
}

.s1-character {
  height: 85%;
  max-height: 780px;
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
  pointer-events: none;
}

.s1-right {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Content card — rounded border box */
.s1-card {
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(255,255,255,0.35);
  border-radius: 28px;
  padding: 56px 72px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 1100px;
  width: 100%;
}

.s1-card-line {
  font-size: 52px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.45;
  text-align: center;
  margin: 0;
  font-family: var(--font-family-primary);
}

/* Yellow highlights on strong tags inside card */
.s1-card-line strong {
  color: var(--color-orange-text);
  font-weight: 800;
}

.s1-card-line--explore {
  font-size: 54px;
  font-weight: 700;
  color: #ffffff;
}

/* S22 only — make fractions yellow-orange for visibility */
.s22-screen .fraction-floating {
  background: #E07B00;
}
.s22-screen .frac-inline {
  color: #E07B00;
}

/* Footer — Let's Start button */
.s1-footer {
  grid-row: 3;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  position: relative;
  z-index: 1;
}

/* S33 right column: card + try-again below */
.s33-right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  height: 100%;
  width: 100%;
}

.s33-try-again {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.s33-try-label {
  font-size: 44px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin: 0;
  font-family: var(--font-family-primary);
}

/* Title-card fraction chip rows (S32) */
.tcard-frac-rows {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  margin-top: 8px;
}

.tcard-frac-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.tcard-eq {
  font-size: 64px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

/* ===== S18: three-bar grand summary ===== */
.s18-screen {
  flex-direction: column;
}

/* ── Top 70%: flex row of bar-with-label blocks + = symbols ── */
/* zone is 756px tall (70% of 1080). bar area = 80% = 605px, fraction row = 20% = 151px */
.s18-bars-zone {
  height: 70%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  background: #1d5f8f;
  padding: 0 60px;
  box-sizing: border-box;
  gap: 0;
}

/* Each bar-with-label: flex column, bar area top 80%, fraction area bottom 20% */
.s18-bars-zone > .bar-with-label {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  max-width: 420px;
}

.s18-bars-zone > .bar-with-label > .bar-chocolate-area {
  height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 0;
  flex-shrink: 0;
}

.s18-bars-zone > .bar-with-label > .bar-fraction-area {
  height: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* hide segment numbers on S18 */
.s18-bars-zone .bar-labels-row {
  display: none;
}

/* bar SVG fills the chocolate area */
.s18-bars-zone .bar-svg-zone {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
}

.s18-bars-zone .chocolate-bar--small {
  width: 420px;
  height: 420px;
}

/* = symbol: align with bar body (top 80% zone), centred vertically */
.s18-eq-symbol {
  height: 80%;
  flex-shrink: 0;
  font-size: 80px;
  font-weight: 900;
  color: #58D98B;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

/* ── Bottom 30%: left 30% character, right 70% dialogue + next button ── */
.s18-bottom-zone {
  height: 30%;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: #0b4f7a;
  border-top: 2px solid rgba(255,255,255,0.12);
  box-sizing: border-box;
}

.s18-bottom-left {
  width: 30%;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px;
}

.s18-character {
  height: 90%;
  width: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.s18-bottom-right {
  width: 70%;
  display: flex;
  flex-direction: column;
  padding: 16px 32px 16px 12px;
  box-sizing: border-box;
  gap: 0;
}

/* top 60% of right side = dialogue */
.s18-dialogue {
  flex: 6;
  background: #0b4f7a;
  border: 4px solid var(--color-active);
  border-radius: 16px;
  padding: 16px 28px;
  font-size: 38px;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.s18-dialogue strong {
  color: #ffffff;
  font-weight: 900;
}

.s18-dialogue .w-blue {
  color: #ffffff;
  font-weight: 800;
}

/* bottom 40% of right side = next button centred */
.s18-next-zone {
  flex: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* S30: definition box below the fraction chip row */
.ex2-def-box {
  background: rgba(255, 100, 180, 0.18);
  border: 2px solid rgba(255, 100, 180, 0.55);
  border-radius: 12px;
  padding: 14px 22px;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.4;
  margin-top: 8px;
}

/* Pulsating split-guide lines (untapped dotted lines) */
@keyframes splitGuidePulse {
  0%, 100% { opacity: 0.55; stroke-width: 3; }
  50%       { opacity: 1; stroke-width: 6; filter: drop-shadow(0 0 10px rgba(255,255,255,1)); }
}
.split-guide-svg .split-guide-dotted {
  animation: splitGuidePulse 1s ease-in-out infinite;
}

/* S28/S29 wrong: block Yes/No while group pulse plays */
.ex2-ctrl-zone--blocked { pointer-events: none; opacity: 0.6; }

