:root {
  --paper: #f5f0e8; --ink: #1a1714; --mid: #6b6560; --ochre: #c08a3e; --forest: #3a6b4a;
  color-scheme: light;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #d9ccb1; }
body { font: 15px/1.4 system-ui, sans-serif; color: var(--ink); }
#room { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; outline: none; }
.noscript { position: fixed; inset: auto 1rem 1rem; padding: 1rem; background: var(--paper); }

/* ---- plumbing (S4): hint bar, overlays, capability banner, perf meter. All words on these are DRAFT. ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#room:focus-visible { outline: none; }

.hints {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem calc(.4rem + env(safe-area-inset-bottom)) .75rem;
  padding-left: calc(.75rem + env(safe-area-inset-left)); padding-right: calc(.75rem + env(safe-area-inset-right));
  background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink);
  font-size: 13px; border-top: 1px solid #d4cdc0; backdrop-filter: blur(4px);
}
.hint-list { display: flex; gap: .35rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hint-list::-webkit-scrollbar { display: none; }
.hints button, .hints a {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 4px; padding: .3rem .5rem;
  white-space: nowrap; cursor: pointer; text-decoration: none; flex: none;
}
.hints button:hover, .hints a:hover { background: rgba(26, 23, 20, .08); }
.tape-chip { display: flex; flex: none; align-items: center; border: 1px solid #b9b2a4; border-radius: 999px; background: #fff8; }
.tape-chip[hidden] { display: none; }
.hints .tape-chip button { border-radius: 999px; }
.tape-chip-go { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .tape-chip-go { max-width: 7.5rem; } .hints { gap: .3rem; } }
.hints :focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
.hints kbd {
  font: 600 11px/1 ui-monospace, monospace; padding: .12rem .3rem; margin-right: .15rem;
  border: 1px solid #b9b2a4; border-radius: 3px; background: #fff8;
}
.hint-back { border: 1px solid var(--ink) !important; font-weight: 600; }
.hint-lofi { color: var(--mid) !important; }
.hints [aria-current="true"] { background: rgba(192, 138, 62, .25); }
@media (pointer: coarse) {
  .hints kbd { display: none; }
  .hints .hint-list button { border: 1px solid #b9b2a4; border-radius: 999px; padding: .45rem .8rem; background: #fff8; }
  .hints .hint-back kbd { display: none; }
  .hints .hint-back { padding: .45rem .8rem; border-radius: 999px; }
}

.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(26, 23, 20, .55); }
.overlay-close {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); background: var(--paper);
  border: 1px solid var(--ink); border-radius: 4px; padding: .45rem .9rem;
}
.overlay-close:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.book-overlay, .report-overlay {
  /* S6e (D-41): no panel. The editor's page is transparent; the room shows through, softened, and the hint bar
     (with Back to the desk) stays visible below. --hints-h is set from the bar's height by book.js. */
  inset: 0 0 var(--hints-h, 0px) 0; display: block; background: rgba(26, 23, 20, .12);
  opacity: 0; transition: opacity 220ms ease-out; pointer-events: none; /* loading during the move: invisible, inert */
}
.book-overlay.arrived, .report-overlay.arrived { -webkit-backdrop-filter: blur(5px) brightness(.94); backdrop-filter: blur(5px) brightness(.94); }
.book-overlay.shown, .report-overlay.shown { opacity: 1; pointer-events: auto; }
.book-frame, .report-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; color-scheme: light; }
@media (prefers-reduced-motion: reduce) { .book-overlay, .report-overlay { transition: none; } }

.cap-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: .6rem 1rem; text-align: center;
  background: var(--paper); color: var(--ink); border-bottom: 2px solid var(--ochre); font-size: 14px;
}
.cap-banner a { color: var(--forest); font-weight: 600; margin: 0 .5rem; }
.cap-banner button { font: inherit; cursor: pointer; background: none; border: 1px solid var(--ink); border-radius: 4px; padding: .15rem .6rem; }

.perf-meter {
  position: fixed; top: 6px; right: 6px; z-index: 30; margin: 0; padding: 4px 8px; pointer-events: none;
  font: 11px/1.3 ui-monospace, monospace; color: #0f0; background: rgba(0, 0, 0, .7); border-radius: 4px;
}

/* S6a: the projector's sheet bar, just above the hint bar. Words are DRAFT. */
.sheet-bar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 6;
  bottom: calc(3rem + env(safe-area-inset-bottom)); max-width: calc(100vw - 1.5rem);
  display: flex; align-items: center; gap: .35rem; padding: .3rem .5rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink);
  font-size: 13px; border: 1px solid #d4cdc0; border-radius: 999px; backdrop-filter: blur(4px);
}
.sheet-label { padding: 0 .35rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-step, .sheet-visit {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 999px; padding: .3rem .6rem;
  white-space: nowrap; cursor: pointer; text-decoration: none; flex: none;
}
.sheet-step:hover, .sheet-visit:hover { background: rgba(26, 23, 20, .08); }
.sheet-visit { color: var(--forest); font-weight: 600; border: 1px solid #b9b2a4; }
.sheet-bar :focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
/* S6b: the board's step bar reuses .sheet-bar, stacked: controls, region buttons, the selected region's note. DRAFT. */
.board-bar { flex-direction: column; align-items: stretch; border-radius: 16px; gap: .3rem; width: max-content; }
.board-row { display: flex; align-items: center; justify-content: center; gap: .35rem; }
.board-regions { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }
.board-region {
  font: inherit; font-size: 12px; color: inherit; background: none; border: 1px solid #b9b2a4; border-radius: 999px;
  padding: .2rem .55rem; cursor: pointer;
}
.board-region[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.board-note { margin: 0; max-width: 30rem; line-height: 1.35; }
.board-who, .board-title { font-weight: 600; margin-right: .4rem; }
/* S6c: the pinboard's note bar (and S6d's bin bar, same shape) reuses .sheet-bar, stacked: [◀ label ▶] over [Read the post, Back to the board]. DRAFT. */
.pin-bar, .bin-bar, .bio-bar, .tape-bar { flex-direction: column; align-items: stretch; border-radius: 16px; gap: .3rem; }
.pin-row, .pin-actions, .bin-row, .bin-actions, .bio-row, .bio-actions, .tape-row, .tape-actions { display: flex; align-items: center; justify-content: center; gap: .35rem; }
.pin-label, .bin-label, .bio-label, .tape-label { max-width: 24rem; white-space: normal; text-align: center; line-height: 1.3; }
.pin-actions[hidden], .pin-actions > [hidden], .bin-actions[hidden], .bin-actions > [hidden], .bio-actions[hidden], .tape-actions[hidden], .tape-note[hidden] { display: none; }
.pin-back, .bin-back, .bio-back { border: 1px solid #b9b2a4; }
.bio-actions { flex-wrap: wrap; } /* four links and Put it down: wrap on a phone */
.tape-actions { flex-wrap: wrap; } /* play, -30 s, slider, time, link: wrap on a phone */
.tape-seek { flex: 1 1 9rem; min-width: 7rem; accent-color: var(--forest); }
.tape-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tape-note { margin: 0; text-align: center; color: var(--mid); }
.tape-note a { color: var(--forest); }
.bio-bar, .tape-bar { width: max-content; } /* not shrunk to the half viewport right of left: 50% (it was 195 px on a phone) */
.board-body, .board-story { display: block; }
.board-story { margin-top: .2rem; color: var(--mid, #6b6560); }
.board-draft { color: var(--mid, #6b6560); font-size: 11px; }
.board-say { font-style: italic; }
@media (min-width: 481px) { .board-note-say { display: none; } }
@media (max-width: 480px) {
  .board-who, .board-story { display: none; } /* compact on a phone: title + body */
  .board-note { max-width: calc(100vw - 2.5rem); }
  .board-body { display: inline; }
}
@media (pointer: coarse) {
  .sheet-bar { bottom: calc(3.6rem + env(safe-area-inset-bottom)); }
  .sheet-step { padding: .55rem .9rem; border: 1px solid #b9b2a4; background: #fff8; }
}

/* ---- S7 (D-46): the loading still and the class roll. The roll's words, bar the names, are DRAFT. ---- */
@font-face { font-family: 'Roll Hand'; src: url(/vendor/fonts/caveat-500.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Roll Print'; src: url(/vendor/fonts/archivo-narrow-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
.loading { position: fixed; inset: 0; z-index: 15; pointer-events: none; transition: opacity 700ms ease-out; }
.loading.done { opacity: 0; }
.still img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.roll {
  --rule: 27px; --biro: #22337a;
  position: absolute; left: max(16px, 3vw); bottom: max(16px, 5vh); width: 290px; box-sizing: border-box;
  padding: 14px 18px 12px 46px; transform: rotate(-2deg); transform-origin: 30% 100%;
  color: #2b2620; font: 600 15px/var(--rule) 'Roll Print', 'Arial Narrow', sans-serif;
  background:
    linear-gradient(90deg, transparent 34px, #d9786c 34px, #d9786c 35.5px, transparent 35.5px), /* the margin */
    repeating-linear-gradient(180deg, transparent 0 calc(var(--rule) - 1px), #9fb6cf calc(var(--rule) - 1px) var(--rule)) 0 52px / 100% 100% no-repeat,
    #f6f1e4;
  box-shadow: 0 1px 2px rgba(26, 23, 20, .25), 0 10px 24px rgba(26, 23, 20, .28);
  border-radius: 2px;
}
.roll header { display: flex; flex-direction: column; line-height: 1.2; margin: 0 0 13px; letter-spacing: .02em; }
.roll-school { font-size: 11px; text-transform: uppercase; color: #6b6560; }
.roll-title { font-size: 16px; }
.roll ol { list-style: none; margin: 0; padding: 0; counter-reset: roll; }
.roll li { position: relative; counter-increment: roll; }
.roll li::before { content: counter(roll); position: absolute; left: -40px; width: 22px; text-align: right; color: #8a8378; font-size: 12px; }
/* the mark: a biro tick in the column at the right, written on with a wipe */
.roll li::after {
  content: '\2713'; position: absolute; right: 2px; top: -3px; font: 26px/var(--rule) 'Roll Hand', cursive; color: var(--biro);
  clip-path: inset(0 100% 0 0); transition: clip-path 180ms ease-out;
}
.roll li.here::after { clip-path: inset(0 0 0 0); }
.roll-foot {
  margin: 2px 0 0; font: 25px/var(--rule) 'Roll Hand', cursive; color: var(--biro); transform: rotate(-3deg);
  clip-path: inset(0 100% 0 0); transition: clip-path 420ms ease-out;
}
.roll-foot.here { clip-path: inset(0 0 0 0); }
@media (max-aspect-ratio: 1/1) {
  .roll { left: 50%; bottom: max(24px, 6vh); margin-left: -145px; transform: rotate(-1.5deg); transform-origin: 50% 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .loading, .roll li::after, .roll-foot { transition: none; }
}

/* S8a: the simple-version list in index.html is for crawlers and screen readers; a sighted keyboard user who tabs into it
   sees it (a skip link that is the whole simple version). */
nav.sr-only:focus-within {
  position: fixed; inset: 0 0 auto 0; z-index: 20; width: auto; height: auto; margin: 0; overflow: auto; clip: auto; white-space: normal;
  max-height: 100dvh; padding: 1rem 1.25rem; background: var(--paper); color: var(--ink); box-shadow: 0 2px 12px rgba(0, 0, 0, .25);
  font: 16px/1.5 system-ui, sans-serif;
}
nav.sr-only:focus-within h1 { font-size: 1.2rem; margin: 0 0 .25rem; }
nav.sr-only:focus-within ul { padding-left: 1.1rem; }
nav.sr-only a { color: var(--forest); }
nav.sr-only a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
