.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.library-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.library-head h1 { margin: 16px 0; font-size: 40px; }
.search { margin-left: auto; }
.search input, input[type="text"], input[type="email"], input[type="password"] { background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 14px; font: inherit; min-width: 260px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 28px; }
.filters a { text-decoration: none; padding: 6px 14px; border-radius: 999px; background: var(--surface); color: var(--text-2); }
.filters a.active { background: var(--accent); color: var(--on-accent); }
.filters small { opacity: .7; }
.continue { margin-bottom: 28px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px; }
.book-card { position: relative; display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.book-card .cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; box-shadow: 0 16px 30px rgba(0,0,0,.35); }
.book-card strong { font-family: var(--title-font); margin-top: 8px; }
.book-card .author { color: var(--text-2); font-size: 14px; }
.book-card .lang, .book-detail .lang { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.45); color: #fff; }
.book-detail .lang { position: static; display: inline-block; }
.book-card.started strong::after { content: " •"; color: var(--accent); }
.cover.generated { display: flex; align-items: flex-end; padding: 16px; color: #fff; font-family: var(--title-font); font-size: 18px; background: linear-gradient(150deg, #6a3cff, #c03a8f); }
.cover.generated.kind-tale { background: linear-gradient(150deg, #2d7dff, #6a3cff); }
.cover.generated.kind-fable { background: linear-gradient(150deg, #2aa37a, #1f6fa3); }
.cover.generated.kind-poem { background: linear-gradient(150deg, #ff8a3d, #d63c7a); }
.cover.generated.kind-story { background: linear-gradient(150deg, #1aa6b7, #2d5bff); }
.text-results { list-style: none; padding: 0; display: grid; gap: 8px; }
.text-results a { display: flex; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface); text-decoration: none; }
.text-results span, .empty { color: var(--text-2); }
.book-head { display: flex; gap: 40px; align-items: center; flex-wrap: wrap; }
.book-head .cover { width: 180px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; }
.book-head h1 { font-size: 40px; margin: 8px 0; }
.chapter-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.chapter-list a { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 14px; background: var(--surface); text-decoration: none; }
.chapter-list .label { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-family: var(--title-font); }
.chapter-list .title { flex: 1; }
.chapter-list small, .chapter-list .pages, .source { color: var(--text-2); }
main.typing { max-width: 1000px; display: flex; flex-direction: column; gap: 18px; min-height: 100vh; padding-top: 20px; }
.typing-head { display: flex; align-items: center; gap: 10px; }
.typing-title { flex: 1; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 10px 18px; border-radius: 999px; background: var(--surface); }
.button.icon { width: 40px; height: 40px; padding: 0; justify-content: center; }
.button:disabled { opacity: .35; cursor: default; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress .bar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.page-window { overflow: hidden; margin-top: 12px; }
.page-text { font: 30px/1.45 var(--title-font); white-space: pre-wrap; color: var(--text-3); transition: transform .28s ease; }
.page-text .typed { color: var(--text); }
.page-text .current { color: var(--text); background: color-mix(in srgb, var(--accent) 40%, transparent); border-bottom: 2px solid var(--accent); border-radius: 3px; }
.page-text .current.newline::before { content: "↵"; }
.page-text .error { background: color-mix(in srgb, var(--error) 70%, transparent); border-bottom-color: var(--error); }
.metrics { display: flex; gap: 22px; align-items: baseline; justify-content: center; }
.metrics b { font-size: 26px; color: var(--accent); }
.dead-key { font-size: 22px; padding: 0 10px; border-radius: 8px; background: var(--surface); }
.keyboard { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 24px; background: var(--surface); max-width: 820px; width: 100%; margin: 0 auto; }
.key-row { display: flex; gap: 6px; }
.key { flex: 1 1 0; min-width: 0; height: 44px; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 15px; position: relative; color: var(--text); }
.key.symbol { color: var(--text-3); }
.key[data-shifted]::before { content: attr(data-shifted); position: absolute; top: 3px; font-size: 10px; color: var(--text-3); }
.key::after { content: ""; position: absolute; bottom: 4px; width: 12px; height: 3px; border-radius: 2px; opacity: .8; }
.key[data-finger="pinky"]::after { background: #b48cff; }
.key[data-finger="ring"]::after { background: #5aa9ff; }
.key[data-finger="middle"]::after { background: #3fd8c4; }
.key[data-finger="index"]::after { background: #ffb15c; }
.key[data-finger="thumb"]::after { background: #9aa0b5; }
.key.next { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; }
.key.error { background: var(--error); color: #fff; border-color: transparent; }
.typing-input { position: fixed; opacity: 0; pointer-events: none; left: -1000px; top: 0; width: 10px; height: 10px; }
.hint { text-align: center; font-size: 13px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 10; }
.overlay[hidden] { display: none; }
.summary-card { width: min(520px, 92vw); padding: 32px; border-radius: 24px; background: var(--canvas); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.summary-card h2 { margin: 0; }
.summary-card .stats { display: flex; gap: 14px; }
.summary-card .stats div { flex: 1; padding: 14px; border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; }
.summary-card .stats b { font-size: 32px; }
.speed-chart { width: 100%; height: auto; }
.speed-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.speed-chart .average { stroke: var(--text-3); stroke-dasharray: 4 6; }
.speed-chart .error { fill: var(--error); }
@media (max-width: 700px) { .page-text { font-size: 22px; } .key { height: 34px; font-size: 12px; } main { padding: 16px; } }
[data-text-size="small"] .page-text { font-size: 24px; }
[data-text-size="large"] .page-text { font-size: 38px; }
.settings, .stats-page { max-width: 900px; margin: 0 auto; padding: 0 32px 48px; width: 100%; }
.settings-form { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.settings-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; display: flex; gap: 18px; flex-wrap: wrap; }
.settings-form label { display: flex; gap: 10px; align-items: center; }
.settings-form select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; }
.settings-form .muted { margin: -8px 0 0; font-size: 14px; }
.reader { max-width: 1200px; margin: 0 auto; padding: 18px 32px 32px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.spread { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 32px; }
.reader-page { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px 40px; font: 19px/1.65 var(--title-font); min-height: 560px; display: flex; flex-direction: column; }
.reader-page h2 { margin-top: 0; font-size: 26px; }
.reader-page p { margin: 0 0 .7em; }
.reader-page footer { margin-top: auto; text-align: center; color: var(--text-3); font-size: 14px; }
.reader-nav { display: flex; justify-content: center; align-items: center; gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 28px; color: var(--accent); }
.tile span { color: var(--text-2); font-size: 14px; }
.bars { width: 100%; height: auto; }
.bars rect { fill: var(--accent); }
.recent-sessions { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.recent-sessions li { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; padding: 10px 14px; background: var(--surface); border-radius: 10px; }
.story-section { margin-bottom: 32px; }
.story-section h2 { margin-bottom: 0; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; margin-top: 16px; }
.story-card { position: relative; display: flex; flex-direction: column; text-decoration: none; border-radius: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); transition: transform .2s ease; }
.story-card:hover { transform: translateY(-3px); }
.story-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.story-info { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.story-info .muted { font-size: 14px; }
.story-card .progress { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.story-card .bar { display: block; height: 100%; width: 0; background: var(--accent); }
.story .story-scroll { position: relative; flex: 1; overflow-y: auto; max-width: 820px; width: 100%; margin: 0 auto; padding: 0 8px 40vh; max-height: calc(100vh - 360px); }
.story-hero { margin: 0 0 20px; position: relative; }
.story-hero img { width: 100%; max-height: 300px; object-fit: cover; border-radius: 18px; display: block; }
.story-hero figcaption { position: absolute; left: 14px; bottom: 12px; padding: 3px 12px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; }
.story-hero figcaption:empty { display: none; }
.story-transcript p { font: 22px/1.6 var(--title-font); margin: 0 0 .7em; color: var(--text); }
.story-transcript p.chosen { color: var(--accent); }
.story-transcript span, .story-option span { color: var(--text-3); }
.story-transcript span.typed, .story-option span.typed { color: var(--text); }
.story-transcript span.current, .story-option span.current { color: var(--text); background: color-mix(in srgb, var(--accent) 40%, transparent); border-bottom: 2px solid var(--accent); border-radius: 3px; }
.story-transcript span.error, .story-option span.error, .page-text .error { background: color-mix(in srgb, var(--error) 70%, transparent); border-bottom-color: var(--error); }
.choices ol { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.story-option { padding: 14px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font: 20px/1.5 var(--title-font); transition: opacity .2s ease; }
.story-option.dead { opacity: .35; }
.chapter-picker { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; max-width: 260px; }
.summary-card .actions { display: flex; gap: 12px; justify-content: center; }
.choices-made { text-align: left; color: var(--text-2); }
.story-card .lang { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.45); color: #fff; }
.learn { max-width: 1100px; margin: 0 auto; padding: 0 32px 48px; width: 100%; }
.learn-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.learn-options { display: flex; gap: 18px; align-items: center; }
.learn-options select { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; }
.learn-summary { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.learn-count { margin: 0; }
.learn-count b { font-size: 48px; color: var(--accent); }
.learn-count span:first-of-type { font-size: 26px; color: var(--text-2); }
.weak-keys { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; padding: 8px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.weak-keys .key-chip { color: var(--error); }
.stage-head { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.stage-head h2 { margin: 24px 0 10px; font-size: 20px; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lesson-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: transform .2s ease; }
a.lesson-card:hover { transform: translateY(-2px); }
.lesson-card.locked { opacity: .45; }
.lesson-card.upcoming { outline: 2px solid var(--accent); }
.lesson-top { display: flex; justify-content: space-between; font-size: 13px; }
.stars { letter-spacing: 2px; color: var(--text-3); }
.stars.earned, .big-stars.earned { color: #ffc75c; }
.big-stars { font-size: 34px; letter-spacing: 6px; margin: 0; text-align: center; color: var(--text-3); }
.key-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.key-chip { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 7px; border: 1px solid var(--line); display: inline-grid; place-items: center; font: 15px var(--title-font); }
#intro-keys .key-chip { min-width: 48px; height: 48px; font-size: 26px; }
.lesson .exercise { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; max-width: 900px; margin: 0 auto; text-align: center; }
.exercise-kind { font-size: 13px; font-weight: 600; color: var(--accent); padding: 5px 12px; border-radius: 999px; background: var(--surface); }
.exercise-text { font: 40px/1.4 var(--title-font); margin: 0; white-space: pre-wrap; }
.exercise-text span { color: var(--text-3); }
.exercise-text span.typed { color: var(--text); }
.exercise-text span.current { color: var(--text); background: color-mix(in srgb, var(--accent) 40%, transparent); border-bottom: 2px solid var(--accent); border-radius: 3px; }
.exercise-text span.error { background: color-mix(in srgb, var(--error) 70%, transparent); border-bottom-color: var(--error); }
.exercise-upcoming { font: 22px var(--title-font); color: var(--text-3); opacity: .6; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
