/* RT-EDU-018 — Kanji Stroke Order Animator.
 * Light surfaces throughout: --rt-ink / --rt-ink-soft on --rt-surface, the
 * current stroke in --rt-accent. No navy result box on this page, so no
 * --rt-result-* tokens (docs/contrast-conventions.md).
 * Spacing tokens are a 4px scale: --rt-s-3 is 12px, --rt-s-4 is 16px. */

.ks-form { display: flex; flex-direction: column; gap: var(--rt-s-4); min-width: 0; }
.ks-top { display: flex; flex-direction: column; gap: 8px; }
.ks-field { display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.ks-label { font-family: var(--rt-font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; color: var(--rt-ink-muted); }
.ks-input {
    width: 100%; box-sizing: border-box; padding: 8px 14px;
    border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-button);
    background: var(--rt-surface); color: var(--rt-ink); font-size: 26px; line-height: 1.3;
}
.ks-input:focus { outline: none; border-color: var(--rt-accent); box-shadow: 0 0 0 3px var(--rt-accent-soft); }
.ks-samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ks-samples-label { font-size: 11px; color: var(--rt-ink-soft); margin-right: 2px; }
.ks-chip {
    min-width: 38px; padding: 4px 10px; border-radius: var(--rt-r-chip); cursor: pointer;
    border: 1px solid var(--rt-hairline); background: var(--rt-surface-2); color: var(--rt-ink); font-size: 18px;
    transition: border-color 140ms ease, background 140ms ease;
}
.ks-chip:hover { border-color: var(--rt-accent); background: var(--rt-surface); }

.ks-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ks-tabs[hidden] { display: none; }
.ks-tab { font-size: 22px; min-width: 44px; padding: 2px 10px; border-radius: 8px; border: 1px solid var(--rt-hairline); background: var(--rt-surface); color: var(--rt-ink); cursor: pointer; }
.ks-tab.is-on { border-color: var(--rt-accent); box-shadow: inset 0 0 0 1px var(--rt-accent); }
.ks-tab.is-missing { color: var(--rt-ink-soft); text-decoration: line-through; }

.ks-main { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--rt-s-4); align-items: start; }
@media (max-width: 720px) { .ks-main { grid-template-columns: 1fr; } }

.ks-stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ks-canvas-wrap { position: relative; border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-card); background: var(--rt-surface); aspect-ratio: 1 / 1; max-width: 340px; width: 100%; }
.ks-canvas { display: block; width: 100%; height: 100%; }
.ks-grid line { stroke: var(--rt-hairline); stroke-width: .5; stroke-dasharray: 2 2; }
.ks-ghost path { fill: none; stroke: var(--rt-hairline); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ks-ink path { fill: none; stroke: var(--rt-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ks-ink path.is-current { stroke: var(--rt-accent); }
.ks-ink path.is-hl { stroke: var(--rt-accent); stroke-width: 3.8; }
.ks-nums text { font-size: 7px; fill: var(--rt-ink-soft); font-family: var(--rt-font-sans); }
.ks-nums text.is-done { fill: var(--rt-ink); }
.ks-status { position: absolute; left: 10px; bottom: 6px; margin: 0; font-size: 12px; color: var(--rt-ink-soft); }

.ks-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ks-btn { padding: 7px 14px; border-radius: var(--rt-r-button); border: 1px solid var(--rt-hairline); background: var(--rt-surface); color: var(--rt-ink); font-size: 14px; cursor: pointer; }
.ks-btn:hover { border-color: var(--rt-accent); }
.ks-btn-primary { min-width: 76px; font-weight: 600; }
.ks-sel { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--rt-ink); }
.ks-sel select { padding: 5px 8px; border: 1px solid var(--rt-hairline); border-radius: 6px; background: var(--rt-surface); color: var(--rt-ink); }
.ks-check { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; color: var(--rt-ink); cursor: pointer; }
.ks-credit { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--rt-ink-soft); }

/* ── info panel ─────────────────────────────────────────────────────────── */
.ks-info { border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-card); background: var(--rt-surface); padding: var(--rt-s-3) var(--rt-s-4); min-width: 0; }
.ks-info:empty { display: none; }
.ks-info-head { display: flex; gap: 14px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--rt-hairline); }
.ks-info-char { font-size: 44px; line-height: 1; color: var(--rt-ink); }
.ks-info-meta { display: flex; flex-direction: column; gap: 2px; }
.ks-info-count { font-size: 15px; font-weight: 600; color: var(--rt-ink); }
.ks-info-code { font-family: var(--rt-font-mono); font-size: 12px; color: var(--rt-ink-soft); }
.ks-info-h { margin: 12px 0 6px; font-size: 12px; font-family: var(--rt-font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--rt-ink-muted); }
.ks-muted { color: var(--rt-ink-soft); }
.ks-comps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ks-depth-2 { padding-left: 18px; } .ks-depth-3 { padding-left: 36px; }
.ks-comp-btn { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; width: 100%; text-align: left; padding: 5px 8px; border-radius: 8px; border: 1px solid transparent; background: var(--rt-surface-2); color: var(--rt-ink); cursor: pointer; }
.ks-comp-btn:hover, .ks-comp-btn.is-on { border-color: var(--rt-accent); }
.ks-comp-el { font-size: 20px; }
.ks-comp-meta { font-size: 12px; color: var(--rt-ink-soft); }
.ks-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rt-hairline); color: var(--rt-ink); }
.ks-badge-ph { border-color: var(--rt-accent); }
.ks-strokes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px 10px; }
.ks-stroke { display: flex; gap: 6px; align-items: baseline; font-size: 12.5px; color: var(--rt-ink); }
.ks-stroke-n { font-family: var(--rt-font-mono); font-size: 11px; color: var(--rt-ink-soft); min-width: 18px; text-align: right; }
.ks-stroke-g { font-size: 17px; }
.ks-stroke-name { font-family: var(--rt-font-mono); font-size: 11px; color: var(--rt-ink-soft); }

/* ── diagram ────────────────────────────────────────────────────────────── */
.ks-panel { border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-card); background: var(--rt-surface); min-width: 0; }
.ks-panel-head { padding: var(--rt-s-3) var(--rt-s-4); border-bottom: 1px solid var(--rt-hairline); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.ks-panel-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--rt-ink); }
.ks-panel-note { font-size: 12.5px; color: var(--rt-ink-soft); }
.ks-frames { padding: var(--rt-s-3) var(--rt-s-4); display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ks-frame { margin: 0; border: 1px solid var(--rt-hairline); border-radius: 6px; padding: 3px; text-align: center; background: var(--rt-surface); }
.ks-frame svg { display: block; width: 100%; aspect-ratio: 1 / 1; }
.ks-frame figcaption { font-family: var(--rt-font-mono); font-size: 10px; color: var(--rt-ink-soft); }
.ks-f-ghost path { fill: none; stroke: var(--rt-hairline); stroke-width: 3; stroke-linecap: round; }
.ks-f-ink path { fill: none; stroke: var(--rt-ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.ks-f-ink path.is-current { stroke: var(--rt-accent); }

.ks-stamp { font-size: 11.5px; color: var(--rt-ink-soft); line-height: 1.6; margin: 0; }

@media print {
    .ks-controls, .ks-samples, .ks-tabs, .ks-info { display: none; }
    .ks-frames { grid-template-columns: repeat(8, 1fr); }
}

/* CLS floors for the default character (字), whose info panel and diagram app.js
   renders after the data file arrives. MEASURED 2026-09-27 — info panel: 353px
   at 1280, 410px at 768 and 375 (single column); diagram: 104 / 111 / 231px.
   Both are released on the first edit, a user-initiated shift. */
.ks-info.ks-reserve { min-height: 350px; }
.ks-frames.ks-reserve-frames { min-height: 100px; }
@media (max-width: 720px) { .ks-info.ks-reserve { min-height: 406px; } .ks-frames.ks-reserve-frames { min-height: 108px; } }
@media (max-width: 480px) { .ks-frames.ks-reserve-frames { min-height: 228px; } }
