:root {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  color: #242922;
  background: #f7f8f5;
  --page: #f7f8f5;
  --surface: #fff;
  --ink: #242922;
  --muted: #596258;
  --line: #e0e5dc;
  --olive: #e8efd9;
  --lavender: #e8e2f5;
  --accent: #614d8a;
  --accent-soft: #f1ecf8;
  --positive: #3b673f;
  --negative: #974d43;
  --gap: 16px;
  --section: 28px;
  --pad: 24px;
  --radius: 22px;
  --control: 48px;
  --gutter-left: max(24px, env(safe-area-inset-left));
  --gutter-right: max(24px, env(safe-area-inset-right));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3,
strong,
b {
  font-weight: 650;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button svg,
a svg {
  pointer-events: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}

.ico {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body > header {
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top,
main {
  width: 100%;
  max-width: 1184px;
  margin-inline: auto;
  padding-inline: var(--gutter-left) var(--gutter-right);
}

.top {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--gap);
}

.brand {
  display: flex;
  width: fit-content;
  min-height: var(--control);
  align-items: center;
  gap: 9px;
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.05em;
}

.top nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top nav a,
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.top nav a {
  min-height: var(--control);
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.top nav a.on {
  color: var(--accent);
  background: var(--accent-soft);
}

.top nav .ico {
  width: 18px;
  height: 18px;
}

.avatar,
.circle {
  display: inline-grid;
  place-items: center;
  width: var(--control);
  height: var(--control);
  padding: 0;
  flex: none;
  background: var(--page);
  border-radius: 50%;
}

.avatar {
  justify-self: end;
}

main {
  padding-block: 36px 64px;
}
.heading,
.between,
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.heading,
.between {
  justify-content: space-between;
}
.heading {
  margin-bottom: var(--pad);
}
.heading h1 {
  font-size: clamp(36px, 4.2vw, 52px);
  letter-spacing: -0.05em;
  line-height: 1.06;
}
.panel h2,
.section-title h2 {
  font-size: 23px;
  letter-spacing: -0.035em;
  line-height: 1.18;
}
.desc {
  max-width: 64ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.primary,
.secondary,
.plain {
  display: inline-flex;
  min-height: var(--control);
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}
.primary,
.secondary {
  min-width: 0;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
}
.primary {
  background: var(--ink);
  color: var(--surface);
}
.secondary {
  background: var(--surface);
  border-color: var(--line);
}
.primary:disabled {
  color: #656e62;
  background: #ebeee8;
}
.primary .ico,
.secondary .ico,
.plain .ico {
  width: 17px;
  height: 17px;
}
.plain {
  color: var(--muted);
  justify-content: flex-start;
}
.actions {
  flex-wrap: wrap;
  margin-top: var(--pad);
}

.overview-grid,
.progress-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(265px, 1fr);
  gap: var(--gap);
}
.panel {
  min-width: 0;
  padding: var(--pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  min-height: 274px;
  align-items: center;
  background: var(--lavender);
  border-radius: var(--radius);
}
.hero-art {
  position: absolute;
  z-index: -1;
  inset: 6% -2% auto auto;
  width: 45%;
  height: 90%;
  object-fit: contain;
}
.hero-copy {
  width: 100%;
  padding: clamp(24px, 3.4vw, 42px);
}
.hero h2 {
  max-width: 63%;
  font-size: clamp(35px, 3.9vw, 53px);
  line-height: 1.01;
  letter-spacing: -0.06em;
}
.hero p {
  max-width: min(58%, 32ch);
  margin-top: 12px;
  color: #514861;
  font-size: 16px;
  line-height: 1.45;
}
.hero-actions {
  display: flex;
  width: fit-content;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: var(--pad);
}
.hero-time,
.hero-progress,
.result-status {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
}
.hero-time,
.hero-progress {
  color: #514861;
}
.hero-time .ico {
  width: 16px;
  height: 16px;
}
.hero-progress i {
  width: 12px;
  height: 6px;
  border-radius: 8px;
  background: #cec3e3;
}
.hero-progress .fill {
  background: var(--accent);
}

.weekly {
  display: grid;
  align-content: center;
  gap: var(--gap);
}
.summary-score span {
  color: var(--muted);
  font-size: 0.5em;
  font-weight: 500;
  letter-spacing: -0.025em;
}
.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  text-align: center;
}
.week i {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-width: 40px;
  margin: 0 auto 6px;
  border-radius: 11px;
  background: var(--page);
  border: 1px solid transparent;
  font-size: 22px;
  font-style: normal;
  line-height: 1;
}
.week i .ico {
  width: 17px;
  height: 17px;
}
.week .active i {
  background: var(--olive);
  color: var(--positive);
}
.week .today i {
  border-color: #9caa93;
}
.week span {
  color: var(--muted);
  font-size: 12px;
}

.screen-section {
  margin-top: var(--section);
}
.section-title {
  margin-bottom: 8px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
.game-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-art,
.art-thumb {
  display: grid;
  place-items: center;
  background: var(--tint);
  border-radius: 14px;
}
.card-art {
  width: 64px;
  height: 64px;
}
.card-art svg {
  width: 62px;
  height: 49px;
}
.art-thumb {
  min-height: 108px;
}
.art-thumb svg {
  width: 148px;
  height: 96px;
}
.card-text,
.band-content,
.row-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.card-name,
.band-title {
  font-size: 18px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.card-end {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.card-end .ico {
  width: 18px;
  height: 18px;
}
.band {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 84px;
  align-items: center;
  gap: var(--gap);
  margin-top: var(--gap);
  padding: 16px;
  text-align: left;
}
.band-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: #3e5336;
  background: var(--olive);
}

.tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--pad);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.tabs a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}
.tabs a[aria-current] {
  color: var(--accent);
  background: var(--accent-soft);
}
.mastery {
  display: grid;
  align-content: center;
  gap: 12px;
}
.summary-score {
  color: var(--ink);
  font-size: 58px;
  line-height: 1;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
}
.progress-grid {
  align-items: start;
}
.progress-grid h2 {
  margin-bottom: 12px;
}
.table-list {
  display: grid;
}
.statrow,
.rank-row {
  min-height: 52px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}
.statrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.statrow:last-child,
.rank-row:last-child {
  border-bottom: 0;
}
.skill-row {
  width: 100%;
  padding-inline: 0;
  text-align: left;
}
.skill-row .row-title {
  gap: 3px;
  font-weight: 600;
}
.skill-row .small {
  font-weight: 400;
}
.skill-row:focus-visible {
  outline-offset: 1px;
}
.levels {
  display: flex;
  flex: none;
  gap: 4px;
}
.levels i,
.meter i,
.track {
  border-radius: 8px;
  background: #e9ede7;
}
.levels i {
  width: 18px;
  height: 7px;
}
.levels .fill,
.meter .fill,
.track i {
  background: #9d8bbf;
}
.history-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(110px, 1fr);
  gap: 8px;
}
.history {
  display: grid;
  gap: 12px;
  margin-top: var(--gap);
}
.chartrow {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.chartrow b {
  text-align: right;
}
.track {
  height: 8px;
  overflow: hidden;
}
.track i {
  display: block;
  height: 100%;
}
.empty {
  padding: 14px;
  border-radius: 12px;
  background: var(--page);
}
.ranking {
  max-width: 840px;
}
.ranking-heading {
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}
.ranking-heading .small {
  margin-top: 4px;
}
.ranking-heading select {
  width: auto;
}
.ranking .empty,
.ranking-list {
  margin-top: var(--pad);
}
.rank-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  padding-inline: 10px;
}
.rank-row > span:nth-child(2) {
  overflow-wrap: anywhere;
}
.rank-row > :last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rank-labels {
  min-height: 36px;
}
.rank-me {
  color: var(--accent);
  background: var(--accent-soft);
}

body:has(.game-shell) {
  display: flex;
  flex-direction: column;
}
main:has(.game-shell) {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-block: 24px;
}
.game-shell {
  width: 100%;
  max-width: 680px;
  margin: auto;
}
.game-shell .heading {
  margin-bottom: var(--gap);
}
.game-shell .heading h1 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.035em;
}
.board {
  min-width: 0;
  padding: clamp(20px, 3.1vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.board h2 {
  margin-bottom: var(--gap);
  font-size: clamp(25px, 4vw, 34px);
  letter-spacing: -0.038em;
  line-height: 1.16;
}
.round-meta {
  font-variant-numeric: tabular-nums;
}
.round-meta > :last-child {
  text-align: right;
}
.meter {
  display: flex;
  gap: 4px;
  height: 5px;
  margin-block: 10px var(--pad);
}
.meter i {
  flex: 1 1 0;
}
.stim {
  padding: 16px;
  margin-block: var(--gap);
  border-radius: 14px;
  background: var(--page);
  font-size: 18px;
  line-height: 1.45;
  white-space: pre-line;
}
.game-action {
  margin-top: var(--pad);
}
.game-action-paused {
  min-height: var(--control);
  visibility: hidden;
}
.memory-round h2 {
  min-height: 1.16em;
}
.memory-hint {
  min-height: 1.45em;
}
.choices,
.shelf {
  display: grid;
  gap: 8px;
}
.choice,
.cell {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  min-height: var(--control);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}
.choice {
  font-size: 16px;
}
.choice b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.choice.selected,
.cell.selected {
  background: var(--accent-soft);
  border-color: #9380b3;
}
.choice.correct,
.cell.correct {
  background: #edf4e9;
  border-color: #9bb794;
}
.choice.wrong,
.cell.wrong {
  background: #fbefec;
  border-color: #ca9a90;
}
.sequence {
  min-width: 0;
  padding: 9px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--page);
}
.sequence-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}
.sequence-value {
  height: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  font-weight: 650;
  line-height: 24px;
  white-space: nowrap;
  scrollbar-width: none;
}
.sequence-position {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  margin-left: auto;
  border-radius: 8px;
  background: var(--lavender);
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}
.sequence-position:empty {
  visibility: hidden;
}
.choices.inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.choices.inline .choice {
  flex-direction: column;
  gap: 7px;
  padding: 10px 4px 14px;
}
.shape {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(76px, 100%);
  aspect-ratio: 1;
  gap: 3px;
  margin: auto;
}
.shape i {
  border-radius: 3px;
  background: #eae5f2;
}
.shape .solid {
  background: #60547b;
}
.stim .shape {
  width: 88px;
}
.rule {
  width: 74px;
  height: 74px;
  margin-inline: auto;
  border: 2px solid #332a40;
}
.roundshape {
  border-radius: 50%;
}
.stripes {
  background: repeating-linear-gradient(45deg, #ded4ed 0 7px, #534c62 7px 10px);
}
.dots {
  background: radial-gradient(#534c62 2.5px, #e6def0 3px) 0 0 / 12px 12px;
}
.shelf {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}
.cell {
  height: clamp(56px, 13vw, 84px);
  justify-content: center;
  background: #f5f4ed;
  padding: 4px;
  font-size: clamp(24px, 7vw, 40px);
}
.feedback {
  margin-top: var(--pad);
  padding-top: var(--gap);
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}
.feedback p {
  margin-top: 4px;
}
.feedback details {
  margin-top: 8px;
}
.feedback summary {
  width: fit-content;
  min-height: 48px;
  padding-block: 10px;
  cursor: pointer;
}
.answer-right,
.result-status {
  color: var(--positive);
}
.answer-wrong {
  color: var(--negative);
}
.result-status {
  font-size: 14px;
  font-weight: 650;
}
.result-status .ico {
  width: 18px;
  height: 18px;
}
.results .summary-score {
  margin-block: 16px 10px;
}
.results .desc {
  margin-bottom: 12px;
}
.results > .statrow:nth-last-child(2) {
  border-bottom: 0;
}

.stack,
.form,
.math-answer {
  display: grid;
  gap: 12px;
}
.form label,
.math-answer label {
  font-size: 14px;
}
.form label {
  display: grid;
  gap: 6px;
}
.form .check {
  display: flex;
  align-items: center;
  min-height: 44px;
}
.form input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}
.form h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
}
.profile-account {
  margin-top: var(--pad);
  padding-top: var(--pad);
  border-top: 1px solid var(--line);
}
select,
input:not([type="checkbox"], [type="radio"]) {
  width: 100%;
  min-width: 0;
  min-height: var(--control);
  padding-inline: 12px;
  border: 1px solid #cbd3c7;
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px;
}
select {
  appearance: none;
  padding: 10px 34px 10px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m3.5 6 4.5 4.5L12.5 6' stroke='%23596258' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 11px center;
  background-repeat: no-repeat;
  background-size: 15px;
  text-overflow: ellipsis;
}
input::placeholder {
  color: #70776d;
  opacity: 1;
}
.exercise-description {
  display: grid;
  gap: 4px;
}
.level-picker {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.level-picker legend {
  margin-bottom: 4px;
  padding: 0;
  font-size: 14px;
  font-weight: 650;
}
.level-strip {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(58px, 1fr);
  gap: 8px;
  min-inline-size: 0;
  padding: 3px 3px 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 3px;
  scrollbar-width: thin;
  scrollbar-color: #b7acc7 transparent;
}
.level-option {
  position: relative;
  display: grid;
  scroll-snap-align: start;
}
.level-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.level-option input:disabled {
  pointer-events: none;
}
.level-number {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.level-number .ico {
  width: 14px;
  height: 14px;
}
.level-option input:checked + .level-number {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.level-option input:disabled + .level-number {
  border-color: #e5e9e2;
  color: #777e74;
  background: #eef0eb;
}
.level-option input:focus-visible + .level-number {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
@media (hover: hover) {
  .level-option:hover input:enabled:not(:checked) + .level-number {
    border-color: #a4af9f;
    background: var(--page);
  }
}
.math-answer {
  justify-items: start;
}
.math-answer input {
  max-width: 260px;
  font-size: 22px;
}

dialog {
  width: min(460px, calc(100% - 32px));
  max-height: 90dvh;
  padding: var(--pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop {
  background: #24292270;
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] {
    --dialog-rise: 16px;
    animation: dialog-enter 220ms ease-out both;
  }
  dialog.exercise-dialog[open] {
    --preview-travel: min(18dvh, 132px);
    animation: exercise-enter 230ms cubic-bezier(0.18, 0.8, 0.24, 1) both;
  }
  dialog[open]::backdrop {
    animation: backdrop-enter 220ms ease-out both;
  }
  dialog.exercise-dialog[open].exercise-closing {
    animation: exercise-exit 175ms cubic-bezier(0.44, 0, 0.82, 0.5) both;
  }
  dialog.exercise-dialog[open].exercise-closing::backdrop {
    animation: backdrop-enter 175ms ease-in reverse both;
  }
  .choice,
  .cell,
  .level-number,
  .primary,
  .secondary,
  .game-card {
    transition:
      background-color 160ms ease,
      color 160ms ease,
      border-color 160ms ease;
  }
}
@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(var(--dialog-rise));
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes exercise-enter {
  from {
    opacity: 0;
    transform: translateY(calc(-1 * var(--preview-travel)));
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes exercise-exit {
  from {
    opacity: var(--exit-opacity, 1);
    transform: var(--exit-transform, none);
  }
  to {
    opacity: 0;
    transform: translateY(var(--preview-travel));
  }
}
@keyframes backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.dialog-heading {
  margin-bottom: var(--gap);
}
.dialog-heading h2:focus {
  outline: none;
}
.dialog-heading h2 {
  font-size: 24px;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.notice {
  position: fixed;
  z-index: 6;
  inset: auto auto calc(16px + var(--safe-bottom)) 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(90vw, 420px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
}

@media (hover: hover) {
  .primary:not(:disabled):hover {
    background: #3c453a;
  }
  .secondary:not(:disabled):hover,
  .circle:hover,
  .avatar:hover {
    background: #eef1eb;
  }
  .top nav a:not(.on):hover,
  .tabs a:not([aria-current]):hover {
    background: var(--page);
  }
  .game-card:hover,
  .band:hover,
  .choice:not(:disabled):hover {
    border-color: #a4af9f;
  }
  .plain:hover,
  .skill-row:hover {
    color: var(--accent);
  }
}
@media (max-width: 940px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .history-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 660px),
  (max-width: 950px) and (hover: none) and (pointer: coarse) {
  :root {
    --pad: 18px;
    --gap: 12px;
    --section: 24px;
    --control: 48px;
    --gutter-left: max(16px, env(safe-area-inset-left));
    --gutter-right: max(16px, env(safe-area-inset-right));
    --tab-bar: 76px;
    --round-button: 54px;
    --dock-top: 10px;
    --dock-bottom: calc(12px + var(--safe-bottom));
    --round-dock: calc(
      1px + var(--dock-top) + var(--round-button) + var(--dock-bottom)
    );
  }
  .top {
    min-height: 64px;
    grid-template-columns: 1fr auto;
  }
  .brand {
    font-size: 23px;
  }
  .brand img {
    width: 32px;
    height: 32px;
  }
  .top nav {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: calc(var(--tab-bar) + var(--safe-bottom));
    padding: 6px var(--gutter-right) calc(7px + var(--safe-bottom))
      var(--gutter-left);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .top nav a {
    flex-direction: column;
    min-height: 56px;
    gap: 3px;
    padding: 4px;
    font-size: 13px;
  }
  .top nav a.on {
    background: transparent;
  }
  .nav-icon {
    width: 48px;
    height: 32px;
    border-radius: 12px;
  }
  .top nav .on .nav-icon {
    background: var(--accent-soft);
  }
  .top nav .ico {
    width: 22px;
    height: 22px;
  }
  main {
    padding-top: 22px;
    padding-bottom: calc(var(--tab-bar) + var(--safe-bottom) + var(--section));
  }
  .heading h1 {
    font-size: 40px;
  }
  .desc {
    font-size: 17px;
  }
  .small {
    font-size: 14px;
  }
  .primary,
  .secondary {
    font-size: 16px;
  }
  .overview-grid,
  .progress-grid,
  .cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero {
    min-height: 252px;
  }
  .hero-copy {
    padding: var(--pad);
  }
  .hero h2 {
    max-width: 67%;
    font-size: clamp(34px, 9.1vw, 44px);
  }
  .hero p {
    max-width: 62%;
    font-size: 16px;
  }
  .hero-art {
    inset: 5% -4% auto auto;
    width: 43%;
    height: 70%;
  }
  .hero-actions {
    width: 100%;
    gap: 8px 12px;
  }
  .primary {
    min-height: 54px;
  }
  .week {
    gap: 5px;
  }
  .week i {
    max-width: 42px;
    margin-bottom: 5px;
  }
  .week span {
    font-size: 13px;
  }
  .section-title .plain {
    font-size: 13px;
  }
  .section-title h2,
  .panel h2 {
    font-size: 22px;
  }
  .game-card {
    min-height: 90px;
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }
  .card-art {
    width: 56px;
    height: 56px;
  }
  .card-art svg {
    width: 54px;
    height: 45px;
  }
  .card-name {
    font-size: 20px;
  }
  .band {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding: 12px;
  }
  .band-icon {
    width: 44px;
    height: 44px;
  }
  .tabs {
    width: 100%;
  }
  .tabs a {
    flex: 1 1 0;
    min-height: 48px;
    padding-inline: 7px;
  }
  .rank-row {
    grid-template-columns: 44px minmax(0, 1fr) 40px;
    gap: 8px;
    padding-inline: 6px;
  }
  .history-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .history-filters select {
    width: 100%;
  }
  .board {
    padding: var(--pad);
  }
  .game-shell {
    max-width: 520px;
  }
  .round-shell .board {
    padding: 16px;
  }
  .round-shell .board h2 {
    font-size: clamp(23px, 6.4vw, 29px);
  }
  .game-shell .heading h1 {
    font-size: clamp(22px, 5.5vw, 27px);
  }
  body:has(.round-shell) > header {
    display: none;
  }
  main:has(.game-shell) {
    padding-block: 14px calc(14px + var(--tab-bar) + var(--safe-bottom));
  }
  main:has(.round-shell) {
    padding-block: calc(14px + env(safe-area-inset-top, 0px))
      calc(14px + var(--safe-bottom));
  }
  main:has(.round-shell .game-action) {
    padding-bottom: calc(14px + var(--round-dock));
  }
  .results .actions > a {
    flex: 1 1 100%;
    justify-content: center;
  }
  .choice {
    min-height: 58px;
    font-size: 18px;
  }
  .choice b {
    display: none;
  }
  .stim {
    padding: 12px;
    font-size: 17px;
  }
  .game-action {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    display: grid;
    justify-items: center;
    margin: 0;
    padding: var(--dock-top) var(--gutter-right) var(--dock-bottom)
      var(--gutter-left);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .game-action button {
    width: 100%;
    max-width: 520px;
    min-height: var(--round-button);
  }
  .game-action-paused {
    min-height: var(--round-dock);
  }
  .math-answer input,
  .math-answer button {
    width: 100%;
    max-width: none;
  }
  .round-shell .feedback {
    scroll-margin-bottom: var(--round-dock);
  }
  dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--pad) var(--gutter-right)
      calc(var(--pad) + var(--safe-bottom)) var(--gutter-left);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  dialog.exercise-dialog {
    inset: env(safe-area-inset-top, 0px) var(--gutter-right) var(--safe-bottom)
      var(--gutter-left);
    width: min(440px, calc(100% - var(--gutter-left) - var(--gutter-right)));
    max-height: calc(
      100dvh - env(safe-area-inset-top, 0px) - var(--safe-bottom) - 28px
    );
    margin: auto;
    padding: var(--pad);
    border-radius: var(--radius);
  }
  dialog .primary,
  dialog .secondary {
    width: 100%;
  }
  .notice {
    bottom: calc(var(--tab-bar) + var(--safe-bottom) + 10px);
  }
}

@media (max-width: 365px) {
  .hero .primary {
    padding-inline: 12px;
    font-size: 14px;
  }
  .hero p {
    max-width: 68%;
  }
  .hero-art {
    right: -6%;
  }
  .section-title h2 {
    font-size: 19px;
  }
}

.account-email {
  overflow-wrap: anywhere;
}
.auth-demo {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
}
.auth-demo strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  user-select: all;
}
.auth-message {
  color: var(--negative);
}
.auth-actions {
  flex-wrap: wrap;
  gap: 0 16px;
}

.game-tile {
  --tile-border: var(--line);
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
  background: var(--surface);
}
.game-tile.rated-today {
  --tile-border: #8eae84;
}
.game-tile .game-card {
  grid-template-columns: auto minmax(0, 1fr);
  border: 0;
  background: transparent;
}
.game-tile .card-art {
  position: relative;
}
.card-level {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  padding-inline: 3px;
  border: 1px solid var(--tile-border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.favorite-toggle {
  display: grid;
  width: 44px;
  height: 48px;
  place-items: center;
  margin-right: 6px;
  border-radius: 12px;
  color: var(--muted);
}
.favorite-toggle[aria-pressed="true"] {
  color: #80621f;
}
.favorite-toggle[aria-pressed="true"] svg {
  fill: #f0cb62;
}
.catalog-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 3px 9px;
  margin: 0 -3px var(--gap);
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.catalog-filters button {
  display: flex;
  min-height: var(--control);
  flex: none;
  align-items: center;
  gap: 7px;
  padding-inline: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}
.catalog-filters button[aria-pressed="true"] {
  border-color: #b6a4d1;
  background: var(--accent-soft);
  color: var(--accent);
}
.catalog-filters .ico {
  width: 16px;
  height: 16px;
}
.catalog-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--section) var(--gap);
}
.catalog-group h2,
.catalog-empty h2 {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.catalog-group .cards {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.catalog-empty {
  max-width: 620px;
}
#rating-preview {
  min-height: 1.45em;
}
.rating-earned {
  color: var(--positive);
  font-weight: 650;
}
.leaderboard-personal {
  display: flex;
  max-width: 840px;
  min-height: 128px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}
.leaderboard-score {
  margin-top: 6px;
  font-size: 44px;
  font-weight: 650;
  line-height: 1;
}
.leaderboard-place {
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.rating-rules {
  max-width: 840px;
  margin-block: 8px 12px;
}
.rating-rules summary {
  display: list-item;
  width: fit-content;
  min-height: 48px;
  padding-block: 12px;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.rating-rules p {
  padding-bottom: 10px;
}
.rating-sign-in {
  display: grid;
  justify-items: start;
  gap: 6px;
}
.rank-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: var(--gap);
}
.rank-pagination button {
  width: var(--control);
  padding: 0;
}
.rank-pagination button:disabled {
  opacity: 0.45;
}
@media (hover: hover) {
  .game-tile:hover {
    --tile-border: #a4af9f;
  }
  .game-tile.rated-today:hover {
    --tile-border: #6d9465;
  }
  .band:hover {
    border-color: #a4af9f;
  }
  .favorite-toggle:hover,
  .catalog-filters button:not([aria-pressed="true"]):hover {
    background: var(--page);
  }
}
@media (max-width: 660px) {
  .catalog-groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

body:has(.completion-shell) > header {
  display: none;
}
.round-verdict {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-block: 24px;
  text-align: center;
}
.round-verdict strong {
  font-size: clamp(24px, 6vw, 32px);
  letter-spacing: -0.035em;
}
.verdict-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 26px;
}
.verdict-mark .ico {
  width: 40px;
  height: 40px;
  stroke-width: 2;
}
.verdict-right {
  color: var(--positive);
}
.verdict-right .verdict-mark {
  background: #e4efdf;
}
.verdict-wrong {
  color: var(--negative);
}
.verdict-wrong .verdict-mark,
.verdict-mark.verdict-wrong {
  background: #fae9e5;
}
.answer-review {
  display: grid;
  gap: var(--gap);
}
.answer-review h1 {
  font-size: clamp(24px, 5vw, 32px);
  letter-spacing: -0.035em;
}
.answer-review .verdict-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}
.answer-review .verdict-mark .ico {
  width: 24px;
  height: 24px;
}
.review-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
.review-compare h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}
.review-shelf {
  gap: 3px;
  margin: 0;
}
.review-shelf .cell {
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
  padding: 1px;
  border-radius: 7px;
  font-size: clamp(13px, 4vw, 27px);
}
.review-figure {
  display: grid;
  justify-items: center;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.review-continue {
  justify-content: center;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}
main:has(.answer-review) {
  cursor: pointer;
  touch-action: manipulation;
}
@media (prefers-reduced-motion: no-preference) {
  .round-verdict {
    animation: verdict-arrive 230ms ease-out both;
  }
  .round-verdict .verdict-mark {
    animation: verdict-mark-arrive 290ms cubic-bezier(0.25, 0.8, 0.25, 1) both;
  }
}
@keyframes verdict-arrive {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes verdict-mark-arrive {
  from {
    transform: translateY(8px) scale(0.76);
  }
  to {
    transform: translateY(0) scale(1);
  }
}
.mobile-status,
.top nav a[href="#me"] {
  display: none;
}
.avatar[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.profile-settings {
  border: 1px solid var(--line);
  background: var(--surface);
}
.account-overview {
  display: flex;
  align-items: center;
  gap: var(--gap);
}
.account-overview > div {
  min-width: 0;
}
.account-overview .small {
  margin-top: 4px;
}
.profile-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  flex: none;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}
.personal-section {
  margin-top: var(--section);
}
.personal-section > h2 {
  margin-bottom: var(--gap);
  font-size: clamp(22px, 4vw, 29px);
  letter-spacing: -0.035em;
}
.guest-profile {
  max-width: 650px;
}
.guest-profile h2 {
  margin: 14px 0 8px;
}

@media (max-width: 660px),
  (max-width: 950px) and (hover: none) and (pointer: coarse) {
  html,
  body,
  dialog,
  .catalog-filters,
  .level-strip {
    scrollbar-width: none;
  }
  html::-webkit-scrollbar,
  body::-webkit-scrollbar,
  dialog::-webkit-scrollbar,
  .catalog-filters::-webkit-scrollbar,
  .level-strip::-webkit-scrollbar {
    display: none;
  }
  html.modal-page-locked {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .modal-page-locked body {
    position: fixed;
    inset: var(--modal-page-top) 0 auto;
    width: 100%;
    padding-top: var(--modal-header-height);
  }
  .modal-page-locked body > header {
    position: fixed;
    inset: 0 0 auto;
  }
  dialog {
    overscroll-behavior: contain;
  }
  body > header {
    position: sticky;
    top: 0;
    z-index: 4;
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .top {
    min-height: 64px;
    grid-template-columns: minmax(0, 1fr);
  }
  .top .brand,
  .top .avatar {
    display: none;
  }
  .mobile-status {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .header-metric {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    line-height: 1.15;
  }
  .header-metric strong {
    color: var(--ink);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .metric-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: none;
    place-items: center;
    border-radius: 9px;
  }
  .metric-icon .ico {
    width: 19px;
    height: 19px;
  }
  .metric-points {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .metric-streak {
    background: #f9edd3;
    color: #825815;
  }
  .top nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-inline: max(8px, env(safe-area-inset-left))
      max(8px, env(safe-area-inset-right));
  }
  .top nav a,
  .top nav a[href="#me"] {
    display: flex;
    padding-inline: 1px;
    font-size: 12px;
  }
  .top nav a.on,
  .top nav a:active {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .top nav .on .nav-icon {
    background: transparent;
  }
}
