:root {
  color-scheme: light dark;
  --ink: #1b2430; --bg: #fbf8f1; --panel: #ffffff; --line: #e4ded1; --muted: #5d6675;
  --accent: #2a6fdb; --accent-ink: #ffffff; --bad: #c2362f; --good: #1d8a57; --warn: #b26a00; --chart: #2a6fdb;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #eceff4; --bg: #12161c; --panel: #1b2129; --line: #2e3641; --muted: #a2adbc;
    --accent: #6ea8ff; --accent-ink: #0b1420; --bad: #ff8078; --good: #58cf95; --warn: #f0b35a; --chart: #3987e5; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.in-app [data-no-app] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
main.wide { max-width: 1040px; }
h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 24px; letter-spacing: -0.01em; margin: 36px 0 8px; }
h3 { font-size: 18px; margin: 20px 0 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small, .hint { font-size: 14px; } .hint { color: var(--muted); }
.error { color: var(--bad); min-height: 1em; margin: 6px 0; } .ok { color: var(--good); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px; z-index: 9; }
.site-header { display: flex; align-items: center; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.site-header nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-header nav a { color: var(--ink); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
.site-header nav a[aria-current=page] { border-color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.sync-dot[data-state=synced] { background: var(--good); } .sync-dot[data-state=error] { background: var(--bad); } .sync-dot[data-state=offline] { background: var(--warn); }
.claim { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 20px; background: #fff3cf; color: #3b2d00; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 20px; display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent); border-radius: 12px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 5px 12px; font-size: 14px; border-radius: 9px; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 16px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid .card { margin: 0; }
label { display: block; font-weight: 650; margin: 14px 0 4px; }
label.check { font-weight: 500; display: flex; gap: 8px; align-items: center; }
input:not([type=checkbox]):not([type=file]), textarea, select { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
.honeypot { position: absolute; left: -9999px; }
.notice { background: #fff3cf; color: #3b2d00; padding: 10px 14px; border-radius: 10px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 650; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.count-new { color: var(--accent); font-weight: 700; } .count-learn { color: var(--bad); font-weight: 700; } .count-review { color: var(--good); font-weight: 700; }
.hero { padding: 26px 0 8px; } .hero p { font-size: 20px; max-width: 34em; }
.deck-name { font-weight: 650; }
.indent-1 { padding-left: 22px !important; } .indent-2 { padding-left: 44px !important; } .indent-3 { padding-left: 66px !important; }

/* Review: big enough for a small child's finger, with no need to read. */
.study { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.study-counts { display: flex; gap: 14px; font-size: 16px; }
.face { width: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 26px 18px; font-size: clamp(34px, 8vw, 60px); line-height: 1.25; white-space: pre-line; overflow-wrap: anywhere; }
.face img { max-width: 100%; max-height: 300px; border-radius: 12px; }
.answer-side { font-size: clamp(30px, 7vw, 54px); }
.speak { font-size: 34px; width: 84px; height: 84px; border-radius: 50%; }
.big { font-size: 30px; padding: 18px 42px; border-radius: 20px; min-height: 84px; }
.answers { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; width: 100%; }
.answers button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 6px; min-height: 110px; border-radius: 18px; border: 3px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.answers .emoji { font-size: 44px; line-height: 1; }
.answers .when { font-size: 13px; color: var(--muted); font-weight: 500; }
.answers [data-rating="1"] { border-color: var(--bad); } .answers [data-rating="3"] { border-color: var(--good); } .answers [data-rating="4"] { border-color: var(--accent); }
.study-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.typed { max-width: 420px; font-size: 24px !important; text-align: center; }

/* Charts */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile .n { font-size: 32px; font-weight: 800; line-height: 1.1; } .tile .k { font-size: 13px; color: var(--muted); }
.chart { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--line); margin-top: 22px; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.chart .col:hover { background: color-mix(in srgb, var(--chart) 10%, transparent); }
.chart .bar { width: 100%; max-width: 18px; margin: 0 auto; background: var(--chart); border-radius: 4px 4px 0 0; }
.chart .top { position: absolute; left: 0; top: -20px; font-size: 12px; color: var(--muted); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-tip { position: absolute; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 3px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; pointer-events: none; top: -8px; z-index: 2; }

/* On a phone the question, the answer and the buttons must fit on one screen:
   a child who cannot read will not know to scroll. */
@media (max-width: 560px) {
  main { padding: 14px 12px 40px; }
  .site-header { padding: 8px 12px; gap: 4px 12px; }
  .site-header nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 12px; font-size: 15px; }
  .study { gap: 10px; }
  .face { min-height: 110px; padding: 12px; font-size: 34px; border-radius: 16px; }
  .answer-side { font-size: 30px; }
  .face img { max-height: 120px; }
  .speak { width: 60px; height: 60px; font-size: 24px; }
  .answers button { min-height: 92px; padding: 10px 4px; }
}
