/* The accepted paper design comes from styles.css. Only title faces vary.
   The remaining rules fit the duplicate's audio, compact result and detail insert. */
@font-face{font-family:Diagnostic Pixel;src:url('./assets/fonts/tiny5.woff2') format('woff2');font-weight:400;font-display:swap}
@font-face{font-family:Diagnostic Book;src:url('./assets/fonts/literata.woff2') format('woff2');font-weight:200 900;font-display:swap}
@font-face{font-family:Diagnostic Sans;src:url('./assets/fonts/rubik.woff2') format('woff2');font-weight:300 900;font-display:swap}
:root{--display:Diagnostic Pixel,monospace}
:root[data-theme=lilac]{--display:Diagnostic Book,Georgia,serif}
:root[data-theme=amber]{--display:Diagnostic Sans,system-ui,sans-serif}
.signal-heading h1{font-family:var(--display);font-weight:400;line-height:1.05;letter-spacing:.025em}
/* Optional terminal contrast changes the title alone, never the paper palette. */
:root[data-theme=terminal] .signal-heading h1{color:#b0ff70;text-shadow:0 1px 2px #101812,0 0 7px #101812}
:root[data-theme=lilac] .signal-heading h1{font-weight:650;letter-spacing:-.025em}
:root[data-theme=amber] .signal-heading h1{font-weight:600;letter-spacing:.01em}
.question-screen .signal-heading{width:auto;right:64px}
.question-screen .signal-heading h1{font-size:clamp(28px,8vw,38px)}
.question-screen .long-heading h1{font-size:clamp(24px,6.8vw,32px)}
.question-screen .single-word-heading h1{font-size:clamp(18px,5.5vw,24px)}
:root[data-theme=lilac] .question-screen .single-word-heading h1{font-size:clamp(16px,4.9vw,21px)}
:root[data-theme=amber] .question-screen .single-word-heading h1{font-size:clamp(16px,4.9vw,21px)}

/* Sound is a small ink control in the same reserved corner as owner reset. */
.audio-control{position:absolute;right:8px;top:max(5px,env(safe-area-inset-top));width:44px;height:44px;min-height:44px;padding:10px;background:#e9d8eee8;color:var(--ink);border:1px solid #e9d8ee8c;border-radius:5px;box-shadow:none;z-index:3;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.audio-control svg{width:24px;height:24px;stroke:currentColor;fill:none}
.audio-control[aria-pressed=true]{background:#d2b8e6;border-color:#563071}
.audio-error{position:absolute;right:12px;top:calc(5.5svh + 94px);max-width:230px;margin:0;padding:5px 8px;background:#e9d8eef0;color:#682343;font-size:12px;line-height:1.2;z-index:4}
/* Both rows exist before failures: 44px for save/retry, 20px for sound.
   Their 4px gap keeps the existing 68px reservation and answer positions. */
.question-feedback{grid-template-rows:44px 20px;row-gap:4px}
.question-feedback .answer-error{grid-row:1;font-size:13px;line-height:1.15}
.question-feedback .audio-error{position:static;grid-column:1/-1;grid-row:2;max-width:none;padding:0;background:transparent;align-self:center}

/* The outer screen and action rows stay fixed. Only the prose insert scrolls. */
.detail-screen .paper-content{position:absolute;top:clamp(126px,18svh,160px);left:var(--paper-edge);right:var(--paper-edge);bottom:max(12px,env(safe-area-inset-bottom));width:auto;gap:8px;min-height:0}
.detail-title{font-size:21px;line-height:1.15;margin:0;flex:none;text-align:center}
.detail-scroll{position:relative;flex:1;min-height:0}
.detail-region.prose{height:100%;min-height:0;overflow:auto;overscroll-behavior:contain;padding:8px 10px 32px;border:0;border-radius:0;background:transparent;font-size:19px;line-height:1.35;scrollbar-width:none;--fade-top:0px;--fade-bottom:0px;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 var(--fade-top),#000 calc(100% - var(--fade-bottom)),transparent);mask-image:linear-gradient(to bottom,transparent,#000 var(--fade-top),#000 calc(100% - var(--fade-bottom)),transparent)}
.detail-region::-webkit-scrollbar{display:none}
.detail-scroll[data-more-above=true] .detail-region{--fade-top:12px}
.detail-scroll[data-more-below=true] .detail-region{--fade-bottom:52px}
.detail-scroll-cue{position:absolute;left:calc(50% - 22px);bottom:0;width:44px;height:44px;min-height:44px;padding:8px;display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:var(--ink);box-shadow:none;cursor:pointer;z-index:1}
.detail-scroll-cue svg{width:28px;height:28px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.detail-region:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.detail-region p{margin:0 0 .9em}.detail-recommendation{border-top:1px solid #74548466;padding-top:12px}
.detail-actions{flex:none;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px}
.detail-actions .paper-button{min-height:44px;font-size:16px;line-height:1.15;padding:6px;gap:4px}
.detail-actions .navigation-arrow{width:18px;flex:none}
.detail-actions>.paper-button:last-child:nth-child(odd){grid-column:1/-1}
/* Reserve genuine failure feedback so footer buttons do not move on failure. */
.detail-screen .retake-status,.detail-screen .retake-status:empty{display:block;height:36px;min-height:36px;flex:none;margin:0;padding-block:2px;font-size:13px;line-height:1.2}

/* Reserved rows keep the meter at the same height when the album CTA appears. */
.analysis-screen .paper-content{position:absolute;left:var(--paper-edge);right:var(--paper-edge);top:calc(50% - 82px);margin:0;transform:none;width:auto;display:grid;grid-template-rows:64px 12px 34px 54px;gap:12px;align-items:stretch}
.analysis-status{margin:0;align-self:center;font-size:clamp(21px,5.6vw,28px);line-height:1.12}
.analysis-percent{align-self:center}
.analysis-interference{justify-content:flex-end}
.analysis-screen .paper-content>.paper-button{align-self:end}
/* Use the middle of the paper, including the CTA, rather than its bottom edge. */
.result-screen .paper-content{position:absolute;top:44%;bottom:max(8%,env(safe-area-inset-bottom));left:var(--paper-edge);right:var(--paper-edge);width:auto;justify-content:space-evenly;gap:clamp(8px,1.4svh,16px)}
.invitation-url{min-height:44px}
@media(max-height:740px){.result-screen .paper-content{top:38%;bottom:max(5%,env(safe-area-inset-bottom));gap:9px}}
@media(max-height:600px){
 .result-screen .paper-content{top:30%;bottom:max(16px,env(safe-area-inset-bottom));gap:8px}
 .detail-screen .paper-content{top:110px;bottom:10px;gap:6px}
 .detail-title{font-size:18px}.detail-region.prose{font-size:16px;line-height:1.3;padding:8px 8px 32px}
 .detail-actions .paper-button{font-size:14px}
}
@media(max-width:340px){.detail-actions .paper-button{font-size:14px}.detail-actions .navigation-arrow{width:16px}}
