:root {
  color-scheme: light;
  --background: #ecfaff;
  --surface: #ffffff;
  --warm: #fff7e2;
  --ink: #233247;
  --muted: #667085;
  --stroke: rgba(35, 50, 71, 0.16);
  --coral: #ff7378;
  --coral-dark: #d94e56;
  --blue: #5da6ff;
  --blue-dark: #377ed2;
  --yellow: #ffd95a;
  --green: #6dd081;
  --green-dark: #278c54;
  --purple: #9c7af7;
  --purple-dark: #7252c9;
  --shadow: 0 12px 32px rgba(35, 50, 71, 0.1);
  --max-width: 980px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(rgba(93, 166, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 208, 129, 0.09) 1px, transparent 1px),
    var(--background);
  background-size: 44px 44px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible + span {
  outline: 4px solid rgba(93, 166, 255, 0.34);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: 0;
}

.app-shell {
  width: min(var(--max-width), calc(100% - 32px));
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  margin: 0 auto;
}

.app-header {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 950;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.back-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
}

.icon-button:hover,
.back-button:hover {
  border-color: rgba(93, 166, 255, 0.52);
  background: white;
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 30px 0 26px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.app-footer a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.screen {
  padding: 12px 0 44px;
}

.loading-state {
  min-height: 65vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
}

.loading-mark {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  color: white;
  background: var(--coral);
  box-shadow: var(--shadow);
  font-size: 3.8rem;
  font-weight: 950;
  transform: rotate(4deg);
  animation: breathe 1.2s ease-in-out infinite alternate;
}

@keyframes breathe {
  to {
    transform: rotate(-3deg) scale(1.04);
  }
}

.eyebrow,
.game-kicker,
.question-kind {
  margin-bottom: 6px;
  color: var(--blue-dark);
  font-size: 0.77rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-intro {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.75fr);
  align-items: center;
  gap: 28px;
  padding: 34px 0 44px;
}

.home-intro h1 {
  max-width: 650px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.92;
}

.intro-copy {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  font-weight: 650;
}

.letter-board {
  width: min(100%, 340px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  justify-self: end;
  transform: rotate(2deg);
}

.letter-tile {
  display: grid;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  color: white;
  box-shadow: var(--shadow);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 950;
}

.letter-tile:nth-child(1) {
  transform: rotate(-5deg);
}

.letter-tile:nth-child(2) {
  transform: rotate(5deg);
}

.letter-tile:nth-child(3) {
  transform: rotate(3deg);
}

.letter-tile:nth-child(4) {
  transform: rotate(-4deg);
}

.tile-coral {
  background: var(--coral);
}

.tile-blue {
  background: var(--blue);
}

.tile-green {
  background: var(--green);
}

.tile-purple {
  background: var(--purple);
}

.progress-band,
.quick-start-band,
.resume-band,
.review-band,
.topic-progress-band,
.practice-panel,
.daily-band,
.question-stage,
.feedback-band,
.mistakes-panel {
  border: 2px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--shadow);
}

.progress-band,
.topic-progress-band,
.practice-panel {
  margin-bottom: 22px;
  padding: 26px;
}

.quick-start-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(190px, auto);
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px 26px;
  border-color: rgba(49, 156, 79, 0.46);
  background: rgba(255, 235, 198, 0.72);
}

.resume-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(190px, auto);
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px 26px;
  border-color: rgba(114, 82, 201, 0.44);
  background: rgba(237, 230, 255, 0.88);
}

.resume-band h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
}

.resume-band p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.resume-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--purple-dark);
  font-size: 1.8rem;
  font-weight: 950;
  transform: rotate(-5deg);
}

.resume-actions {
  min-width: 220px;
  display: grid;
  gap: 8px;
}

.resume-actions .text-button {
  justify-self: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.quick-start-band h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  line-height: 1.08;
}

.quick-start-band p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.quick-start-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green-dark);
  font-size: 1.8rem;
  font-weight: 950;
  transform: rotate(-4deg);
}

.quick-start-actions {
  min-width: 220px;
  display: grid;
  gap: 10px;
}

.quick-start-actions .secondary-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.quick-start-daily {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  align-items: center;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid rgba(49, 156, 79, 0.28);
}

.quick-start-daily > div {
  display: grid;
  gap: 4px;
}

.quick-start-daily strong {
  color: var(--ink);
  font-size: 1rem;
}

.quick-start-daily span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.topic-progress-band {
  border-color: rgba(109, 208, 129, 0.42);
}

.topic-progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}

.topic-progress-item {
  min-width: 0;
}

.topic-progress-item > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.topic-progress-item span {
  color: var(--muted);
  font-weight: 900;
}

.topic-progress-item progress {
  width: 100%;
  height: 9px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: rgba(102, 112, 133, 0.14);
  accent-color: var(--green-dark);
}

.topic-progress-item progress::-webkit-progress-bar {
  background: rgba(102, 112, 133, 0.14);
}

.topic-progress-item progress::-webkit-progress-value,
.topic-progress-item progress::-moz-progress-bar {
  border-radius: 6px;
  background: var(--green-dark);
}

.recommendation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px solid rgba(109, 208, 129, 0.24);
}

.recommendation-row strong {
  display: block;
}

.recommendation-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.review-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px 26px;
  border-color: rgba(230, 102, 82, 0.42);
  background: rgba(255, 235, 198, 0.72);
}

.review-band[hidden] {
  display: none;
}

.review-band h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 3.5vw, 1.8rem);
  line-height: 1.08;
}

.review-band p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.review-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--coral-dark);
  font-size: 1.8rem;
  font-weight: 950;
  transform: rotate(4deg);
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading h2,
.daily-band h2,
.mistakes-panel h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.06;
}

.stat-row,
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.reset-status {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.stat-item {
  min-width: 0;
  min-height: 108px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 14px 8px;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  background: white;
  text-align: center;
}

.stat-item strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.55rem, 4vw, 2.3rem);
  line-height: 1;
}

.stat-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat-green {
  border-color: rgba(109, 208, 129, 0.5);
  background: rgba(109, 208, 129, 0.14);
}

.stat-purple {
  border-color: rgba(156, 122, 247, 0.46);
  background: rgba(156, 122, 247, 0.12);
}

.stat-blue {
  border-color: rgba(93, 166, 255, 0.48);
  background: rgba(93, 166, 255, 0.12);
}

.stat-coral {
  border-color: rgba(255, 115, 120, 0.48);
  background: rgba(255, 115, 120, 0.12);
}

.control-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-group + .control-group {
  margin-top: 22px;
}

.control-group legend {
  margin-bottom: 10px;
  font-size: 0.86rem;
  font-weight: 950;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.topic-option,
.segmented-control label {
  min-width: 0;
  position: relative;
}

.topic-option input,
.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.topic-option span {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 10px 6px;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  text-align: center;
}

.topic-option strong {
  font-size: 1rem;
}

.topic-option small {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 750;
}

.topic-option input:checked + span {
  border-color: var(--blue-dark);
  color: white;
  background: var(--blue);
}

.topic-option input:checked + span small {
  color: white;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 24px 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  background: rgba(35, 50, 71, 0.05);
}

.segmented-control span {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
}

.segmented-control input:checked + span {
  color: var(--ink);
  background: white;
  box-shadow: 0 3px 10px rgba(35, 50, 71, 0.1);
}

.control-help {
  min-height: 36px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 650;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 950;
}

.primary-button {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border: 2px solid var(--blue-dark);
  color: white;
  background: var(--blue-dark);
  font-size: 1rem;
}

.primary-button:hover {
  background: #2e70bd;
}

.secondary-button {
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  background: white;
}

.secondary-button:hover {
  background: var(--warm);
}

.text-button {
  min-height: 40px;
  padding: 8px 2px;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.danger-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 2px solid var(--coral-dark);
  color: white;
  background: var(--coral-dark);
}

.daily-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "mark copy action"
    ". week week";
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  border-color: rgba(156, 122, 247, 0.44);
  background: rgba(156, 122, 247, 0.12);
}

.daily-mark {
  grid-area: mark;
}

.daily-copy {
  grid-area: copy;
}

.daily-band .secondary-button {
  grid-area: action;
}

.daily-week-block {
  grid-area: week;
  display: grid;
  gap: 8px;
}

.daily-week-block > strong {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.daily-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.daily-day {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.daily-day-weekday {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
}

.daily-day-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(48, 46, 43, 0.18);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 900;
}

.daily-day.is-completed .daily-day-mark {
  border-color: var(--green-dark);
  color: white;
  background: var(--green-dark);
}

.daily-day.is-today .daily-day-weekday {
  color: var(--blue-dark);
}

.daily-day.is-today .daily-day-mark {
  box-shadow: 0 0 0 2px var(--blue);
}

.daily-band p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.daily-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--purple);
  font-size: 1.8rem;
  font-weight: 950;
  transform: rotate(-4deg);
}

.game-screen {
  width: min(100%, 720px);
  margin: 0 auto;
}

.game-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.game-topbar p {
  margin-bottom: 1px;
}

.game-topbar strong {
  font-size: 1rem;
}

.game-counter {
  min-width: 86px;
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.game-counter span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 2px solid rgba(35, 50, 71, 0.1);
  border-radius: 8px;
  background: white;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: 6px;
  background: var(--green);
  transition: width 220ms ease;
}

.question-stage {
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 34px 28px;
  border: 3px solid rgba(255, 217, 90, 0.74);
  background: var(--warm);
  text-align: center;
}

.question-stage h1 {
  max-width: 650px;
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 5vw, 2.8rem);
  line-height: 1.15;
}

.hint-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-top: 14px;
  padding: 15px 18px;
  border: 2px solid rgba(255, 217, 90, 0.58);
  border-radius: 8px;
  background: rgba(255, 217, 90, 0.18);
}

.hint-band p {
  margin: 0;
  font-weight: 700;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.answer-button {
  min-width: 0;
  min-height: 92px;
  padding: 14px;
  border: 3px solid rgba(93, 166, 255, 0.46);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(93, 166, 255, 0.15);
  cursor: pointer;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 4vw, 2.1rem);
  font-weight: 950;
}

.answers.choice-mode {
  grid-template-columns: 1fr;
}

.choice-mode .answer-button {
  min-height: 90px;
  padding: 18px;
  font-size: clamp(1rem, 3vw, 1.28rem);
  line-height: 1.35;
}

.answer-button:hover:not(:disabled) {
  border-color: var(--blue-dark);
  background: rgba(93, 166, 255, 0.25);
  transform: translateY(-1px);
}

.answer-button:disabled {
  cursor: default;
}

.answer-button.is-correct {
  border-color: var(--green-dark);
  color: white;
  background: var(--green-dark);
}

.answer-button.is-wrong {
  border-color: var(--coral-dark);
  color: white;
  background: var(--coral-dark);
}

.answer-button.is-muted {
  border-color: var(--stroke);
  color: var(--muted);
  background: white;
}

.unknown-button {
  width: 100%;
  margin-top: 12px;
}

.feedback-band {
  margin-top: 16px;
  padding: 18px 20px;
}

.feedback-band.is-correct {
  border-color: rgba(39, 140, 84, 0.54);
  background: rgba(109, 208, 129, 0.15);
}

.feedback-band.is-wrong {
  border-color: rgba(217, 78, 86, 0.5);
  background: rgba(255, 115, 120, 0.14);
}

.feedback-title {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.feedback-band p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.game-screen > .primary-button {
  margin-top: 16px;
}

.results-screen {
  width: min(100%, 760px);
  margin: 0 auto;
}

.result-heading {
  display: grid;
  justify-items: center;
  padding: 20px 0 14px;
  text-align: center;
}

.result-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 0.95;
}

.result-heading p:last-child {
  max-width: 560px;
  color: var(--muted);
  font-weight: 700;
}

.result-medal {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 4px solid white;
  border-radius: 8px;
  color: white;
  background: var(--yellow);
  box-shadow: var(--shadow);
  font-size: 2.5rem;
  transform: rotate(4deg);
}

.result-score {
  display: grid;
  justify-items: center;
  margin-bottom: 16px;
  padding: 22px;
  border: 3px solid rgba(255, 217, 90, 0.74);
  border-radius: 8px;
  background: var(--warm);
}

.result-score strong {
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 0.9;
}

.result-score span {
  color: var(--muted);
  font-weight: 850;
}

.result-stats {
  margin-bottom: 20px;
}

.leaderboard-panel {
  margin: 20px 0;
  padding: 22px;
  border: 2px solid rgba(255, 217, 90, 0.72);
  border-radius: 8px;
  background: var(--warm);
}

.leaderboard-panel[hidden] {
  display: none;
}

.leaderboard-note {
  margin: -10px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: white;
}

.leaderboard-rank,
.leaderboard-time,
.leaderboard-score {
  font-weight: 950;
}

.leaderboard-entry:first-child .leaderboard-rank {
  color: var(--green-dark);
}

.leaderboard-result {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leaderboard-result small,
.leaderboard-score {
  color: var(--muted);
  font-size: 0.76rem;
}

.leaderboard-time {
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}

.mistakes-panel {
  margin: 20px 0;
  padding: 22px;
  border-color: rgba(255, 115, 120, 0.42);
}

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

.mistake-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--stroke);
}

.mistake-item:first-child {
  border-top: 0;
}

.mistake-badge {
  min-width: 48px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 6px;
  color: white;
  background: var(--coral);
  font-size: 0.74rem;
  font-weight: 950;
}

.mistake-item strong {
  display: block;
  margin-bottom: 3px;
}

.mistake-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.share-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.result-home-button {
  justify-self: center;
}

dialog {
  width: min(430px, calc(100% - 32px));
  padding: 0;
  border: 2px solid var(--stroke);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  box-shadow: 0 30px 90px rgba(35, 50, 71, 0.28);
}

dialog::backdrop {
  background: rgba(35, 50, 71, 0.38);
}

dialog form {
  padding: 24px;
}

dialog h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
}

dialog p {
  color: var(--muted);
  font-weight: 650;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 24px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, var(--max-width));
  }

  .home-intro {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 20px 0 32px;
  }

  .home-intro h1 {
    font-size: clamp(3rem, 15vw, 4.8rem);
  }

  .letter-board {
    width: 100%;
    max-width: none;
    aspect-ratio: 2.35 / 1;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    justify-self: stretch;
  }

  .letter-tile {
    font-size: clamp(1.2rem, 6vw, 2rem);
  }

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

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .settings-grid .control-group + .control-group {
    margin-top: 0;
  }
}

@media (max-width: 520px) {
  .app-header {
    min-height: 68px;
    padding: 10px 0;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .brand span {
    font-size: 1rem;
  }

  .screen {
    padding-top: 8px;
  }

  .progress-band,
  .resume-band,
  .practice-panel {
    padding: 18px;
  }

  .review-band {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 18px;
  }

  .quick-start-band {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 18px;
  }

  .resume-band {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 18px;
  }

  .resume-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .resume-actions .primary-button {
    width: 100%;
  }

  .resume-mark {
    width: 48px;
    height: 48px;
  }

  .quick-start-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .quick-start-actions button {
    width: 100%;
  }

  .quick-start-daily {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-start-daily .secondary-button {
    width: 100%;
  }

  .quick-start-mark {
    width: 48px;
    height: 48px;
  }

  .review-band .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .review-mark {
    width: 48px;
    height: 48px;
  }

  .topic-progress-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-row {
    grid-template-columns: 1fr;
  }

  .recommendation-row .secondary-button {
    width: 100%;
  }

  .section-heading {
    margin-bottom: 16px;
  }

  .stat-row,
  .result-stats {
    gap: 6px;
  }

  .stat-item {
    min-height: 94px;
    padding: 10px 4px;
  }

  .stat-item strong {
    font-size: clamp(1.3rem, 7vw, 1.9rem);
  }

  .stat-item span {
    font-size: 0.67rem;
  }

  .leaderboard-entry {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .leaderboard-score {
    grid-column: 2 / -1;
  }

  .daily-band {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "mark copy"
      "week week"
      "action action";
    padding: 18px;
  }

  .daily-band .secondary-button {
    width: 100%;
  }

  .daily-week {
    gap: 3px;
  }

  .daily-day-mark {
    width: 32px;
    height: 32px;
  }

  .daily-mark {
    width: 48px;
    height: 48px;
  }

  .question-stage {
    min-height: 210px;
    padding: 28px 18px;
  }

  .answers {
    gap: 8px;
  }

  .answer-button {
    min-height: 82px;
    padding: 10px;
  }

  .game-counter {
    min-width: 66px;
  }

  .game-topbar {
    gap: 9px;
  }

  .app-footer {
    gap: 12px;
    padding-top: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Local round history is a modal reader; the underlying round is untouched. */
#history-dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 24px; overflow-y: auto; }
#history-content { display: grid; gap: 16px; overflow-wrap: anywhere; }
.history-list { display: grid; gap: 12px; }
.history-entry { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 6px; width: 100%; }
.history-answer, .history-confirm { padding: 16px 0; border-top: 1px solid currentColor; }
.history-answer p { margin-block: 10px; }
.history-filter { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.history-filter input { width: 22px; height: 22px; }
