:root {
  --maroon: #7f2020;
  --maroon-2: #9b2a2a;
  --sage: #869b7e;
  --sage-2: #6f8468;
  --earth: #c9caac;
  --vintage: #f6f3eb;
  --paper: #fffdf7;
  --ink: #211d1b;
  --muted: #716b62;
  --line: rgba(127, 32, 32, .18);
  --shadow: 0 22px 70px rgba(42, 31, 24, .15);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(246, 243, 235, .95), rgba(201, 202, 172, .5)),
    var(--vintage);
  color: var(--ink);
}

body::before {
  background: linear-gradient(90deg, var(--maroon), var(--sage), var(--earth), var(--vintage));
  content: "";
  display: block;
  height: 5px;
}

button, input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
}

button:hover:not(:disabled) {
  border-color: var(--maroon);
  color: var(--maroon);
}

button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.primary {
  background: var(--maroon);
  border-color: var(--maroon);
  color: var(--vintage);
}

.login-screen {
  align-items: center;
  background:
    linear-gradient(145deg, rgba(33, 29, 27, .92), rgba(127, 32, 32, .82) 46%, rgba(134, 155, 126, .72)),
    var(--vintage);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.login-screen.is-hidden {
  display: none;
}

.login-card {
  backdrop-filter: blur(18px);
  background: rgba(246, 243, 235, .9);
  border: 1px solid rgba(246, 243, 235, .32);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(20, 13, 10, .35);
  display: grid;
  gap: 13px;
  max-width: 390px;
  overflow: hidden;
  padding: 26px;
  position: relative;
  width: 100%;
}

.login-card::before {
  background: linear-gradient(90deg, var(--maroon), var(--sage), var(--earth));
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.login-mark {
  align-items: center;
  background: var(--maroon);
  border-radius: 8px;
  color: var(--vintage);
  display: flex;
  font-size: 1.65rem;
  font-weight: 950;
  height: 52px;
  justify-content: center;
  margin-bottom: 6px;
  width: 52px;
}

.login-card h1 {
  font-size: clamp(2.1rem, 9vw, 3.2rem);
  line-height: .95;
}

.login-copy, .login-error {
  color: var(--muted);
  line-height: 1.45;
}

.login-error {
  color: var(--maroon);
  font-weight: 850;
  min-height: 20px;
}

.login-card label {
  color: var(--muted);
  display: grid;
  font-size: .88rem;
  font-weight: 850;
  gap: 6px;
}

.login-fields {
  display: grid;
  gap: 10px;
}

.login-card input {
  background: rgba(255, 253, 247, .72);
  border: 1px solid rgba(127, 32, 32, .18);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
}

.login-card input:focus {
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(127, 32, 32, .1);
  outline: 0;
}


.app-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 260px) minmax(430px, 1fr) minmax(300px, 340px);
  min-height: calc(100vh - 5px);
  padding: 18px;
}

.rail, .arena, .coach {
  min-width: 0;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-card, .score-card, .game-tab, .coach-card, .arena {
  background: rgba(255, 253, 247, .82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(42, 31, 24, .07);
}

.profile-card {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.avatar {
  align-items: center;
  background: var(--maroon);
  border-radius: 8px;
  color: var(--vintage);
  display: flex;
  font-size: 1.45rem;
  font-weight: 950;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.kicker {
  color: var(--maroon);
  font-size: .72rem;
  font-weight: 950;
  letter-spacing: .12em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

.profile-card h1 {
  font-size: 1.65rem;
  line-height: 1;
}

.profile-card span, small {
  color: var(--muted);
  font-size: .8rem;
}

.score-card {
  padding: 14px;
}

.score-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.score-row span {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.meter {
  background: rgba(201, 202, 172, .55);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.meter span {
  background: linear-gradient(90deg, var(--maroon), var(--sage-2));
  display: block;
  height: 100%;
  width: 0;
}

.stat-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.stat-grid div {
  background: rgba(246, 243, 235, .9);
  border: 1px solid rgba(134, 155, 126, .26);
  border-radius: 8px;
  padding: 9px;
}

.stat-grid strong, .stat-grid span {
  display: block;
}

.stat-grid span {
  color: var(--muted);
  font-size: .72rem;
  margin-top: 2px;
}

.game-nav {
  display: grid;
  gap: 8px;
}

.game-tab {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  height: auto;
  padding: 13px;
  text-align: left;
}

.game-tab span {
  font-size: .95rem;
}

.game-tab.is-active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: var(--vintage);
}

.game-tab.is-active small {
  color: rgba(246, 243, 235, .78);
}

.arena {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
}

.arena-head {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.arena-head h2 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  letter-spacing: 0;
  line-height: .92;
}

#status {
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.35;
  margin-top: 8px;
}

.controls, .segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.controls .primary, .segmented .is-active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: var(--vintage);
}

.game-view {
  display: none;
  min-height: 0;
}

.game-view.is-active {
  display: block;
}

.versus {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 auto 12px;
  max-width: 680px;
}

.player-card {
  align-items: center;
  background: rgba(246, 243, 235, .88);
  border: 1px solid rgba(127, 32, 32, .15);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 14px 1fr auto;
  padding: 10px 12px;
}

.player-card strong, .player-card small {
  display: block;
}

.player-card b {
  color: var(--maroon);
}

.side-dot {
  border-radius: 999px;
  height: 14px;
  width: 14px;
}

.bot .side-dot { background: #1f1b18; }
.ego .side-dot { background: var(--paper); border: 2px solid var(--maroon); }

.board-frame {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 22px;
  margin: 0 auto;
  max-width: min(620px, 100%);
  width: 100%;
}

.rank-labels, .file-labels {
  color: rgba(33, 29, 27, .58);
  font-size: .72rem;
  font-weight: 900;
}

.rank-labels {
  display: grid;
  grid-row: 1;
  grid-template-rows: repeat(8, 1fr);
  padding-right: 6px;
  text-align: right;
}

.rank-labels span {
  align-self: center;
}

.file-labels {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: repeat(8, 1fr);
  padding-top: 5px;
  text-align: center;
}

.chess-board {
  aspect-ratio: 1;
  background: #342822;
  border: 10px solid #342822;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  overflow: hidden;
  width: 100%;
}

.square {
  align-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  display: flex;
  height: 100%;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: relative;
  width: 100%;
}

.square.light { background: var(--earth); }
.square.dark { background: var(--sage); }

.piece {
  align-items: center;
  border: 2px solid rgba(33, 29, 27, .18);
  border-radius: 999px;
  display: flex;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 4.2vw, 2.45rem);
  font-weight: 900;
  height: 76%;
  justify-content: center;
  line-height: 1;
  max-height: 50px;
  max-width: 50px;
  pointer-events: none;
  width: 76%;
}

.piece.white {
  background: linear-gradient(145deg, #fffef8, #e7dcc9);
  color: var(--maroon);
  box-shadow: inset 0 -5px 10px rgba(127, 32, 32, .08), 0 5px 10px rgba(35, 28, 23, .14);
}

.piece.black {
  background: linear-gradient(145deg, #372d28, #181411);
  color: var(--earth);
  box-shadow: inset 0 5px 10px rgba(255, 255, 255, .06), 0 5px 10px rgba(35, 28, 23, .22);
}

.square.selected {
  box-shadow: inset 0 0 0 4px var(--maroon);
}

.square.legal::after {
  background: rgba(127, 32, 32, .36);
  border-radius: 999px;
  content: "";
  height: 20%;
  position: absolute;
  width: 20%;
}

.square.capture::after {
  background: transparent;
  border: 5px solid rgba(127, 32, 32, .72);
  height: 76%;
  width: 76%;
}

.square.last {
  box-shadow: inset 0 0 0 999px rgba(246, 243, 235, .24);
}

.square.check {
  background: var(--maroon);
}

.coach {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coach-card {
  padding: 14px;
}

.coach-card h2 {
  font-size: .98rem;
}

.audio-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.audio-heading span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
}

.audio-controls {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  margin-top: 10px;
}

.composer-select {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  margin-top: 10px;
  min-height: 40px;
  padding: 0 10px;
  width: 100%;
}

.audio-controls input[type="range"] {
  accent-color: var(--maroon);
  width: 100%;
}

.coach-title {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

#evalBadge {
  background: rgba(134, 155, 126, .22);
  border: 1px solid rgba(134, 155, 126, .45);
  border-radius: 8px;
  color: var(--maroon);
  font-size: .82rem;
  font-weight: 950;
  padding: 5px 8px;
  white-space: nowrap;
}

#coachAdvice {
  font-size: .95rem;
  line-height: 1.48;
  margin-top: 12px;
}

.note {
  background: rgba(201, 202, 172, .28);
  border: 1px solid rgba(134, 155, 126, .32);
  border-radius: 8px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.4;
  margin-top: 12px;
  min-height: 48px;
  padding: 10px;
}

.tips, .moves {
  color: var(--muted);
  display: grid;
  font-size: .88rem;
  gap: 7px;
  line-height: 1.35;
  margin: 10px 0 0;
  padding-left: 19px;
}

.moves {
  max-height: 190px;
  overflow: auto;
}

.move-card {
  min-height: 0;
}

.sudoku-board, .reversi-board, .memory-board, .iq-layout, .logic-layout {
  margin: 20px auto 0;
  max-width: min(560px, 100%);
}

.sudoku-board {
  aspect-ratio: 1;
  border: 8px solid #342822;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.sudoku-cell {
  align-items: center;
  background: var(--paper);
  border: 1px solid rgba(127, 32, 32, .25);
  color: var(--maroon);
  display: flex;
  font-size: clamp(1.8rem, 9vw, 4rem);
  font-weight: 950;
  justify-content: center;
}

.sudoku-cell input {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: inherit;
  font-weight: 900;
  height: 100%;
  text-align: center;
  width: 100%;
}

.sudoku-cell.fixed {
  background: var(--maroon);
  color: var(--vintage);
}

.sudoku-cell:nth-child(2n), .sudoku-cell:nth-child(n+9):nth-child(-n+12) {
  background: rgba(201, 202, 172, .36);
}

.reversi-board, .memory-board {
  aspect-ratio: 1;
  display: grid;
  gap: 8px;
}

.reversi-board {
  grid-template-columns: repeat(4, 1fr);
}

.rev-cell, .memory-cell {
  align-items: center;
  background: var(--sage);
  border: 1px solid rgba(33, 29, 27, .15);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 64px;
}

.rev-cell.legal {
  box-shadow: inset 0 0 0 4px rgba(127, 32, 32, .55);
}

.disc {
  border-radius: 999px;
  height: 58%;
  width: 58%;
}

.disc.ego { background: var(--paper); border: 3px solid var(--maroon); }
.disc.bot { background: #211d1b; }

.mini-score {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.mini-score span {
  background: rgba(246, 243, 235, .88);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 850;
  padding: 8px 12px;
}

.memory-board {
  grid-template-columns: repeat(3, 1fr);
}

.memory-cell {
  background: var(--earth);
  color: var(--maroon);
  font-size: 2rem;
  font-weight: 950;
}

.memory-cell.active, .memory-cell.done {
  background: var(--maroon);
  color: var(--vintage);
}

.memory-board .primary {
  grid-column: 1 / -1;
}

.dashboard-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px auto 0;
  max-width: min(760px, 100%);
}

.insight-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.2fr .8fr;
  margin: 12px auto 0;
  max-width: min(760px, 100%);
}

.insight-card, .focus-panel {
  background: rgba(246, 243, 235, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.insight-card h3, .focus-panel h3 {
  font-size: 1.2rem;
  margin: 0 0 12px;
}

.trend-chart {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(8, 1fr);
  height: 140px;
}

.trend-bar {
  background: linear-gradient(180deg, var(--sage), var(--maroon));
  border-radius: 8px 8px 0 0;
  min-height: 10px;
}

.badge-list {
  display: grid;
  gap: 8px;
}

.badge {
  background: var(--paper);
  border: 1px solid rgba(127, 32, 32, .14);
  border-radius: 8px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 850;
  padding: 10px;
}

.badge.is-earned {
  background: var(--maroon);
  color: var(--vintage);
}

.daily-list {
  display: grid;
  gap: 12px;
  margin: 18px auto 0;
  max-width: min(760px, 100%);
}

.daily-item {
  align-items: center;
  background: rgba(246, 243, 235, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  padding: 14px;
}

.daily-item strong, .daily-item span {
  display: block;
}

.daily-item span {
  color: var(--muted);
  font-size: .86rem;
  margin-top: 4px;
}

.dash-card {
  background: rgba(246, 243, 235, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 148px;
  padding: 16px;
}

.dash-card span {
  color: var(--maroon);
  display: block;
  font-size: .78rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dash-card strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
  margin-top: 8px;
}

.dash-card p {
  color: var(--muted);
  line-height: 1.4;
  margin-top: 10px;
}

.lesson-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 420px) minmax(240px, 1fr);
  margin: 18px auto 0;
  max-width: min(780px, 100%);
}

.lesson-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px auto 0;
  max-width: min(780px, 100%);
}

.lesson-legend span {
  align-items: center;
  background: rgba(246, 243, 235, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex;
  font-size: .88rem;
  font-weight: 850;
  gap: 8px;
  padding: 8px 10px;
}

.legend-piece {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-style: normal;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.ego-piece {
  background: var(--paper);
  border: 2px solid var(--maroon);
  color: var(--maroon);
}

.bot-piece {
  background: #211d1b;
  color: var(--earth);
}

.lesson-board {
  aspect-ratio: 1;
  background: #342822;
  border: 8px solid #342822;
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
}

.lesson-tile {
  align-items: center;
  background: var(--earth);
  border-bottom: 1px solid rgba(52, 40, 34, .28);
  border-right: 1px solid rgba(52, 40, 34, .28);
  display: flex;
  font-size: clamp(1.3rem, 5vw, 2.4rem);
  font-weight: 950;
  justify-content: center;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(255, 255, 255, .35);
}

.lesson-tile .lesson-piece {
  align-items: center;
  border-radius: 999px;
  display: flex;
  font-family: Georgia, "Times New Roman", serif;
  height: 54%;
  justify-content: center;
  max-height: 58px;
  max-width: 58px;
  width: 54%;
}

.lesson-tile .lesson-piece.ego {
  background: var(--paper);
  border: 2px solid var(--maroon);
  color: var(--maroon);
}

.lesson-tile .lesson-piece.bot {
  background: #211d1b;
  color: var(--earth);
}

.lesson-tile:nth-child(2n) {
  background: var(--sage);
}

.lesson-tile:nth-child(4n) {
  border-right: 0;
}

.lesson-tile:nth-child(n+13) {
  border-bottom: 0;
}

.lesson-panel {
  background: rgba(246, 243, 235, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.lesson-panel span {
  color: var(--maroon);
  font-size: .8rem;
  font-weight: 950;
}

.lesson-panel h3 {
  font-size: 1.6rem;
  line-height: 1;
  margin: 10px 0;
}

.lesson-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.lesson-choices {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.iq-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.iq-cat.is-active {
  background: var(--maroon);
  border-color: var(--maroon);
  color: var(--vintage);
}

.focus-panel {
  display: grid;
  justify-items: center;
  line-height: 1.45;
  margin: 32px auto 0;
  max-width: 520px;
  text-align: center;
}

.focus-ring {
  align-items: center;
  background: var(--maroon);
  border: 10px solid rgba(201, 202, 172, .7);
  border-radius: 999px;
  color: var(--vintage);
  display: flex;
  font-size: clamp(2.2rem, 12vw, 4.4rem);
  font-weight: 950;
  height: 190px;
  justify-content: center;
  width: 190px;
}

.focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.promotion-dialog {
  align-items: center;
  background: rgba(33, 29, 27, .42);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 30;
}

.app-modal {
  align-items: center;
  background: rgba(33, 29, 27, .46);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 35;
}

.app-modal.is-open {
  display: flex;
}

.modal-card {
  background: rgba(255, 253, 247, .96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 520px;
  padding: 20px;
  width: 100%;
}

.modal-card h2 {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  line-height: .95;
  margin: 0 0 10px;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.45;
}

.modal-stats,
.full-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.modal-stat {
  background: rgba(201, 202, 172, .24);
  border: 1px solid rgba(134, 155, 126, .28);
  border-radius: 8px;
  padding: 10px;
}

.modal-stat strong,
.modal-stat span {
  display: block;
}

.modal-stat span {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 3px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.promotion-dialog.is-open {
  display: flex;
}

.promotion-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  width: min(360px, 100%);
}

.promotion-card h2 {
  font-size: 1.2rem;
  margin: 0 0 12px;
}

.promotion-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, 1fr);
}

.promotion-options button {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  min-height: 64px;
}

.iq-layout {
  display: grid;
  gap: 14px;
}

.iq-topline {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: .9rem;
  font-weight: 850;
  justify-content: space-between;
}

.iq-question, .iq-result {
  background: rgba(246, 243, 235, .88);
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
  padding: 16px;
}

.iq-question strong {
  color: var(--maroon);
}

.iq-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.iq-options button {
  min-height: 58px;
  white-space: normal;
}

.iq-result {
  display: none;
}

.iq-result.is-visible {
  display: block;
}

.iq-result h3 {
  font-size: 1.6rem;
  line-height: 1;
  margin: 0 0 10px;
}

.iq-review {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.iq-review div {
  background: var(--paper);
  border: 1px solid rgba(127, 32, 32, .12);
  border-radius: 8px;
  padding: 10px;
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 230px minmax(420px, 1fr);
  }

  .coach {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding: 12px;
  }

  .rail, .arena, .coach {
    margin-bottom: 12px;
  }

  .game-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .arena {
    padding: 12px;
  }

  .arena-head {
    align-items: start;
    flex-direction: column;
  }

  .arena-head h2 {
    font-size: 2.45rem;
  }

  .controls {
    justify-content: start;
    width: 100%;
  }

  .controls button {
    flex: 1;
  }

  .versus {
    grid-template-columns: 1fr;
  }

  .board-frame {
    grid-template-columns: 18px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 18px;
  }

  .chess-board {
    border-width: 6px;
  }

  .piece {
    font-size: clamp(1rem, 7vw, 2rem);
    height: 72%;
    width: 72%;
  }

  .coach {
    display: block;
  }

  .coach-card {
    margin-bottom: 12px;
  }

  .iq-options {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .lesson-layout,
  .insight-row {
    grid-template-columns: 1fr;
  }

  .login-fields {
    grid-template-columns: 1fr;
  }

  .daily-item {
    grid-template-columns: 1fr;
  }

  .modal-stats,
  .full-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 8px;
  }

  .arena {
    padding: 10px;
  }

  .game-nav {
    grid-template-columns: 1fr;
  }

  .board-frame {
    grid-template-columns: 16px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 16px;
  }

  .rank-labels, .file-labels {
    font-size: .62rem;
  }
}
