/* All Areas Script (web). The dashboard look (Angus, 29 Oct 2026: the same as Tour and Patch, in Script sepia, with a
   light switch): dark greys #171717 / #1C1C1C / #232323 with #2E2E2E borders, one accent used sparingly (the main
   button, the chosen tool, the live dot), Inter for words and Source Code Pro for cue numbers, 6px buttons, 8px panels.
   The values follow Tour's tour.css dashboard section; the class names on the home screen are Script's own (.side,
   .crumbbar, .home-page) because the editor already uses .page, .topbar, .menu and .panel. When the shared
   packages/ui/dash.css lands (the Patch chat), Script takes its tokens from there.
   Script pages stay white paper in both themes. Printing stays black on white. */

:root {
  --bg: #171717;
  --surface: #1C1C1C;
  --surface-2: #232323;
  --hover: #2A2A2A;
  --ink: #EDEDED;
  --muted: #A1A1A1;
  --faint: #8F8F8F;
  --line: #2E2E2E;
  --line-2: #3A3A3A;
  --accent: #8A5A2E;          /* Script's pass colour (sepia): the main button */
  --accent-ink: #FFFFFF;
  --accent-text: #D69C64;     /* sepia as text, a border or the live dot */
  --accent-soft: rgba(214, 156, 100, .14);
  --aa: #C0362D;              /* the All Areas mark */
  --viewer: #0E0E0E;          /* behind the pages */
  --paper: #FFFFFF;
  --danger: #F38B82;
  --ok: #3ECF8E;
  --warn: #F0C25A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -12px rgba(0, 0, 0, .8);
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-mark: "Saira Stencil One", "Barlow Condensed", Impact, sans-serif;
  --radius: 8px;
  color-scheme: dark;
}
/* Daylight (a rehearsal room with the lights up): the same layout in light greys. */
:root[data-theme="light"] {
  --bg: #F6F6F5;
  --surface: #FFFFFF;
  --surface-2: #F2F2F1;
  --hover: #ECECEA;
  --ink: #171717;
  --muted: #5C5C5C;
  --faint: #6B6B6B;
  --line: #E2E2E0;
  --line-2: #CFCFCC;
  --accent: #8A5A2E;
  --accent-ink: #FFFFFF;
  --accent-text: #8A5A2E;
  --accent-soft: rgba(138, 90, 46, .12);
  --aa: #B4231B;
  --viewer: #D7D7D1;
  --danger: #B4231B;
  --ok: #1B6E3A;
  --warn: #7A5100;
  --shadow: 0 1px 2px rgba(20, 21, 23, .12), 0 8px 24px -12px rgba(20, 21, 23, .35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.muted { color: var(--muted); }
.caps { font-family: var(--font-head); font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ buttons and fields */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 36px; padding: 0 .9rem;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-head); font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap; user-select: none; -webkit-user-select: none;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 28px; padding: 0 .6rem; font-size: 12px; }
.btn.icon { padding: 0; width: 36px; }
.btn svg, .tool svg, .iconbtn svg { width: 20px; height: 20px; flex: none; }
.tool .glyph svg { width: 28px; height: 24px; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--ink); cursor: pointer; padding: 0;
}
.iconbtn:hover { background: var(--hover); }
.iconbtn:disabled { opacity: .35; cursor: default; background: transparent; border-color: transparent; }

input[type=text], input[type=number], input:not([type]), select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px;
  padding: .3rem .55rem; min-height: 32px; color: var(--ink); font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-text); outline-offset: -1px; }
textarea { resize: vertical; line-height: 1.35; }
label.field { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
label.field > span { font-family: var(--font-head); font-weight: 500; font-size: 13px; color: var(--muted); }
label.check { display: flex; gap: .55rem; align-items: center; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button {
  border: 0; background: transparent; padding: 0 .7rem; min-height: 32px; cursor: pointer;
  font-family: var(--font-head); font-weight: 500; font-size: 13px; color: var(--muted);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------------------ wordmark */

.wordmark { display: inline-flex; align-items: baseline; gap: .45rem; margin: 0; line-height: 1; white-space: nowrap; }
.wordmark .aa { font-family: var(--font-head); font-weight: 600; font-size: .8em; letter-spacing: .12em; color: var(--muted); }
.wordmark .script { font-family: var(--font-mark); font-weight: 400; color: var(--accent-text); letter-spacing: .02em; }

/* ------------------------------------------------------------ home: sidebar, then the trail bar over the page */

.home { min-height: 100%; display: flex; }
.aa-home { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; }
.aa-mark { white-space: nowrap; background: var(--aa); color: #fff; font: 400 .72rem/1.2 var(--font-mark); letter-spacing: .04em; text-transform: uppercase;
  display: inline-flex; align-items: center; height: 24px; padding: 0 7px; border-radius: 5px; }
.aa-home:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
.side { flex: none; width: 232px; height: 100vh; position: sticky; top: 0; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
.side-in { min-height: 100%; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-top { display: flex; align-items: center; gap: 8px; padding: 0 8px 14px; }
.logo-mark { font: 400 1rem/1 var(--font-mark); color: var(--accent-text); letter-spacing: .03em; }
.side-toggle { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-menu { display: flex; flex-direction: column; gap: 2px; }
.side-menu button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--muted); font-size: 13px;
  background: none; border: 0; text-align: left; cursor: pointer; min-height: 32px; width: 100%; }
.side-menu button:hover { background: var(--hover); color: var(--ink); }
.side-menu button[aria-current] { background: var(--hover); color: var(--ink); font-weight: 500; }
.side-menu button .ro { margin-left: auto; font-size: 11px; color: var(--faint); }
.menu-head { margin: 14px 10px 4px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.who { margin: auto 0 0; padding: 10px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.who .me { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who p { margin: 0; font-size: 12px; color: var(--faint); }
.link { background: none; border: 0; padding: 0 .2rem; color: var(--muted); cursor: pointer; font-size: 12px; min-height: 28px; text-align: left; }
.link:hover { color: var(--ink); text-decoration: underline; }
.work { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.crumbbar { position: sticky; top: 0; z-index: 5; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 24px;
  border-bottom: 1px solid var(--line); background: var(--bg); font-size: 13px; }
.crumbpath { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; color: var(--ink); }
.crumbpath .sep { color: var(--faint); }
.crumbpath .dim { color: var(--muted); }
.live { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.live:empty { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 4px; background: var(--accent-text); }
.home-page { width: 100%; max-width: 1180px; padding: 22px 24px 64px; }
.page-head { display: grid; gap: 6px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 500; }
.page-head .lede { margin: 0; color: var(--muted); max-width: 60ch; }
.home-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.privacy { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin: 0; font-size: 13px; }
.privacy svg { width: 16px; height: 16px; flex: none; color: var(--accent-text); }
.drop {
  border: 1px dashed var(--line-2); border-radius: 8px; padding: 16px; text-align: center; color: var(--faint); font-size: 13px;
  margin: 16px 0 24px; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent-text); background: var(--accent-soft); color: var(--ink); }
.home h2 { font-family: var(--font-head); font-weight: 500; font-size: 13px; color: var(--muted); margin: 22px 0 10px; }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.project {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px;
  display: grid; gap: 8px; min-width: 0;
}
.project:hover { border-color: var(--line-2); }
.project .pname {
  font-family: var(--font-head); font-weight: 600; font-size: 15px; line-height: 1.25; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; color: var(--ink);
}
.project .meta { color: var(--muted); font-size: 12px; }
.project .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 16px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; font-size: 13px; }
.note { border-radius: 6px; padding: 8px 12px; margin: 0 0 4px; font-size: 13px; background: var(--surface-2); }
.note.ok { color: var(--ok); }
.note.bad { color: var(--danger); }
.dlg.login form { display: grid; gap: 10px; }
.dlg .links { justify-content: flex-start; gap: 4px 12px; }
.aa-signin { display: grid; gap: 10px; margin-bottom: 4px; }
.aa-signin-list { display: grid; gap: 8px; }
.aa-signin-btn { display: flex; align-items: center; width: 100%; justify-content: center; gap: .6em; }
.aa-signin-btn svg { flex: none; }
.aa-signin-or { margin: 0; color: var(--muted); font-size: 12px; }
label.check small { display: block; font-size: 12px; margin-top: 2px; }
label.check { align-items: flex-start; }

@media (max-width: 900px) {
  .home { flex-direction: column; }
  .side { width: auto; height: auto; position: sticky; top: 0; z-index: 10; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .side-in { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; gap: 4px 8px; min-height: 0; }
  .side-top { padding: 0; }
  .side-toggle { display: inline-flex; margin-left: auto; }
  .side-nav { display: none; flex-basis: 100%; padding: 6px 0 4px; }
  .side.open .side-nav { display: flex; }
  .side-menu button { padding: 10px; font-size: 14px; min-height: 40px; }
  .crumbbar { position: static; padding: 0 16px; }
  .home-page { padding: 16px 16px 56px; }
}

/* ------------------------------------------------------------ editor layout */

.editor { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 54px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: nowrap;
}
.topbar .wordmark { font-size: 1.05rem; }
.topbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 2px; }
.pname-input {
  min-width: 0; flex: 1 1 160px; max-width: 320px; border-color: transparent !important; background: transparent !important;
  font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis;
}
.pname-input:hover { border-color: var(--line) !important; }
.tb-group { display: flex; align-items: center; gap: 2px; }
.zoom-label { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 0; }
.pager { display: flex; align-items: center; gap: 4px; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.pager input { width: 3.6rem; text-align: center; min-height: 32px; padding: 0 .3rem; font-variant-numeric: tabular-nums; }
.save-state { font-size: .8rem; color: var(--muted); white-space: nowrap; min-width: 4.5rem; text-align: right; }
.spacer { flex: 1; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 250px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; display: grid; gap: 2px;
}
.menu-list button {
  text-align: left; border: 0; background: transparent; padding: .55rem .7rem; border-radius: 8px; cursor: pointer; color: var(--ink);
  display: flex; justify-content: space-between; gap: 1rem; font-size: .95rem;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list kbd { color: var(--muted); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; width: auto; }

.workspace { flex: 1; display: flex; min-height: 0; position: relative; overflow: hidden; }  /* clips the panel drawer when it's tucked away */

/* tool rail */
.tools {
  width: 76px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; padding: 6px 6px; overflow-y: auto;
}
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 9px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink);
  font-family: var(--font-head); font-weight: 600; font-size: .7rem; line-height: 1.05;
  padding: 4px 2px; text-align: center;
}
.tool:hover { background: var(--surface-2); }
.tool.on { background: var(--accent-soft); border-color: var(--accent-text); color: var(--accent-text); }
.tool .glyph { width: 26px; height: 22px; display: flex; align-items: center; justify-content: center; }
.tools .tool-sep { height: 1px; background: var(--line); margin: 4px 6px; flex: none; }

/* options bar */
.viewer-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; } /* min-height: phones stack it in a column */
.options {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 12px; min-height: 50px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.options .olabel { font-family: var(--font-head); font-weight: 600; font-size: .82rem; color: var(--muted); }
.options .hint { color: var(--muted); font-size: .88rem; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.options input[type=text] { min-height: 32px; }
.options textarea { min-height: 34px; height: 34px; width: min(420px, 100%); }
.palette { display: flex; gap: 4px; flex-wrap: wrap; }
.dcabtn {
  min-width: 38px; height: 36px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding: 2px 4px;
  font-family: var(--font-head); font-weight: 600; color: var(--ink);
}
.dcabtn b { font-size: 1rem; }
.dcabtn small { font-size: .58rem; letter-spacing: .03em; color: var(--muted); max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcabtn.on { background: #0A7A4B; border-color: #0A7A4B; color: #fff; }
.dcabtn.on.off { background: #C2410C; border-color: #C2410C; }
.dcabtn.on small { color: rgba(255, 255, 255, .85); }
.swatches { display: flex; gap: 5px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--accent-text); }

/* pages */
.pages {
  flex: 1; overflow: auto; background: var(--viewer); position: relative; outline: none;
  padding: 18px 40px 80px; overscroll-behavior: contain;
}
.pages-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; min-width: min-content; margin: 0 auto; }
.page {
  position: relative; background: var(--paper); box-shadow: var(--shadow); flex: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.pages.tool-select .page { touch-action: pan-x pan-y pinch-zoom; }
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.page .ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.page .ink g.sel, .page .ink .handle { pointer-events: auto; touch-action: none; }
.page .pageno {
  position: absolute; right: calc(100% + 8px); top: 0; font-family: var(--font-head); font-weight: 600; font-size: .8rem;
  color: var(--muted); text-align: right; line-height: 1.2; white-space: nowrap;
}
.page .pageno small { display: block; font-weight: 600; font-size: .68rem; opacity: .8; }
.page.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #ddd; border-top-color: #8A5A2E; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pages.tool-place .page { cursor: crosshair; }
.pages.tool-pen .page { cursor: crosshair; }
.pages.tool-eraser .page { cursor: cell; }
.pages.dragging .page { cursor: grabbing; }

/* ink (SVG marks, in page points) */
.ink text { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-weight: 700; }  /* marks on the page keep their own type: core.js sizes them */
.ink .bt { fill: #fff; font-size: 11px; }
.ink .nm, .ink .cn { font-size: 8.5px; paint-order: stroke; stroke: #fff; stroke-width: 2.4px; stroke-linejoin: round; }
.ink .cn { font-weight: 600; font-size: 7.5px; }
.ink .lv { font-size: 9.5px; }
.ink .nt { font-family: var(--font-body); font-weight: 500; font-size: 8.5px; fill: #3D3200; }
.ink .fl { font-size: 9px; paint-order: stroke; stroke: #fff; stroke-width: 2.4px; stroke-linejoin: round; }
.ink .hl { mix-blend-mode: multiply; }
.ink .selbox { fill: none; stroke: #8A5A2E; stroke-width: 1; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; }
.ink .handle { fill: #fff; stroke: #8A5A2E; stroke-width: 1.2; cursor: grab; }
.ink .flash { animation: flash 1.2s ease-out 1; }
@keyframes flash { 0%, 40% { opacity: 1; } 20%, 60% { opacity: .15; } 100% { opacity: 1; } }
.ink .erasing { opacity: .2; }

/* side panel */
.panel {
  width: 310px; flex: none; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
.panel-tabs button {
  flex: 1; border: 0; background: transparent; padding: 12px 6px 10px; cursor: pointer; color: var(--muted);
  font-family: var(--font-head); font-weight: 600; font-size: .9rem;
  border-bottom: 2px solid transparent;
}
.panel-tabs button.on { color: var(--ink); border-bottom-color: var(--accent-text); }
.panel-body { flex: 1; overflow-y: auto; padding: 12px; display: grid; gap: 12px; align-content: start; }
.panel-close { display: none; }
.cue-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.cue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cue-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: baseline;
  padding: 7px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%; color: var(--ink);
}
.cue-row:hover { background: var(--surface-2); }
.cue-row.sel { border-color: var(--accent-text); background: var(--accent-soft); }
.cue-row .num {
  font-family: var(--font-head); font-weight: 600; color: #fff; border-radius: 4px; padding: 1px 6px; font-size: .9rem;
  min-width: 2.4rem; text-align: center;
}
.cue-row .num.cue { background: #C8102E; }
.cue-row .num.sfx { background: #6D28D9; }
.cue-row .desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.cue-row .pg { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cue-row .dcas { grid-column: 2 / 4; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-list { display: grid; gap: 2px; }
.layer {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; border: 0; background: none;
  color: var(--ink); text-align: left; width: 100%;
}
.layer:hover { background: var(--surface-2); }
.layer .eye { width: 22px; height: 22px; color: var(--muted); }
.layer.off .lname { color: var(--muted); text-decoration: line-through; }
.layer .dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.layer .count { margin-left: auto; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.panel h3 { margin: 4px 0 0; font-family: var(--font-head); font-weight: 600; font-size: .8rem; color: var(--muted); }
.panel .note-text { font-size: .9rem; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 300;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
  max-width: min(92vw, 560px); font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.visible { opacity: 1; pointer-events: auto; }
.toast.bad { background: var(--danger); color: #fff; }

/* dialogs */
dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10, 10, 12, .55); }
.dlg { display: grid; gap: 14px; padding: 20px 22px; }
.dlg h2 { margin: 0; font-family: var(--font-head); font-weight: 500; font-size: 18px; }
.dlg p { margin: 0; }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dlg .box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.dlg .warn { color: var(--danger); }
.dlg .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg .tm-chans { max-height: 38vh; overflow: auto; gap: 4px; }
.dlg .tm-head, .dlg .tm-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 10px; align-items: center; }
.dlg .tm-head { font-family: var(--font-head); font-weight: 600; font-size: .78rem; color: var(--muted); }
.dlg .tm-row span { overflow-wrap: anywhere; }
.dlg .tm-row input.bad { border-color: var(--danger); }
.keys { width: 100%; border-collapse: collapse; font-size: .92rem; }
.keys td { padding: 5px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.keys td:first-child { width: 42%; white-space: nowrap; }
.keys h3 { margin: 10px 0 2px; font-family: var(--font-head); font-size: .85rem; color: var(--muted); }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px;
  font-family: var(--font-head); font-weight: 600; font-size: .85rem; text-align: center; background: var(--surface-2); color: var(--ink);
}

/* ------------------------------------------------------------ Show Mode */

.show {
  position: fixed; inset: 0; z-index: 200; background: #050506; color: #ECEBE6;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
}
.show-hud {
  display: flex; align-items: center; gap: 18px; padding: 10px 16px; background: #111214; border-bottom: 1px solid #24262B;
  flex-wrap: wrap;
}
.show-next { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.show-next .lbl { font-family: var(--font-head); font-weight: 600; font-size: .85rem; color: #9C9FA6; }
.show-next .big { font-family: var(--font-head); font-weight: 600; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; color: #FF5A6E; font-variant-numeric: tabular-nums; }
.show-next .sfx { color: #B794F6; font-size: clamp(1.4rem, 3vw, 2rem); }
.show-next .what { color: #ECEBE6; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.show-next .where { color: #9C9FA6; font-size: .9rem; white-space: nowrap; }
.show-page-no { font-family: var(--font-head); font-weight: 600; font-size: 1.3rem; letter-spacing: .04em; white-space: nowrap; color: #ECEBE6; }
.show-page-no small { color: #9C9FA6; font-size: .8rem; letter-spacing: .08em; }
.show-tools { display: flex; gap: 6px; align-items: center; }
.show .btn { background: #1B1C20; border-color: #2E3036; color: #ECEBE6; }
.show .btn.on { background: #8A5A2E; border-color: #8A5A2E; }
.show .midi { font-size: .8rem; color: #9C9FA6; white-space: nowrap; }
.show-stage { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.show-page { position: relative; background: #fff; box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0, 0, 0, .6); }
.show-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.show-page .ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.show-tap { position: absolute; top: 0; bottom: 0; width: 22%; z-index: 2; }
.show-tap.left { left: 0; }
.show-tap.right { right: 0; }
.show.drawing .show-tap { display: none; }
.show-hint { color: #8B8E96; font-size: .85rem; line-height: 1.4; }
.show-hint:empty { display: none; }
@media (orientation: landscape) and (min-width: 900px) {
  .show { grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .show-hud { flex-direction: column; align-items: stretch; border-bottom: 0; border-right: 1px solid #24262B; padding: 18px 16px; gap: 20px; overflow-y: auto; }
  .show-next { flex-direction: column; align-items: flex-start; gap: 4px; flex: none; }
  .show-next .what { white-space: normal; }
  .show-tools { flex-wrap: wrap; }
  .show-hud .grow { flex: 1; }
}

/* ------------------------------------------------------------ narrower screens */

.panel-toggle { display: none; }
@media (max-width: 1180px) {
  .panel {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow);
    transform: translateX(105%); transition: transform .2s ease; width: min(340px, 92vw);
  }
  .panel.open { transform: none; }
  .panel-toggle { display: inline-flex; }
  .panel-close { display: inline-flex; margin-left: auto; }
  .panel-tabs { align-items: center; padding-right: 6px; }
}
@media (max-width: 900px) {
  .hide-md { display: none !important; }
  .pages { padding: 14px 14px 80px 30px; }
  .topbar { gap: 4px; padding: 6px; }
  .topbar .wordmark .aa { display: none; }
}
@media (max-width: 680px) {
  .workspace { flex-direction: column-reverse; }
  .tools {
    width: auto; flex-direction: row; border-right: 0; border-top: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden; padding: 4px; gap: 2px; padding-bottom: max(4px, env(safe-area-inset-bottom));
  }
  .tool { min-width: 58px; min-height: 50px; }
  .tools .tool-sep { width: 1px; height: auto; margin: 6px 2px; }
  .hide-sm { display: none !important; }
  .pages { padding: 10px 10px 60px 10px; }
  .page .pageno { right: auto; left: 4px; top: -16px; }
  .pages-inner { gap: 30px; padding-top: 10px; }
  .pname-input { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
  .ink .flash { animation: none; }
}

/* ------------------------------------------------------------ Follow along (beta) */

.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; }
.follow {
  --warn: #E3B341; --warn-soft: rgba(227, 179, 65, .14); --cue-here: #FF7A85; --cue-here-soft: rgba(255, 122, 133, .14); --ok-text: var(--ok);
  display: grid; gap: 5px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
:root[data-theme="light"] .follow { --warn: #8A5A00; --warn-soft: rgba(176, 116, 0, .12); --cue-here: #C8102E; --cue-here-soft: rgba(200, 16, 46, .1); --ok-text: #146C3A; }
.follow[hidden] { display: none; }
.follow-row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }
.follow-title { margin: 0; font: 700 1rem/1.2 var(--font-head); display: flex; align-items: center; gap: 6px; }
.follow .beta { font-size: .7rem; color: var(--accent-text); border: 1px solid var(--accent-text); border-radius: 4px; padding: 0 4px; }
.follow .soon { font-size: .72rem; font-weight: 600; }
.follow .grow { flex: 1; }
.follow .btn.on { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-soft); }
.follow-state {
  font: 700 .8rem/1.6 var(--font-head); padding: 0 8px; border-radius: 4px; border: 1px solid currentColor; color: var(--muted);
  min-width: 5.5em; text-align: center;
}
.follow-state[data-state=following] { color: var(--ok-text); }
.follow-state[data-state=holding] { color: var(--warn); }
.follow-state[data-state=lost] { color: #fff; background: var(--danger); border-color: var(--danger); }
.follow-msg { flex: 1 1 260px; min-width: 0; font-size: .9rem; }
.follow-meter { width: 110px; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.follow-meter span { display: block; height: 100%; width: 0; background: var(--muted); transition: width .2s; }
.follow-meter[data-level=high] span { background: var(--ok); }
.follow-meter[data-level=mid] span { background: var(--warn); }
.follow-meter[data-level=low] span { background: var(--danger); }
.follow-conf { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 5em; }
.follow-standby { font-size: .92rem; display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.follow-standby .cue { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); }
.follow-standby .cue.standby { border-color: var(--warn); background: var(--warn-soft); }
.follow-standby .cue.here { border-color: var(--cue-here); background: var(--cue-here-soft); }
.follow-sim { font-size: .85rem; color: var(--muted); }
.follow-sim label { display: inline-flex; align-items: center; gap: 4px; }
.follow-sim .olabel { font-family: var(--font-head); font-weight: 600; font-size: .82rem; }
.follow-heard { flex: 1 1 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.follow-note { font-size: .8rem; color: var(--muted); margin-left: auto; }
/* on the page (always white paper, so these colours are fixed) */
.follow-hl {
  position: absolute; pointer-events: none; border-radius: 3px; mix-blend-mode: multiply;
  background: rgba(138, 90, 46, .16); box-shadow: 0 0 0 2px rgba(138, 90, 46, .8);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.follow-hl[data-state=holding] { background: rgba(176, 116, 0, .14); box-shadow: 0 0 0 2px rgba(176, 116, 0, .8); }
.follow-hl[data-state=lost] { background: transparent; box-shadow: 0 0 0 2px rgba(180, 35, 24, .8); }
.follow-hl[data-state=locked] { box-shadow: 0 0 0 2px rgba(20, 21, 23, .7); }
.follow-word { position: absolute; height: 3px; margin-top: 1px; border-radius: 2px; background: #8A5A2E; pointer-events: none; transition: left .2s ease, width .2s ease; }
@media (max-width: 680px) {
  .follow { padding: 6px 8px; }
  .follow-meter { width: 80px; }
  .follow-heard, .follow-note, .follow .soon { display: none; }
  .follow-msg { flex-basis: 100%; order: 3; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .follow-hl, .follow-word, .follow-meter span { transition: none; }
}

/* New draft: marks to check */
.rd-item{display:block;width:100%;text-align:left;font:inherit;font-size:.95rem;line-height:1.35;color:inherit;background:transparent;border:1px solid var(--line);border-radius:10px;padding:.55rem .75rem;cursor:pointer}
.rd-item:hover{background:var(--soft,rgba(138,90,46,.08))}
.rd-item .muted{display:block;font-size:.86rem;margin-top:2px}

/* Print the marked-up script: only the prepared pages print, one per sheet. */
#printArea{display:none}
@media print{
  @page{margin:8mm}
  body>*:not(#printArea){display:none!important}
  #printArea{display:block!important}
  #printArea .pp{position:relative;width:100%;max-height:100vh;margin:0 auto;break-after:page;page-break-after:always;background:#fff}
  #printArea .pp img{display:block;width:100%;height:100%;object-fit:contain}
  #printArea .pp svg{position:absolute;inset:0;width:100%;height:100%}
  #printArea .pp-cues{color:#000;font:11pt/1.35 Helvetica,Arial,sans-serif}
  #printArea .pp-cues h1{font-size:15pt;margin:0 0 8pt}
  #printArea .pp-cues table{border-collapse:collapse;width:100%}
  #printArea .pp-cues th,#printArea .pp-cues td{border-bottom:.5pt solid #999;padding:3pt 4pt;text-align:left;vertical-align:top}
}

/* ------------------------------------------------------------ saving to a production */

.cloud-state { font-size: 12px; color: var(--muted); white-space: nowrap; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
.cloud-state.ok::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 4px; background: var(--accent-text); margin-right: 6px; vertical-align: 1px; }
.cloud-state.warn { color: var(--warn); }
.cloud-state.bad { color: var(--danger); }
.editor.read-only .tools .tool:not([data-tool="select"]) { opacity: .35; }
.cue-no, .pager input, .zoom-label { font-family: var(--font-mono); }
