:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f6efdc;
  --paper-light: #f8f0de;
  --surface: #fffcf3;
  --ink: #243126;
  --muted: #515b4c;
  --line: #ded4bd;
  --benetton: #008c45;
  --accent: #00753d;
  --accent-dark: #00582f;
  --soft: #e7efe0;
  --green: #005b31;
  --green-bg: #e5f1e4;
  --error: #574939;
  --error-bg: #ede1cb;
  --radius: 18px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  background-image:
    radial-gradient(ellipse at 78% 0%, #fff9e9 0, transparent 58%),
    radial-gradient(ellipse at 4% 90%, #eadbbd 0, transparent 66%),
    repeating-linear-gradient(0deg, #72562c06 0 1px, transparent 1px 5px);
}
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-underline-offset: .2em; }
button, select, input { font: inherit; }
button, select, input[type='checkbox'] { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a, select, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--benetton); outline-offset: 3px; }
.skip { position: fixed; top: -5rem; left: 1rem; z-index: 9; background: white; padding: .75rem; }
.skip:focus { top: 1rem; }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; min-height: 100dvh; padding: 32px 17px 22px; background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; overflow: auto; }
.brand { display: inline-flex; gap: 11px; align-items: center; margin: 0 8px 44px; font-size: 21px; font-weight: 800; letter-spacing: -.055em; color: var(--ink); text-decoration: none; width: fit-content; }
.brand-mark { display: grid; grid-auto-flow: column; align-content: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 13px; background: var(--accent); color: white; font: 800 27px/1 Georgia, serif; }
.brand-mark span { color: #cbeacf; }
.brand-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .21em; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { padding: 11px 12px; display: flex; align-items: center; gap: 12px; min-height: 44px; border-radius: 10px; white-space: nowrap; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.sidebar nav a span { width: 20px; text-align: center; font: 20px/1 system-ui, sans-serif; color: var(--accent-dark); }
.sidebar nav a:hover { background: var(--paper-light); }
.sidebar nav a[aria-current] { color: var(--accent-dark); background: var(--soft); }
.sidebar nav a[aria-current] span { color: var(--accent); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin: auto 9px 0; padding-top: 28px; font-size: 11px; font-weight: 650; color: var(--muted); }
.sidebar-foot i { width: 7px; height: 7px; border-radius: 100%; background: var(--benetton); }
main { min-width: 0; outline: none; }
.topbar { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px clamp(20px, 5vw, 68px); border-bottom: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); font-weight: 650; }
.profile-switch { display: flex; align-items: center; gap: 9px; }
.profile-switch select { width: auto; min-height: 36px; max-width: 170px; padding: 6px 8px; border-color: transparent; background: transparent; font-size: 13px; }
.avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--accent-dark); background: var(--soft); font-size: 11px; font-weight: 800; }
#view, .message { width: min(100%, 1210px); margin-inline: auto; }
#view { padding: clamp(23px, 4vw, 53px) clamp(18px, 5vw, 68px) 70px; }
.message { padding: 10px clamp(18px, 5vw, 68px) 0; color: var(--accent-dark); font-weight: 650; font-size: 14px; }
.message.error { color: var(--error); }
.loading, .muted, small { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.09; letter-spacing: -.053em; }
h2 { font-size: 22px; line-height: 1.22; letter-spacing: -.034em; }
h3 { font-size: 17px; letter-spacing: -.025em; }
p { line-height: 1.55; }
.page-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 14px; margin-bottom: 25px; }
.page-heading p { color: var(--muted); margin-top: 8px; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 285px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(140px, .85fr); align-items: center; padding: clamp(25px, 4vw, 48px); border-radius: 24px; background: #005b33; background-image: radial-gradient(ellipse at 90% 12%, var(--benetton), transparent 59%), linear-gradient(111deg, #004b2b 5%, #006438 100%); color: #fff; }
.hero h2 { font-size: clamp(30px, 4vw, 49px); line-height: 1.04; letter-spacing: -.055em; max-width: 13ch; }
.hero p { color: #e5f2e4; margin: 13px 0 22px; max-width: 35ch; }
.hero .button { background: var(--surface); color: var(--accent-dark); border-color: var(--surface); }
.hero .button:hover { background: #edf5e8; }
.hero .button.outline { color: #fff; background: transparent; border-color: #ffffff80; }
.hero .button.outline:hover { background: #ffffff20; }
.hero-art { position: relative; height: 200px; display: grid; place-items: center; }
.hero-art::before, .hero-art::after { content: ''; width: min(100%, 280px); aspect-ratio: 1; border-radius: 50%; border: 1px solid #ffffff28; position: absolute; z-index: -1; }
.hero-art::after { width: min(80%, 222px); }
.flashcard { position: absolute; display: grid; align-content: center; justify-items: center; width: clamp(92px, 12vw, 141px); aspect-ratio: .87; border-radius: 17px; font-weight: 750; box-shadow: 0 12px 24px #002a1850; }
.flashcard b { font: bold clamp(32px, 6vw, 61px)/1 Georgia, serif; }
.flashcard small { margin-top: 7px; color: inherit; font-size: clamp(9px, 1vw, 12px); }
.flashcard:first-child { background: #f8efd8; color: var(--accent-dark); transform: translate(-28%, -8%) rotate(-15deg); }
.flashcard:last-child { background: #d5ebd6; color: #004b2b; transform: translate(36%, 7%) rotate(13deg); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-block: 17px 27px; }
.metric, .panel, .session, .language-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { padding: 18px; display: grid; gap: 4px; }
.metric b { font-size: 26px; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric span { font-size: 12px; font-weight: 650; color: var(--muted); }
.metric i { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 6px; border-radius: 10px; font: 20px/1 system-ui, sans-serif; color: var(--accent-dark); background: var(--soft); }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; }
.panel { padding: clamp(15px, 2.5vw, 24px); margin-bottom: 15px; }
.panel > h2, .panel > h3 { margin-bottom: 12px; }
.panel > p + p, .panel > p + .actions { margin-top: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.section-head a { font-weight: 650; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 10px; padding: 9px 15px; font-size: 14px; line-height: 1.2; font-weight: 700; text-decoration: none; text-align: center; }
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.alt { color: var(--accent-dark); background: var(--soft); border-color: #cddfcb; }
.button.alt:hover { background: #dcebdd; }
.button.outline { color: var(--accent-dark); background: var(--surface); border-color: #b6cdb6; }
.button.outline:hover { background: #f0f5e9; }
.button[aria-pressed='true'] { background: var(--accent-dark); color: #fff; }
.button.small { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.pill { display: inline-flex; align-items: center; max-width: 100%; border-radius: 30px; padding: 4px 9px; font-weight: 700; font-size: 11px; background: var(--soft); color: var(--accent-dark); }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.bad { background: var(--error-bg); color: var(--error); }
.languages { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.pair { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.pair > label { min-width: 132px; flex: 1; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); align-items: end; gap: 12px; }
label.field, .pair > label { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
select, input:not([type='checkbox']) { width: 100%; min-height: 43px; padding: 9px 10px; color: var(--ink); background: #fffdf7; border: 1px solid #c7c3ae; border-radius: 9px; }
input[type='checkbox'] { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.checkbox { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; font-size: 13px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { font-weight: 750; margin-bottom: 9px; }
.form-stack { display: grid; gap: 17px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 9px; }
.choice-row label { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--paper-light); padding: 6px 10px; border-radius: 10px; font-size: 13px; }
.language-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); gap: 10px; }
.language-tile { padding: 13px; border-radius: 12px; }
.language-tile select { min-height: 35px; }
.game-wrap { max-width: 770px; margin: 0 auto; }
.game-question { text-align: center; padding: clamp(23px, 5vw, 44px) 17px; background: var(--paper-light); border: 1px solid var(--line); border-radius: 20px; margin-bottom: 14px; }
.game-question .direction { font-size: 13px; font-weight: 750; color: var(--accent-dark); }
.game-question h2 { font-size: clamp(34px, 8vw, 67px); line-height: 1.1; margin: 10px 0; overflow-wrap: anywhere; color: var(--ink); }
.game-question p { color: var(--muted); font-size: 14px; }
.game-question > .romanization { display: block; color: var(--muted); font-size: 18px; }
.game-hint { margin-top: 8px; }
.game-hint summary { width: fit-content; min-height: 44px; margin-inline: auto; padding: 12px 5px; cursor: pointer; color: var(--accent-dark); font-size: 14px; font-weight: 700; }
.game-hint:not([open]) > p { display: none; }
.options { display: grid; gap: 8px; }
.option { border: 1px solid var(--line); background: #fffdf7; color: var(--ink); padding: 12px 14px; min-height: 53px; border-radius: 12px; text-align: left; font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.option:hover:not(:disabled) { border-color: var(--accent); background: #f0f5e9; }
.option.correct { background: var(--green-bg); border-color: #82b990; color: var(--green); }
.option.wrong { background: var(--error-bg); border: 1px dashed #897660; color: var(--error); }
.option b { display: inline-grid; place-items: center; min-width: 23px; height: 23px; margin-right: 7px; border-radius: 6px; background: var(--soft); color: var(--accent-dark); font-size: 12px; }
.option .romanization { display: block; margin-left: 30px; font-weight: 500; }
.game-feedback { margin: 12px 0; padding: 13px 15px; border-radius: 10px; background: var(--paper-light); }
.game-feedback p { font-size: 14px; }
.speed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.scoreboard { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.timer { font-variant-numeric: tabular-nums; }
.session { padding: 15px; margin-bottom: 10px; }
.session summary { cursor: pointer; font-weight: 750; }
.session .actions { margin-top: 13px; }
.history-preview { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.history-preview:last-child { border-bottom: 0; }
.table-wrap { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
caption { text-align: left; font-weight: 750; margin-bottom: 7px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px; vertical-align: top; }
th { color: var(--ink); background: var(--paper-light); }
td { overflow-wrap: anywhere; }
.empty { padding: 13px 0 3px; color: var(--muted); }
.chart { display: grid; gap: 7px; }
.chart-row { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(0, 2fr) 42px; gap: 9px; align-items: center; font-size: 13px; }
.chart-row progress { width: 100%; height: 10px; accent-color: var(--accent); }
#print-sheet { display: none; }
@media (max-width: 850px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { z-index: 2; display: block; height: auto; min-height: 0; padding: 12px 14px 6px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 7px; font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 21px; }
  .brand-sub { font-size: 7px; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 3px; padding: 1px 3px 4px; }
  .sidebar nav a { min-height: 40px; padding: 8px 9px; gap: 5px; font-size: 12px; }
  .sidebar nav a span { width: 16px; font-size: 16px; }
  .sidebar-foot { display: none; }
  .topbar { min-height: 49px; padding-block: 5px; }
}
@media (max-width: 560px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cards { gap: 7px; }
  .metric { padding: 10px; }
  .metric b { font-size: 20px; }
  .metric span { font-size: 11px; }
  .hero { min-height: 235px; grid-template-columns: minmax(0, 1fr) minmax(69px, .42fr); gap: 10px; padding: 20px 16px; border-radius: 18px; }
  .hero p { font-size: 13px; }
  .flashcard { width: clamp(44px, 14vw, 78px); border-radius: 9px; }
  .flashcard b { font-size: clamp(23px, 7vw, 36px); }
  .flashcard small { max-width: 100%; text-align: center; overflow-wrap: anywhere; font-size: 8px; }
  .pair > label { min-width: 103px; }
  select, input:not([type='checkbox']), .profile-switch select { font-size: 16px; }
}
@page { size: A4; margin: 12mm; }
@media print {
  :root, body { background: white; color: #000; }
  .shell, .skip { display: none !important; }
  #print-sheet { display: block; font-family: Arial, sans-serif; }
  #print-sheet h1 { font-size: 18pt; margin-bottom: 4mm; letter-spacing: 0; }
  #print-sheet p { font-size: 10pt; margin-bottom: 4mm; }
  #print-sheet table { font-size: 9pt; }
  #print-sheet th, #print-sheet td { border: 1px solid #777; padding: 2mm; color: black; }
  #print-sheet th { background: #f2f2f2; }
  #print-sheet tr { break-inside: avoid; }
  #print-sheet thead { display: table-header-group; }
  #print-sheet .tick { display: block; width: 5mm; height: 5mm; border: 1px solid #222; margin: auto; }
  #print-sheet .answer-line { display: block; min-width: 25mm; height: 6mm; border-bottom: 1px solid #777; }
}
