@charset "UTF-8";

:root {
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: #23392f;
  background: #f5f7f2;
  font-synthesis: none;
  --green: #286346;
  --muted: #66756b;
  --line: #dce3d9;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button, input { border-radius: 12px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #d39127; outline-offset: 4px; }
[hidden] { display: none !important; }
.app { max-width: 1440px; min-height: 100svh; margin: auto; padding: max(24px, env(safe-area-inset-top)) max(36px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(36px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; font-size: 23px; font-weight: 800; letter-spacing: -.7px; }
.brand-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 40px; line-height: 1; font-weight: 400; }
.brand-note { display: block; font-size: 11px; font-weight: 500; letter-spacing: .3px; color: var(--muted); margin-top: 3px; }
.settings { display: flex; gap: 24px; }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; font-weight: 600; min-height: 44px; position: relative; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 1; cursor: pointer; }
.switch-track { width: 38px; height: 23px; border-radius: 20px; background: #b6c1b5; transition: background .15s; }
.switch-track::after { content: ""; display: block; width: 17px; height: 17px; margin: 3px; background: white; border-radius: 50%; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(15px); }
.switch input:focus-visible + .switch-track { outline: 3px solid #d39127; outline-offset: 4px; }
main { flex: 1; display: grid; align-items: center; }
.setup, .results { text-align: center; padding: 36px 0 20px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--muted); }
h1 { font-size: clamp(36px, 4.4vw, 58px); line-height: 1.12; letter-spacing: -2px; margin: 16px 0; }
.setup h1 span { color: var(--green); }
.intro { font-size: 17px; color: var(--muted); line-height: 1.7; margin: 18px 0 28px; }
.level-picker { border: none; display: flex; justify-content: center; gap: 20px; padding: 0; margin: 0 0 26px; }
.level-card { width: 265px; cursor: pointer; position: relative; text-align: left; }
.level-card input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 1; cursor: pointer; }
.level-content { display: flex; flex-direction: column; padding: 23px; border: 2px solid var(--line); border-radius: 18px; background: #fff9; position: relative; }
.level-card input:checked + .level-content { border-color: var(--green); background: #eaf1e6; }
.level-card input:focus-visible + .level-content { outline: 3px solid #d39127; outline-offset: 4px; }
.level-number { font-size: 40px; font-weight: 800; line-height: 1; color: var(--green); margin-bottom: 18px; }
.level-name { font-size: 17px; font-weight: 700; }
.level-description { font-size: 13px; color: var(--muted); margin-top: 7px; }
.selected-mark { position: absolute; right: 20px; top: 20px; background: var(--green); color: #fff; width: 24px; height: 24px; border-radius: 50%; text-align: center; opacity: 0; }
.level-card input:checked + .level-content .selected-mark { opacity: 1; }
.primary { border: 0; background: var(--green); color: #fff; padding: 15px 25px; font-weight: 700; min-height: 52px; }
.primary:hover { background: #1d4d36; }
.primary span { margin-left: 20px; }
.start-button { min-width: 240px; }
.setup-note { font-size: 12px; color: var(--muted); margin-top: 20px; }
footer { text-align: center; font-size: 11px; color: #798478; padding-top: 16px; }
footer span { color: #b29152; margin-left: 5px; }
.exercise { padding-top: 28px; padding-bottom: 8px; width: 100%; }
.round-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.round-heading h1 { font-size: 28px; letter-spacing: -.8px; margin: 7px 0 0; }
.round-actions { display: flex; gap: 8px; }
.quiet { border: 1px solid var(--line); color: var(--muted); background: transparent; min-height: 44px; padding: 10px 16px; font-size: 13px; font-weight: 600; }
.quiet:hover { background: #e9eee5; color: var(--green); }
.stats { margin-bottom: 22px; }
.progress-info { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.clock strong { font-size: 15px; color: #23392f; font-variant-numeric: tabular-nums; margin-left: 8px; }
progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 12px; overflow: hidden; background: #e2e8dd; color: var(--green); }
progress::-webkit-progress-bar { background: #e2e8dd; border-radius: 12px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 12px; transition: width .2s; }
progress::-moz-progress-bar { background: var(--green); border-radius: 12px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 24px; align-items: stretch; }
.table-panel { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.panel-heading h2 { font-size: 16px; margin: 0; }
.table-key { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.table-key i { width: 10px; height: 10px; border-radius: 3px; background: #f2cf75; }
.multiplication-table { border-collapse: separate; border-spacing: 4px; width: 100%; table-layout: fixed; font-variant-numeric: tabular-nums; }
.multiplication-table th, .multiplication-table td { text-align: center; height: clamp(28px, 3.5vw, 42px); border-radius: 6px; font-size: 14px; padding: 0; }
.multiplication-table th { color: var(--muted); font-size: 12px; font-weight: 600; background: #f5f7f2; }
.multiplication-table td { background: #f0f3ed; color: var(--green); font-weight: 700; }
.multiplication-table td.current { background: #f2cf75; color: #69511b; outline: 2px solid #d6ae4d; outline-offset: -2px; }
.multiplication-table td.solved { background: #dcebd7; }
.multiplication-table .active-axis { color: var(--green); background: #dcebd7; font-weight: 800; }
.table-note { color: var(--muted); font-size: 12px; text-align: center; margin: 20px 0 0; }
.table-note span { color: #a48647; margin-right: 6px; }
.answer-panel { background: #e9efe4; border: 1px solid #dce5d5; border-radius: 22px; padding: 22px 28px; text-align: center; display: grid; align-items: center; }
.answer-panel .eyebrow { font-size: 10px; }
.question { display: flex; justify-content: center; gap: 18px; font-size: 54px; line-height: 1.25; font-weight: 750; letter-spacing: -2px; margin: 7px 0 12px; font-variant-numeric: tabular-nums; }
.multiply { color: #7e927c; font-weight: 400; }
.answer-input { width: 100%; height: 65px; background: #fff; border: 2px solid #c7d4bf; text-align: center; font-size: 34px; font-weight: 700; color: var(--green); caret-color: var(--green); }
.answer-input::placeholder { color: #c1cbb9; }
.answer-input.correct { border-color: var(--green); background: #f3faef; }
.answer-input.incorrect { border-color: #b16a3c; }
.feedback { min-height: 19px; margin: 7px 0; font-size: 12px; color: #86542f; }
.feedback.success { color: var(--green); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 9px; }
.keypad button { min-height: 48px; border: 1px solid #dce3d5; background: #fff; box-shadow: 0 2px 0 #d4ddcc; color: #23392f; font-size: 22px; font-weight: 600; }
.keypad button:hover { background: #f4f8f0; }
.keypad button:active { transform: translateY(2px); box-shadow: none; }
.keypad .utility { background: #dce5d5; color: #566b50; font-size: 19px; }
.check-button { width: 100%; min-height: 46px; padding: 11px; font-size: 14px; }
.answer-help { color: var(--muted); font-size: 10px; margin: 11px 0 0; }
.pause-icon { font-size: 58px; color: var(--green); }
.pause-screen p { color: var(--muted); margin-bottom: 24px; }
.workspace.paused .multiplication-table { visibility: hidden; }
.result-icon { font-size: 54px; color: #b79137; margin-bottom: 20px; }
.results .eyebrow { display: block; }
.result-stats { display: flex; justify-content: center; gap: 56px; margin: 32px 0; }
.result-stats strong { display: block; font-size: 35px; color: var(--green); font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 12px; color: var(--muted); }
.results > .quiet { display: block; margin: 16px auto 0; border: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 761px) and (max-height: 800px) {
  .app { padding-top: 18px; }
  .exercise { padding-top: 20px; }
  .round-heading { margin-bottom: 14px; }
  .stats { margin-bottom: 16px; }
  .answer-panel { padding: 15px 24px; }
  .question { font-size: 46px; margin: 4px 0 8px; }
  .answer-input { height: 54px; }
  .keypad button { min-height: 44px; }
  .multiplication-table th, .multiplication-table td { height: 31px; }
  .table-panel { padding: 20px; }
  .panel-heading { margin-bottom: 14px; }
  .table-note { margin-top: 14px; }
  footer { padding-top: 10px; }
}

@media (max-width: 760px) {
  .app { padding: 18px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
  .topbar { flex-wrap: wrap; gap: 14px; }
  .settings { gap: 20px; }
  .setup { padding-top: 32px; }
  .level-picker { gap: 10px; }
  .level-card { width: 50%; }
  .level-content { padding: 18px 13px; min-height: 175px; }
  .level-name { font-size: 14px; }
  .level-description { font-size: 11px; }
  .selected-mark { right: 13px; top: 18px; }
  .intro { font-size: 15px; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .table-panel { padding: 16px 12px; }
  .table-note { display: none; }
  .multiplication-table { border-spacing: 3px; }
  .multiplication-table th, .multiplication-table td { height: 26px; font-size: 12px; }
  .round-heading { align-items: start; gap: 12px; }
  .round-heading h1 { font-size: 23px; }
  .round-heading .eyebrow { font-size: 8px; letter-spacing: 1px; }
  .round-actions { flex-direction: column; gap: 4px; }
  .round-actions .quiet { padding: 8px 10px; font-size: 11px; }
  .answer-panel { padding: 20px 26px; }
  .question { font-size: 48px; }
  .result-stats { gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
