/* The Plot Thickens: reusable, audio-first story collection. */
.library-app { min-height: 100dvh; color: var(--charcoal); background: var(--ivory); }
.library-app button, .library-app input, .library-app textarea { font: inherit; }
.library-app button { cursor: pointer; }
.library-app button:disabled { cursor: not-allowed; opacity: .37; }
.library-app button:focus-visible, .library-app input:focus-visible, .library-app textarea:focus-visible, .library-app a:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.library-app button, .library-app a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.library-app .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.library-loading { display: flex; min-height: 100dvh; flex-direction: column; align-items: center; justify-content: center; gap: 22px; color: var(--muted-foreground); }
.library-topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: max(17px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) 17px max(24px,env(safe-area-inset-left)); border-bottom: 1px solid var(--border); background: rgba(250,252,251,.95); position: sticky; top: 0; z-index: 15; backdrop-filter: blur(14px); }
.library-brand-button { background: none; border: none; padding: 5px 0; display: flex; align-items: center; }
.library-topnote { font-weight: 850; letter-spacing: .21em; font-size: .64rem; color: #656f72; text-align: center; }
.library-topnote span { color: var(--teal-dark); margin: 0 7px; }
.library-top-home, .library-back { display: inline-flex; align-items: center; gap: 9px; border: 0; background: transparent; font-size: .81rem; font-weight: 800; padding: 12px; }
.library-top-home:hover, .library-back:hover { color: var(--teal-dark); }
.library-kicker { font-size: .68rem; font-weight: 850; letter-spacing: .22em; text-transform: uppercase; color: var(--teal-dark); margin: 0 0 16px; }
.library-hero { min-height: min(650px, 83dvh); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0,.95fr); border-bottom: 1px solid var(--border); }
.library-hero-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(46px,6vw,100px) clamp(28px,7vw,116px); max-width: 900px; }
.library-hero h1 { font-family: 'Arial Black',Impact,ui-sans-serif,sans-serif; margin: 0 0 30px; font-size: clamp(4rem, 8.3vw, 9.4rem); letter-spacing: -.08em; line-height: .85; font-weight: 900; }
.library-hero h1 em { color: var(--teal-dark); font-style: normal; }
.library-hero-copy > p:not(.library-kicker) { margin: 0; font-size: clamp(1rem,1.35vw,1.24rem); line-height: 1.7; color: #4d575a; max-width: 600px; }
.library-hero-stats { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 36px; }
.library-hero-stats span { display: inline-flex; flex-direction: column; gap: 3px; text-transform: uppercase; font-weight: 800; letter-spacing: .1em; font-size: .63rem; color: #5f6a6c; }
.library-hero-stats strong { font-size: 1.55rem; color: var(--charcoal); letter-spacing: -.05em; }
.library-source-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 36px; padding-bottom: 5px; border-bottom: 1px solid var(--teal-dark); color: var(--charcoal); text-decoration: none; font-size: .76rem; font-weight: 800; }
.library-hero-art { position: relative; background: #cddad5; min-height: 480px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; isolation: isolate; }
.library-hero-art::before { content: ''; position: absolute; inset: -35% 3% auto auto; width: 78%; aspect-ratio: 1; border-radius: 50%; background: var(--teal); z-index: -1; }
.library-hero-art::after { content: ''; position: absolute; left: -20%; bottom: -35%; width: 74%; aspect-ratio:1; border-radius:50%; background:#dae9e4; z-index:-1; }
.library-hero-art img { width: 100%; height: 100%; max-height: 640px; object-fit: cover; object-position: center; display: block; }
.library-art-sticker { position: absolute; bottom: clamp(20px,4vw,68px); right: clamp(20px,5vw,76px); transform: rotate(-5deg); background: var(--charcoal); color: var(--ivory); padding: 20px 25px; font-weight: 850; font-size: clamp(1rem,1.65vw,1.6rem); line-height: 1.17; box-shadow: 7px 7px 0 var(--teal); }
.library-catalog { max-width: 1540px; margin: 0 auto; padding: clamp(50px,7vw,100px) clamp(20px,5vw,76px) 110px; }
.library-catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 36px; }
.library-catalog h2 { font-family:'Arial Black',Impact,ui-sans-serif,sans-serif; font-size:clamp(2.2rem,4vw,4.6rem); letter-spacing:-.065em; line-height:1.05; margin:0 0 12px; }
.library-catalog h2 span, .library-stage h2 span { color:var(--teal-dark); }
.library-catalog-heading p:not(.library-kicker) { color:var(--muted-foreground); line-height:1.55; margin:0; }
.library-completion { border:1px solid var(--border); padding:22px 24px; min-width:190px; background:var(--paper); }
.library-completion strong { font-size:2.4rem; line-height:1; font-weight:900; letter-spacing:-.06em; }
.library-completion strong span { font-size:1rem; color:var(--muted-foreground); }
.library-completion small { display:block; margin-top:8px; font-size:.57rem; letter-spacing:.15em; font-weight:850; }
.library-completion-track, .library-card-track { display:block; width:100%; height:4px; background:var(--stone); overflow:hidden; margin-top:16px; }
.library-completion-track i, .library-card-track i { display:block; height:100%; background:var(--teal-dark); transition:width .2s ease; }
.library-tools { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:20px; }
.library-filters { display:flex; flex-wrap:wrap; gap:8px; }
.library-filters button { border:1px solid var(--border); background:transparent; padding:12px 17px; font-size:.79rem; font-weight:800; min-height:44px; }
.library-filters button.active { background:var(--charcoal); border-color:var(--charcoal); color:var(--ivory); }
.library-search { display:flex; align-items:center; gap:10px; border:1px solid var(--border); min-height:46px; width:min(100%,330px); padding:0 14px; background:var(--paper); }
.library-search input { background:transparent; border:0; outline:0; width:100%; min-width:0; color:var(--charcoal); }
.library-results { color:var(--muted-foreground); font-size:.75rem; font-weight:750; text-transform:uppercase; letter-spacing:.1em; margin:0 0 20px; }
.library-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:15px; }
.library-story-card { display:flex; flex-direction:column; text-align:left; min-width:0; min-height:260px; padding:24px 24px 0; border:1px solid var(--border); background:var(--paper); transition:background .18s,border-color .18s,transform .18s; }
.library-story-card:hover { background:#fff; border-color:var(--teal-dark); transform:translateY(-3px); }
.library-card-top { display:flex; justify-content:space-between; gap:8px; align-items:center; font-size:.67rem; letter-spacing:.15em; font-weight:850; color:var(--teal-dark); }
.library-card-theme { color:var(--muted-foreground); margin:31px 0 10px; font-size:.76rem; }
.library-story-card > strong { font-family:'Arial Black',Impact,ui-sans-serif,sans-serif; letter-spacing:-.045em; font-size:clamp(1.3rem,1.7vw,1.9rem); line-height:1.17; overflow-wrap:anywhere; }
.library-card-bottom { display:flex; align-items:center; justify-content:space-between; margin:auto 0 0; padding-top:30px; font-size:.75rem; font-weight:850; }
.library-card-bottom span { font-size:1.3rem; color:var(--teal-dark); }
.library-card-track { margin-top:18px; width:calc(100% + 48px); margin-left:-24px; height:4px; }
.library-empty { padding:50px 20px; color:var(--muted-foreground); text-align:center; }
.library-lesson { width:min(100%,1260px); margin:0 auto; padding:32px clamp(20px,5vw,64px) 75px; }
.library-lesson-top { display:flex; align-items:center; justify-content:space-between; gap:20px; font-size:.72rem; color:var(--muted-foreground); font-weight:750; }
.library-back { padding-left:0; color:var(--charcoal); }
.library-lesson-title { padding:38px 0 34px; border-bottom:1px solid var(--border); }
.library-lesson-title h1 { font-family:'Arial Black',Impact,ui-sans-serif,sans-serif; font-size:clamp(2.7rem,5.9vw,6.5rem); letter-spacing:-.075em; line-height:.98; max-width:1020px; margin:0 0 20px; text-wrap:balance; }
.library-lesson-title > p:last-child { max-width:650px; color:var(--muted-foreground); line-height:1.55; margin:0; }
.library-step-nav { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin:23px 0 42px; overflow-x:auto; -ms-overflow-style:none; scrollbar-width:none; }
.library-step-nav::-webkit-scrollbar { display:none; }
.library-step-nav button { display:flex; gap:8px; align-items:center; text-align:left; background:transparent; border:1px solid var(--border); padding:12px; min-height:52px; font-weight:800; font-size:.72rem; }
.library-step-nav button > span { display:grid; flex:0 0 27px; place-items:center; width:27px; height:27px; border-radius:50%; background:#e6e2d9; font-size:.6rem; }
.library-step-nav button.current { background:var(--charcoal); color:var(--ivory); border-color:var(--charcoal); }
.library-step-nav button.current > span { background:var(--teal); color:var(--charcoal); }
.library-step-nav button:disabled { opacity:.53; }
.library-stage { min-height:500px; display:grid; grid-template-columns:minmax(195px,.32fr) minmax(0,1fr); gap:clamp(24px,4.2vw,72px); padding:40px 0 44px; }
.library-stage-heading { border-right:1px solid var(--border); padding-right:20px; display:flex; flex-direction:column; justify-content:space-between; gap:48px; }
.library-step-number { font-size:.76rem; font-weight:850; color:var(--teal-dark); letter-spacing:.17em; }
.library-stage h2 { font-family:'Arial Black',Impact,ui-sans-serif,sans-serif; font-size:clamp(2.1rem,3.9vw,4.3rem); line-height:1.02; letter-spacing:-.06em; margin:0 0 16px; }
.library-stage-heading p:last-child { color:var(--muted-foreground); font-size:.91rem; line-height:1.55; max-width:240px; }
.library-stage-content { min-width:0; }
.library-instruction { max-width:710px; color:#3e4749; line-height:1.75; margin:0 0 30px; font-size:clamp(1.04rem,1.3vw,1.17rem); }
.library-audio { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:18px; background:var(--charcoal); color:var(--ivory); padding:24px; margin:0 0 27px; }
.library-audio-icon { display:grid; place-items:center; background:var(--teal); color:var(--charcoal); width:54px; height:54px; border-radius:50%; }
.library-audio-info { display:flex; flex-direction:column; gap:6px; }
.library-audio-info strong { font-size:1.04rem; }
.library-audio-info span { font-size:.75rem; color:#c0c9c8; line-height:1.4; }
.library-audio-buttons { display:flex; gap:8px; align-items:center; }
.library-primary, .library-outline { display:inline-flex; align-items:center; justify-content:center; gap:10px; min-height:48px; padding:12px 18px; font-weight:850; font-size:.8rem; border-radius:2px; }
.library-primary { color:white; background:var(--teal-dark); border:1px solid var(--teal-dark); }
.library-primary:hover { background:#007b7e; }
.library-outline { background:transparent; border:1px solid var(--border); color:var(--charcoal); }
.library-outline:hover:not(:disabled) { border-color:var(--teal-dark); background:rgba(0,179,182,.06); }
.library-icon-button { display:grid; place-items:center; height:48px; width:48px; border:1px solid rgba(255,255,255,.25); background:transparent; color:var(--ivory); }
.library-icon-button:hover { border-color:var(--teal); }
.library-inline-link { grid-column:1 / -1; display:flex; align-items:center; gap:9px; justify-self:start; color:#a5edef; border:0; padding:10px 0 0; background:transparent; font-size:.77rem; font-weight:800; }
.library-rotated { transform:rotate(180deg); }
.library-audio-error { grid-column:1 / -1; margin:0; color:#ffe0c2; }
.library-transcript { grid-column:1 / -1; border-top:1px solid rgba(255,255,255,.23); padding-top:18px; color:#f4f4ed; line-height:1.82; max-width:75ch; }
.library-transcript p { margin:0; }
.library-quiet-note { font-size:.77rem; color:var(--muted-foreground); line-height:1.7; margin:24px 0 0; }
.library-clues { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; margin:0 0 32px; }
.library-clue { display:flex; align-items:center; gap:13px; min-height:70px; padding:14px 16px; font-size:clamp(.88rem,1.2vw,1.12rem); font-weight:750; background:var(--paper); border:1px solid var(--border); overflow-wrap:anywhere; }
.library-clue small { color:var(--teal-dark); font-size:.65rem; font-weight:850; }
.library-notes-label { display:block; margin-bottom:10px; font-size:.73rem; text-transform:uppercase; letter-spacing:.13em; font-weight:850; }
.library-notes { resize:vertical; width:100%; min-height:120px; background:var(--paper); padding:18px; border:1px solid var(--border); line-height:1.6; }
.library-reading { border:1px solid var(--border); background:var(--paper); padding:clamp(23px,4vw,44px); }
.library-reading-bar { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; padding-bottom:18px; border-bottom:1px solid var(--border); color:var(--teal-dark); font-size:.7rem; text-transform:uppercase; letter-spacing:.12em; font-weight:850; }
.library-reading-bar span:first-child { display:flex; align-items:center; gap:8px; }
.library-reading-text { font-size:clamp(1.02rem,1.35vw,1.18rem); line-height:2; max-width:70ch; margin:28px 0; overflow-wrap:anywhere; }
.library-inline-gap { display:inline-flex; align-items:center; vertical-align:baseline; white-space:nowrap; position:relative; }
.library-inline-gap input { min-height:31px; border:0; border-bottom:2px solid var(--teal-dark); border-radius:0; padding:2px 5px; background:#e1f3f0; font-size:inherit; font-weight:800; color:var(--charcoal); text-align:center; outline-offset:2px; }
.library-inline-gap input[aria-invalid='true'] { border-bottom-color:#a94733; background:#f9e9df; }
.library-gap-ok, .library-gap-retry { font-weight:900; margin-left:3px; color:var(--teal-dark); }
.library-gap-retry { color:#a94733; }
.library-reading-actions { display:flex; flex-wrap:wrap; gap:10px; padding-top:19px; border-top:1px solid var(--border); }
.library-feedback { margin-top:22px; padding:16px; background:#d6eae3; line-height:1.5; }
.library-gap-notes { margin-top:13px; font-size:.84rem; color:var(--muted-foreground); }
.library-gap-notes p { margin:9px 0; }
.library-gap-notes strong { color:var(--charcoal); }
.library-repairs { display:grid; gap:20px; }
.library-repair-card { padding:clamp(22px,3vw,36px); background:var(--paper); border:1px solid var(--border); }
.library-repair-id { font-size:.67rem; font-weight:850; color:var(--teal-dark); letter-spacing:.16em; }
.library-repair-card h3 { font-size:clamp(1.2rem,1.75vw,1.65rem); letter-spacing:-.025em; margin:14px 0 23px; line-height:1.4; }
.library-repair-card label { display:block; font-size:.77rem; font-weight:800; margin-bottom:9px; }
.library-repair-card textarea { display:block; width:100%; padding:14px; background:var(--ivory); border:1px solid var(--border); resize:vertical; min-height:88px; line-height:1.5; margin-bottom:18px; }
.library-correction { background:#e2f2eb; border-left:4px solid var(--teal-dark); margin-top:17px; padding:18px 20px; line-height:1.65; }
.library-correction p { margin:7px 0 0; color:#4b5857; font-size:.85rem; }
.library-grammar-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.library-grammar-grid > div { border:1px solid var(--border); padding:22px; background:var(--paper); overflow-wrap:anywhere; }
.library-grammar-grid > div:first-child { border-top:5px solid var(--teal); }
.library-grammar-grid > div:nth-child(2) { border-top:5px solid #899a9e; }
.library-grammar-grid > div:last-child { border-top:5px solid var(--charcoal); }
.library-grammar-grid span { display:block; font-size:.65rem; font-weight:850; letter-spacing:.12em; color:var(--muted-foreground); }
.library-grammar-grid p { font-size:clamp(1.1rem,1.45vw,1.5rem); line-height:1.5; font-weight:750; margin:30px 0 3px; letter-spacing:-.018em; }
.library-grammar-note { display:flex; gap:13px; align-items:start; background:#dcebe4; padding:21px; margin-top:20px; line-height:1.55; }
.library-grammar-note svg { flex:0 0 auto; color:var(--teal-dark); margin-top:2px; }
.library-source-details { padding:18px 0 30px; border-top:1px solid var(--border); }
.library-source-details summary { display:flex; align-items:center; gap:8px; cursor:pointer; font-size:.76rem; font-weight:850; }
.library-source-details details[open] summary svg { transform:rotate(180deg); }
.library-source-details p { max-width:80ch; color:var(--muted-foreground); font-size:.78rem; line-height:1.7; }
.library-source-details .library-review-note { color:#9b5438; }
.library-lesson-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:20px 0 10px; border-top:1px solid var(--border); }
.library-lesson-footer > span { font-size:.68rem; font-weight:850; letter-spacing:.16em; color:var(--muted-foreground); }
.library-site-footer { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:28px clamp(22px,4vw,64px) max(28px,env(safe-area-inset-bottom)); border-top:1px solid var(--border); font-size:.7rem; color:var(--muted-foreground); }
.library-site-footer .brand-mark { font-size:1.28rem; }
@media (max-width:1100px) { .library-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } .library-hero-copy { padding:52px 38px; } .library-hero h1 { font-size:clamp(3.6rem,7.3vw,7rem); } .library-step-nav { grid-template-columns:repeat(5,minmax(145px,1fr)); } .library-grammar-grid { grid-template-columns:1fr; } .library-grammar-grid p { margin-top:14px; } }
@media (max-width:760px) { .library-topnote { display:none; } .library-topbar { min-height:68px; } .library-hero { grid-template-columns:1fr; } .library-hero-copy { padding:60px 25px 45px; } .library-hero h1 { font-size:clamp(4rem,11vw,6rem); } .library-hero-art { min-height:350px; max-height:470px; } .library-hero-art img { max-height:450px; } .library-catalog-heading { align-items:start; flex-direction:column; } .library-completion { width:100%; } .library-tools { align-items:stretch; flex-direction:column; } .library-search { width:100%; max-width:none; } .library-lesson { padding:20px 22px 60px; } .library-lesson-title { padding:24px 0; } .library-lesson-title h1 { font-size:clamp(2.6rem,9vw,4.4rem); } .library-step-nav { margin:18px 0 20px; padding-bottom:6px; scroll-snap-type:x proximity; } .library-step-nav button { scroll-snap-align:start; } .library-stage { grid-template-columns:1fr; gap:28px; padding:20px 0 30px; } .library-stage-heading { flex-direction:row; gap:24px; padding:0 0 18px; border:0; border-bottom:1px solid var(--border); } .library-stage-heading h2 { font-size:clamp(2.1rem,7vw,3.4rem); } .library-stage-heading p:last-child { max-width:none; } .library-audio { grid-template-columns:54px 1fr; } .library-audio-buttons { grid-column:1 / -1; width:100%; } .library-audio-play { flex:1; } .library-audio-info strong { font-size:.95rem; } .library-clues { grid-template-columns:1fr; } }
@media (max-width:520px) { .library-grid { grid-template-columns:1fr; } .library-story-card { min-height:245px; } .library-catalog { padding:48px 20px 70px; } .library-hero-copy { padding:48px 22px 38px; } .library-hero h1 { font-size:clamp(3.55rem,15vw,5.4rem); } .library-hero-art { min-height:300px; } .library-art-sticker { padding:13px 16px; font-size:1rem; right:18px; bottom:17px; } .library-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); } .library-lesson-top > span { display:none; } .library-lesson { padding-inline:17px; } .library-step-nav { grid-template-columns:repeat(5,minmax(130px,1fr)); } .library-stage-heading { flex-direction:column; gap:12px; } .library-audio { padding:18px; gap:12px; } .library-reading { padding:19px; } .library-reading-text { line-height:2.1; } .library-reading-actions > button { flex:1 1 100%; } .library-lesson-footer > span { display:none; } .library-lesson-footer > button { flex:1; } .library-site-footer { flex-wrap:wrap; } .library-site-footer > span:last-child { display:none; } }
@media (hover:none) { .library-story-card:hover { transform:none; } }
@media (prefers-reduced-motion:reduce) { .library-app *, .library-app *::before, .library-app *::after { transition:none !important; scroll-behavior:auto !important; } }

/* Guess Who: keep neutral choices and the reveal clearly distinct. */
.library-guess { background:var(--paper); border:1px solid var(--border); padding:clamp(20px,3vw,32px); margin-top:28px; }
.library-guess h3 { font-family:'Arial Black',Impact,ui-sans-serif,sans-serif; font-size:clamp(1.55rem,2.5vw,2.45rem); letter-spacing:-.05em; margin:0 0 10px; }
.library-guess > p:not(.library-kicker) { max-width:62ch; margin:0 0 22px; color:var(--muted-foreground); line-height:1.6; }
.library-guess-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:0 0 18px; }
.library-guess-choice { min-height:56px; padding:13px 12px; border:1px solid var(--border); background:var(--ivory); font-weight:800; text-align:center; }
.library-guess-choice:hover:not(:disabled), .library-guess-choice.selected { border-color:var(--teal-dark); background:#e5f6f2; }
.library-guess-choice.selected { box-shadow:inset 0 0 0 2px var(--teal-dark); }
.library-guess-choice:disabled { opacity:1; cursor:default; }
.library-guess-confirm { width:100%; }
.library-guess-result { display:flex; align-items:flex-start; gap:12px; background:#e5f6f2; border-left:4px solid var(--teal-dark); padding:19px; line-height:1.55; }
.library-guess-result svg { color:var(--teal-dark); flex:0 0 auto; }
.library-guess-result strong { font-size:1.1rem; }
.library-guess-result p { margin:6px 0 0; }
@media(max-width:520px) { .library-guess-options { grid-template-columns:1fr; } }
