/* GODIMS Typing - tool UI (practice, exams, lessons). Loaded only on pages that use the engine. */
.tool-wrap { max-width: 980px; margin: 0 auto; padding: 36px 24px 72px; }
.panel { background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; padding: clamp(20px, 4vw, 36px); margin-bottom: 24px; box-shadow: 6px 6px 0 var(--teal); }
.panel[hidden] { display: none; }
.history-panel { box-shadow: none; border-color: var(--line); }
.panel-title { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: .6em; }
.small-title { font-size: 1.25rem; }
.muted { color: var(--ink-3); }
.small { font-size: .92rem; }
.lead-sm { font-size: 1.1rem; color: var(--ink-2); max-width: 52ch; }

.field { margin-bottom: 28px; }
.field-label { font: 700 1.1rem var(--font-display); margin-bottom: 12px; }
.keyrow { display: flex; flex-wrap: wrap; gap: 10px; }
.subpanel { margin-top: 16px; }
.subpanel[hidden] { display: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel label { font-weight: 600; display: grid; gap: 6px; }
.panel select, .panel textarea, .panel input[type="number"] {
    font: 500 1rem var(--font-body); padding: .7em .9em; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink); width: 100%;
}
.panel textarea { font-family: var(--font-mono); font-size: .95rem; resize: vertical; }
.custom-time { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 16px; }
.custom-time label.inline { display: flex; align-items: center; gap: 8px; }
.custom-time input { width: 84px; }
.check { display: flex !important; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.check small { font-weight: 400; color: var(--ink-3); }
.keycap.is-static { cursor: default; pointer-events: none; }

/* test stage */
.stage-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.stage-title { font: 700 1.25rem var(--font-display); }
.live { display: flex; gap: 12px; }
.live > div { border: 2px solid var(--ink); border-radius: 12px; padding: 8px 16px; min-width: 96px; text-align: center; background: var(--paper-2); }
.live-label { display: block; font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.live b { font: 700 1.6rem var(--font-mono); }
.progress { height: 8px; border-radius: 99px; background: var(--paper-2); border: 1.5px solid var(--line); overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s linear; }

.display { position: relative; height: calc(2.6rem * 5 + 38px); overflow: hidden; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper-2); padding: 18px 22px; cursor: text; scroll-behavior: smooth; }
.display.focus { border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 30%, transparent); }
.words { font: 500 1.55rem/2.6rem var(--font-mono); word-break: normal; overflow-wrap: anywhere; white-space: pre-wrap; user-select: none; color: var(--ink-3); }
.ch { border-radius: 3px; }
.ch.ok { color: var(--ink); }
.ch.err { color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, transparent); text-decoration: underline wavy var(--bad) 1px; }
.ch.cur { background: var(--teal); color: #000; }
.display:not(.focus) .ch.cur { background: transparent; box-shadow: inset 0 -3px 0 var(--teal); }
.hidden-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; font-size: 16px; }   /* 16px stops iOS zoom */
.display-hint { position: absolute; right: 14px; bottom: 10px; font-size: .82rem; color: var(--ink-3); background: var(--paper-2); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.display.focus .display-hint { opacity: 0; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* results */
.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 24px; }
.badge { display: inline-block; background: var(--teal); color: #000; font-weight: 700; padding: .25em .9em; border-radius: 999px; border: 2px solid var(--ink); margin: 0; }
.badge[hidden] { display: none; }
.big-wpm { border: 2px solid var(--ink); border-radius: 18px; padding: 14px 30px; background: var(--teal); color: #000; text-align: center; }
.big-wpm b { display: block; font: 800 clamp(3rem, 8vw, 4.6rem)/1 var(--font-display); letter-spacing: -0.04em; }
.big-wpm span { font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.stat-grid > div { border: 2px solid var(--line); border-radius: 14px; padding: 14px 18px; }
.stat-grid b { display: block; font: 700 1.7rem var(--font-display); }
.stat-grid span { color: var(--ink-3); font-size: .92rem; }
.graph { border: 2px solid var(--line); border-radius: 14px; padding: 12px; background: var(--paper-2); margin-bottom: 8px; }
.graph svg { display: block; width: 100%; }
#result h3 { margin-top: 26px; }

/* history table */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--font-display); }

@media (max-width: 700px) {
    .two-col { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .words { font-size: 1.2rem; line-height: 2.2rem; }
    .display { height: calc(2.2rem * 5 + 30px); padding: 14px; }
    .live > div { min-width: 0; padding: 6px 10px; flex: 1; }
    .live { width: 100%; }
    .tool-wrap { padding: 24px 16px 56px; }
}
