:root {
    --bg: #fafaf7; --fg: #1d1d1b; --muted: #6b6b66; --card: #fff; --line: #dcdcd4;
    --accent: #2f6fdb; --green: #3a9d5d; --yellow: #d9a520; --red: #cf4a3a; --none: #c8c8c0;
    --cur: #fff3bf; --err: #f6c7c0;
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #17181a; --fg: #e8e8e3; --muted: #9a9a93; --card: #202225; --line: #34363a;
        --accent: #6aa0ff; --green: #4fb877; --yellow: #e0b43c; --red: #e0645a; --none: #4a4c50;
        --cur: #4a4420; --err: #5a2a25;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, sans-serif; }
main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.bar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.bar nav { display: flex; gap: 1rem; flex: 1; }
.bar a { color: var(--muted); text-decoration: none; }
.bar a.on { color: var(--fg); font-weight: 600; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; }
.narrow { max-width: 22rem; margin: 3rem auto; display: grid; gap: .8rem; }
label { display: grid; gap: .25rem; }
input[type=email], input[type=password] { padding: .5rem; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); }
button { padding: .5rem 1rem; font: inherit; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.err { color: var(--red); margin: 0; }
.banner { background: var(--yellow); color: #000; padding: .6rem 1rem; border-radius: 6px; font-weight: 600; }
.big { font-size: 1.8rem; font-weight: 700; }

.lesson-text { font: 1.9rem/2.6rem ui-monospace, Menlo, monospace; letter-spacing: .06em; margin: 2rem 0 1rem; word-break: break-word; }
.lesson-text span { border-radius: 3px; padding: .1rem 0; }
.lesson-text span.done { color: var(--muted); }
.lesson-text span.cur { background: var(--cur); outline: 2px solid var(--accent); }
.lesson-text span.wrong { background: var(--err); animation: shake .15s; }
.lesson-text span.sp { display: inline-block; width: .6em; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
#capture { position: fixed; left: -9999px; opacity: 0; }

.kbd { position: relative; height: calc(var(--u) * 4.2); margin: 1.5rem 0 2.5rem; }
.key { position: absolute; width: calc(var(--u) - .25rem); height: calc(var(--u) - .25rem); display: grid; place-items: center;
       border-radius: 6px; font: 600 1.1rem ui-monospace, Menlo, monospace; color: #fff; background: var(--none); }
.key.green { background: var(--green); } .key.yellow { background: var(--yellow); color: #000; } .key.red { background: var(--red); }
.key.none { color: var(--fg); }
.key.locked { opacity: .35; }
.key.space { width: calc(var(--u) * 5 - .25rem); }

.log { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.log th, .log td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
.log .bad { color: var(--red); font-weight: 600; }
