/* RT-EDU-019 — Kanji Grade Lookup.
 * Light surfaces throughout: --rt-ink / --rt-ink-soft on --rt-surface, list
 * badges and coverage bars 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. */

.kg-form { display: flex; flex-direction: column; gap: var(--rt-s-4); min-width: 0; }
.kg-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kg-label { font-family: var(--rt-font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; color: var(--rt-ink-muted); }
.kg-input {
    width: 100%; box-sizing: border-box; resize: vertical; padding: 10px 14px;
    border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-button);
    background: var(--rt-surface); color: var(--rt-ink); font-size: 20px; line-height: 1.5;
}
.kg-input:focus { outline: none; border-color: var(--rt-accent); box-shadow: 0 0 0 3px var(--rt-accent-soft); }
.kg-samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kg-samples-label { font-size: 11px; color: var(--rt-ink-soft); margin-right: 2px; }
.kg-chip {
    padding: 5px 11px; 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: 14px;
    transition: border-color 140ms ease, background 140ms ease;
}
.kg-chip:hover { border-color: var(--rt-accent); background: var(--rt-surface); }

.kg-out { display: flex; flex-direction: column; gap: var(--rt-s-3); min-width: 0; }
.kg-loading, .kg-empty { margin: 0; font-size: 14px; color: var(--rt-ink-soft); }
.kg-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--rt-ink-soft); }

/* ── profile ─────────────────────────────────────────────────────────────── */
.kg-profile { 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); display: flex; flex-direction: column; gap: 10px; }
.kg-profile-head { margin: 0; font-size: 15px; line-height: 1.5; color: var(--rt-ink); }
.kg-bars { display: flex; flex-direction: column; gap: 5px; }
.kg-bar-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.kg-bar-label { font-size: 12px; color: var(--rt-ink-soft); }
.kg-bar-track { height: 10px; border-radius: 999px; background: var(--rt-surface-2); overflow: hidden; }
.kg-bar-fill { display: block; height: 100%; background: var(--rt-accent); border-radius: 999px; }
.kg-bar-value { font-family: var(--rt-font-mono); font-size: 12px; text-align: right; color: var(--rt-ink); }
.kg-beyond { color: var(--rt-ink); }
.kg-beyond-chars { font-size: 18px; letter-spacing: .1em; }

/* ── cards ───────────────────────────────────────────────────────────────── */
.kg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.kg-card { border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-card); background: var(--rt-surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kg-card-head { display: flex; gap: 12px; align-items: center; }
.kg-card-char { font-size: 44px; line-height: 1; color: var(--rt-ink); flex: none; }
.kg-card-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kg-badge { align-self: flex-start; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--rt-hairline); color: var(--rt-ink); }
.kg-badge-kyoiku, .kg-badge-joyo { border-color: var(--rt-accent); }
.kg-badge-none { color: var(--rt-ink-soft); }
.kg-card-facts { font-size: 11.5px; line-height: 1.45; color: var(--rt-ink-soft); }
.kg-row { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.kg-row-label { flex: none; width: 44px; font-family: var(--rt-font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--rt-ink-muted); }
.kg-row-value { color: var(--rt-ink); min-width: 0; overflow-wrap: anywhere; }
.kg-kun-oku { color: var(--rt-ink-soft); }
.kg-kun-dash { color: var(--rt-ink-soft); }
.kg-meaning { margin: 0; font-size: 13px; line-height: 1.5; color: var(--rt-ink); }
.kg-link { border: 0; background: none; padding: 0; font-size: 16px; color: var(--rt-ink); text-decoration: underline; text-decoration-color: var(--rt-accent); cursor: pointer; }

/* ── grade browser ───────────────────────────────────────────────────────── */
.kg-panel { border: 1px solid var(--rt-hairline); border-radius: var(--rt-r-card); background: var(--rt-surface); min-width: 0; }
.kg-panel-head { padding: var(--rt-s-3) var(--rt-s-4); border-bottom: 1px solid var(--rt-hairline); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.kg-panel-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--rt-ink); }
.kg-panel-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.kg-sel { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--rt-ink); }
.kg-panel-controls .kg-sel select { width: auto; max-width: 260px; padding: 5px 8px; border: 1px solid var(--rt-hairline); border-radius: 6px; background: var(--rt-surface); color: var(--rt-ink); }
.kg-grid { padding: var(--rt-s-3) var(--rt-s-4); display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; max-height: 360px; overflow-y: auto; }
.kg-cell { font-size: 22px; line-height: 1; padding: 8px 0; border: 1px solid var(--rt-hairline); border-radius: 6px; background: var(--rt-surface); color: var(--rt-ink); cursor: pointer; }
.kg-cell:hover { border-color: var(--rt-accent); }

.kg-ack { font-size: 11.5px; color: var(--rt-ink-soft); line-height: 1.6; margin: 0; }
.kg-ack a { color: inherit; }

@media (max-width: 480px) {
    .kg-cards { grid-template-columns: 1fr; }
    .kg-card-char { font-size: 38px; }
}

/* CLS floor for the default text (憂鬱な日に図書館で漢字を調べた。), whose profile
   and cards app.js renders after the data file arrives. MEASURED 2026-09-30
   through the real Blade render: 1,039px at 1280, 1,324px at 768, 2,186px at
   375 (one card per row). Each floor sits just under its measurement; all are
   released on the first edit, a user-initiated shift. */
.kg-out.kg-reserve { min-height: 1034px; }
@media (max-width: 900px) { .kg-out.kg-reserve { min-height: 1318px; } }
@media (max-width: 480px) { .kg-out.kg-reserve { min-height: 2180px; } }
