:root {
  --ink: #2b1d12; --paper: #f6ecd2; --paper-2: #efe2c0; --wood: #4a2c17; --gold: #c9a24b; --green: #23493f;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif; --mono: 'Courier New', Courier, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1a10; color: var(--paper); font-family: var(--serif); }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.quiet { opacity: 0.7; font-style: italic; }

/* ---------- heads-up ---------- */
#crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255, 240, 210, 0.85); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); pointer-events: none; }
#prompt, #toast, #hint, #mode { position: fixed; margin: 0; pointer-events: none; text-shadow: 0 1px 3px #000; }
#prompt { left: 50%; top: 56%; transform: translateX(-50%); padding: 6px 14px; background: rgba(30, 18, 10, 0.78); border: 1px solid var(--gold); border-radius: 4px; max-width: 80vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toast { left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 18px; background: rgba(35, 73, 63, 0.92); border: 1px solid var(--gold); border-radius: 4px; max-width: min(90vw, 640px); text-align: center; }
#hint { left: 50%; bottom: 12px; transform: translateX(-50%); font-size: 13px; opacity: 0.75; white-space: nowrap; }
#mode { right: 12px; top: 10px; font-size: 12px; opacity: 0.6; letter-spacing: 0.08em; text-transform: uppercase; }
#player { position: fixed; left: 12px; bottom: 8px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: rgba(30, 18, 10, 0.94); border: 1px solid var(--gold); border-radius: 6px; max-width: min(92vw, 520px); }
#player .playing { font-size: 13px; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#player .time { font: 12px var(--mono); opacity: 0.8; white-space: nowrap; }
#player button { background: none; border: 1px solid rgba(201, 162, 75, 0.6); border-radius: 4px; min-width: 30px; height: 28px; }
#player audio { display: none; }
.mini-tape { flex: none; width: 30px; height: 19px; border-radius: 2px; background: radial-gradient(circle at 30% 60%, #f2ead0 3px, transparent 4px), radial-gradient(circle at 70% 60%, #f2ead0 3px, transparent 4px), linear-gradient(#d9772b 0 5px, #2b2b2e 5px); border: 1px solid #000; }
#hand { position: fixed; right: 12px; bottom: 8px; z-index: 5; margin: 0; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: rgba(30, 18, 10, 0.9); border: 1px dashed var(--gold); border-radius: 6px; font-size: 13px; max-width: 46vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.has-player #overlay { padding-bottom: 58px; }
.has-player #hint { display: none; }

/* ---------- start ---------- */
#start { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(42, 26, 16, 0.55), rgba(20, 12, 7, 0.92)); padding: 16px; }
.plate { max-width: 520px; padding: 28px 34px; background: var(--paper); color: var(--ink); border: 3px double var(--wood); border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); text-align: center; }
.plate h1 { margin: 0 0 8px; font-size: 44px; letter-spacing: 0.02em; }
.plate ul { list-style: none; padding: 0; margin: 14px 0; line-height: 1.8; }
.plate .small { font-size: 13px; opacity: 0.75; margin-bottom: 0; }
.plate .problem:empty { display: none; }
.plate .problem { background: #f3d9b0; border-left: 4px solid #a3472b; padding: 8px 12px; text-align: left; font-size: 14px; }
#enter, .button { background: var(--green); color: var(--paper); border: 1px solid #16302a; border-radius: 4px; padding: 9px 18px; font-size: 16px; }
#enter { font-size: 20px; padding: 12px 34px; }
#enter:hover, .button:hover { background: #2d5c50; }
.button.small { padding: 5px 10px; font-size: 13px; }
.button:disabled { opacity: 0.45; cursor: default; }

/* ---------- overlay ---------- */
#overlay { position: fixed; inset: 0; z-index: 20; background: rgba(20, 12, 7, 0.72); display: flex; flex-direction: column; align-items: center; padding: 10px 12px 14px; }
.bar { width: min(1100px, 100%); display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bar button { background: rgba(30, 18, 10, 0.85); border: 1px solid var(--gold); border-radius: 4px; padding: 6px 14px; }
.bar .close { margin-left: auto; }
.stage { flex: 1; min-height: 0; width: min(1100px, 100%); display: flex; justify-content: center; }
.panel { outline: none; max-height: 100%; width: 100%; animation: arrive 0.28s ease-out; }
@keyframes arrive { from { transform: translateY(18px) scale(0.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel, .card, .printout, .crt-line { animation: none !important; } }
.out { color: #7a2e2e; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 14px 0; }

/* rows used by chapters and lists */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(74, 44, 23, 0.25); padding: 9px 4px; }
.row:hover, .row:focus-visible { background: rgba(201, 162, 75, 0.22); }
.row .num { font-variant-numeric: tabular-nums; opacity: 0.55; min-width: 2.6em; text-align: right; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main strong { overflow-wrap: anywhere; }
.row small { opacity: 0.7; }
.snippet { font-size: 14px; opacity: 0.85; overflow-wrap: anywhere; }

/* ---------- the open book ---------- */
.book { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); color: var(--ink); background: var(--wood); padding: 10px; border-radius: 6px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65); }
.leaf { background: var(--paper); padding: 26px 28px; overflow-y: auto; max-height: calc(100vh - 110px); }
.leaf.left { border-right: 1px solid rgba(0, 0, 0, 0.2); box-shadow: inset -18px 0 22px -18px rgba(0, 0, 0, 0.35); text-align: center; }
.leaf.right { box-shadow: inset 18px 0 22px -18px rgba(0, 0, 0, 0.35); }
.leaf h1 { font-size: 26px; margin: 16px 0 6px; overflow-wrap: anywhere; }
.leaf header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--wood); margin-bottom: 4px; padding-bottom: 6px; }
.leaf header h2 { margin: 0; }
.leaf header .button { margin-left: auto; }
.leaf.right > .button { margin-top: 12px; }
.cover { position: relative; width: min(230px, 80%); aspect-ratio: 1; margin: 0 auto; border-radius: 3px; display: grid; place-items: center; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); border: 4px solid rgba(227, 192, 111, 0.7); }
.cover span { color: #f6e7c1; font-weight: bold; font-size: 22px; padding: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dewey { font-variant: small-caps; letter-spacing: 0.04em; }

/* ---------- single sheets: article, lists, newspaper ---------- */
.sheet { background: var(--paper); color: var(--ink); padding: 28px clamp(18px, 5vw, 54px); overflow-y: auto; max-width: 780px; border-radius: 3px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65); }
.newsprint { background: #efe9d8; font-family: var(--serif); }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; margin: 0; opacity: 0.7; }
.episode h2, .sheet h2 { font-size: 30px; margin: 4px 0 6px; overflow-wrap: anywhere; }
.episode h3 { margin: 20px 0 4px; font-size: 18px; }
.episode p, .episode li { line-height: 1.55; overflow-wrap: anywhere; }
.facts { opacity: 0.7; margin: 0; }
.takeaways { padding-left: 20px; }
.notes { white-space: pre-wrap; font-size: 14px; }
details { margin-top: 20px; }
summary { cursor: pointer; }
.paper { max-width: 900px; }
.masthead { text-align: center; border-bottom: 4px double #1d1a16; margin-bottom: 14px; }
.masthead h1 { font-size: clamp(30px, 6vw, 56px); margin: 0; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.dateline { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-style: italic; font-size: 14px; margin: 6px 0 8px; border-top: 1px solid #1d1a16; padding-top: 6px; }
.stamp { color: #a3472b; border: 2px solid #a3472b; padding: 0 8px; font-style: normal; text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; transform: rotate(-2deg); }
.story { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 6px; break-inside: avoid; border-bottom: 1px solid rgba(0, 0, 0, 0.25); }
.story:hover, .story:focus-visible { background: rgba(0, 0, 0, 0.07); }
.story strong { display: block; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.story.lead strong { font-size: clamp(26px, 4.4vw, 40px); }
.story small { display: block; opacity: 0.65; font-style: italic; margin-top: 4px; }
.standfirst { display: block; margin-top: 5px; line-height: 1.4; overflow-wrap: anywhere; }
.columns { columns: 3 220px; column-gap: 22px; column-rule: 1px solid rgba(0, 0, 0, 0.25); margin-top: 6px; }

/* ---------- microfiche reader ---------- */
.fiche { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; height: 100%; color: #d8d2bd; font-family: var(--mono); }
.fiche aside, .machine { background: #2c302d; border: 2px solid #121412; border-radius: 8px; padding: 12px; min-height: 0; }
.fiche aside { overflow-y: auto; }
.fiche h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }
.reels { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.reels button { width: 100%; text-align: left; background: #3a2c1d; border: 1px solid #1a130b; border-left: 10px solid var(--gold); border-radius: 3px; padding: 7px 8px; display: grid; }
.reels button.on { background: #6b4a22; border-left-color: #fff3c4; }
.reels small { opacity: 0.7; }
.machine { display: flex; flex-direction: column; gap: 8px; }
.machine header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.machine h2 { margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout { background: #0d120e; color: #ffb648; padding: 3px 10px; border-radius: 3px; letter-spacing: 0.1em; white-space: nowrap; }
.hood { position: relative; flex: 1; min-height: 0; border: 14px solid #171917; border-radius: 12px; background: #0b0d0b; overflow: hidden; }
.glass { position: absolute; inset: 0; overflow-y: scroll; scrollbar-width: none; outline: none; background: #14160f; }
.glass::-webkit-scrollbar { display: none; }
.hood::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.6)); }
.fiche-deck { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.knob { background: #1a1c1a; border: 2px solid #050605; border-radius: 18px; padding: 7px 14px; color: #d8d2bd; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08); font-size: 13px; }
.knob:hover:not(:disabled) { background: #2b2f2b; }
.knob.wide { margin-left: auto; background: #6b2f1f; }
.knob:disabled { opacity: 0.4; cursor: default; }
.dial { display: grid; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.dial input { font: 14px var(--mono); background: #0d120e; color: #ffb648; border: 1px solid #000; border-radius: 3px; padding: 4px 6px; color-scheme: dark; }
.machine > .quiet { margin: 0; font-size: 12px; }
.printout { position: absolute; left: 50%; bottom: 0; width: min(640px, 94%); max-height: 94%; overflow-y: auto; transform: translateX(-50%); z-index: 2; background: #fbf8ee; color: #1b1a15; padding: 20px 26px 30px; font-family: var(--serif); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7); border-top: 3px dashed #b9b29a; }
.printout.feed { animation: feed 0.9s steps(14) both; }
@keyframes feed { from { transform: translate(-50%, 100%); } }
/* positioned, so it sits above the printed text beside it and takes the click (as a plain float it was covered) */
.tear { position: sticky; top: 0; z-index: 2; float: right; margin-left: 12px; background: #fbf8ee; cursor: pointer; border: 1px solid #1b1a15; border-radius: 3px; padding: 3px 8px; font-size: 12px; }

/* ---------- catalog computer ---------- */
.crt { --glow: #7dffa0; --dim: #1f6b3a; --bg: #04130a; align-self: center; max-width: 860px; background: #d9cdb0; border-radius: 18px 18px 10px 10px; padding: 26px 30px 12px; box-shadow: inset 0 -8px 0 #b5a888, 0 26px 70px rgba(0, 0, 0, 0.7); font-family: var(--mono); }
.crt.amber { --glow: #ffb648; --dim: #7a5216; --bg: #150c02; }
.crt-bezel { background: #2a2620; border-radius: 26px; padding: 18px; box-shadow: inset 0 0 0 4px #b5a888; }
.crt-screen { position: relative; height: min(62vh, 520px); overflow: hidden; display: flex; flex-direction: column; background: radial-gradient(ellipse at center, color-mix(in srgb, var(--glow) 9%, var(--bg)), var(--bg) 85%); color: var(--glow); border-radius: 30px / 22px; padding: 20px 24px; font-size: 16px; line-height: 1.35; text-shadow: 0 0 6px color-mix(in srgb, var(--glow) 70%, transparent); text-transform: uppercase; }
.crt-screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px); border-radius: inherit; box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7); }
.crt-banner { margin: 0; font: inherit; overflow: hidden; }
.crt-status { margin: 6px 0; }
.crt-lines { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.crt-line { display: grid; grid-template-columns: 3ch 10ch minmax(0, 1fr) 10ch; gap: 1ch; width: 100%; text-align: left; background: none; border: 0; padding: 1px 4px; font: inherit; color: inherit; text-shadow: inherit; text-transform: inherit; animation: type-in 0.2s steps(4) both; }
@keyframes type-in { from { opacity: 0; } }
.crt-line.more { display: block; }
.crt-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-kind { text-align: right; }
.crt-line.on, .crt-line:hover { background: var(--glow); color: var(--bg); text-shadow: none; }
.crt-actions { display: flex; flex-wrap: wrap; gap: 2ch; align-items: center; border-top: 1px dashed var(--dim); padding-top: 6px; margin-top: 4px; }
.crt-actions button { background: none; border: 0; font: inherit; color: inherit; text-shadow: inherit; padding: 0 2px; }
.crt-actions button:hover, .crt-actions button:focus-visible { background: var(--glow); color: var(--bg); text-shadow: none; outline: none; }
.crt-prompt { margin-top: 8px; }
.crt-prompt label { display: flex; gap: 1ch; }
.crt-field { position: relative; flex: 1; white-space: pre; overflow: hidden; }
.crt-field input { position: absolute; inset: 0; width: 100%; opacity: 0; font: inherit; text-transform: uppercase; }
.crt-cursor { display: inline-block; width: 1ch; height: 1.1em; vertical-align: text-bottom; background: var(--glow); box-shadow: 0 0 8px var(--glow); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.crt-foot { display: flex; align-items: center; gap: 14px; padding: 10px 6px 4px; color: #6b6048; font-size: 12px; letter-spacing: 0.3em; }
.crt-switch { margin-left: auto; background: #c7ba9a; border: 1px solid #8f8468; border-radius: 3px; padding: 3px 10px; color: #4a4232; letter-spacing: 0.05em; font-size: 12px; }
.crt-led { width: 9px; height: 9px; border-radius: 50%; background: #ff5533; box-shadow: 0 0 6px #ff5533; }

/* ---------- card catalog ---------- */
.cards { align-self: center; max-width: 720px; background: linear-gradient(#7a4a28, #5e3719); border: 3px solid #3a2110; border-radius: 8px; padding: 18px 22px 14px; text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65); }
.cards h2 { margin: 0 0 10px; color: #f0d48a; letter-spacing: 0.06em; }
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-bottom: 18px; }
.tabs button { width: 30px; height: 30px; background: var(--paper-2); color: var(--ink); border: 1px solid #8c6a25; border-radius: 3px 3px 0 0; font-weight: bold; padding: 0; }
.tabs button.on { background: var(--gold); transform: translateY(-3px); }
.deck-of-cards { position: relative; height: 290px; perspective: 900px; margin: 0 auto 10px; max-width: 520px; }
.card { position: absolute; inset: 0; background: #fbf6e4; color: var(--ink); border-radius: 4px; padding: 16px 22px; text-align: left; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; background-image: linear-gradient(transparent 47px, #c9705f 47px, #c9705f 49px, transparent 49px), repeating-linear-gradient(transparent 0 27px, rgba(70, 110, 160, 0.22) 27px 28px); transform-origin: 50% 100%; }
.card.ghost.g1 { transform: translateY(-7px) scale(0.985); filter: brightness(0.93); }
.card.ghost.g2 { transform: translateY(-14px) scale(0.97); filter: brightness(0.86); }
.card.flip-on { animation: flip-on 0.32s ease-out; }
.card.flip-back { animation: flip-back 0.32s ease-out; }
@keyframes flip-on { from { transform: rotateX(-70deg); opacity: 0.3; } }
@keyframes flip-back { from { transform: rotateX(50deg) translateY(-30px); opacity: 0.3; } }
.card-top { display: flex; justify-content: space-between; font-family: var(--mono); font-weight: bold; height: 34px; }
.call { font-size: 19px; letter-spacing: 0.06em; }
.kind { font-size: 12px; letter-spacing: 0.2em; padding-top: 5px; }
.card-body { flex: 1; display: flex; gap: 14px; justify-content: space-between; min-height: 0; padding-top: 8px; }
.typed { font-family: var(--mono); margin: 0 0 6px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.typed.big { font-size: 20px; font-weight: bold; -webkit-line-clamp: 3; }
.typed.where { opacity: 0.75; font-size: 13px; }
.card-art { width: 84px; height: 84px; object-fit: cover; border: 1px solid rgba(0, 0, 0, 0.3); flex: none; }
.card-actions { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.hole { position: absolute; left: 50%; bottom: 7px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #5e3719; box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6); }
.card-nav { display: flex; justify-content: center; align-items: center; gap: 16px; color: var(--paper); }
.cards > .quiet { color: var(--paper); font-size: 12px; margin: 8px 0 0; }

@media (max-width: 720px) {
  .book { grid-template-columns: 1fr; overflow-y: auto; max-height: 100%; }
  .leaf { max-height: none; }
  .fiche { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .fiche aside { max-height: 110px; }
  .frame { grid-template-columns: 1fr; gap: 2px; }
  .crt { padding: 12px 12px 8px; }
  .crt-line { grid-template-columns: 3ch 9ch minmax(0, 1fr); }
  .c-kind { display: none; }
  #hint { display: none; }
}

/* ---------- round two: books are episodes ---------- */
.cover { --trim: #e3c06f; border-color: var(--trim); flex: none; }
.cover::before { content: ''; position: absolute; inset: 9px; border: 1px solid var(--trim); opacity: 0.7; pointer-events: none; }
.cover.small { width: 104px; margin: 0; flex: none; border-width: 3px; }
.cover.small span { font-size: 13px; padding: 8px; }
.leaf.left { display: flex; flex-direction: column; align-items: center; }
.leaf.left > p { margin: 5px 0; }
.leaf.right h2 { font-size: 28px; margin: 4px 0 10px; }
.series-line { font-size: 16px; }
.linkish { background: none; border: 0; padding: 0; color: #7a2e2e; text-decoration: underline; font: inherit; font-weight: bold; }
.spine-label { display: inline-block; background: #fbf8ee; color: #1d1a16; border: 1px solid #b9a57c; font: bold 14px var(--mono); padding: 3px 9px; letter-spacing: 0.06em; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.spine-label.inline { font-size: 12px; padding: 1px 6px; white-space: nowrap; align-self: center; margin-left: auto; flex: none; }
.actions.center { justify-content: center; }
.row.faint { opacity: 0.62; }
.pocket { margin-top: auto; width: 100%; padding: 12px 14px 14px; background: #e6d6ae; border: 1px solid #b9a57c; border-bottom-width: 4px; border-radius: 2px 2px 8px 8px; box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pocket .kicker { align-self: flex-start; }

.cassette { --stripe: #7a2e2e; position: relative; width: 236px; height: 150px; flex: none; background: #2b2b2e; border-radius: 8px; padding: 9px 11px; box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45), inset 0 0 0 2px #3c3c40; text-align: left; }
.cassette-label { height: 78px; background: linear-gradient(var(--stripe) 0 12px, #f7f3e6 12px); border-radius: 3px; padding: 16px 9px 4px; color: #1d1a16; overflow: hidden; }
.cassette-label strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.15; overflow-wrap: anywhere; }
.cassette-label small { display: block; font: 10px var(--mono); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cassette-window { position: absolute; left: 50px; right: 50px; bottom: 14px; height: 38px; background: #0e0e10; border-radius: 4px; overflow: hidden; }
.reel { --size: 30px; position: absolute; top: 50%; width: var(--size); height: var(--size); margin: calc(var(--size) / -2); border-radius: 50%; background: repeating-conic-gradient(#f2ead0 0 20deg, #8a826c 20deg 60deg); box-shadow: 0 0 0 calc(var(--tape, 8px)) #3b2a1e; }
.reel.left { left: 26px; --tape: calc(14px - 12px * var(--wound, 0)); }
.reel.right { right: 26px; --tape: calc(2px + 12px * var(--wound, 0)); }
.reel::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #0e0e10; }
.turning .reel, .cassette.spin .reel { animation: reel 1.6s linear infinite; }
.turning.fast .reel { animation-duration: 0.22s; }
.turning.backward .reel { animation-direction: reverse; }
@keyframes reel { to { transform: rotate(-360deg); } }

.series { max-width: 860px; background: #fbf6e4; background-image: linear-gradient(transparent 0, transparent 100%); }
.series-head { display: flex; gap: 18px; align-items: flex-start; border-bottom: 2px solid #c9705f; padding-bottom: 12px; }
.series-head h2 { margin: 2px 0; }
.series-head p { margin: 4px 0; }
.list-head { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; }
.list-head h3 { margin: 0; }
.list-head .button { margin-left: auto; }

/* ---------- the cassette deck ---------- */
.deck { align-self: center; max-width: 760px; background: linear-gradient(#3a3a3e, #232326); border-radius: 14px; padding: 16px 20px 12px; color: #e9e2c6; font-family: var(--mono); box-shadow: 0 26px 70px rgba(0, 0, 0, 0.7), inset 0 2px 0 rgba(255, 255, 255, 0.12); border: 2px solid #111; }
.deck-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 6px 10px; font-size: 11px; letter-spacing: 0.22em; color: #b9b6ad; }
.deck-counter { display: flex; gap: 2px; background: #0d0d0d; padding: 4px 6px; border-radius: 3px; box-shadow: inset 0 2px 4px #000; }
.deck-counter i { font: bold 22px var(--mono); font-style: normal; width: 20px; text-align: center; background: linear-gradient(#2a2a2a, #111 50%, #2a2a2a); color: #f2ead0; border-radius: 2px; letter-spacing: 0; }
.deck-counter i.tick { animation: tick 0.25s ease-out; }
@keyframes tick { from { transform: translateY(-7px); opacity: 0.3; } }
.deck-body { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 14px; align-items: stretch; background: #b9b6ad; border-radius: 8px; padding: 14px; box-shadow: inset 0 0 0 2px #8f8c84; }
.grille { border-radius: 6px; background: repeating-linear-gradient(0deg, #2b2b2e 0 5px, #77746c 5px 8px); box-shadow: inset 0 0 0 3px #2b2b2e; min-height: 170px; }
.deck-lid { background: linear-gradient(160deg, rgba(20, 20, 22, 0.92), rgba(48, 48, 52, 0.92)); border-radius: 8px; display: grid; place-items: center; padding: 14px; min-height: 190px; box-shadow: inset 0 0 0 3px #1a1a1c, inset 0 10px 30px rgba(0, 0, 0, 0.6); overflow: hidden; }
.well.drop { animation: drop 0.5s cubic-bezier(0.3, 1.5, 0.6, 1); }
@keyframes drop { from { transform: translateY(-150px) rotate(-5deg); opacity: 0; } 70% { transform: translateY(4px); } }
.well.empty { text-align: center; color: #cfc8b0; font-family: var(--serif); max-width: 320px; }
.well.empty p { margin: 6px 0; }
.deck-side { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; color: #2b2b2e; font-size: 10px; letter-spacing: 0.16em; }
.vu { display: flex; align-items: flex-end; gap: 4px; height: 70px; background: #1a1a1c; border-radius: 4px; padding: 8px; }
.vu i { flex: 1; height: 8%; background: linear-gradient(#ff5533 0 18%, #ffb648 18% 40%, #7dffa0 40%); border-radius: 1px; }
.turning:not(.fast) .vu i { animation: vu 0.7s ease-in-out infinite alternate; }
.vu i:nth-child(2) { animation-delay: -0.3s !important; } .vu i:nth-child(3) { animation-delay: -0.55s !important; } .vu i:nth-child(4) { animation-delay: -0.15s !important; }
.vu i:nth-child(5) { animation-delay: -0.42s !important; } .vu i:nth-child(6) { animation-delay: -0.08s !important; } .vu i:nth-child(7) { animation-delay: -0.6s !important; }
@keyframes vu { from { height: 12%; } to { height: 92%; } }
.phones { display: grid; gap: 4px; }
.phones input { width: 100%; accent-color: #d9772b; }
.deck-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 6px 2px; font-family: var(--serif); }
.deck-info strong { font-size: 18px; overflow-wrap: anywhere; }
.deck-info span { font: 12px var(--mono); opacity: 0.8; }
.deck-info .linkish { color: #ffb648; margin-left: auto; font-size: 14px; }
.deck-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.key { background: linear-gradient(#e4e0d4, #a9a69c); color: #1a1a1c; border: 0; border-radius: 3px 3px 6px 6px; padding: 16px 2px 12px; font: bold 11px var(--mono); letter-spacing: 0.04em; box-shadow: 0 6px 0 #5f5c55, 0 8px 6px rgba(0, 0, 0, 0.5); transition: transform 0.05s, box-shadow 0.05s; touch-action: none; }
.key:active:not(:disabled), .key.down { transform: translateY(5px); box-shadow: 0 1px 0 #5f5c55, 0 2px 3px rgba(0, 0, 0, 0.5); }
.key.eject { background: linear-gradient(#e27a5f, #a3472b); color: #fff; }
.key:disabled { opacity: 0.5; cursor: default; }
.deck > .quiet { font: italic 12px var(--serif); margin: 14px 0 0; text-align: center; min-height: 1em; }

/* ---------- catalog computer: the SERIES / TITLES switch ---------- */
.crt-mode { display: flex; flex-wrap: wrap; gap: 2ch; margin-top: 4px; }
.crt-mode button { background: none; border: 0; font: inherit; color: inherit; text-shadow: inherit; padding: 0 4px; }
.crt-mode button.on { background: var(--glow); color: var(--bg); text-shadow: none; }
.crt-mode .dim { opacity: 0.55; }
.crt-line { grid-template-columns: 3ch 13ch minmax(0, 1fr) 11ch; }
.machine .span { margin: -4px 0 0; font-size: 12px; }

@media (max-width: 720px) {
  .deck-body { grid-template-columns: 1fr; }
  .grille, .deck-side .vu { display: none; }
  .deck-keys { grid-template-columns: repeat(3, 1fr); }
  .crt-line { grid-template-columns: 3ch 12ch minmax(0, 1fr); }
  .series-head { flex-direction: column; }
  #hand { bottom: 52px; max-width: 80vw; }
}

/* ---------- getting the mouse back ---------- */
#resume { position: fixed; inset: 0; z-index: 15; display: grid; place-content: center; justify-items: center; gap: 6px; background: rgba(20, 12, 7, 0.28); border: 0; color: var(--paper); cursor: pointer; }
#resume span { padding: 14px 30px; font-size: 22px; background: rgba(30, 18, 10, 0.9); border: 2px solid var(--gold); border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); animation: nudge 1.6s ease-in-out infinite; }
#resume small { font-size: 13px; opacity: 0.85; text-shadow: 0 1px 3px #000; }
@keyframes nudge { 50% { transform: translateY(-4px); } }

/* ---------- has it a summary, has it a tape ---------- */
.marks { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.mark { display: inline-flex; align-items: center; gap: 4px; font: bold 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 1px 6px; border-radius: 2px; white-space: nowrap; }
.mark.sum { color: #1f5a3f; border: 1.5px solid #1f5a3f; transform: rotate(-1.5deg); }
.mark.none { color: inherit; border: 1px dashed currentColor; opacity: 0.45; font-weight: normal; }
.mark.tape { padding-left: 0; opacity: 0.85; }
.mark .mini-tape { width: 19px; height: 12px; background: radial-gradient(circle at 30% 62%, #f2ead0 2px, transparent 2.5px), radial-gradient(circle at 70% 62%, #f2ead0 2px, transparent 2.5px), linear-gradient(#d9772b 0 3px, #2b2b2e 3px); }
.story .marks { display: flex; margin-top: 6px; }

/* ---------- microfiche: a card on an X/Y stage ---------- */
.fiche-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 10px; }
.fiche-body .hood { height: 100%; }
.glass { overflow: hidden; cursor: grab; background: #0c0e0b; touch-action: none; }
.glass.dragging { cursor: grabbing; }
.hood::after { display: none; }
.lens { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: normal; }
.fcard { position: absolute; left: 0; top: 0; width: max-content; min-width: 900px; transform-origin: 0 0; will-change: transform; padding: 22px 26px 30px; background: #23261f; color: #ece6cf; border-radius: 10px; box-shadow: 0 0 0 2px #3a3d33, 0 30px 80px rgba(0, 0, 0, 0.8); font-family: var(--serif); transition: opacity 0.15s; }
.fcard.loading { opacity: 0.35; }
.glass.sliding .fcard { filter: blur(0.6px); }
.fcard-head { display: flex; gap: 28px; align-items: baseline; background: #ece6cf; color: #1b1a15; padding: 10px 18px; margin-bottom: 18px; font: bold 26px var(--mono); letter-spacing: 0.08em; white-space: nowrap; }
.fcard-head strong { font: bold 30px var(--serif); letter-spacing: 0; margin-right: auto; }
.fcard-empty { font: italic 22px var(--serif); padding: 80px 40px; opacity: 0.8; max-width: 800px; }
.week { display: flex; gap: 18px; margin-bottom: 18px; }
.fframe { flex: none; width: 236px; height: 296px; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 12px 14px; background: #2f332a; color: #ece6cf; border: 1px solid #555a4b; border-radius: 2px; overflow: hidden; }
.fframe time { font: 11px var(--mono); letter-spacing: 0.06em; border-bottom: 2px solid currentColor; padding-bottom: 5px; }
.fframe strong { font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.fframe .greek { flex: 1; min-height: 10px; background: repeating-linear-gradient(rgba(236, 230, 207, 0.33) 0 3px, transparent 3px 9px); margin-right: 18%; }
.fframe .marks { margin: 0; }
.fframe .mark.sum { color: #9fe0bd; border-color: #9fe0bd; }
.fframe.bare { color: #a5a08c; background: #2a2d26; }
.fframe.under { outline: 3px solid #ffb648; outline-offset: 3px; background: #3a3f33; }
.fframe:hover { background: #3a3f33; }
.whole .fframe.under { outline-width: 8px; }
.lens-panel { background: #1c1f1c; border: 2px solid #121412; border-radius: 8px; padding: 12px 14px; overflow-y: auto; font-family: var(--serif); display: flex; flex-direction: column; gap: 8px; }
.lens-panel time { font: 12px var(--mono); color: #ffb648; }
.lens-panel h3 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; color: #f4eed8; }
.lens-panel .kicker { font-family: var(--mono); }
.lens-panel .mark.sum { color: #9fe0bd; border-color: #9fe0bd; }
.lens-snippet { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.lens-panel .knob.wide { margin: auto 0 0; align-self: stretch; padding: 10px; }
.drawer { display: grid; gap: 4px; }
.drawer-year { display: flex; align-items: center; gap: 8px; justify-content: center; }
.drawer-year .year { font: bold 15px var(--mono); color: #ffb648; min-width: 4ch; text-align: center; }
.knob.small { padding: 2px 9px; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.months button { font: 10px var(--mono); padding: 5px 4px; background: #3a2c1d; color: #d8d2bd; border: 1px solid #1a130b; border-top: 3px solid var(--gold); border-radius: 0 0 3px 3px; }
.months button.on { background: #ffb648; color: #1b1a15; font-weight: bold; }
.months button:disabled { opacity: 0.25; cursor: default; border-top-color: #555; }
.fiche-deck { justify-content: space-between; }
.printout { z-index: 3; }

@media (max-width: 900px) {
  .fiche-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lens-panel { max-height: 150px; }
  .months { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- catalog computer: where a subject mostly sits ---------- */
.crt-shelves { display: flex; flex-wrap: wrap; gap: 0 2ch; align-items: baseline; margin: 2px 0 4px; }
.crt-shelves button { background: none; border: 0; font: inherit; color: inherit; text-shadow: inherit; padding: 0 2px; }
.crt-shelves button:hover, .crt-shelves button:focus-visible { background: var(--glow); color: var(--bg); text-shadow: none; outline: none; }
.crt-shelves .dim { opacity: 0.6; }
.crt-mode { gap: 1ch 2ch; }
