:root {
    --bg: #faf9f6;
    --fg: #1b1b19;
    --muted: #6b6a64;
    --faint: #a09f98;
    --line: #e3e1da;
    --rule: #1b1b19;
    --accent: #c4402b;
    --key: #f0eee8;
    --key-edge: #d4d2ca;
    --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, "D2Coding", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #131312;
        --fg: #ecebe6;
        --muted: #9c9b94;
        --faint: #64635e;
        --line: #2a2a27;
        --rule: #ecebe6;
        --accent: #ff7a5e;
        --key: #22221f;
        --key-edge: #3a3a36;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 17px/1.7 var(--sans);
    word-break: keep-all;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

nav, main, footer { max-width: 920px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.help main { max-width: 760px; }

nav { display: flex; justify-content: space-between; align-items: baseline; padding-top: 22px; padding-bottom: 22px; font-size: 15px; }
nav .name { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
/* The J of the name is the accent colour wherever the name stands as a name: the nav, the footer, a page's title. */
nav .name::first-letter, footer .links a:first-child::first-letter, .help h1::first-letter { color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--fg); }

h1 { font-size: clamp(40px, 7.4vw, 76px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; margin: 9vh 0 22px; }
.lead { max-width: 30em; margin: 0 0 56px; font-size: 19px; color: var(--muted); }

/* The demo is a writing line, not a card: a heavy rule on top, a hairline under it. */
.stage { cursor: text; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--line); padding: 14px 0 12px; transition: border-color 0.2s; }
.stage.live { border-top-color: var(--accent); }
.hint { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.paper {
    min-height: 2.7em;
    max-height: 5.4em;
    overflow-y: auto;
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    cursor: text;
}
.paper.selected .typed, .paper.selected .marked { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.marked { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 7px; }
.caret {
    display: inline-block;
    width: 3px;
    height: 0.95em;
    margin-left: 2px;
    vertical-align: -0.1em;
    background: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.keys { --rows: 1; display: flex; align-items: flex-start; gap: 12px; margin: 14px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
.keys span { flex: none; line-height: 36px; }
.keys-seq { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px 3px; flex: 1; min-width: 0; height: calc(var(--rows) * 40px - 4px);
    overflow: hidden; font: 14px var(--mono); color: var(--muted); white-space: pre; background: none; padding: 0; word-break: normal; }
.keys-seq kbd { flex: none; min-width: 24px; height: 36px; padding: 0 5px; font-size: 12px; font-weight: 500; line-height: 34px; color: var(--fg); }
.keys-seq kbd.space { min-width: 44px; }
kbd.letter { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 24px; height: 36px; padding: 0 4px; font-size: 10px; font-weight: 500; line-height: 1; color: var(--muted); }
kbd.letter i { font: 600 13px/1 var(--sans); color: var(--fg); }
.tally { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.tally b { color: var(--fg); }
.tally > b { color: var(--accent); }

/* Only the visitor's platform shows until they ask for the others. */
.get { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin: 36px 0 0; }
.get.all, .get:not([data-os]) { gap: 28px; }
.get[data-os="linux"] .platform[data-os="linux"],
.get[data-os="windows"] .platform[data-os="windows"] { order: -1; }
.get[data-os="mac"]:not(.all) .platform:not([data-os="mac"]),
.get[data-os="windows"]:not(.all) .platform:not([data-os="windows"]),
.get[data-os="linux"]:not(.all) .platform:not([data-os="linux"]),
.get[data-arch="x86_64"]:not(.all) .download[data-arch="aarch64"],
.get[data-arch="aarch64"]:not(.all) .download[data-arch="x86_64"],
.get[data-os="touch"]:not(.all) .platform,
.get:not([data-os="touch"]) .phone,
.get:not([data-os]) .more,
.get.all .more { display: none; }
.platform .meta { margin: 8px 0 0; }
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.download {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 6px;
    background: var(--fg);
    color: var(--bg);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
}
.download:hover { background: var(--accent); }
.download small { font-weight: 500; font-size: 13px; opacity: 0.7; margin-left: 4px; }
.more { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
    text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.more:hover { color: var(--fg); }
.meta { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.meta a { color: inherit; }
.meta.then { margin-top: 2px; }
.assure { margin: 0; font-size: 14px; color: var(--muted); }
.phone { max-width: 26em; }
.phone p { margin: 0 0 14px; }
.share { padding: 12px 22px; border: 0; border-radius: 6px; background: var(--fg); color: var(--bg); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }

/* How it works: a heading column and a text column per row, with the keys and what they become. */
.how { margin-top: 120px; }
.how h2, .install h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 8px 40px; padding: 26px 0; border-top: 1px solid var(--line); }
.row h3 { margin: 0; font-size: 21px; line-height: 1.4; letter-spacing: -0.02em; }
.row p { margin: 0 0 12px; }
.row p:last-child { margin-bottom: 0; }
.map { display: grid; grid-template-columns: max-content max-content; gap: 4px 18px; align-items: baseline; font-weight: 600; }
.map code { background: none; padding: 0; font-size: 15px; color: var(--muted); font-weight: 400; }
/* Each row says its thing in the form that fits it: the screen at every key, two lines to compare, a key between
   a wrong word and the right one, and a short table. */
.trace { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 14px 6px; margin: 4px 0 18px; padding: 0; list-style: none; }
.trace li { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.trace b { font-size: 19px; line-height: 1.2; letter-spacing: -0.02em; white-space: nowrap; }
.trace li:last-child b { color: var(--accent); }
.versus { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 12px 18px; align-items: baseline; margin: 0; font-size: 19px; font-weight: 600; }
.versus dt { font-size: 14px; font-weight: 400; color: var(--muted); }
.versus dd { margin: 0; }
.versus dd:nth-of-type(1) { color: var(--muted); }
.versus .n { font-variant-numeric: tabular-nums; }
.versus dd:last-child { color: var(--accent); }
.versus kbd { font-family: var(--sans); font-size: 11px; color: var(--fg); vertical-align: 2px; }
.mixed { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 19px; font-weight: 600; }
.mixed b { color: var(--accent); font-weight: 600; }
.turn { display: flex; align-items: center; gap: 14px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.turn span { color: var(--faint); }

/* Install: the three steps side by side, the download as the first of them. */
.install { align-items: stretch; margin-top: 96px; }
.install .more { align-self: flex-start; }
.install .platform h3 { display: none; margin: 14px 0 0; font-size: 17px; }
.install.all .platform h3, .install:not([data-os]) .platform h3 { display: block; }
.install[data-os="touch"]:not(.all) { display: none; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--line); list-style: none; counter-reset: step; }
.three li { counter-increment: step; }
.three li::before { content: counter(step); display: block; margin-bottom: 10px; font: 600 15px var(--mono); color: var(--accent); }
.three p { margin: 0; }
.three .download + p, .three .files + p { margin-top: 10px; font-size: 14px; color: var(--muted); }
.install + .next { margin-top: 40px; }
.next { margin: 0; padding-top: 26px; border-top: 1px solid var(--line); color: var(--muted); }
@media (max-width: 640px) {
    .row { grid-template-columns: 1fr; }
    .three { grid-template-columns: 1fr; gap: 22px; }
    .versus { grid-template-columns: minmax(0, 1fr) max-content; }
    .versus dt { grid-column: 1 / -1; margin-bottom: -8px; }
}

footer { margin-top: 120px; padding-top: 22px; padding-bottom: 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
footer p { margin: 0 0 6px; }
footer .links { margin-bottom: 14px; }
footer .sums { font-size: 12px; color: var(--faint); }

code { font: 14px var(--mono); background: var(--key); border-radius: 4px; padding: 1px 5px; word-break: break-all; }
footer code { font-size: 12px; background: none; padding: 0; }

kbd {
    display: inline-block;
    min-width: 24px;
    padding: 0 6px;
    border: 1px solid var(--key-edge);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--key);
    font: 600 13px/1.6 var(--mono);
    text-align: center;
}

/* A small R in the corner marks the right-hand one of a pair of keys. */
kbd.right { position: relative; padding-right: 11px; }
kbd.right::after { content: "R"; position: absolute; top: 1px; right: 2px; font-size: 8px; line-height: 1; font-weight: 700; color: var(--muted); }

/* Help and practice: one reading column, sections divided by rules. */
.help h1 { font-size: clamp(32px, 5vw, 44px); margin: 6vh 0 40px; }
.help main > section { margin: 0; padding: 32px 0; border-top: 1px solid var(--line); }
.help main > p { margin: 0 0 32px; }
.help main > .toc { margin-bottom: 14px; }
.help h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 14px; }
.help p { margin: 0 0 14px; }

.help h3 { margin: 26px 0 8px; font-size: 16px; }
.help h2 + h3 { margin-top: 0; }
.os-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.os-switch span { margin-right: 8px; }
.os-switch button { padding: 4px 12px; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.os-switch button[aria-pressed="true"] { border-color: var(--fg); background: var(--fg); color: var(--bg); }
body[data-os="mac"] [data-for]:not([data-for="mac"]),
body[data-os="windows"] [data-for]:not([data-for="windows"]),
body[data-os="linux"] [data-for]:not([data-for="linux"]) { display: none; }
.seq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 600; }
.seq i { font-style: normal; font-weight: 400; color: var(--faint); }
.seq span { color: var(--muted); }
.toc { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; color: var(--muted); }
.by-os { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0 0 14px; }
.by-os dt { color: var(--muted); }
.by-os dd { margin: 0; }

ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 14px; }
ol.steps li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: baseline; }
ol.steps li::before { content: counter(step); font: 600 15px var(--mono); color: var(--accent); }
ol.steps p { margin: 0 0 8px; }
ol.steps + p { margin-top: 18px; }

details { margin-top: 18px; border-left: 2px solid var(--line); padding: 2px 0 2px 16px; }
summary { cursor: pointer; font-weight: 600; }
details ol { margin: 12px 0 4px; padding-left: 20px; }

pre { margin: 8px 0 0; padding: 12px 14px; border-radius: 6px; background: var(--key); overflow-x: auto; }
pre code { padding: 0; background: none; word-break: normal; }

.lesson .goal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.lesson .goal span { font-size: 13px; color: var(--faint); }
.lesson .examples { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.lesson .examples code { margin-left: 8px; background: none; padding: 0; color: var(--muted); }
.lesson textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--fg);
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.4;
    resize: vertical;
}
.lesson textarea:focus { outline: none; border-color: var(--fg); }
.lesson.done textarea { border-color: var(--accent); }
.lesson .result { display: none; margin: 10px 0 0; color: var(--accent); font-weight: 600; }
.lesson.done .result { display: flex; align-items: center; gap: 12px; }
.again { font: inherit; font-size: 13px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    .caret { animation: none; }
}

@media (max-width: 560px) {
    nav, main, footer { padding-left: 16px; padding-right: 16px; }
    h1 { margin-top: 5vh; }
    .lead { margin-bottom: 40px; }
    .how, footer { margin-top: 88px; }
    .keys { flex-direction: column; gap: 2px; }
    .keys span { line-height: 1.7; }
    .keys-seq { flex: none; width: 100%; }
    .keys-seq kbd { min-width: 22px; }
}
