.indices-game {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.game-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display, "Fraunces", serif);
  font-size: 1.35rem;
}

.game-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 36rem;
  line-height: 1.5;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
}

.game-hud strong {
  font-weight: 700;
  color: var(--ink);
}

.game-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-preset-pill {
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.game-preset-pill:hover {
  border-color: #2d6a4f;
}

.game-preset-pill.is-active {
  background: #edf7f1;
  border-color: #2d6a4f;
  color: #1b4332;
}

.game-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0b1c2e;
  max-width: 900px;
}

.game-question {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0.65rem 1rem;
  background: rgba(11, 28, 46, 0.88);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.4;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-toast {
  position: absolute;
  top: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: rgba(155, 35, 53, 0.92);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.game-toast.is-visible {
  opacity: 1;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.game-touch {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  background: rgba(11, 28, 46, 0.95);
}

.game-touch button {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  min-width: 3rem;
}

.game-touch #btn-fire {
  min-width: 5.5rem;
  background: rgba(45, 106, 79, 0.55);
  border-color: rgba(61, 214, 140, 0.45);
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 28, 46, 0.72);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.game-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.game-overlay .overlay-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  max-width: 22rem;
  text-align: center;
  border: 1px solid var(--line);
}

.game-overlay .overlay-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display, "Fraunces", serif);
}

.game-overlay .overlay-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.overlay-weakest {
  margin: -0.35rem 0 1rem !important;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: #fdf6ec;
  border: 1px solid #e9c46a;
  color: #7c4a03 !important;
  font-weight: 600;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.overlay-review {
  background: #edf7f1;
  border-color: #2d6a4f;
  color: #1b4332;
}

@media (min-width: 768px) {
  .game-touch {
    display: none;
  }
}

@media (max-width: 640px) {
  .game-hud {
    width: 100%;
  }

  .game-wrap {
    max-width: none;
    border-radius: 0;
    margin: 0 -1rem;
    border-left: none;
    border-right: none;
  }
}

/* Scientific notation interactive tool */
.sci-tool {
  margin-top: 0.5rem;
}

.sci-module-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.sci-module-pill {
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sci-module-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sci-walkthrough {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem 1.1rem;
  box-shadow: var(--shadow);
}

.sci-walkthrough-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.25rem;
}

.sci-prompt {
  margin: 0 0 1rem;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
}

.sci-progress {
  margin-bottom: 1rem;
}

.sci-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.sci-ref {
  text-align: right;
}

.sci-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}

.sci-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3d7ea6, #5ba4c9);
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.sci-step-stage {
  min-height: 9.5rem;
  position: relative;
}

.sci-step-panel {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.sci-step-panel.is-exiting {
  opacity: 0;
  transform: translateY(-12px);
}

.sci-step-panel.is-entering {
  opacity: 0;
  transform: translateY(16px);
}

.sci-step-kicker {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.sci-step-body {
  margin: 0 0 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.sci-step-math {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #f3f7fb;
  border: 1px solid rgba(61, 126, 166, 0.15);
  font-family: "DM Sans", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--ink);
}

.sci-answer-banner {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid rgba(61, 214, 140, 0.35);
  font-size: 0.95rem;
}

.sci-answer-banner strong {
  font-size: 1.1rem;
}

.sci-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.15rem;
}

.sci-nav-btn {
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

.sci-nav-btn.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sci-nav-btn.is-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

/* Factor tool ??aligned math visualizations */
.sci-step-math--mono {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  white-space: pre-wrap;
  tab-size: 4;
}

.math-viz {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #f3f7fb;
  border: 1px solid rgba(61, 126, 166, 0.15);
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  overflow-x: auto;
}

.math-viz--annotate {
  display: inline-block;
  min-width: min(100%, 16rem);
}

.math-annotate-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  column-gap: 1.5rem;
  align-items: end;
  text-align: center;
}

.math-annotate-row + .math-annotate-row {
  margin-top: 0.2rem;
}

.math-cell--mid {
  min-width: 3.75rem;
  color: var(--muted);
}

.math-expr-term {
  display: inline-block;
  padding: 0.1rem 0.15rem;
}

.math-pointer {
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
}

.math-note {
  color: #b45309;
}

.math-cross-caption {
  margin: 0 0 0.65rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.math-cross-grid2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.math-cross-grid2-table {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.55rem;
  width: min(100%, 15rem);
  aspect-ratio: 1.15;
}

.math-cross-grid2-cell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.35rem 0.5rem;
  text-align: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(61, 126, 166, 0.18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.math-cross-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.math-cross-diag {
  stroke-width: 2.5;
  stroke-linecap: round;
}

.math-cross-diag--tl-br {
  stroke: #3d7ea6;
  stroke-dasharray: none;
}

.math-cross-diag--bl-tr {
  stroke: #b45309;
  stroke-dasharray: 6 4;
}

.math-cross-diag-label {
  position: absolute;
  z-index: 2;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

.math-cross-diag-label--tl-br {
  left: 50%;
  top: 50%;
  transform: translate(-15%, -115%);
  color: #2a6282;
  background: rgba(61, 126, 166, 0.12);
}

.math-cross-diag-label--bl-tr {
  left: 50%;
  top: 50%;
  transform: translate(-85%, 15%);
  color: #92400e;
  background: rgba(180, 83, 9, 0.1);
}

.math-cross-row-labels {
  width: min(100%, 15rem);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.math-cross-row-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.math-cross-row-tag {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  min-width: 3.25rem;
}

.math-sum-row--diag-a span:first-child {
  color: #2a6282;
}

.math-sum-row--diag-b span:first-child {
  color: #92400e;
}

.math-sum-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
}

.math-sum-row + .math-sum-row {
  margin-top: 0.35rem;
}

.math-sum-eq {
  text-align: center;
  color: var(--muted);
}

.math-sum-divider {
  height: 1px;
  margin: 0.55rem 0;
  background: rgba(61, 126, 166, 0.25);
}

.math-sum-row--total span:last-child {
  color: #0a7a4b;
}

.math-sum-row--extra {
  grid-template-columns: 1fr;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.math-bracket-row + .math-bracket-row {
  margin-top: 0.35rem;
}

.math-bracket-label {
  color: var(--muted);
  font-weight: 500;
}

.math-bracket-result {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(61, 126, 166, 0.25);
  font-size: 1.08rem;
  color: #0a7a4b;
}

.math-viz--lines .math-line + .math-line {
  margin-top: 0.35rem;
}

.math-viz--line {
  text-align: center;
}

/* ?”â€?JM26 Boundary Runner ?”â€?*/
.runner-game .runner-map {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.runner-world {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.runner-world-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display, "Fraunces", serif);
  font-size: 1.05rem;
}

.runner-level-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.runner-level-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.runner-level-btn:hover:not(.is-locked) {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.runner-level-btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.runner-level-btn-boss {
  border-color: #9b2335;
  background: #fdf2f4;
}

.runner-level-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.runner-level-stars {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: #7c3aed;
}

.runner-world-boss .runner-level-stars {
  color: #9b2335;
}

.solve-panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow-y: auto;
  background: rgba(11, 28, 46, 0.94);
  color: #fff;
}

.solve-panel-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
}

.solve-phase-label {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.solve-question {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
}

.solve-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
}

.runner-solve-options {
  margin-bottom: 0.75rem;
}

.runner-solve-options .quiz-option {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.runner-solve-options .quiz-option:hover:not(:disabled) {
  background: rgba(124, 58, 237, 0.2);
  border-color: #a78bfa;
}

.runner-solve-options .quiz-letter {
  background: rgba(124, 58, 237, 0.35);
  color: #e9d5ff;
}

.solve-feedback {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.solve-feedback.is-correct {
  color: #86efac;
}

.solve-feedback.is-wrong {
  color: #fca5a5;
}

.runner-back-map {
  margin-top: 0.5rem;
}

.runner-game #btn-jump {
  min-width: 5rem;
}

.runner-next-level {
  background: #edf7f1;
  border-color: #2d6a4f;
  color: #1b4332;
  font-weight: 700;
}

.runner-next-level:hover {
  background: #d8f3dc;
}

@media (max-width: 640px) {
  .runner-level-btn {
    min-width: calc(50% - 0.4rem);
    flex: 1 1 calc(50% - 0.4rem);
  }
}

