/* Study Engine: shared look. Apps override the tokens in :root. */
:root {
  --bg: #f6f2e9; --panel: #fffdf8; --ink: #1c2433; --muted: #5d6576; --line: #ddd5c4;
  --accent: #b5302a; --accent-ink: #fff; --good: #2e7d4f; --bad: #b5302a; --chip: #ece5d6;
  --radius: 14px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #12161f; --panel: #1b2130; --ink: #ece7dc; --muted: #a3a9b7; --line: #2d3446; --chip: #252c3d; --accent: #e0574f; --good: #4fb07a; --bad: #e0574f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
header.se-top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.se-brand { display: flex; align-items: baseline; gap: 10px; padding: 12px 0 6px; }
.se-brand h1 { margin: 0; font-family: var(--display); font-size: 24px; letter-spacing: -0.01em; }
.se-brand small { color: var(--muted); font-size: 13px; }
nav.se-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
nav.se-tabs::-webkit-scrollbar { display: none; }
nav.se-tabs button { flex: none; border: 0; background: none; padding: 7px 10px; border-radius: 999px; font-size: 15px; color: var(--muted); cursor: pointer; position: relative; }
nav.se-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.se-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 12px; line-height: 18px; text-align: center; }
main.wrap { padding-top: 16px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
section.se-view { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3, .card h2 { margin: 0; }
h2.se-h { margin: 8px 0 0; font-size: 18px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.foot { font-size: 13px; color: var(--muted); }
.q { font-size: 19px; font-weight: 600; }
.big { font-family: var(--display); font-size: 34px; line-height: 1.1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.good { background: var(--good); color: #fff; } .btn.bad { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; cursor: pointer; min-height: 48px; display: flex; gap: 10px; align-items: center; }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt.ok { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--panel)); }
.opt.no { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--panel)); }
.opt:disabled { cursor: default; color: inherit; }
.opts.grid2 { grid-template-columns: 1fr 1fr; }
.fb { font-weight: 600; } .fb.ok { color: var(--good); } .fb.no { color: var(--bad); }
input[type=text], select { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; min-height: 48px; }
input[type=text]:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.meter { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; } .meter i { display: block; height: 100%; background: var(--ink); }
.chunks { display: flex; gap: 6px; flex-wrap: wrap; }
.chunk { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 14px; }
.chunk.done { background: color-mix(in srgb, var(--good) 18%, var(--panel)); border-color: var(--good); }
.chunk[aria-current="true"] { outline: 2px solid var(--ink); }
.chunk:disabled { opacity: .4; cursor: default; }
.recallrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.recallrow .lab { flex: 0 0 auto; min-width: 0; font-weight: 600; }
.recallrow input { flex: 1 1 160px; }
.recallrow.ok input { border-color: var(--good); } .recallrow.no input { border-color: var(--bad); }
.recallrow b.fix { color: var(--bad); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: 22px; } .stat span { font-size: 12px; color: var(--muted); }
.prog { display: grid; grid-template-columns: minmax(0, 1fr) 2fr auto; gap: 6px 10px; align-items: center; font-size: 14px; }
.bar { position: relative; height: 10px; background: var(--chip); border-radius: 5px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; }
.bar i.seen { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.bar i.learned { background: color-mix(in srgb, var(--good) 55%, transparent); }
.bar i.mastered { background: var(--good); }
.fc { min-height: 220px; justify-content: center; align-items: center; text-align: center; cursor: pointer; }
.note { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
label.ck { display: flex; gap: 6px; align-items: center; font-size: 14px; }
details summary { cursor: pointer; }
.kbd { font-size: 12px; color: var(--muted); }
@media (max-width: 420px) { .q { font-size: 18px; } .big { font-size: 28px; } }
