: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; }

/* Face Switch additions */
.gestures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.gcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.gcard .emo { font-size: 38px; line-height: 1.2; }
.gcard b { display: block; margin: 6px 0 2px; font-size: 15px; }
#optRow { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
#optRow button { font-size: 16px; padding: 14px 18px; }
#optRow button.focused { outline: 3px solid var(--accent); background: #eaf3f7; }
#scrollPane { height: 150px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; line-height: 1.6; background: #fff; }
#scrollPane.scrolling { outline: 3px solid var(--ok); }
#clickTarget { font-size: 20px; padding: 18px 28px; }
#hintBar { min-height: 2.6em; font-size: 17px; font-weight: 600; color: var(--warn); text-align: center; padding: 8px; }
#hintBar:empty { min-height: 0; }
#quizPrompt { text-align: center; padding: 24px 12px; }
#quizPrompt .emo { font-size: 72px; line-height: 1.2; }
#quizPrompt .gname { font-size: 28px; font-weight: 700; margin: 8px 0; }
#camchip { display: inline-block; font-size: 13px; font-weight: 700; color: var(--ok); border: 1px solid var(--ok); border-radius: 99px; padding: 3px 10px; }
#pauseBtn { font-size: 18px; padding: 14px 26px; }
.paused-banner { background: #fff4e3; border: 2px solid var(--warn); border-radius: 10px; padding: 10px; text-align: center; font-weight: 700; font-size: 17px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.dash-stat { background: #f7f5f1; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.dash-stat .big { font-size: 26px; font-weight: 700; }
.dash-stat .lbl { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; background: #eaf3f7; border: 1px solid var(--accent); color: var(--accent); border-radius: 99px; padding: 4px 12px; margin: 3px; font-size: 13px; font-weight: 600; }
.levelbar { height: 12px; background: #efebe4; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.levelbar .fill { height: 100%; background: var(--accent); }
#confettiBox { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti { position: absolute; top: -12px; width: 10px; height: 14px; opacity: .9; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }
.camrow { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.camrow video { max-width: 240px; }
.rep-meter { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.rep-dot { width: 18px; height: 18px; border-radius: 99px; border: 2px solid var(--line); background: #fff; }
.rep-dot.done { background: var(--ok); border-color: var(--ok); }
