@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Literata:opsz,wght@7..72,400;7..72,500;7..72,600&display=swap');

:root {
    color-scheme: light;
    font-family: "DM Sans", system-ui, sans-serif;
    color: #233a3a;
    background: #ffffff;
    font-synthesis: none;
    --ink: #233a3a;
    --muted: #7d8075;
    --line: #e2e5e2;
    --accent: #344e45;
}

* { box-sizing: border-box; }
#voice-audio:not([hidden]) { display: block; width: min(100%, 480px); margin: 16px auto 0; }
body { margin: 0; min-width: 320px; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #b7894d; outline-offset: 4px; }
button:disabled { cursor: default; opacity: .38; }
a { color: inherit; }
.reader { width: min(1120px, calc(100% - 96px)); margin: 0 auto; padding: 29px 0 18px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { width: 37px; height: 37px; }
.brand strong { display: block; font-family: "Literata", Georgia, serif; font-size: 26px; font-weight: 500; letter-spacing: -.9px; line-height: 1.25; }
.brand small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: 1.35px; color: var(--muted); }
.dedication { font-size: 12px; color: #72796f; }
.dedication span { margin-left: 14px; font-size: 24px; color: #7d887b; vertical-align: middle; }
.story-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 29px 0 23px; }
.eyebrow { margin: 0 0 7px; text-transform: uppercase; font-size: 10px; letter-spacing: 2.15px; color: #798276; font-weight: 600; }
h1 { margin: 0; font-family: "Literata", Georgia, serif; font-size: clamp(23px, 3vw, 34px); font-weight: 500; line-height: 1.3; letter-spacing: -.8px; }
h1:focus { outline: none; }
.story-note { flex-shrink: 0; color: var(--muted); font-size: 11px; line-height: 1.8; text-align: right; }
.book { overflow: hidden; background: #ffffff; border: 1px solid #dfe3de; border-radius: 7px; box-shadow: 0 7px 32px #24352b06, 0 1px 2px #24352b04; }
.page-meta { display: flex; align-items: center; gap: 22px; padding: 17px 27px; border-bottom: 1px solid #e8ebe6; }
.chapter { flex-shrink: 0; font-size: 11px; font-weight: 600; }
.chapter span { margin-left: 3px; color: #929286; font-weight: 400; }
.progress { flex: 1; max-width: 190px; height: 3px; overflow: hidden; border-radius: 2px; background: #e4e8e1; }
.progress span { display: block; height: 100%; background: #9aab90; transition: width .4s ease; }
.read-label { margin-left: auto; color: #8b8d80; font-size: 10px; }
.read-label span { margin-left: 5px; font-size: 15px; }
.illustration { height: clamp(180px, 24vh, 240px); margin: 0; background: #ffffff; position: relative; overflow: hidden; }
.illustration img { display: block; width: 100%; height: 100%; object-fit: contain; }
.reading { min-height: 250px; padding: 17px 7% 26px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.ornament { color: #89957f; font-size: 25px; line-height: 1; margin-bottom: 15px; }
.german { margin: 0; max-width: 920px; font-family: "Literata", Georgia, serif; font-weight: 400; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.6; letter-spacing: .1px; text-align: center; text-wrap: pretty; white-space: pre-line; }
.german:focus { outline: none; }
.page-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 25px; border-top: 1px solid #e8ebe6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 11px 20px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--ink); font-size: 12px; font-weight: 600; cursor: pointer; transition: background .16s, border-color .16s, transform .16s; white-space: nowrap; }
.button:not(:disabled):active { transform: translateY(1px); }
.button svg { width: 20px; height: 20px; }
.button span { font-size: 19px; font-weight: 400; }
.previous { padding-left: 3px; color: #798174; }
.previous:not(:disabled):hover, .quiet:hover { background: #edf1e9; }
.next { background: #eef2eb; border-color: #e0e6dc; padding-inline: 22px; }
.next:not(:disabled):hover { background: #e3eadf; border-color: #cbd7c4; }
.page-hint { color: #9b9b8d; font-size: 10px; }
.companion { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 20px; padding: 18px 20px; background: #f3f6f0; border: 1px solid #e2e8dd; border-radius: 7px; }
.companion-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.voice-orb { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #d5dfce; border-radius: 50%; color: #74816a; background: #ffffff; }
.voice-orb svg { width: 23px; height: 23px; }
.voice-orb.active { color: #47643c; box-shadow: 0 0 0 5px #d4dfc955; }
.voice-orb.muted { color: #999787; box-shadow: none; }
.voice-status { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.5; }
.voice-hint { margin: 4px 0 0; color: #7c8273; font-size: 11px; line-height: 1.5; }
.voice-actions { display: flex; gap: 8px; flex-shrink: 0; }
.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; padding-inline: 22px; }
.primary:not(:disabled):hover { background: #253e35; }
.quiet, .stop { min-height: 44px; padding-inline: 13px; }
.stop { border-color: #c9d0c0; color: #55654e; }
.stop:not(:disabled):hover { border-color: #9dab92; background: #f1f3e9; }
.error { padding: 13px 17px; margin: 12px 0 0; border: 1px solid #dec4ae; background: #f7eee3; border-radius: 5px; color: #8c5236; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 20px 2px 0; color: #9b9b8e; font-size: 10px; letter-spacing: .2px; }
.ending { min-height: 470px; text-align: center; padding: 65px 24px; border: 1px solid #dfe3de; border-radius: 7px; background: #ffffff; }
.ending-star { display: block; font-size: 58px; color: #89957f; margin-bottom: 18px; }
.ending h2 { margin: 0; font-family: "Literata", Georgia, serif; font-size: clamp(28px, 5vw, 44px); font-weight: 500; }
.ending p:not(.eyebrow) { margin: 20px 0 28px; font-size: 15px; line-height: 1.9; color: #7c8273; }
.missing { max-width: 600px; margin: 15vh auto; padding: 24px; }
.missing a { display: inline-block; margin-top: 24px; }
#blazor-error-ui { display: none; position: fixed; inset: auto 12px 12px; padding: 16px; background: #faedd8; border: 1px solid #c5a879; border-radius: 5px; color: #644a2c; font-size: 14px; z-index: 1000; box-shadow: 0 3px 20px #0002; }
#components-reconnect-modal { display: none; position: fixed; inset: auto 12px 12px; padding: 16px; background: #f3f6f0; border: 1px solid #b5c2ad; border-radius: 5px; color: #344e45; font-size: 14px; z-index: 1000; box-shadow: 0 3px 20px #0002; }
#components-reconnect-modal.components-reconnect-show, #components-reconnect-modal.components-reconnect-failed, #components-reconnect-modal.components-reconnect-rejected { display: block; }
.reconnect-failed { display: none; }
.components-reconnect-failed .reconnect-pending, .components-reconnect-rejected .reconnect-pending { display: none; }
.components-reconnect-failed .reconnect-failed, .components-reconnect-rejected .reconnect-failed { display: inline; }

@media (min-width: 1500px) {
    .reader { padding-top: 38px; }
    .story-heading { margin-top: 35px; margin-bottom: 26px; }
    .reading { min-height: 260px; }
}

@media (max-width: 760px) {
    .reader { width: calc(100% - 40px); padding-top: 20px; }
    .masthead { padding-bottom: 18px; }
    .brand strong { font-size: 24px; }
    .brand small { font-size: 9px; letter-spacing: 1px; }
    .brand-mark { width: 33px; }
    .story-heading { margin: 23px 0 19px; }
    .story-note { display: none; }
    .page-meta { padding: 13px 20px; gap: 15px; }
    .illustration { height: clamp(180px, 24vh, 220px); }
    .reading { min-height: 240px; padding-inline: 6%; }
    .german { font-size: clamp(28px, 4.6vw, 36px); }
    .page-nav { padding: 13px 18px; }
    .companion { padding: 15px; margin-top: 16px; gap: 14px; }
    .voice-hint { max-width: 220px; }
    .voice-actions { gap: 2px; }
    .primary { padding-inline: 16px; }
}

@media (max-width: 480px) {
    .reader { width: calc(100% - 28px); padding-top: 16px; }
    .masthead { gap: 8px; padding-bottom: 16px; }
    .brand { gap: 8px; }
    .brand strong { font-size: 23px; }
    .brand-mark { width: 29px; height: 33px; }
    .dedication { max-width: 70px; font-size: 10px; line-height: 1.7; text-align: right; }
    .dedication span { display: none; }
    .story-heading { margin: 21px 0 17px; }
    .eyebrow { font-size: 9px; margin-bottom: 6px; }
    h1 { font-size: 25px; max-width: 320px; }
    .page-meta { padding: 11px 16px; gap: 13px; }
    .progress { max-width: 95px; }
    .read-label { font-size: 9px; }
    .illustration { height: 175px; }
    .reading { min-height: 225px; padding: 17px 18px 23px; }
    .ornament { font-size: 22px; margin-bottom: 12px; }
    .german { font-size: 29px; line-height: 1.55; }
    .page-nav { padding: 11px 13px; }
    .page-hint { display: none; }
    .button { font-size: 12px; }
    .next { padding-inline: 18px; }
    .companion { flex-wrap: wrap; justify-content: center; padding: 16px; gap: 13px; }
    .companion-info { width: 100%; gap: 12px; }
    .voice-status { font-size: 12px; }
    .voice-hint { font-size: 10px; max-width: none; }
    .voice-orb { width: 38px; height: 38px; }
    .voice-actions { width: 100%; justify-content: stretch; gap: 9px; }
    .voice-actions .button { flex: 1; }
    .footer { padding-top: 17px; font-size: 9px; }
    .footer span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
