@font-face { font-family: "Courier Prime"; src: url(fonts/CourierPrime-Regular.woff2) format("woff2"); font-display: block; }
/* Layout only; chrome colours/shapes come from theme.css. Script page is fixed white + Courier. */
:root { --paper: #ffffff; --ink: #111111; --k: 0.5; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 var(--font-ui); -webkit-text-size-adjust: 100%; }
button, .btn, select { font: inherit; color: var(--fg); background: var(--panel); border: 0; border-radius: var(--radius); padding: 8px 12px; cursor: pointer; }
button.primary { background: var(--acc); color: var(--acc-fg); } button.danger { color: var(--danger); }
.btn input[type=file] { display: none; }
header { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px; background: var(--bg); border-bottom: 1px solid var(--panel); }
header h1 { flex: 1; margin: 0; font-size: 20px; }
header .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; font-weight: 600; }
.bar { display: flex; gap: 10px; align-items: center; padding: 8px 10px; flex-wrap: wrap; }
.chk { display: flex; gap: 6px; align-items: center; }
.muted { color: var(--muted); } .note { padding: 0 12px; font-size: 14px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--panel); }
.rows li .open { flex: 1; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.rows li .open b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows li.empty { justify-content: center; }
.pop { position: fixed; z-index: 20; top: calc(env(safe-area-inset-top) + 52px); left: 10px; right: 10px; max-width: 420px; margin: auto; background: var(--panel); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.pop[hidden] { display: none; } .pop button, .pop label { text-align: left; background: none; padding: 12px; }
dialog { background: var(--panel-2); color: var(--fg); border: 0; border-radius: var(--radius-lg); width: min(92vw, 440px); padding: 16px; }
dialog::backdrop { background: var(--backdrop); }
dialog h2 { margin: 0 0 10px; font-size: 18px; }
dialog label { display: block; margin: 8px 0; } dialog label.chk { display: flex; }
dialog input:not([type=checkbox]), dialog textarea { display: block; width: 100%; font: inherit; font-size: 16px; padding: 8px; margin-top: 4px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--field); color: var(--fg); }
.btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; } .col { display: flex; flex-direction: column; gap: 6px; }
.warn { color: var(--warn); font-size: 14px; } progress { width: 100%; }
#toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 60px); background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 10px 14px; border-radius: 10px; max-width: 92vw; }
#update { position: fixed; z-index: 30; left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 60px); background: var(--panel); padding: 10px; border-radius: 10px; text-align: center; }
[hidden] { display: none !important; }

/* ---- script page: indents come from layout.js as --l-*, --r-* (tenths of an inch = 1ch at 10 cpi) ---- */
#page { background: var(--paper); color: var(--ink); min-height: 100vh; padding: 16px 12px 60vh; }
.script { font-family: "Courier Prime", Courier, monospace; font-size: 16px; line-height: 1.25; max-width: 62ch; margin: 0 auto; outline: none; white-space: pre-wrap; overflow-wrap: break-word; -webkit-user-select: text; user-select: text; }
#pv.script { background: var(--paper); color: var(--ink); padding: 16px 12px; }
.el { min-height: 1.25em; margin-top: 1.25em; }
.el:first-child { margin-top: 0; }
@media (min-width: 700px) { :root { --k: 1; } }
.el[data-t=scene]         { margin-left: calc(var(--l-scene) * var(--k) * 1ch); text-transform: uppercase; margin-top: calc(var(--b-scene) * 1.25em); }
.el[data-t=action]        { margin-left: calc(var(--l-action) * var(--k) * 1ch); }
.el[data-t=character]     { margin-left: calc(var(--l-character) * var(--k) * 1ch); text-transform: uppercase; }
.el[data-t=parenthetical] { margin-left: calc(var(--l-parenthetical) * var(--k) * 1ch); margin-right: calc(var(--r-parenthetical) * var(--k) * 1ch); margin-top: 0; }
.el[data-t=dialogue]      { margin-left: calc(var(--l-dialogue) * var(--k) * 1ch); margin-right: calc(var(--r-dialogue) * var(--k) * 1ch); margin-top: 0; }
.el[data-t=transition]    { margin-left: calc(var(--l-transition) * var(--k) * 1ch); text-transform: uppercase; }
.el[data-t=shot]          { margin-left: calc(var(--l-shot) * var(--k) * 1ch); text-transform: uppercase; }
.el[data-t=centered]      { text-align: center; }
#pv .copy { display: block; margin: 18px 0 4px; font: 13px var(--font-ui); background: var(--acc); }

/* ---- element strip, kept above the keyboard by editor.js (visualViewport) ---- */
#strip { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px); background: var(--panel-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--chip); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; will-change: transform; }
#strip.kb { padding-bottom: 6px; }
body:not([data-screen=editor]) #strip { display: none; }
#types { flex: 1; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
#types::-webkit-scrollbar { display: none; }
.chip, #keys > div { flex: none; scroll-snap-align: start; padding: 8px 11px; border-radius: var(--chip-radius); background: var(--chip); font-size: 15px; cursor: pointer; }
.chip.on { background: var(--acc); color: var(--acc-fg); }
#keys { display: flex; gap: 4px; flex: none; }
#keys > div { padding: 8px 9px; border-radius: var(--radius); }
@media (max-width: 380px) { #keys > [data-k=undo], #keys > [data-k=redo] { display: none; } }
