:root { --bg: #f3f1ec; --fg: #23211d; --muted: #6e6960; --accent: #2f6f8f; --line: #ddd7cc; --card: #fff; --ok: #2f7d5b; --warn: #b45a1c; --again: #c0392b; --hard: #8a6d1c; --good: #2f7d5b; --easy: #2f6f8f; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, sans-serif; }
header.top { max-width: 1060px; margin: 0 auto; padding: 14px 16px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
header.top h1 { font-size: 20px; margin: 0; }
header.top .spacer { flex: 1; }
main { max-width: 1060px; margin: 0 auto; padding: 12px 16px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.panel h2:first-child { margin-top: 0; }
button, select, input { font: 14px system-ui, sans-serif; }
button { font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: #f7f5f1; padding: 8px 12px; cursor: pointer; color: var(--fg); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
select, input[type=text], input[type=password] { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; color: var(--fg); min-width: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #fff; }
.seg button[aria-pressed=true] { background: var(--accent); color: #fff; }
#stage { min-height: 420px; display: flex; flex-direction: column; }
.cardbox { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 24px 16px; gap: 14px; }
.q { font-size: 34px; font-weight: 600; overflow-wrap: anywhere; }
.a { font-size: 26px; color: var(--accent); overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line); margin: 0 10%; }
.counts { font: 13px ui-monospace, Menlo, monospace; color: var(--muted); text-align: center; }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.rates button { color: #fff; border: 0; padding: 12px 6px; }
.r1 { background: var(--again); } .r2 { background: var(--hard); } .r3 { background: var(--good); } .r4 { background: var(--easy); }
#flash { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: var(--fg); color: #fff; padding: 8px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 5; }
#flash.show { opacity: 1; }
.map { display: grid; grid-template-columns: 1fr 120px; gap: 5px 8px; align-items: center; font-size: 13px; margin: 6px 0 4px; }
#map details { border-top: 1px solid var(--line); padding: 6px 0; }
#map summary { font-weight: 600; font-size: 13px; color: var(--fg); }
#map select.on { border-color: var(--accent); background: #eef5f8; }
canvas#meter { width: 100%; height: 16px; display: block; background: #efebe4; border-radius: 6px; margin-top: 8px; }
video { width: 100%; max-width: 320px; border-radius: 10px; transform: scaleX(-1); background: #000; display: block; margin-top: 8px; }
.pill { font: 12px ui-monospace, Menlo, monospace; background: #efebe4; border-radius: 99px; padding: 3px 9px; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.legend b { color: var(--fg); }
#log { font: 12px ui-monospace, Menlo, monospace; height: 110px; overflow-y: auto; background: #f7f5f1; border-radius: 8px; padding: 6px 8px; margin: 0; list-style: none; }
.note { background: #fff4e3; border: 1px solid #f0d9b5; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
.status { font-size: 14px; margin: 6px 0; min-height: 1.4em; }
.err { color: var(--again); } .okc { color: var(--ok); }
kbd { font: 12px ui-monospace, Menlo, monospace; background: #efebe4; border-radius: 4px; padding: 1px 5px; }
[hidden] { display: none !important; }
#calib { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 6px 4px; }
.cal-icon { font-size: 64px; text-align: center; line-height: 1.1; margin-top: 8px; }
.cal-title { font-size: 24px; font-weight: 700; text-align: center; }
.cal-say { font-size: 17px; text-align: center; max-width: 34em; margin: 0 auto; line-height: 1.45; }
.cal-phase { text-align: center; font-weight: 700; font-size: 15px; min-height: 1.4em; }
.cal-phase.go { color: var(--ok); }
.track { position: relative; height: 10px; background: #efebe4; border-radius: 99px; overflow: hidden; }
.track.tall { height: 18px; border-radius: 6px; }
.track .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .08s linear; }
.track .fill.live { background: var(--ok); }
.cal-result { min-height: 3em; text-align: center; font-size: 15px; line-height: 1.45; }
.cal-result.ok { color: var(--ok); } .cal-result.bad { color: var(--warn); }
#calReport { list-style: none; padding: 0; margin: 4px 0; font-size: 13px; line-height: 1.45; max-height: 340px; overflow-y: auto; }
#calReport li { padding: 5px 0; border-bottom: 1px solid var(--line); }
button.linkish { background: none; border: 0; padding: 4px 6px; color: var(--accent); text-decoration: underline; font-weight: 500; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
ol.steps { padding-left: 20px; margin: 6px 0; font-size: 13px; line-height: 1.6; }
code { font: 12px ui-monospace, Menlo, monospace; background: #efebe4; padding: 1px 4px; border-radius: 4px; }
/* Welcome dialog */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: 34em; background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin-top: 0; }
/* Offline proof panel */
#proofPanel { position: fixed; inset: auto 12px 12px auto; width: min(480px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 24px)); overflow-y: auto; z-index: 20; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
#proofPanel h2 { margin-top: 0; }
#proofLog { font: 11px ui-monospace, Menlo, monospace; max-height: 180px; overflow-y: auto; background: #f7f5f1; border-radius: 8px; padding: 6px 8px; margin: 6px 0; list-style: none; }
#proofLog li { padding: 3px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.proof-origin { font-weight: 700; color: var(--ok); }
.proof-origin.remote { color: var(--again); }
#proofStore ul { font-size: 13px; padding-left: 18px; }
footer.site { max-width: 1060px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: 13px; }
footer.site nav { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
footer.site a { color: var(--accent); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 30; }
