/*
 * Matematik Atölyesi — Interface refresh
 * A calm, readable layer that sits above the original component styles.
 * The game engines keep their own mechanics; this file unifies their shell.
 */

:root {
  --navy: #17213d;
  --navy-2: #263354;
  --navy-3: #3b496a;
  --cream: #f5f7fb;
  --paper: #ffffff;
  --white: #ffffff;
  --ink-soft: #59647d;
  --line: #dfe4ee;
  --coral: #f5665b;
  --coral-dark: #c94740;
  --yellow: #f7c948;
  --yellow-soft: #fff4c7;
  --teal: #20ad99;
  --teal-dark: #087a6d;
  --blue: #4d77df;
  --blue-dark: #3154ad;
  --green: #16845a;
  --red: #c83d4d;
  --primary: #5654c7;
  --primary-dark: #3d3aa1;
  --primary-soft: #eeefff;
  --surface-soft: #f8f9fc;
  --shadow-sm: 0 2px 8px rgba(23, 33, 61, .08);
  --shadow-md: 0 12px 30px rgba(23, 33, 61, .10);
  --shadow-lg: 0 24px 60px rgba(23, 33, 61, .16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --header-height: 78px;
  --content-max: 1320px;
  --touch: 52px;
  --font-sans: Inter, Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-display: Inter, Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

html { background: var(--cream); }

body {
  color: var(--navy);
  background:
    radial-gradient(circle at 8% 2%, rgba(86, 84, 199, .08), transparent 24rem),
    radial-gradient(circle at 95% 18%, rgba(32, 173, 153, .07), transparent 27rem),
    var(--cream);
  background-attachment: fixed;
  background-image:
    radial-gradient(circle at 8% 2%, rgba(86, 84, 199, .08), transparent 24rem),
    radial-gradient(circle at 95% 18%, rgba(32, 173, 153, .07), transparent 27rem);
  font-size: 17px;
  line-height: 1.55;
}

h1, h2, h3, strong { text-wrap: balance; }

:focus-visible {
  outline: 4px solid #886cff;
  outline-offset: 3px;
}

.skip-link {
  color: #fff;
  background: var(--primary-dark);
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.view { animation-duration: .22s; }

/* Header */

.topbar {
  grid-template-columns: auto minmax(190px, 1fr) auto auto;
  min-height: var(--header-height);
  padding: 9px clamp(18px, 2.5vw, 36px);
  gap: 20px;
  color: var(--navy);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(23, 33, 61, .06);
  backdrop-filter: blur(14px);
}

.brand { min-height: 56px; gap: 11px; }

.brand__mark {
  width: 50px;
  height: 50px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 15px;
  box-shadow: none;
  transform: none;
}

.brand__pi { font-size: 31px; }
.brand__spark { display: none; }

.brand__copy { line-height: 1.05; }
.brand__copy strong { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand__copy span {
  margin-top: 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: none;
}

.primary-nav { display:flex; justify-content:center; gap:6px; }
.primary-nav button { min-height:48px; padding:10px 22px; border:1px solid transparent; border-radius:12px; background:transparent; color:var(--navy); font:inherit; font-weight:750; }
.primary-nav [aria-current=page] { color:var(--primary-dark); background:var(--primary-soft); border-color:var(--primary); }
.grade-context { display:flex; align-items:center; gap:8px; font-size:14px; }
.grade-context select { min-height:48px; padding:8px; border:1px solid var(--line); border-radius:10px; background:white; color:var(--navy); font:inherit; }

.topbar__actions { gap: 5px; }

.icon-button {
  grid-template-rows: 22px auto;
  min-width: 56px;
  min-height: 54px;
  padding: 6px 7px 4px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 12px;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.icon-button[aria-pressed="false"] { color: var(--ink-soft); background: #eef1f6; border-color: transparent; }
.icon-button__label { font-size: 11px; font-weight: 650; }

/* Shared controls */

.button {
  min-height: var(--touch);
  padding: 11px 20px;
  gap: 9px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: none;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.button:hover { border-color: #c8cde0; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.button:active { box-shadow: none; transform: translateY(0); }
.button--large { min-height: 56px; padding: 13px 22px; font-size: 16px; }
.button--primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.button--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 8px 18px rgba(86, 84, 199, .24); }
.button--paper { background: #fff; }
.button--navy { color: #fff; background: var(--navy); border-color: var(--navy); box-shadow: none; }
.button--navy:hover { background: var(--navy-2); box-shadow: var(--shadow-sm); }
.button--ghost { color: var(--ink-soft); background: transparent; border-color: transparent; }
.button--ghost:hover { color: var(--navy); background: #eef1f6; box-shadow: none; transform: none; }
.button__arrow { font-size: 20px; }

.text-button {
  min-height: 48px;
  padding: 10px 14px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 0;
  border-radius: 12px;
  font-weight: 750;
}

.text-button:hover { background: #e2e3ff; }

.section-kicker,
.eyebrow {
  margin-bottom: 9px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .01em;
  text-transform: none;
}

.section-heading h2 {
  color: var(--navy);
  font-size: clamp(30px, 3vw, 43px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.035em;
}

.section-heading--center { margin-bottom: 30px; }
.section-heading--row { margin-bottom: 24px; }

.site-footer {
  min-height: 76px;
  padding: 18px clamp(22px, 4vw, 64px);
  color: var(--ink-soft);
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.site-footer span { color: var(--primary); }

/* Catalogue */

.view--catalog {
  max-width: var(--content-max);
  padding: 24px 24px 84px;
}

.catalog-hero { display:flex; justify-content:space-between; align-items:center; gap:16px; min-height:0; margin:0 0 16px; padding:0; color:var(--navy); background:none; border:0; border-radius:0; box-shadow:none; }
.catalog-hero::before { content:none; }
.catalog-hero h1 { margin:0 0 8px; font-size:32px; line-height:1.2; letter-spacing:-.025em; }
.catalog-hero #catalogDescription { color:var(--ink-soft); font-size:16px; line-height:1.5; }
.curriculum-source { flex-shrink:0; min-height:44px; padding:10px; color:var(--primary-dark); font-size:13px; }

.catalog-toolbar {
  grid-template-columns: minmax(300px, 1fr) auto;
  margin: 15px 0 12px;
  padding: 10px;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.search-field {
  min-height: 58px;
  background: var(--surface-soft);
  border: 1px solid #e1e5ee;
  border-radius: 13px;
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86,84,199,.15); }
.search-field__icon { width: 20px; height: 20px; margin-left: 16px; border-width: 2px; }
.search-field__icon::after { height: 2px; }
.search-field input { height: 56px; font-size: 16px; font-weight: 550; }
.search-field input::placeholder { color: #7a8499; }

.filter-controls { gap: 8px; }
.select-field {
  min-width: 185px;
  min-height: 58px;
  padding: 7px 38px 7px 13px;
  background: var(--surface-soft);
  border: 1px solid #e1e5ee;
  border-radius: 13px;
}
.select-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86,84,199,.15); }
.select-field span { color: var(--ink-soft); font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.select-field select { min-height: 28px; font-size: 14px; font-weight: 700; }

.filter-reset {
  min-height: 58px;
  padding: 10px 15px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #d8daf4;
  border-radius: 13px;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
}
.filter-reset:hover { background: #e1e2ff; }

.topic-chips {
  margin: 0 0 8px;
  padding: 6px 2px 10px;
  gap: 7px;
  border: 0;
  scrollbar-color: #c8cedd transparent;
}

.topic-chip,
.filter-chip {
  min-height: 43px;
  padding: 8px 15px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}
.topic-chip:hover,
.topic-chip.is-active,
.topic-chip[aria-pressed="true"],
.filter-chip.is-active,
.filter-chip[aria-pressed="true"] {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
  transform: none;
}

.catalog-meta { min-height: 50px; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.catalog-meta p { color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.view-option {
  width: 43px;
  height: 43px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 11px;
}
.view-option.is-active { color: var(--primary); background: var(--primary-soft); border-color: #d8daf3; box-shadow: none; }

.topic-groups { gap: 54px; }
.topic-group { scroll-margin-top: 95px; }
.topic-group__header {
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 18px;
  padding-bottom: 14px;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.topic-group__icon {
  width: 52px;
  height: 52px;
  color: var(--navy);
  background: var(--primary-soft);
  border: 0;
  border-radius: 14px;
  box-shadow: none;
  font-size: 22px;
  transform: none;
}
.topic-group--coral .topic-group__icon { background: #fff0ee; }
.topic-group--teal .topic-group__icon { background: #e6f8f4; }
.topic-group--blue .topic-group__icon { background: #edf2ff; }
.topic-group__header h2 { margin-bottom: 2px; font-size: clamp(24px, 2.4vw, 32px); font-weight: 800; letter-spacing: -.025em; }
.topic-group__header p { color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.topic-group__count {
  min-height: 34px;
  padding: 6px 11px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.game-card {
  min-width: 0;
  min-height: 240px;
  display:flex; flex-direction:column; justify-content:space-between;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  transform: none;
}
.game-card:hover { border-color: #ccd2df; box-shadow: var(--shadow-md); transform: translateY(-3px); }
.game-card__art {
  min-height: 72px; height: 72px; padding: 14px 18px;
  display: flex; align-items: center; justify-content: flex-start;
  background: color-mix(in srgb, var(--card-accent) 12%, var(--paper));
  border-bottom: 1px solid var(--line);
}
.game-card__art::before, .game-card__art::after { display: none; }
.game-card:focus-within { outline-color: var(--primary); }
.game-card.is-played::after {
  top: 13px;
  left: 13px;
  width: auto;
  padding: 5px 8px;
  color: var(--teal-dark);
  background: #e3f8f2;
  border: 1px solid #b8e7dc;
  border-radius: 8px;
  font-size: 10px;
  letter-spacing: .02em;
  transform: none;
}

.game-card__body { padding:18px; }
.game-card__meta { display:block; min-height:20px; margin-bottom:8px; color:var(--ink-soft); font-size:12px; font-weight:600; }
.game-card__meta > span {
  min-height: 24px;
  padding: 4px 8px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.game-card__meta > span:first-child { color: var(--navy); background: color-mix(in srgb, var(--card-accent) 18%, white); border-color: transparent; }
.game-card__title { margin-bottom: 4px; font-size: clamp(20px, 1.7vw, 24px); font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.game-card__topic {
  margin: 0 0 11px;
  overflow: visible;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: clip;
  white-space: normal;
}
.game-card__mechanic {
  min-height: 58px;
  margin: 0 0 10px;
  padding: 8px 10px;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}
.game-card__mechanic > b {
  width: 35px;
  height: 35px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 0;
  border-radius: 10px;
  font-size: 16px;
}
.game-card__mechanic strong,
.game-card__mechanic small {
  overflow: visible;
  line-height: 1.3;
  text-overflow: clip;
  white-space: normal;
}
.game-card__mechanic strong { font-size: 13px; font-weight: 750; }
.game-card__mechanic small { color: var(--ink-soft); font-size: 12px; font-weight: 550; }
.game-card__description { margin-bottom: 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; -webkit-line-clamp: 2; }
.game-card__footer { padding-top: 12px; border-top: 1px solid var(--line); }
.game-card__play {
  min-height: 38px;
  padding: 7px 11px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 750;
}
.game-card__play b { font-size: 15px; }
.card-stars i { color: #c7ccda; -webkit-text-stroke: 0; }
.card-stars i.is-earned { color: var(--yellow); }

.topic-groups.is-compact .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.topic-groups.is-compact .game-card { min-height: 230px; }
.topic-groups.is-compact .game-card__button { grid-template-columns: 150px minmax(0, 1fr); }
.topic-groups.is-compact .game-card__art { min-height: 100%; border-right: 1px solid var(--line); border-bottom: 0; }
.game-card__glyph { font-size: 32px; line-height: 1; color: var(--navy); user-select: none; }
.game-card:hover .game-card__glyph { transform: scale(1.12); }
.game-card__meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.game-card__icon-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--surface-soft); border: 1px solid var(--line); font-size: 14px; font-weight: 800; color: var(--primary); }
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 99999; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; left: var(--x); width: var(--size); height: calc(var(--size) * 1.3); background: var(--color); border-radius: 2px; opacity: 0.9; animation: confettiFall 2.4s ease-out var(--delay) forwards; pointer-events: none; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; } 80% { opacity: 0.9; } 100% { transform: translateY(105vh) rotate(var(--rotation)) scale(0.6); opacity: 0; } }

.empty-state {
  padding: 50px 24px;
  background: #fff;
  border: 1px dashed #cbd1df;
  border-radius: 20px;
  box-shadow: none;
}
.empty-state__symbol { width: 72px; height: 72px; background: var(--primary-soft); border: 0; box-shadow: none; font-size: 34px; }
.empty-state h2 { font-size: 27px; font-weight: 800; }

/* Setup dialog */

.overlay { padding: 18px; }
.overlay__backdrop { background: rgba(15, 22, 43, .62); backdrop-filter: blur(10px); }

.modal {
  width: min(1020px, 100%);
  max-height: calc(100dvh - 36px);
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.modal__close {
  width: 48px;
  height: 48px;
  color: var(--ink-soft);
  background: rgba(255,255,255,.82);
  border: 1px solid #d8dce8;
  border-radius: 13px;
  font-size: 25px;
}
.modal__close:hover { color: var(--navy); background: #fff; border-color: #c9cfdd; transform: none; }
.setup-modal > .modal__close { top: 18px; right: 18px; }

.modal__header {
  padding: 30px 38px 24px;
  background: linear-gradient(125deg, var(--primary-soft), #edf9f6);
  background-image: linear-gradient(125deg, var(--primary-soft), #edf9f6);
  border-bottom: 1px solid #dfe2ee;
}
.modal__header h1 {
  margin-bottom: 7px;
  padding-right: 55px;
  font-size: clamp(29px, 3.5vw, 42px);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -.035em;
}
.modal__header p:last-child { color: var(--ink-soft); font-size: 15px; line-height: 1.5; }

.setup-modal { width:min(640px,100%); display:flex; flex-direction:column; overflow:hidden; }
.setup-modal .modal__header { padding:22px 24px 14px; background:var(--paper); flex-shrink:0; }
.setup-modal .modal__header h1 { font-size:28px; }
.setup-form { display:flex; flex-direction:column; min-height:0; padding:0; overflow:hidden; }
#setupContent { padding:16px 24px; overflow:auto; }
#setupError { margin:0; padding:0 24px; color:#a32332; }
.setup-summary { margin:0 0 14px; color:var(--ink-soft); font-size:14px; }
.setup-guidance { margin:12px 0 4px; padding:12px 14px; color:var(--navy-2); background:var(--surface-soft); border-radius:var(--radius-sm); font-size:14px; line-height:1.5; }
.setup-essentials,.setup-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.setup-essentials:empty { display:none; }
#participantFields { grid-column:1 / -1; }
.setup-form details { border-top:1px solid var(--line); margin-top:12px; }
.setup-form summary,.recent-activities summary,.exploration-collection > summary { cursor:pointer; min-height:48px; padding:12px 0; font-weight:650; }
.setup-form textarea { width:100%; resize:vertical; min-height:90px; padding:10px; border:1px solid var(--line); border-radius:10px; font:inherit; }
#setupTournament p { margin:12px 0 0; }
#setupTournament .bracket { gap:12px; }
#tournamentEntrants { margin-top:14px; }
.form-field { gap: 6px; font-weight: 700; }
.form-field > span { color: var(--ink-soft); font-size: 13px; letter-spacing: 0; }
.form-field input,
.form-field select {
  min-height: 52px;
  padding: 9px 13px;
  background: #fff;
  border: 1px solid #ccd2df;
  border-radius: 11px;
  font-weight: 600;
}
.form-field input:focus,
.form-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86,84,199,.14); }
.modal__actions { flex-shrink:0; margin:0; padding:14px 24px; gap:10px; border-top:1px solid var(--line); background:var(--paper); }

/* Full-screen game shell */

.game-overlay { padding: 0; }
.game-shell {
  color: var(--navy);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 5% 10%, rgba(86,84,199,.055), transparent 22rem),
    radial-gradient(circle at 95% 90%, rgba(32,173,153,.055), transparent 25rem);
}

.game-shell__header {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-height: 76px;
  padding: 8px clamp(14px, 2.2vw, 30px);
  gap: 16px;
  color: var(--navy);
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 15px rgba(23,33,61,.06);
}

.game-shell__identity { gap: 13px; }
.game-shell__identity h1 { margin-top: 3px; font-size: clamp(19px, 1.8vw, 25px); font-weight: 800; line-height: 1.1; }
.game-shell__meta { gap: 5px; }
.game-shell__meta .pill {
  min-height: 23px;
  padding: 4px 8px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}
.game-shell__meta .pill--grade { color: var(--navy); background: color-mix(in srgb, var(--accent) 20%, white); border-color: transparent; }

.game-close {
  min-width: 72px;
  min-height: 48px;
  padding: 8px 12px;
  color: var(--navy);
  background: #f1f3f8;
  border: 1px solid #dce0e9;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.game-close:hover { color: var(--primary-dark); background: var(--primary-soft); border-color: #d7d9f3; }
.game-close span:first-child { font-size: 19px; }

.game-shell__status { gap: 7px; }
.status-chip {
  min-height: 49px;
  padding: 6px 13px;
  color: var(--navy);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.status-chip small { color: var(--ink-soft); font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.status-chip strong { font-size: 18px; font-weight: 800; }
.status-chip--timer { min-width: 100px; }
.timer-ring { width: 20px; height: 20px; border-color: var(--teal); border-right-color: #d6dbe6; }

.game-shell__actions { gap: 6px; }
.round-button {
  width: 47px;
  height: 47px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 18px;
}
.round-button:hover { color: var(--primary); background: var(--primary-soft); border-color: #d7d9f3; }

.game-shell__body { grid-template-rows: auto minmax(0, 1fr); }
.game-scoreboard {
  padding: 8px 16px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.game-stage { padding: clamp(14px, 2vw, 28px); }
.game-loading { color: var(--ink-soft); font-weight: 650; }
.game-loading__shape {
  width: 78px;
  height: 78px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  font-size: 43px;
}

.game-shell__footer {
  min-height: 64px;
  padding: 8px clamp(16px, 2.5vw, 32px);
  gap: 16px;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
}
.game-instruction { color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.game-instruction::before {
  width: 25px;
  height: 25px;
  margin-right: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
}

.pause-curtain { background: rgba(18,25,49,.72); backdrop-filter: blur(10px); }
.pause-card {
  padding: 36px;
  background: #fff;
  border: 0;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}
.pause-card > span { width: 68px; height: 68px; background: var(--primary-soft); border: 0; box-shadow: none; color: var(--primary); }
.pause-card h2 { font-size: 28px; font-weight: 800; }

/* Scoreboards */

.game-scoreboard,
.scoreboard,
.score-board {
  min-height: 62px;
  gap: 9px;
}

.solo-score,
.class-score {
  width: min(700px, 100%);
  min-height: 46px;
  padding: 7px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}
.solo-score > strong,
.class-score > b { font-size: 21px; font-weight: 800; }
.solo-score > span { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.solo-score > span b { font-size: 15px; }

.score-team {
  min-width: 220px;
  padding: 7px 13px 7px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 12px;
  box-shadow: none;
}
.score-team--coral { border-left-color: var(--coral); }
.score-team > strong { font-size: 14px; font-weight: 750; }
.score-team > b { font-size: 25px; font-weight: 850; }
.score-team__turn { color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: 0; }
.score-team > small { color: var(--ink-soft); font-size: 12px; font-weight: 650; text-transform: none; }
.score-team.is-active { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.versus-chip { width: 36px; height: 36px; color: var(--primary); background: var(--primary-soft); border: 0; font-size: 10px; }
.tug-meter { font-size: 12px; font-weight: 700; letter-spacing: 0; }
.tug-meter > div { height: 11px; border: 1px solid #cbd1dc; }
.relay-label { margin-top: 1px; color: var(--ink-soft); font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }

.class-score__hearts i { color: #d7dae3; -webkit-text-stroke: 0; }
.class-score__hearts i.is-full { color: var(--coral); }
.class-energy {
  height: 28px;
  background: #e8ebf2;
  border: 1px solid #d3d8e3;
  border-radius: 999px;
}
.class-energy > i { border: 0; }
.class-energy > span { color: var(--navy); font-size: 12px; font-weight: 750; }
.boss-meter { min-height: 48px; background: #eef2ff; border: 1px solid #d7ddf1; border-radius: 12px; }
.boss-meter__track { background: #fff; border: 0; }

/* Shared game cards and legacy interactions */

.arena-card,
.question-card,
.challenge-card {
  padding: clamp(22px, 3vw, 40px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}
.question-card::before,
.arena-card::before,
.challenge-card::before { display: none; }

.question-card--signature,
.question-card--mission,
.question-card--arcade.question-card--mission {
  width: min(1360px, 100%);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.question-copy { max-width: 1020px; margin-bottom: clamp(16px, 2.4vw, 26px); }
.question-copy h2,
.question-prompt,
.prompt,
.challenge-prompt {
  color: var(--navy);
  font-size: clamp(27px, 3.5vw, 48px);
  font-weight: 820;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.question-copy > p:last-child:not(.question-kicker) { color: var(--ink-soft); font-size: clamp(15px, 1.4vw, 18px); font-weight: 550; }
.question-kicker { margin-bottom: 7px; color: var(--primary); font-size: 13px; font-weight: 750; letter-spacing: .02em; text-transform: none; }
.question-experience {
  min-height: 31px;
  margin-bottom: 10px;
  padding: 5px 10px;
  gap: 5px;
  color: var(--navy);
  background: var(--primary-soft);
  border: 1px solid #d7daf4;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.question-experience b { color: var(--primary); }
body .question-card--arcade:not(.question-card--signature) .question-experience {
  min-height: 29px;
  margin-bottom: 8px;
  padding: 5px 10px;
  font-size: 11px;
}
.turn-banner {
  min-height: 36px;
  margin: -4px auto 12px;
  padding: 6px 12px;
  background: var(--yellow-soft);
  border: 1px solid #edd887;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.answers-grid,
.answer-grid,
.choices-grid,
.options-grid { gap: 12px; }

.answer-option,
.answer-button,
.answer-btn,
.option-button,
.option-btn,
.choice-button {
  min-height: 72px;
  padding: 13px 17px;
  color: var(--navy);
  background: #fff;
  border: 2px solid #d8dce7;
  border-radius: 15px;
  box-shadow: none;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 700;
}
.answer-option:hover,
.answer-button:hover,
.answer-btn:hover,
.option-button:hover,
.option-btn:hover,
.choice-button:hover { border-color: var(--primary); background: var(--primary-soft); box-shadow: none; transform: translateY(-1px); }
.choice-button:active { box-shadow: none; transform: translateY(0); }
.choice-button.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86,84,199,.15); }

.answer-option.correct,
.answer-button.correct,
.choice-button.correct,
.is-correct-answer { color: #075e43; background: #e1f7ef; border-color: #49ad8a; }
.answer-option.wrong,
.answer-button.wrong,
.choice-button.wrong,
.is-wrong-answer { color: #8c2733; background: #ffebed; border-color: #db7180; }

.answer-input,
.numeric-input,
.numeric-answer input,
.answer-form input {
  min-height: 60px;
  color: var(--navy);
  background: #fff;
  border: 2px solid #ccd2df;
  border-radius: 14px;
  box-shadow: none;
  font-size: clamp(22px, 3vw, 34px);
}
.answer-input:focus,
.numeric-input:focus,
.numeric-answer input:focus,
.answer-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(86,84,199,.14); }

.feedback-banner,
.feedback {
  min-height: 58px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: none;
  font-size: 14px;
}
.feedback-banner.is-correct { background: #e1f7ef; border-color: #9cd9c3; }
.feedback-banner.is-wrong { background: #ffebed; border-color: #efb7be; }
.feedback-icon { border: 0; }

/* Results */

.results-card,
.result-screen {
  width: min(820px, 100%);
  padding: clamp(26px, 3.5vw, 44px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}
.results-card h2,
.result-screen h2 { font-size: clamp(30px, 4.5vw, 47px); font-weight: 850; letter-spacing: -.04em; }
.results-burst,
.result-icon,
.result-medal {
  width: clamp(78px, 10vw, 105px);
  margin-bottom: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 0;
  border-radius: 25px;
  box-shadow: none;
  font-size: clamp(36px, 5vw, 54px);
}
.result-stars { margin: 7px 0 15px; }
.result-stars span { color: #d7dae4; font-size: clamp(26px, 3.5vw, 38px); -webkit-text-stroke: 0; }
.result-stars span.is-earned { color: var(--yellow); }
.result-metrics { margin: 8px 0 14px; gap: 8px; }
.result-metrics > div,
.result-stat { padding: 12px 8px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.result-metrics strong { font-size: clamp(21px, 2.8vw, 29px); font-weight: 820; }
.result-metrics span,
.result-stat small { color: var(--ink-soft); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.result-note { padding: 13px 15px; background: var(--primary-soft); border: 1px solid #d9dbf4; border-radius: 13px; }
.result-note p { color: var(--ink-soft); font-size: 13px; }
.result-note strong { color: var(--navy); font-size: 14px; }
.final-score-row > div { background: var(--surface-soft); border-color: var(--line); }

/* Teacher controls */

.drawer-backdrop { background: rgba(15,22,43,.48); backdrop-filter: blur(8px); }
.teacher-drawer {
  width: min(470px, 96vw);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -22px 0 55px rgba(23,33,61,.18);
}
.teacher-drawer__header {
  min-height: 96px;
  padding: 18px 20px 17px 24px;
  color: var(--navy);
  background: linear-gradient(125deg, var(--primary-soft), #edf9f6);
  border-bottom: 1px solid var(--line);
}
.teacher-drawer__header p { color: var(--primary); }
.teacher-drawer__header h2 { font-size: 26px; font-weight: 820; }
.teacher-drawer__header .modal__close { color: var(--ink-soft); background: #fff; border-color: var(--line); }
.teacher-drawer__body { padding: 18px; background: var(--cream); }
.tool-section {
  padding: 19px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.tool-section + .tool-section { margin-top: 13px; }
.tool-section h3 { font-size: 18px; font-weight: 800; }
.tool-badge { padding: 5px 8px; color: var(--teal-dark); background: #e5f8f3; border: 0; font-size: 11px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.class-timer { color: #fff; background: var(--navy); border-radius: 13px; font-size: clamp(38px, 10vw, 52px); }
.timer-presets { gap: 6px; }
.timer-presets button {
  min-height: 43px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
.timer-presets button:hover,
.timer-presets button.is-active { color: var(--primary-dark); background: var(--primary-soft); border-color: #d7daf3; }
.custom-timer-control { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.custom-timer-control input { width: 90px; min-height: 42px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--navy); background: var(--paper); }
.custom-timer-control button { min-height: 42px; padding: 6px 16px; }
.tool-actions .button { min-height: 47px; font-size: 13px; box-shadow: none; }
.switch-row { min-height: 76px; border-top: 1px solid var(--line); }
.switch-row strong { font-size: 14px; font-weight: 750; }
.switch-row small { color: var(--ink-soft); font-size: 12px; }
.switch { border: 0; background: #cbd1dd; }
.switch::after { top: 4px; left: 4px; width: 21px; height: 21px; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(23,33,61,.2); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(22px); }
.quick-tools { gap: 8px; }
.quick-tools button {
  min-height: 68px;
  padding: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.quick-tools button:hover { background: var(--primary-soft); box-shadow: none; }
.quick-tools span { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.quick-tools strong { font-size: 12px; }
.teacher-drawer__footer { min-height: 68px; color: var(--navy); background: #fff; border-top: 1px solid var(--line); }
.teacher-drawer__footer strong { font-size: 13px; }
.teacher-drawer__footer small { color: var(--ink-soft); font-size: 11px; }
.offline-dot { background: var(--teal); border: 0; }

/* Notifications */

.toast-region { right: 18px; bottom: 18px; }
.toast {
  min-height: 64px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.toast--success { border-left: 5px solid var(--teal); }
.toast--error { border-left: 5px solid var(--coral); }
.toast--warning { border-left: 5px solid var(--yellow); }
.toast__content strong { font-size: 14px; }
.toast__content small { color: var(--ink-soft); font-size: 12px; }
.toast > span:first-child,
.toast__icon { color: var(--primary); background: var(--primary-soft); }

/* Accessibility modes */

body.large-text .game-card__meta > span,
body.large-text .game-shell__meta .pill,
body.large-text .status-chip small,
body.large-text .score-team__turn,
body.large-text .score-team > small { font-size: 13px; }

body.large-text .game-card__mechanic strong,
body.large-text .game-card__mechanic small,
body.large-text .game-card__topic { font-size: 14px; }

body.large-text .mw-arcade,
body.large-text .mw-mission,
body.large-text .sg-game { font-size: 20px; }

body.large-text .mw-arcade__button,
body.large-text .mw-arcade__status,
body.large-text .mw-pop__counter,
body.large-text .mw-token__zone-label,
body.large-text .mw-bars__slider-row label,
body.large-text .mw-bars__slider-row output { font-size: 19px; }

body.large-text .mw-line__tick span { font-size: 17px; }

body.large-text .mw-mission__button,
body.large-text .mw-probability__predict,
body.large-text .mw-probability__bar-label,
body.large-text .mw-probability__bar-value,
body.large-text .mw-probability__last,
body.large-text .mw-coordinate__mission-card,
body.large-text .mw-coordinate__legend,
body.large-text .mw-detective__case-file p,
body.large-text .mw-detective__clue,
body.large-text .mw-detective__number { font-size: 18px; }

body.large-text .mw-coordinate__cell { font-size: 16px; }

body.large-text .mw-mission__topline small,
body.large-text .mw-mission__status,
body.large-text .sg-game__eyebrow,
body.large-text .sg-game__mode,
body.large-text .sg-equation-label,
body.large-text .sg-rack-section h4,
body.large-text .sg-conveyor__label { font-size: 17px; }

body.large-text .sg-button,
body.large-text .sg-sort-card,
body.large-text .sg-progress-count { font-size: 18px; }

body.high-contrast {
  --navy: #071225;
  --ink-soft: #26334c;
  --line: #5c6678;
  --primary: #342ab4;
  --primary-dark: #211984;
  --primary-soft: #e7e5ff;
  --cream: #ffffff;
}

body.high-contrast .topbar,
body.high-contrast .game-shell__header,
body.high-contrast .game-shell__footer,
body.high-contrast .game-scoreboard,
body.high-contrast .site-footer,
body.high-contrast .teacher-drawer__footer { background: #fff; border-color: var(--navy); }

body.high-contrast .catalog-hero__badge { color: #000; background: #fff; border-color: #000; }

body.high-contrast .hero,
body.high-contrast .catalog-hero,
body.high-contrast .modal__header,
body.high-contrast .teacher-drawer__header,
body.high-contrast .curriculum-callout { background: #f0f0ff; border-color: var(--navy); }

body.high-contrast .game-card,
body.high-contrast .mode-card,
body.high-contrast .question-card,
body.high-contrast .arena-card,
body.high-contrast .challenge-card,
body.high-contrast .results-card,
body.high-contrast .tool-section { border: 2px solid var(--navy); }

body.high-contrast .question-card--signature,
body.high-contrast .question-card--mission,
body.high-contrast .question-card--arcade.question-card--mission { border: 0; box-shadow: none; }

body.high-contrast .sg-game {
  --sg-ink: #000;
  --sg-ink-2: #000;
  --sg-muted: #151515;
  --sg-canvas: #fff;
  --sg-paper: #fff;
  --sg-line: #000;
  --sg-line-dark: #000;
  --sg-blue: #173fa8;
  --sg-teal: #006b61;
  --sg-coral: #ad2434;
}

body.high-contrast .mw-mission {
  --mission-ink: #000;
  --mission-muted: #151515;
  --mission-canvas: #fff;
  --mission-card: #fff;
  --mission-line: #000;
  --mission-teal: #006b61;
  --mission-coral: #a92721;
  --mission-blue: #1745a4;
}

/* Responsive layout */

@media (max-width: 1180px) {
  .topbar { grid-template-columns: auto minmax(430px, 1fr) auto; gap: 12px; }
  .brand__copy { display: none; }
  .grade-tab { min-width: 69px; padding-right: 10px; padding-left: 10px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr); }
  .hero__copy { padding: 42px; }
  .hero__playground { padding-right: 32px; }
  .mode-cards { grid-template-columns: repeat(2, 1fr); }
  .mode-card { min-height: 155px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-toolbar { grid-template-columns: 1fr; }
  .filter-controls { display: grid; grid-template-columns: repeat(2, 1fr) auto; }
  .select-field { min-width: 0; }
}

@media (max-width: 900px) {
  :root { --header-height: 128px; }

  .topbar {
    grid-template-columns: 1fr auto;
    min-height: var(--header-height);
    padding: 8px 14px 9px;
    gap: 5px 10px;
  }
  .brand { grid-row: 1; grid-column: 1; }
  .brand__mark { width: 45px; height: 45px; border-radius: 13px; }
  .brand__pi { font-size: 28px; }
  .topbar__actions { grid-row:1; grid-column:2; }
  .primary-nav { grid-row:2; grid-column:1; justify-content:start; }
  .grade-context { grid-row:2; grid-column:2; justify-content:end; }
  .hero-wrap { padding: 18px 15px 0; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero__copy { padding: 36px 30px 25px; text-align: center; }
  .hero h1 { max-width: 700px; margin-right: auto; margin-left: auto; }
  .hero__description { margin-right: auto; margin-left: auto; }
  .hero__actions { justify-content: center; }
  .hero__playground { padding: 18px 26px 32px; }
  .hero-board { min-height: 300px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }

  .home-section { padding: 64px 15px 0; }
  .home-section--featured { padding-top: 64px; }
  .home-section--curriculum { padding-top: 64px; padding-bottom: 70px; }
  .curriculum-callout { grid-template-columns: auto 1fr; }
  .curriculum-callout .button { grid-column: 1 / -1; width: 100%; }

  .view--catalog { padding: 18px 15px 70px; }
  .catalog-hero { min-height:0; padding:0 0 16px; }
  .catalog-hero::before { display: none; }
  .catalog-hero__badge { width: 88px; height: 88px; }
  .catalog-toolbar { margin-top: 12px; }
  .topic-group__header { align-items: start; }

  .choice-cards--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { max-height: calc(100dvh - 20px); border-radius: 20px; }
  .modal__header { padding: 27px 27px 21px; }
  .setup-form { padding:0; }

  .game-shell__header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 72px;
    gap: 10px;
  }
  .game-shell__identity { grid-column: 1; }
  .game-shell__status { grid-column: 2; }
  .game-shell__actions { display: flex; grid-column: 3; }
  .game-shell__footer { min-height: 58px; }
  .game-stage { padding: 14px; }
}

@media (max-width: 680px) {
  :root { --header-height: 126px; }

  body { font-size: 16px; }
  .icon-button { min-width: 48px; }
  .icon-button__label { display: none; }
  .primary-nav button { padding:8px 14px; }
  .grade-context > span { display:none; }
  .brand__copy { display:none; }

  .hero__copy { padding: 31px 20px 20px; }
  .hero h1 { font-size: clamp(40px, 12vw, 57px); }
  .hero__description { font-size: 16px; }
  .hero__actions { align-items: stretch; flex-direction: column; }
  .hero__actions .button { width: 100%; }
  .hero__playground { padding: 13px 14px 24px; }
  .hero-board { min-height: 260px; padding: 18px; border-radius: 18px; }
  .hero-board__equation { padding: 22px 0 18px; }
  .hero-board__answers { grid-template-columns: 1fr; }
  .hero-board__answers span { min-height: 42px; }
  .hero-board__score { align-items: start; flex-direction: column; gap: 3px; }
  .hero-stats { gap: 8px; }
  .hero-stat--note { grid-column: auto; }
  .hero-stat { min-height: 82px; padding: 13px 14px; }
  .hero-stat dt { font-size: 28px; }
  .hero-stat dd,
  .hero-stat--note dd { font-size: 12px; }

  .section-heading--row { align-items: start; flex-direction: column; gap: 12px; }
  .mode-cards { grid-template-columns: 1fr; }
  .mode-card { min-height: 138px; }

  .curriculum-callout { grid-template-columns: 1fr; padding: 25px; text-align: center; }
  .curriculum-callout__stamp { margin: auto; }

  .site-footer { align-items: flex-start; flex-direction: column; gap: 4px; }

  .catalog-hero { align-items:start; flex-direction:column; gap:0; }
  .catalog-hero h1 { font-size:28px; }
  .curriculum-source { padding-left:0; }
  .catalog-hero__badge { display: none; }
  .filter-controls { grid-template-columns: 1fr; }
  .filter-reset { width: 100%; }
  .topic-group__header { grid-template-columns: auto minmax(0, 1fr); }
  .topic-group__count { grid-column: 2; width: max-content; }
  .game-grid,
  .topic-groups.is-compact .game-grid { grid-template-columns: 1fr; }
  .topic-groups.is-compact .game-card__button { grid-template-columns: 118px minmax(0, 1fr); }
  .game-card { min-height: 390px; }

  .overlay { padding: 10px; }
  .game-overlay { padding: 0; }
  .modal__header { padding: 24px 20px 19px; }
  .setup-form { padding: 20px; }
  .choice-cards,
  .choice-cards--four,
  .difficulty-options,
  .setup-grid,
  .team-fields { grid-template-columns: 1fr; }
  .choice-card { min-height: 92px; }
  .modal__actions { align-items:stretch; flex-direction:row; }
  .setup-modal .modal__header { padding:18px 20px 12px; }
  #setupContent { padding:12px 20px; }
  .setup-grid { grid-template-columns:1fr; }
  .modal__actions .button { flex:1; width:auto; }

  .game-shell__header {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 112px;
    padding: 7px 9px;
  }
  .game-shell__identity { grid-row:1; grid-column:1; gap:7px; }
  .game-shell__actions { grid-row:2; grid-column:1 / -1; justify-content:flex-start; }
  .game-shell__actions > .button { min-height:42px; padding:6px 10px; font-size:13px; }
  .game-shell__status { grid-row:1; grid-column:2; }
  .game-close { min-width: 47px; min-height: 44px; padding: 7px; }
  .game-close span:last-child,
  .game-shell__meta { display: none; }
  .game-shell__identity h1 { max-width: 155px; font-size: 17px; }
  .status-chip { min-height: 44px; padding: 5px 9px; }
  .status-chip--timer { min-width: 83px; }
  .status-chip small { font-size: 9px; }
  .game-shell__actions .round-button { display: grid; width: 42px; height: 42px; }
  .game-shell__actions .round-button:first-child { display: grid; }
  .game-scoreboard { padding: 6px 8px; }
  .game-shell__footer { min-height: 54px; padding: 7px 10px; }
  .game-instruction {
    overflow: visible;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: clip;
    white-space: normal;
  }
  .game-instruction::before { display: none; }
  .game-stage { padding: 10px; }

  .score-team { min-width: 160px; }
  .tug-meter { display: none; }
  .result-metrics { grid-template-columns: repeat(2, 1fr); }
  .results-actions { align-items: stretch; flex-direction: column; width: 100%; }
  .results-actions .button { width: 100%; }
}

@media (orientation: landscape) and (max-height: 820px) {
  .game-shell__header { min-height: 68px; padding-top: 6px; padding-bottom: 6px; }
  .game-close { min-height: 44px; }
  .status-chip { min-height: 44px; }
  .round-button { width: 43px; height: 43px; }
  .game-scoreboard { padding-top: 6px; padding-bottom: 6px; }
  .game-scoreboard,
  .scoreboard,
  .score-board { min-height: 54px; }
  .game-shell__footer { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .game-stage { padding-top: 11px; padding-bottom: 11px; }
  .arena-card,
  .question-card,
  .challenge-card { padding-top: 18px; padding-bottom: 18px; }
  .question-card--signature,
  .question-card--mission,
  .question-card--arcade.question-card--mission { padding: 0; }
  .question-copy { margin-bottom: 11px; }
  .question-copy h2 { font-size: clamp(25px, 3vw, 38px); }
  .question-card--arcade:not(.question-card--signature) .question-kicker { display: none; }
  .results-card { padding-top: 22px; padding-bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card:hover,
  .mode-card:hover,
  .button:hover { transform: none; }
}

/* Classroom working surfaces share the existing palette and controls. */
.lesson-controls { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:12px; max-width:800px; }
.lesson-options,.lesson-recent,.card-shortcuts { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin-top:8px; }
.recent-activities { margin:12px 0; border-bottom:1px solid var(--line); }
.lesson-recent { margin:0 0 12px; }
.card-shortcuts { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:12px; }
.card-shortcuts { margin:0; padding:0 16px 16px; }
.card-shortcuts [aria-pressed=true] { background:var(--yellow-soft); }
.session-review { text-align:left; margin:24px 0; }
.session-review details { border-top:1px solid var(--line); padding:14px 0; }
.session-review summary { cursor:pointer; min-height:44px; font-size:16px; }
.review-counts { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.review-counts strong { font-size:24px; color:var(--primary-dark); }
#rosterForm { display:grid; gap:12px; }
#studentResult { display:block; font-size:24px; margin-top:16px; }
body.board-view .game-shell__meta,body.board-view .question-kicker,body.board-view .question-experience { display:none; }
body.board-view .game-shell__header { min-height:60px; padding:8px 20px; }
body.board-view .game-shell__identity h1 { font-size:20px; }
body.board-view .question-copy h2 { font-size:clamp(24px,3vw,36px); }
body.board-view .game-shell__body { padding:12px 20px; gap:8px; }
body.board-view .question-card { padding:16px; }
body.board-view .game-scoreboard { margin-bottom:0; }
body.board-view .game-instruction,body.board-view .feedback-slot { font-size:18px; }
body.board-view .question-copy { margin-bottom:12px; }
body.board-view .game-shell__footer { padding:8px 20px; }
body.board-view .button,body.board-view input,body.board-view select { min-height:48px; font-size:18px; }
@media (max-width:680px) { .lesson-controls { grid-template-columns:1fr; } .review-counts { grid-template-columns:1fr; } .game-shell__actions { flex-wrap:wrap; } }
.hub { max-width:var(--content-max); margin:auto; padding:24px 24px 60px; }
.hub-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.hub-heading .form-field { min-width:180px; }
.activity-group { margin:24px 0 40px; }
.activity-group > h2 { font-size:24px; }
.hub-heading h1 { font-size:clamp(26px,3vw,40px); margin:8px 0 20px; }
.hub-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin:24px 0; }
.hub-card { background:var(--paper); border:1px solid var(--line); border-radius:var(--radius-md); padding:24px; display:flex; flex-direction:column; align-items:start; gap:14px; }
.hub-card h2 { font-size:22px; line-height:1.35; margin:0; }
.hub-card p { margin:0; line-height:1.6; }
.hub-card > button { margin-top:auto; }
.hub-icon { font-size:32px; min-width:64px; height:64px; display:grid; place-items:center; color:var(--primary-dark); background:var(--primary-soft); border-radius:16px; font-weight:800; }
.hub summary { cursor:pointer; min-height:48px; padding:12px 0; font-weight:600; }
.hub input,.hub select,.hub textarea,.arena-dialog input,.arena-dialog select { min-height:48px; border:1px solid var(--line); border-radius:8px; padding:10px; font:inherit; background:var(--paper); color:var(--navy); }
.hub textarea { width:100%; resize:vertical; }
.hub form { display:grid; gap:20px; max-width:800px; }
.hub-empty { padding:40px; background:var(--paper); border:1px dashed var(--line); border-radius:16px; }
.arena-dialog { color:var(--navy); background:var(--paper); border:1px solid var(--line); border-radius:20px; width:min(1240px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:0; overflow:hidden; }
.arena-dialog[open] { display:flex; flex-direction:column; }
#arenaBody { padding:20px 24px; overflow:auto; min-height:0; }
.arena-dialog::backdrop { background:rgba(15,23,42,.6); }
.arena-header { display:flex; flex-shrink:0; justify-content:space-between; align-items:center; gap:16px; border-bottom:1px solid var(--line); padding:16px 24px; background:var(--surface-soft); }
.arena-header h2 { font-size:24px; margin:0; }
.arena-header p { margin:0 0 4px; font-size:14px; }
.arena-header > div:last-child { display:flex; gap:8px; }
.arena-config { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:20px 0; }
.arena-scores { display:flex; align-items:center; gap:12px; margin:16px 0; }
.arena-side { display:flex; gap:12px; align-items:center; padding:8px 16px; border:2px solid transparent; border-radius:12px; }
.arena-side strong { font-size:28px; }
.arena-side.active { border-color:currentColor; }
.side-0 { background:#e4edff; color:#174796; }
.side-1 { background:#ffede5; color:#933211; }
.arena-play { padding:16px; border:1px solid var(--line); border-radius:var(--radius-md); background:var(--paper); }
.arena-play > p { line-height:1.6; }
.arena-problem { font-size:clamp(22px,2.5vw,32px); line-height:1.35; text-align:center; margin:8px 0 16px; }
#arenaFeedback { flex-shrink:0; font-size:17px; line-height:1.5; padding:12px 24px; background:var(--primary-soft); color:var(--navy); border-top:1px solid var(--line); }
#arenaFeedback:empty, #arenaFooter:empty { display:none; }
#arenaFeedback.is-correct { background:#e4f7ec; color:#0c5733; }
#arenaFeedback.is-incorrect { background:#ffeaec; color:#851923; }
#arenaFooter { display:flex; flex-shrink:0; justify-content:flex-end; gap:10px; padding:12px 24px; border-top:1px solid var(--line); background:var(--surface-soft); }
.arena-dialog .button--ghost { color:var(--navy); background:var(--paper); border:1px solid #b8c2d3; box-shadow:var(--shadow-sm); }
.arena-dialog .button--ghost:hover:not(:disabled) { background:var(--primary-soft); border-color:var(--primary); }
.arena-dialog .button--primary { color:white; background:var(--primary); border-color:var(--primary); }
.arena-dialog .button:disabled { opacity:.45; box-shadow:none; cursor:default; }
.arena-dialog .button:focus-visible { outline:3px solid var(--primary); outline-offset:3px; }
.arena-dialog .arena-result { padding:24px; text-align:center; }
.arena-dialog .arena-result h3 { font-size:clamp(24px,3vw,36px); }
.arena-dialog .arena-paused { padding:48px 16px; text-align:center; }
.multiply-rules { text-align:center; margin:0 0 16px; }
.multiply-lanes { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
.multiply-side { min-width:0; border:2px solid currentColor; border-radius:16px; padding:20px; }
.multiply-side header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.multiply-side h3 { margin:0; font-size:24px; overflow-wrap:anywhere; }
.multiply-side header strong { white-space:nowrap; font-size:28px; }
.multiply-side header small { font-size:14px; }
.multiply-progress { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; }
.multiply-clock { font-weight:800; font-variant-numeric:tabular-nums; }
.multiply-side .arena-problem { font-size:clamp(28px,4vw,48px); margin:24px 0; }
.multiply-options { display:grid; gap:12px; }
.multiply-options button { min-height:64px; font-size:28px; background:white; color:inherit; border:2px solid currentColor; touch-action:manipulation; }
.multiply-options button:disabled { opacity:.65; }
.multiply-feedback { min-height:48px; font-weight:700; margin:16px 0 0; }
@media (max-width:680px) {
  .multiply-lanes { gap:10px; }
  .multiply-side { padding:10px; }
  .multiply-side header { flex-direction:column; align-items:start; gap:4px; }
  .multiply-side h3 { font-size:18px; }
  .multiply-side header strong { font-size:22px; }
  .multiply-options button { min-height:56px; padding:8px; font-size:24px; }
  .multiply-feedback { font-size:14px; }
}
.expression-tokens { display:flex; gap:8px; justify-content:center; margin:12px; flex-wrap:wrap; }
.expression-tokens .button { min-width:56px; min-height:56px; font-size:24px; padding:8px 14px; font-variant-numeric:tabular-nums; }
.expression-tokens [data-index] { background:var(--primary-soft); color:var(--primary-dark); border-color:var(--primary); }
.expression-actions { display:flex; flex-wrap:wrap; justify-content:center; gap:10px; margin-top:16px; }
.integer-duel-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; width:min(520px,100%); margin:24px auto; }
.integer-duel-options .button { min-height:72px; font-size:32px; font-variant-numeric:tabular-nums; }
.arena-keyboard-tip { color:var(--ink-soft); text-align:center; font-size:13px; }
.expression-output { display:block; padding:16px; text-align:center; font-size:28px; background:var(--surface-soft); border:1px dashed var(--primary); border-radius:12px; margin:12px 0; }
.target-number { text-align:center; font-size:24px; }
.arena-play .target-number { display:flex; align-items:center; justify-content:center; gap:16px; width:fit-content; height:auto; aspect-ratio:auto; min-height:72px; margin:16px auto; padding:12px 24px; border:1px solid var(--line); border-radius:var(--radius-md); color:var(--navy); background:var(--primary-soft); box-shadow:none; }
.arena-play .target-number strong { font-size:36px; }
.fraction-duel { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.fraction-choice { background:var(--surface-soft); border:2px solid var(--line); border-radius:16px; padding:24px; min-height:150px; color:var(--navy); }
.fraction-choice strong { font-size:36px; }
.fraction-strip { display:grid; height:48px; margin-top:20px; border:2px solid var(--navy); }
.fraction-strip i { border-right:1px solid var(--navy); }
.fraction-strip i.filled { background:var(--primary); }
.coordinate-race { display:flex; justify-content:center; align-items:center; gap:24px; }
.coordinate-board { width:280px; height:280px; display:grid; gap:1px; background:var(--line); border:1px solid var(--navy); }
.coordinate-board span { display:grid; place-items:center; background:var(--paper); }
.coordinate-board .target { background:var(--yellow-soft); }
.coordinate-board .position { background:var(--primary); color:white; }
.direction-pad { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:12px; }
.tile-grid { display:grid; gap:8px; max-width:480px; margin:20px auto; }
.tile-grid.four { grid-template-columns:repeat(4,1fr); }
.tile-grid.three { grid-template-columns:repeat(3,1fr); max-width:300px; }
.tile { min-height:64px; background:var(--surface-soft); color:var(--navy); border:2px solid var(--line); border-radius:10px; font:inherit; font-size:26px; display:grid; place-items:center; padding:8px; }
.tile small { font-size:14px; }
.tile.claimed.side-0 { background:#e4edff; color:#174796; }
.tile.claimed.side-1 { background:#ffede5; color:#933211; }
.tile.solved { background:var(--teal-dark); color:white; }
.tile.lit { background:var(--yellow); color:var(--navy); }
.factor-controls { display:flex; justify-content:center; align-items:center; gap:16px; }
.factor-controls label { display:grid; gap:4px; }
.nim-pile { display:flex; gap:16px; flex-wrap:wrap; align-items:center; border-bottom:1px solid var(--line); padding:12px 0; }
.nim-pile > span { font-size:24px; min-width:240px; color:var(--primary-dark); }
.nim-pile > div { display:flex; flex-wrap:wrap; gap:6px; }
.mathler-container { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 600px; margin: 0 auto; }
.mathler-target-card { display: flex; flex-direction: column; align-items: center; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 14px; padding: 10px 24px; box-shadow: var(--shadow-sm); }
.mathler-target-card .arena-problem { font-size: inherit; margin: 0; display: flex; flex-direction: column; align-items: center; }
.mathler-target-badge { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: var(--primary); text-transform: uppercase; }
.mathler-target-value { font-size: 36px; font-weight: 900; line-height: 1.1; color: var(--navy); }
.mathler-target-meta { font-size: 13px; color: var(--ink-soft); }
.mathler-instruction { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 0; }
.mathler-board { display: grid; gap: 6px; margin: 6px auto; }
.mathler-board-row { display: flex; justify-content: center; gap: 6px; }
.mathler-row { display: flex; justify-content: center; gap: 6px; }
.mathler-cell { display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--navy); font-size: 22px; font-weight: 800; box-sizing: border-box; transition: transform 0.15s ease, border-color 0.15s ease; user-select: none; }
.mathler-cell.empty { border-color: #d8deeb; background: #fbfcfe; }
.mathler-cell.filled { border-color: var(--navy-3); animation: mathlerPop 0.12s ease-out; }
.mathler-cell.active-cell { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(86, 84, 199, 0.25); }
.mathler-cell.exact { background: #16845a; border-color: #16845a; color: #ffffff; }
.mathler-cell.present { background: #f7c948; border-color: #f7c948; color: #3b2a03; }
.mathler-cell.absent { background: #738096; border-color: #738096; color: #ffffff; }
.mathler-cell small { display: none; }
@keyframes mathlerPop { 0% { transform: scale(0.85); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.mathler-legend { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--ink-soft); margin: 2px 0 6px; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.legend-dot.exact { background: #16845a; }
.legend-dot.present { background: #f7c948; }
.legend-dot.absent { background: #738096; }
.mathler-form { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.mathler-real-input { flex: 1 1 200px; max-width: 260px; min-height: 44px; text-align: center; font-size: 18px; font-weight: 700; letter-spacing: 2px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--navy); padding: 0 12px; }
.mathler-real-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(86, 84, 199, 0.2); }
.mathler-submit-btn { flex: 0 0 auto; min-height: 44px; padding: 0 18px; font-weight: 700; }
.mathler-keyboard { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 520px; align-items: center; margin-top: 4px; }
.mathler-key-row { display: flex; justify-content: center; gap: 5px; width: 100%; }
.mathler-key { min-width: 38px; height: 46px; padding: 0 6px; border: 1px solid #d4d9e4; border-radius: 8px; background: #eceff5; color: var(--navy); font-size: 17px; font-weight: 750; cursor: pointer; touch-action: manipulation; display: grid; place-items: center; transition: background 0.15s ease, transform 0.08s ease; }
.mathler-key:active { transform: scale(0.94); }
.mathler-key.key-exact { background: #16845a; border-color: #16845a; color: #ffffff; }
.mathler-key.key-present { background: #f7c948; border-color: #f7c948; color: #3b2a03; }
.mathler-key.key-absent { background: #8b95a5; border-color: #8b95a5; color: #ffffff; opacity: 0.65; }
#mathlerForm { max-width: 680px; margin: auto; }
.hanoi-board { display:flex; gap:16px; margin:24px 0; }
.hanoi-peg { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:4px; flex:1; height:250px; border:2px solid var(--line); border-bottom:8px solid var(--navy); border-radius:12px 12px 0 0; background:var(--surface-soft); color:var(--navy); }
.hanoi-peg.selected { border-color:var(--primary); }
.hanoi-disk { background:var(--primary); color:white; border-radius:8px; min-height:30px; display:grid; place-items:center; }
.sudoku .tile { border-radius:0; }
.sudoku { gap:2px; border:3px solid var(--navy); }
.sudoku .tile:nth-child(4n+2) { border-right:3px solid var(--navy); }
.sudoku .tile:nth-child(n+5):nth-child(-n+8) { border-bottom:3px solid var(--navy); }
.sudoku select { width:100%; font-size:24px; }
.sudoku .given { background:var(--primary-soft); font-weight:800; }
.dots-board { display:grid; grid-template-columns:repeat(3,28px 72px) 28px; grid-template-rows:repeat(3,28px 72px) 28px; justify-content:center; margin:16px auto; }
.dot,.box-owner { display:grid; place-items:center; }
.edge { background:var(--surface-soft); border:1px dashed var(--ink-soft); border-radius:6px; position:relative; }
.edge::before { content:''; position:absolute; inset:-8px; }
.edge.drawn { background:currentColor; border:0; }
.table-scroll { overflow:auto; margin:20px 0; }
.hub table { width:100%; border-collapse:collapse; background:var(--paper); }
.hub th,.hub td { text-align:left; padding:16px; border-bottom:1px solid var(--line); }
.hub caption { text-align:left; padding:12px; }
.bracket { display:flex; overflow:auto; gap:24px; margin:24px 0; }
.bracket section { min-width:240px; flex:1; }
.bracket-match { border:1px solid var(--line); background:var(--paper); padding:16px; border-radius:12px; margin-bottom:12px; }
.bracket-match.active { border:2px solid var(--primary); }
.idea-card { border-top:1px solid var(--line); padding:16px 0; }
.idea-body { white-space:pre-wrap; }
.arena-result,.arena-paused { text-align:center; padding:32px 0; }
body.high-contrast .hub-card,body.high-contrast .arena-dialog,body.high-contrast .tile { border-color:currentColor; }
@media (max-width:900px) { .hub-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:680px) { .hub { padding:18px 15px 50px; } .hub-heading { align-items:start; flex-direction:column; gap:8px; } .hub-heading h1 { margin-bottom:0; } .hub-heading .form-field { width:100%; } .hub-grid,.arena-config { grid-template-columns:1fr; } .arena-dialog { padding:14px; } .arena-header { align-items:start; } .arena-header h2 { font-size:20px; } .arena-header > div:last-child { flex-direction:column; } .arena-scores { flex-wrap:wrap; } .arena-side { padding:6px 10px; } .coordinate-race { flex-direction:column; } .fraction-duel { gap:8px; } .fraction-choice { padding:12px; } .mathler-row { gap:2px; } .mathler-cell { width:32px; font-size:18px; } .hanoi-board { gap:6px; } }
.explorer-dialog { width:min(880px,96vw); }
.explorer-dialog h3 { font-size:26px; }
.explorer-dialog input,.explorer-dialog select { min-height:48px; }
.explorer-dialog input[type=range] { padding:0; }
.explorer-participation { background:var(--primary-soft); border-radius:8px; padding:12px; }
.explorer-equation { text-align:center; font-size:36px!important; }
.balance-model { display:flex; justify-content:center; align-items:center; gap:20px; padding:20px; border-bottom:4px solid var(--primary); }
.balance-model div { min-width:140px; padding:24px; text-align:center; border:2px solid var(--primary); border-radius:0 0 50% 50%; font-size:24px; background:var(--surface-soft); }
#balanceForm { display:flex; flex-wrap:wrap; gap:16px; align-items:end; margin:20px 0; }
#balanceForm input { max-width:130px; }
.explorer-strips { display:grid; gap:24px; margin:24px 0; }
.explorer-strips .fraction-strip { width:100%; height:56px; margin-top:8px; }
.shared-number-line { position:relative; margin:32px 0 56px; border-top:2px solid var(--navy); display:flex; justify-content:space-between; }
.shared-number-line i { position:absolute; top:-8px; border-top:14px solid var(--primary); font-style:normal; padding-top:12px; transform:translateX(-50%); }
.shared-number-line i:first-of-type { padding-top:40px; }
.rectangle-model { display:grid; grid-auto-rows:24px; gap:1px; margin:20px auto; width:max-content; border:3px solid var(--primary); }
.rectangle-model i { background:var(--primary-soft); border:1px solid var(--primary); }
.explorer-adjust,.experiment-buttons,.fraction-predictions { display:flex; flex-wrap:wrap; gap:8px; }
.explorer-split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; margin: 16px 0; }
@media (max-width: 768px) { .explorer-split { grid-template-columns: 1fr; gap: 16px; } }
.explorer-col { display: flex; flex-direction: column; gap: 10px; }
.explorer-col--visual { align-items: center; text-align: center; width: 100%; }
.explorer-col--data { width: 100%; }
.explorer-table { border-collapse:collapse; width:100%; margin:16px 0; }
.explorer-table th,.explorer-table td { text-align:left; border-bottom:1px solid var(--line); padding:10px; }
.explorer-angle { width:360px; max-width:100%; height:220px; display:block; margin:auto; }
#angleEstimate,#probabilityPredict { display:flex; align-items:end; flex-wrap:wrap; gap:16px; }
.probability-bag { display:flex; justify-content:center; gap:12px; margin:20px 0; }
.probability-bag span { display:grid; place-items:center; width:50px; height:50px; border-radius:50%; font-weight:800; }
.red-stone { background:#ad2638; color:white; }.blue-stone { background:#2857a8; color:white; }
.sample-bar { position:relative; height:32px; background:#e4edff; margin:16px 0; }
.sample-bar i { display:block; background:#ad2638; height:100%; }
.sample-bar span { position:absolute; top:-5px; height:42px; border-left:3px dashed var(--navy); }
#explorerFeedback { font-size:18px; padding:12px; background:var(--surface-soft); border-radius:8px; }
.quantity-diagram { display:block; width:300px; max-width:100%; height:190px; margin:auto; font-size:16px; }
.offline-update { position:fixed; z-index:1500; bottom:16px; left:16px; right:16px; display:flex; gap:16px; align-items:center; background:var(--paper); border:2px solid var(--primary); padding:16px; border-radius:16px; box-shadow:var(--shadow-lg); }
.offline-update[hidden] { display:none; }
@media(max-width:680px) { .offline-update { flex-wrap:wrap; } }
.mw-exact-value { width:150px; max-width:60%; min-height:48px; border:2px solid var(--line); border-radius:8px; font-size:22px; text-align:center; margin:12px 8px; color:var(--navy); background:var(--paper); }
.exploration-history { margin:24px 0; }
.device-history { margin-top:24px; padding-top:16px; border-top:1px solid var(--line); }
.device-history summary { cursor:pointer; min-height:44px; padding:10px 0; }
.device-history details { margin-left:12px; border-bottom:1px solid var(--line); }
.classroom-nav,.hub { padding-left:clamp(16px,2vw,28px); padding-right:clamp(16px,2vw,28px); }
.number-pad .button { border:1px solid var(--line); background:var(--surface-soft); }
#storageNotice { padding:16px; border:2px solid var(--yellow); background:var(--yellow-soft); }
@media(min-width:900px) and (max-height:820px) {
 .arena-dialog:not(.explorer-dialog) { padding:0; }
 .arena-dialog .number-pad button { min-height:44px; }
 .arena-dialog .arena-problem { margin:6px 0 12px; }
}

@media (max-width: 680px) {
  .arena-dialog:not(.explorer-dialog) { width:calc(100vw - 16px); padding:0; max-height:calc(100dvh - 16px); border-radius:16px; }
  .arena-header { padding:12px; gap:8px; align-items:center; }
  .arena-header > div:last-child { flex-direction:row; gap:6px; }
  .arena-header .button { min-height:44px; padding:8px 10px; font-size:13px; }
  .arena-header h2 { font-size:18px; }
  .arena-header p { font-size:12px; }
  #arenaBody { padding:12px; }
  .arena-play { padding:12px; }
  .arena-scores { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0 0 12px; }
  .arena-side { flex-wrap:wrap; justify-content:space-between; gap:4px 8px; min-width:0; }
  .arena-side > span { flex-basis:100%; overflow-wrap:anywhere; }
  .arena-side strong { font-size:24px; }
  .arena-side small { font-size:11px; }
  #arenaFeedback, #arenaFooter { padding:10px 12px; }
  .expression-tokens { margin:10px 0; gap:6px; }
  .expression-tokens .button { min-width:44px; min-height:48px; padding:8px 10px; font-size:22px; }
  .expression-output { font-size:22px; padding:12px; }
  .expression-actions .button { min-height:44px; padding:8px 12px; }
  .arena-play .target-number { margin:12px auto; min-height:56px; font-size:18px; }
  .arena-play .target-number strong { font-size:28px; }
}
