theater-reader/public/app.css
agent 2608d10dd2 Add theater reader web app with the 1931 play transcription
Static app (no build step) served by unprivileged nginx in a container:
choose a font, size and theme, pick a character to highlight their lines
and step through them, read in a distraction-free mode, or export a PDF
via the print dialog (one page per original page).

Includes the transcription of typescript pages 5-27 (pages 1-4 and 7
are missing in the original), a parser with node:test tests, and
self-hosted OFL fonts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
2026-10-29 23:14:19 +00:00

245 lines
7.5 KiB
CSS

:root {
--bg: #ffffff;
--panel: #f5f5f3;
--fg: #1d1d1b;
--muted: #6b6a66;
--line: #dddcd7;
--accent: #9a3b1b;
--hl: #fff1a8;
--hl-edge: #e0b400;
--ui-font: system-ui, -apple-system, "Segoe UI", sans-serif;
--script-font: "Atkinson Hyperlegible", system-ui, sans-serif;
--script-size: 19px;
--who-w: 7em;
color-scheme: light;
}
:root[data-theme="sepia"] {
--bg: #f6eedb;
--panel: #ede2c8;
--fg: #2e261b;
--muted: #7a6a52;
--line: #d9caa8;
--accent: #8a3214;
--hl: #f5d77a;
--hl-edge: #b98a00;
}
:root[data-theme="dark"] {
--bg: #17171a;
--panel: #202024;
--fg: #e8e6e1;
--muted: #9c9a94;
--line: #34343a;
--accent: #f0a37f;
--hl: #4a3f12;
--hl-edge: #d6b13a;
color-scheme: dark;
}
:root[data-mono="1"] { --who-w: 9ch; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
background: var(--bg);
color: var(--fg);
font-family: var(--ui-font);
font-size: 16px;
line-height: 1.45;
}
button, select, input { font: inherit; color: inherit; }
/* ---- layout ---- */
.layout {
display: grid;
grid-template-columns: 330px minmax(0, 1fr);
min-height: 100vh;
}
.panel {
position: sticky;
top: 0;
height: 100vh;
overflow-y: auto;
padding: 20px 20px 32px;
background: var(--panel);
border-right: 1px solid var(--line);
}
.panel h1 { font-size: 20px; margin: 0 0 16px; }
.play-note { color: var(--muted); font-size: 13.5px; margin: -6px 0 16px; }
.field { display: block; border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field output { font-weight: 400; color: var(--muted); }
select, input[type="range"] { width: 100%; }
select {
padding: 8px 10px;
border-radius: 8px;
border: 1px solid var(--line);
background: var(--bg);
}
input[type="range"] { accent-color: var(--accent); }
.radio { display: block; padding: 3px 0; }
.radio small { color: var(--muted); display: block; margin-left: 1.6em; font-size: 12.5px; }
input[type="radio"] { accent-color: var(--accent); }
.fonts { display: grid; gap: 6px; }
.font-card {
display: grid;
grid-template-columns: auto 1fr;
gap: 0 8px;
padding: 8px 10px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--bg);
cursor: pointer;
}
.font-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.font-card input { grid-row: span 2; align-self: center; }
.font-name { font-weight: 700; font-size: 15px; }
.font-sample { font-size: 13.5px; color: var(--muted); }
.seg { display: flex; gap: 6px; }
.seg label {
flex: 1;
text-align: center;
padding: 6px 4px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--bg);
cursor: pointer;
font-size: 14px;
}
.seg label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; margin-top: 4px; }
.actions button {
flex: 1;
padding: 10px 12px;
border-radius: 8px;
border: 1px solid var(--line);
background: var(--bg);
cursor: pointer;
font-weight: 600;
}
.actions .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .actions .primary { color: #17171a; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
/* ---- script ---- */
.script {
padding: 24px 40px 120px;
font-family: var(--script-font);
font-size: var(--script-size);
line-height: 1.5;
outline: none;
}
.script > * { max-width: 46em; margin-inline: auto; }
:root[data-mono="1"] .script > * { max-width: 72ch; }
.loading, .error { color: var(--muted); font-family: var(--ui-font); }
.error { color: var(--accent); }
.page { padding: 8px 0 28px; border-bottom: 1px dashed var(--line); }
.pnum { text-align: center; color: var(--muted); font-size: 0.8em; margin: 8px 0 12px; }
.missing-note { text-align: center; color: var(--muted); font-style: italic; padding: 2em 0; }
.speech {
display: grid;
grid-template-columns: var(--who-w) minmax(0, 1fr);
gap: 0 1em;
margin: 0.75em 0;
border-radius: 6px;
}
.speech.cont { margin-top: 0.2em; }
.who { font-weight: 700; overflow-wrap: anywhere; }
.say p { margin: 0; }
.say p + p { margin-top: 0.2em; }
.stage { color: var(--muted); padding-left: 1.5em; }
.verse { padding-left: 2.5em; margin-block: 0.35em !important; }
.scene { margin: 1em 0; }
.center { text-align: center; margin: 1em 0; letter-spacing: 0.03em; }
.gap { height: 0.4em; }
:root[data-layout="flow"] .stage { font-style: italic; }
:root[data-layout="original"] .say p,
:root[data-layout="original"] .scene { white-space: pre-wrap; }
:root[data-layout="original"] .stage { padding-left: 2.5em; }
.speech.mine .say {
background: var(--hl);
border-left: 3px solid var(--hl-edge);
border-radius: 3px;
padding: 0.1em 0.5em;
margin-left: calc(-0.5em - 3px);
}
.speech.mine .who { color: var(--accent); }
.speech.mine .stage { color: inherit; opacity: 0.75; }
.speech.current { outline: 2px solid var(--hl-edge); outline-offset: 6px; }
/* ---- floating navigation for the chosen role / reading mode ---- */
.lines-nav {
position: fixed;
right: 16px;
bottom: 16px;
display: flex;
align-items: center;
gap: 4px;
padding: 6px;
border-radius: 999px;
background: var(--panel);
border: 1px solid var(--line);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
font-family: var(--ui-font);
}
.lines-nav[hidden] { display: none; }
.lines-nav button {
min-width: 40px;
height: 40px;
border-radius: 999px;
border: 0;
background: transparent;
cursor: pointer;
font-size: 15px;
}
.lines-nav button:hover { background: var(--line); }
.lines-nav span { min-width: 4.5em; text-align: center; font-size: 14px; color: var(--muted); }
.lines-nav .exit, .lines-nav .read-only { display: none; }
.lines-nav.no-role #prev, .lines-nav.no-role #next, .lines-nav.no-role span { display: none; }
body.reading .layout { grid-template-columns: minmax(0, 1fr); }
body.reading .panel { display: none; }
body.reading .script { padding-top: 32px; }
body.reading .lines-nav .exit,
body.reading .lines-nav .read-only { display: inline-block; }
/* ---- narrow screens ---- */
@media (max-width: 820px) {
.layout { grid-template-columns: minmax(0, 1fr); }
.panel { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
.script { padding: 16px 16px 120px; }
}
@media (max-width: 560px) {
.speech { display: block; }
.who { font-size: 0.85em; letter-spacing: 0.02em; }
.stage { padding-left: 1em; }
:root[data-layout="original"] .stage { padding-left: 1.5em; }
}
/* ---- PDF export (print) ---- */
@page { size: A4; margin: 18mm 16mm; }
@media print {
:root, :root[data-theme] {
--bg: #fff; --fg: #000; --muted: #444; --line: #ccc; --accent: #000;
--hl: #fff1a8; --hl-edge: #c99a00;
}
body { background: #fff; }
.layout { display: block; }
.panel, .lines-nav { display: none !important; }
.script { padding: 0; font-size: calc(var(--script-size) * 0.7); line-height: 1.35; orphans: 3; widows: 3; }
.script > * { max-width: none; }
.page { border: 0; padding: 0; break-before: page; }
.page:first-child { break-before: auto; }
.speech { margin: 0.6em 0; }
.speech.current { outline: none; }
.speech.mine .say { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.speech.mine .who { text-decoration: underline; }
}