/* BatScript web UI — hand-written, no framework. Light/dark follows the system unless <html data-theme> forces one
   (app.js sets it before first paint from localStorage "bs-theme"; the ◐ button in the top bar cycles it). */
:root {
  color-scheme: light;
  --bg: #f6f5f1; --bg2: #ffffff; --bg3: #ecebe5; --fg: #1d1d1f; --fg2: #5b5b60; --line: #d9d7cf;
  --accent: #5a3fbf; --accent-fg: #fff; --ok: #1a7a42; --warn: #9a6512; --err: #c53030; --hl: #fff2a8;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --mark-alpha: .55; --hl-alpha: .38;       /* marks and character highlights are tints over the real background */
  --bs-tr: #2f6db5; --bs-trdir: #9a5a12;   /* BatScript layout: translation colours for lines / directions */
  --ws: #0b7285; --ws-fg: #fff;             /* creative mode: "you are in a sketch" and nothing else */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --bg: #14151a; --bg2: #1d1f26; --bg3: #262932; --fg: #e8e8ea; --fg2: #a0a3ad; --line: #34373f;
          --accent: #9d86ff; --accent-fg: #14151a; --ok: #4cc27a; --warn: #e0a566; --hl: #5a4a00; --shadow: 0 1px 2px rgba(0,0,0,.4); --mark-alpha: .35; --hl-alpha: .32; --bs-tr: #8ab8ff; --bs-trdir: #e0a566; --ws: #4fd1e0; --ws-fg: #0d1a1d; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #14151a; --bg2: #1d1f26; --bg3: #262932; --fg: #e8e8ea; --fg2: #a0a3ad; --line: #34373f;
          --accent: #9d86ff; --accent-fg: #14151a; --ok: #4cc27a; --warn: #e0a566; --hl: #5a4a00; --shadow: 0 1px 2px rgba(0,0,0,.4); --mark-alpha: .35; --hl-alpha: .32; --bs-tr: #8ab8ff; --bs-trdir: #e0a566; --ws: #4fd1e0; --ws-fg: #0d1a1d; }
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
small, .muted { color: var(--fg2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* ---- layout */
.topbar { display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--bg2); border-bottom: 1px solid var(--line);
          position: sticky; top: 0; z-index: 50; }
.topbar .logo { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--fg); }
.topbar .logo img { width: 28px; height: 28px; border-radius: 6px; }
.topbar .grow { flex: 1; }
.topbar select { max-width: 220px; }
.theme-btn { font-size: 1.1rem; width: 2.2rem; height: 2.2rem; justify-content: center; border-radius: 50%; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--bg3); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 18px; height: 18px; font-size: .6rem; vertical-align: -4px; }
.avatar.xl { width: 128px; height: 128px; font-size: 3rem; }
.uchip { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem .05rem .15rem; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
td.actors, td.plays { white-space: nowrap; } td.actors .roles-pick, td.plays .roles-pick { display: inline-block; vertical-align: middle; margin-left: .2rem; }
td.actors .roles-pick .menu label, td.plays .roles-pick .menu label { display: flex; gap: .4rem; align-items: center; white-space: nowrap; }
td.plays .roles-pick .menu { max-height: 20rem; overflow: auto; }
.badge.role-chip { font-family: var(--mono, monospace); font-size: .72rem; }
#rec-chars.mine-only label[data-char]:not(.mine) { display: none; }
.usermenu { position: relative; }
.usermenu details summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; }
.usermenu details summary::-webkit-details-marker { display: none; }
.usermenu .menu { position: absolute; right: 0; top: 120%; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
                  box-shadow: var(--shadow); padding: .4rem; min-width: 180px; display: flex; flex-direction: column; }
.usermenu .menu a, .usermenu .menu button { padding: .4rem .6rem; text-align: left; background: none; border: 0; color: var(--fg); cursor: pointer; border-radius: 6px; font: inherit; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--bg3); text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.container.wide { max-width: 1600px; }
.subnav { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.subnav a { padding: .5rem .8rem; color: var(--fg2); border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a.active, .subnav a:hover { color: var(--fg); border-bottom-color: var(--accent); text-decoration: none; }
.pagehead { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.pagehead h1 { margin: 0; }
.pagehead .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- components */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card h2 a { color: var(--fg); }
.card .meta { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; background: var(--bg3); color: var(--fg2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); } .badge.warn { color: var(--warn); border-color: var(--warn); } .badge.err { color: var(--err); border-color: var(--err); }
.badge.role-owner, .badge.role-director { color: var(--accent); border-color: var(--accent); }
.badge.public { color: var(--ok); border-color: var(--ok); }
button, .btn { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
[hidden] { display: none !important; }   /* the attribute wins over any display rule (button, .pl-tracks, .lc-mic, .m-cloud…): scripts toggle el.hidden */
button:hover, .btn:hover { background: var(--bg3); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.danger, .btn.danger { color: var(--err); }
button.small, .btn.small, .icon { padding: .15rem .45rem; font-size: .85rem; }
button.icon { border-color: transparent; background: transparent; }
button.icon:hover { background: var(--bg3); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: .4rem .55rem; }
input[type=checkbox], input[type=radio] { width: auto; }
.invite-link { display: flex; gap: .3rem; align-items: center; margin-top: .3rem; }
.invite-link input { font-family: var(--mono); font-size: .8rem; padding: .2rem .4rem; width: 18em; max-width: 100%; }
table.chars td.num { text-align: right; white-space: nowrap; }
textarea { width: 100%; min-height: 6rem; font-family: var(--mono); font-size: .85rem; }
label { display: block; font-size: .85rem; color: var(--fg2); margin-bottom: .2rem; }
.field { margin-bottom: .8rem; }
.field input:not([type=checkbox]), .field select { width: 100%; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 140px; }
.row > .auto { flex: 0 0 auto; }
form.inline { display: inline; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: color-mix(in srgb, var(--bg3) 50%, transparent); }
.table-wrap { overflow-x: auto; }
.empty { padding: 2rem; text-align: center; color: var(--fg2); border: 1px dashed var(--line); border-radius: var(--radius); }
.messages { margin: 0 0 1rem; padding: 0; list-style: none; }
.messages li { padding: .5rem .8rem; border-radius: 6px; margin-bottom: .4rem; background: var(--bg3); border-left: 3px solid var(--accent); }
.messages li.error { border-left-color: var(--err); } .messages li.success { border-left-color: var(--ok); }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .4rem; z-index: 100; max-width: 380px; }
.toast { background: var(--fg); color: var(--bg); padding: .6rem .9rem; border-radius: 6px; box-shadow: var(--shadow); font-size: .9rem; }
.toast.error { background: var(--err); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
.banner { padding: .6rem .9rem; background: color-mix(in srgb, var(--warn) 15%, var(--bg2)); border: 1px solid var(--warn); border-radius: 6px; margin-bottom: .8rem; display: flex; gap: 1rem; align-items: center; }
.banner.hidden { display: none; }
.progress { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; font-size: .92rem; }
.kv dt { color: var(--fg2); } .kv dd { margin: 0; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg2); color: var(--fg); padding: 1.2rem; max-width: 520px; width: calc(100% - 2rem); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--fg2); padding: .5rem .8rem; }
.tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabpane { display: none; } .tabpane.active { display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.qr { width: 160px; height: 160px; background: #fff; border-radius: 6px; padding: 6px; }
.code-big { font-family: var(--mono); font-size: 1.4rem; letter-spacing: .08em; }
.status-queued, .status-running { color: var(--warn); } .status-done { color: var(--ok); } .status-failed { color: var(--err); }
audio { height: 32px; max-width: 220px; vertical-align: middle; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; color: var(--fg2); }
.dropzone.over { border-color: var(--accent); color: var(--fg); }
.swatch { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; }

.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; top: 110%; left: 0; z-index: 20; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; min-width: 220px; max-height: 320px; overflow: auto; display: grid; gap: .2rem; }
.dropdown .menu label { display: flex; gap: .4rem; align-items: center; color: var(--fg); margin: 0; font-size: .9rem; white-space: nowrap; }

/* ---- editor */
.editor { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; align-items: start; }
.editor.with-panel { grid-template-columns: 240px 1fr 320px; }
.editor .side { position: sticky; top: 56px; max-height: calc(100vh - 70px); overflow: auto; padding: .5rem; }
.editor .side a { display: block; padding: .3rem .5rem; border-radius: 6px; color: var(--fg); font-size: .9rem; }
.editor .side a:hover { background: var(--bg3); text-decoration: none; }
.editor .side a.active { background: var(--accent); color: var(--accent-fg); }
.tochead { display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem 0; }
.tochead h3 { margin: 0; flex: 1; }
.tochead button { display: none; }
ol.toc { list-style: none; margin: .3rem 0 0; padding: 0; }
ol.toc li { margin: 0; }
ol.toc a .n { color: var(--fg2); margin-right: .2rem; }
ol.toc a.active .n { color: inherit; }
ol.toc a.song { padding: .15rem .5rem .15rem 1.6rem; font-size: .82rem; color: var(--fg2); }
ol.toc a.song.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--fg); }
.menu-btn { display: none; font-size: 1.2rem; }
.side-backdrop { display: none; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; position: sticky; top: 52px; z-index: 5; background: var(--bg); padding: .4rem 0; }
.toolbar input[type=search] { min-width: 180px; }
.scene { margin-bottom: 2rem; }
.scene, .item, .songhead, .srow { scroll-margin-top: calc(var(--stick, 110px) + 10px); }
.scene h2 { display: flex; gap: .6rem; align-items: baseline; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.scene h2 .t { font-weight: 700; }
.scene h2 .tr { font-weight: 400; color: var(--fg2); }
.item { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.2rem; padding: .35rem .5rem; border-radius: 6px; position: relative; border-left: 3px solid transparent; }
.item:hover { background: color-mix(in srgb, var(--bg3) 60%, transparent); }
.item.dim { opacity: .35; }
.item.hidden, .scene.hidden, .side a.hidden { display: none; }
.item.hl { background: color-mix(in srgb, var(--hl, #ffd60a) calc(var(--hl-alpha) * 100%), transparent); }
.item .name { font-weight: 700; font-family: var(--serif); letter-spacing: .02em; font-size: .92rem; }
.item.cue .name::after { content: ""; }
.item .col { min-width: 0; font-family: var(--serif); font-size: 1.02rem; }
.item .col.tr { color: var(--fg2); }
.item.dir .col, .item .par { font-style: italic; color: var(--fg2); }
.item.sub .col { text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; color: var(--fg2); text-align: center; }
.item.end .col { text-align: center; font-weight: 700; letter-spacing: .1em; font-size: .85rem; }
.item.song { background: color-mix(in srgb, var(--accent) 6%, transparent); border-left-color: var(--accent); }
/* highlight inside songs is per row (.srow is display:contents, so its children carry the colour); the song block
   itself only gets a stronger left border so it is findable while scrolling */
.item.song.hl { background: color-mix(in srgb, var(--accent) 6%, transparent); border-left-color: var(--hl, #ffd60a); border-left-width: 4px; }
/* a singer's rows are highlighted as one block (like a cue), not word by word — consecutive rows of the same
   singer touch, so a whole verse reads as one rectangle */
.srow.hl { background: color-mix(in srgb, var(--hl, #ffd60a) calc(var(--hl-alpha) * 100%), transparent); }
.srow.hl + .srow.hl { border-top-left-radius: 0; border-top-right-radius: 0; }
.srow.hl:has(+ .srow.hl) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.srow.dim > .col, .srow.dim > .label { opacity: .4; }
.item.song .songtitle { grid-column: 1 / -1; font-weight: 700; font-family: var(--serif); }
.item.song .rows { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr; gap: 0; }
.srow { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1.2rem; padding: .05rem .5rem; margin: 0 -.5rem; border-radius: 6px; }
html.tr-under .srow, .editor.no-tr .srow { grid-template-columns: 1fr; }
.srow .label { font-weight: 700; font-size: .85rem; margin-top: .4rem; }
.srow .gap { grid-column: 1 / -1; height: .6rem; }
.srow .mark { grid-column: 1 / -1; font-variant: small-caps; color: var(--fg2); font-size: .9rem; }
.srow .sdir { grid-column: 1 / -1; font-style: italic; color: var(--fg2); text-align: center; font-size: .9rem; }
.srow .note { color: var(--fg2); font-size: .85rem; }
.t[contenteditable] { outline: 0; border-radius: 3px; padding: 0 .15rem; margin: 0 -.15rem; min-width: 2ch; display: inline-block; }
.t[contenteditable]:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.t[contenteditable]:focus { background: var(--bg2); box-shadow: 0 0 0 2px var(--accent); }
.t.saving { opacity: .6; } .t.saved { box-shadow: 0 0 0 2px var(--ok); } .t.pending { box-shadow: 0 0 0 2px var(--warn); }
.t.missing:empty::before { content: "— no translation —"; color: var(--warn); font-style: italic; font-size: .85rem; }
/* z-index keeps it above the neighbouring .item (also position:relative) — editor.js sets `top` so it
   stays clear of the sticky .toolbar (z-index 5) and inside the viewport on tall items like songs. */
.item .ops { position: absolute; right: .3rem; top: .2rem; z-index: 4; display: none; gap: .1rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.item:hover .ops, .item.active .ops { display: flex; }
.item.active { outline: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); }
.item .ops .icon.on { background: var(--err); color: #fff; }
/* element numbers "3.07" (data-no ≡ apps.export.interactive.element_no): in the left margin on hover, always with
   👁 Show → element numbers; a jump (search "3.7", #3.07) flashes the element */
.item[data-no]::before { content: attr(data-no); position: absolute; left: -2.9rem; top: .45rem; width: 2.6rem; text-align: right; font: .72rem var(--mono, ui-monospace, monospace); color: var(--fg2); opacity: 0; pointer-events: none; transition: opacity .12s; }
.item[data-no]:hover::before, .show-nums .item[data-no]::before, .item.no-flash::before { opacity: 1; }
.item.no-flash { animation: bs-no-flash 2s ease-out; }
@keyframes bs-no-flash { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }
@media (max-width: 900px) { .item[data-no]::before { left: auto; right: .3rem; top: .1rem; width: auto; font-size: .66rem; } }
.takebadge { border: 0; background: transparent; cursor: pointer; font-size: .75rem; padding: 0 .2rem; color: var(--fg2); vertical-align: middle; }
.takebadge:hover { color: var(--fg); }
.cut { text-decoration: line-through; opacity: .6; }
.panel { position: sticky; top: 56px; max-height: calc(100vh - 70px); overflow: auto; }
.sugg { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; margin-bottom: .6rem; font-size: .9rem; }
.sugg .old { color: var(--err); text-decoration: line-through; } .sugg .new { color: var(--ok); }
.sugg .who { color: var(--fg2); font-size: .8rem; }
.charchip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; cursor: pointer; }
.charchip.on { background: color-mix(in srgb, #ffd60a 38%, transparent); }
@media (max-width: 900px) {
  .editor, .editor.with-panel { grid-template-columns: 1fr; }
  /* the contents become a drawer: off-canvas at the left, opened with ☰, closed by the backdrop, ✕ or a link */
  .editor .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(85vw, 320px); max-height: none; z-index: 70; border-radius: 0;
                  transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 30px rgba(0,0,0,.35); padding-bottom: 2rem; }
  body.side-open .editor .side { transform: none; }
  .side-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.4); }
  body.side-open .side-backdrop { display: block; }
  body.side-open { overflow: hidden; }
  .tochead button, .menu-btn { display: inline-flex; }
  .item, .srow { grid-template-columns: 1fr; }
  .item .col.tr:empty { display: none; }
  .item .col { width: 100% !important; justify-self: stretch !important; }
  .item.cue .name { text-align: left; font-weight: 700; margin-top: .2rem; }
  .panel { position: static; max-height: none; }
  .toolbar { position: static; gap: .35rem; padding: .35rem 0; }
  .topbar .menu-btn { margin-right: -.3rem; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 120px; }
  .toolbar > .muted:last-child { display: none; }
  .scene h2 { display: block; font-size: 1.05rem; }
  .scene h2 > * { display: inline; }
  .scene h2 .tr { display: block; }
  .item .ops { right: .1rem; }
  #follow-arrows { right: .4rem; }
  #follow-arrows button { width: 2.6rem; height: 2.6rem; font-size: 1.2rem; }
  dialog { width: calc(100% - 1rem); padding: .9rem; }
}

/* ---- guest reader */
.guest .topbar { justify-content: space-between; }
.guest .reader { padding: 0 1rem 1rem; }
.guest footer { text-align: center; color: var(--fg2); padding: 2rem 1rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.guest .scenenav { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1rem 0; }
.guest .scenenav a { padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--fg); }
/* song header (guest reader and editor): ▶ hands the song to the page player; directors upload/pitch from here */
.songhead { grid-column: 1 / -1; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .85rem; margin: .1rem 0 .4rem; }
.songhead .play { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--accent); color: var(--accent-fg); justify-content: center; font-size: .95rem; padding: 0 0 0 .15rem; flex: 0 0 auto; }
.songhead .play:disabled { background: var(--bg3); color: var(--fg2); }
.songhead .songtitle { grid-column: auto; margin: 0; flex: 1 1 auto; }
.songhead .tracks { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.songhead .grow { flex: 1; }
.songhead label.btn { cursor: pointer; margin: 0; }
html.layout-eu .songhead .songtitle, .songhead .songtitle { text-align: left; }

/* ---- casting matrix */
.matrix td select { min-width: 150px; max-width: 220px; }
.cov { font-size: .8rem; color: var(--fg2); }
.cov-row { display: flex; align-items: center; gap: .4rem; }
.cov .progress { flex: 1; }
.cov-def { margin-top: .15rem; color: var(--fg); }
.cov-gen { margin-top: .15rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.gchip { font: inherit; font-size: .78rem; padding: .05rem .45rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); color: var(--fg); cursor: pointer; }
.gchip:disabled { cursor: default; }
.gchip.cast { border-color: var(--ok, #2a9d4a); background: color-mix(in srgb, var(--ok, #2a9d4a) 12%, var(--bg2)); }
.gchip:not(:disabled):hover { border-color: var(--accent); }
.rec { display: grid; grid-template-columns: 1fr; gap: .4rem; padding-bottom: 1rem; }
.rec-stats { display: inline-flex; gap: .6rem; font-size: .85rem; color: var(--fg2); }
.rec-stats b { color: var(--fg); }
.cue-card .who { font-size: .75rem; color: var(--fg2); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.cue-card.done { border-left: 4px solid var(--ok); }
.cue-card.done-other { border-left: 4px solid color-mix(in srgb, var(--ok) 40%, transparent); }
/* recording panel: sticky at the bottom of the studio tab */
.rec-panel { position: sticky; bottom: 0; z-index: 20; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.2); padding: .6rem .8rem .5rem; margin-top: .6rem; }
.rec-panel .rp-line { display: flex; gap: .6rem; align-items: baseline; margin-bottom: .4rem; }
.rec-panel .rp-line .txt { font-family: var(--script-font); font-size: 1.05rem; }
.rp-wave { position: relative; height: 110px; background: var(--bg3); border-radius: 6px; overflow: hidden; touch-action: none; cursor: text; user-select: none; }
.rp-wave canvas { width: 100%; height: 110px; display: block; }
.rp-sel { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 25%, transparent); border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); pointer-events: none; }
.rp-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); pointer-events: none; }
.rp-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: .85rem; pointer-events: none; }
.rp-wave.recording { background: color-mix(in srgb, var(--err) 12%, var(--bg3)); }
.rp-ctl { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.rp-ctl .grow { flex: 1; }
@media (max-width: 700px) { .rec-panel { margin: .6rem -1rem 0; border-radius: 0; } }
.cue-card { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; background: var(--bg2); display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; }
.cue-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.cue-card .text { font-family: var(--serif); font-size: 1.1rem; }
.cue-card .ctl { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; justify-content: end; }
.recbtn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--err); color: var(--err); background: transparent; font-size: 1.2rem; justify-content: center; }
.recbtn.on { background: var(--err); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.steps { display: flex; gap: .4rem; counter-reset: s; margin-bottom: 1rem; flex-wrap: wrap; }
.steps span { padding: .2rem .7rem; border-radius: 999px; border: 1px solid var(--line); color: var(--fg2); font-size: .85rem; }
.steps span.active { border-color: var(--accent); color: var(--fg); }
pre.prompt { white-space: pre-wrap; max-height: 300px; overflow: auto; background: var(--bg3); padding: .8rem; border-radius: 6px; font-size: .8rem; }
.hero { text-align: center; padding: 4rem 1rem; }
.hero img { width: 120px; height: 120px; border-radius: 24px; }
.hero h1 { font-size: 2.4rem; margin: 1rem 0 .4rem; }

/* ---- small screens */
@media (max-width: 700px) {
  .topbar { gap: .5rem; padding: .5rem .6rem; }
  .topbar .usermenu summary > .muted, .topbar .usermenu summary > .badge { display: none; }
  .topbar select { max-width: 150px; }
  .editor .side h3 { display: none; }
  .editor .side .small { white-space: nowrap; }
  .pagehead { gap: .5rem; }
  h1 { font-size: 1.3rem; }
}

/* ---- script typography: standard screenplay layout (uppercase centred names, dialogue 3.5in wide, plain
   full-width action). Face, size, leading and translation placement are reading preferences that app.js writes
   onto <html> (the font-… and tr-under classes plus the two variables) before first paint. */
:root { --script-font: "Courier New", "Courier Prime", "Liberation Mono", "Nimbus Mono PS", "DejaVu Sans Mono", monospace; --script-size: 12pt; --script-lh: 1.25; }
html.font-serif { --script-font: "Times New Roman", "Liberation Serif", Georgia, serif; }
html.font-sans { --script-font: "Helvetica Neue", Arial, "Liberation Sans", sans-serif; }
.item .col, .item .name, .item.song .songtitle, .srow .label, .srow .mark, .srow .sdir, .scene h2 .t, .cue-card .text
  { font-family: var(--script-font); font-size: calc(var(--script-size) * var(--bs-fs, 1)); line-height: var(--script-lh); }
.item.cue .name { text-transform: uppercase; text-align: center; font-weight: 400; letter-spacing: 0; margin-top: .35rem; }
.item.cue .col, .item.song .srow .col { justify-self: center; width: min(100%, 38ch); }
.item .col.par { width: min(100%, 26ch); font-style: normal; color: var(--fg2); }
.item.dir .col { font-style: normal; color: var(--fg); }
.scene h2 .t, .item.sub .col { text-transform: uppercase; }
.item.end .col { text-transform: uppercase; text-align: right; font-weight: 400; letter-spacing: .1em; }
.srow .label { text-align: center; text-transform: uppercase; font-weight: 400; margin-top: .6rem; }
.srow .mark { text-align: center; }
.item.song .songtitle { text-align: center; text-transform: uppercase; }
.paren { color: var(--fg2); font-style: italic; }   /* "(beat)", "(crying)" — a direction, not a word to say */
/* two language columns → a name over each; any single-column mode shows one name */
.item .name.tr, .srow .label.tr { color: var(--fg2); }
html.tr-under .item .name.tr, html.tr-under .srow .label.tr, .editor.no-tr .item .name.tr, .editor.no-tr .srow .label.tr { display: none !important; }
@media (max-width: 900px) { .item .name.tr, .srow .label.tr { display: none !important; } }

/* ---- European layout (UK stage / BBC / French theatre): name in bold capitals at the left margin, the speech
   beside it on the same line with a hanging indent, directions in italics, no width cap on dialogue. */
html.layout-eu .item.cue { grid-template-columns: minmax(6em, 10em) 1fr minmax(6em, 10em) 1fr; column-gap: .8rem; }
html.layout-eu.tr-under .item.cue, html.layout-eu .editor.no-tr .item.cue { grid-template-columns: minmax(6em, 10em) 1fr; }
html.layout-eu .item.cue .name { grid-column: 1; grid-row: 1; text-align: left; font-weight: 700; margin-top: 0; text-transform: uppercase; }
html.layout-eu .item.cue .name.tr { grid-column: 3; grid-row: 1; }
html.layout-eu .item.cue .col { grid-column: 2; width: 100%; justify-self: stretch; }
html.layout-eu .item.cue .col.tr { grid-column: 4; }
html.layout-eu.tr-under .item.cue .col.tr, html.layout-eu .editor.no-tr .item.cue .col.tr { grid-column: 2; }
html.layout-eu .item.cue .col.par { font-style: italic; }
html.layout-eu .item.dir .col { font-style: italic; color: var(--fg2); }
html.layout-eu .scene h2 .t { text-transform: none; font-weight: 700; }
html.layout-eu .item.sub .col { text-align: left; }
html.layout-eu .item.end .col { text-align: left; }
html.layout-eu .item.song .srow .col { width: 100%; justify-self: start; font-style: italic; }
html.layout-eu .item.song .srow .label { text-align: left; font-weight: 700; }
html.layout-eu .item.song .songtitle { text-align: left; }
@media (max-width: 900px) { html.layout-eu .item.cue { grid-template-columns: minmax(5em, 8em) 1fr; } html.layout-eu .item.cue .col.tr { grid-column: 2; } }

/* ---- BatScript layout: the mobile app's look (v0.1). Bold name at the left, the line across the full width (sans
   by default), its translation in blue — in the right column or under the line, like the other styles; stage
   directions in italics with their translation in brown; subheadings centred in italics; roomy blocks. */
html.layout-bs .item { padding: .5rem .6rem; margin-bottom: .35rem; gap: .15rem 1.2rem; }
html.layout-bs .item.cue .name { text-align: left; font-weight: 700; text-transform: none; margin-top: 0; letter-spacing: 0; }
html.layout-bs .item .col, html.layout-bs .item.cue .col, html.layout-bs .item.song .srow .col { width: 100%; justify-self: stretch; }
html.layout-bs .item .col.tr { color: var(--bs-tr); }
html.tr-under.layout-bs .item .col.tr { font-size: calc(var(--script-size) * var(--bs-fs, 1) * .92); margin-top: -.1rem; }
html.layout-bs .item .col.par { font-style: italic; color: var(--fg2); width: 100%; }
html.layout-bs .item.dir .col { font-style: italic; color: var(--fg); }
html.layout-bs .item.dir .col.tr { color: var(--bs-trdir); }
html.layout-bs .item.sub .col { text-align: center; font-style: italic; text-transform: none; letter-spacing: 0; font-size: calc(var(--script-size) * var(--bs-fs, 1)); color: var(--fg); }
html.layout-bs .item.end .col { text-align: center; text-transform: none; letter-spacing: 0; font-weight: 700; }
html.layout-bs .scene h2 .t { text-transform: none; font-weight: 700; }
html.layout-bs .item.song .songtitle { text-align: left; }
html.layout-bs .srow .label { text-align: left; font-weight: 700; text-transform: none; margin-top: .5rem; }
html.layout-bs .srow .label.tr { color: var(--bs-tr); }
html.layout-bs .srow .mark, html.layout-bs .srow .sdir { text-align: left; font-style: italic; font-variant: normal; }
html.layout-bs .item.song .srow .col { font-style: normal; }
html.layout-bs .paren { font-style: italic; }
html.layout-bs #player .title { font-family: var(--sans); }

/* translation under each line instead of a right-hand column; and no column at all when translation is off */
html.tr-under .item, .editor.no-tr .item { grid-template-columns: 1fr; }
html.tr-under .item .col.tr { font-size: calc(var(--script-size) * var(--bs-fs, 1) * .9); margin-top: -.15rem; }
.editor.no-tr .item .col.tr { display: none; }
.typo-menu { min-width: 260px; display: grid; gap: .5rem; }
.typo-menu label { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: .4rem; align-items: center; font-size: .85rem; margin: 0; }
.typo-menu input[type=range] { width: 100%; }

/* ---- line history dialog */
#dlg-hist { width: min(760px, 96vw); }
#dlg-doc { width: min(1000px, 96vw); }
#dlg-doc textarea { resize: vertical; }
#dlg-hist .rev { border-top: 1px solid var(--line); padding: .45rem 0; display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: start; font-size: .9rem; }
#dlg-hist .rev .who { color: var(--fg2); font-size: .8rem; grid-column: 1 / -1; }
#dlg-hist .rev .old { color: var(--err); text-decoration: line-through; }
#dlg-hist .rev .new { color: var(--ok); }
#dlg-hist .rev.inactive { opacity: .55; }
#dlg-hist .rev.undone .new { text-decoration: line-through; color: var(--fg2); }
#dlg-hist .orig { background: var(--bg2); border-radius: 6px; padding: .5rem .7rem; margin: .4rem 0; display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
#dlg-hist .txt { font-family: var(--script-font); white-space: pre-wrap; }

/* ---- page player: one bar for dialogue (takes / generated voices / TTS) and songs (vocal, backing, pitch variants) */
#player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none; flex-direction: column; gap: 0;
  background: color-mix(in srgb, var(--bg2) 92%, var(--accent)); border-top: 1px solid var(--line); box-shadow: 0 -8px 30px rgba(0,0,0,.22); font-size: .85rem;
  padding: 0 .9rem .5rem; backdrop-filter: blur(12px); }
#player.on { display: flex; }
body.has-player { padding-bottom: 7rem; }
#player .pl-progress { display: flex; align-items: center; gap: .5rem; height: 1.6rem; }
#player .pl-progress .time { font-variant-numeric: tabular-nums; color: var(--fg2); font-size: .75rem; min-width: 2.6rem; }
#player .pl-progress .time:last-child { text-align: right; }
#player .pl-seek { flex: 1; height: 1.4rem; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; position: relative; }
#player .pl-seek-track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: var(--line); }
#player .pl-seek-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--pos, 0%); background: var(--accent); border-radius: 2px; }
#player .pl-seek-knob { position: absolute; top: 50%; left: var(--pos, 0%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg2); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#player .pl-seek:focus-visible .pl-seek-knob { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
#player .pl-seek-bms { position: absolute; inset: 0; pointer-events: none; }
#player .pl-seek-bms .bm { position: absolute; top: -7px; width: 0; height: 0; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--warn); pointer-events: auto; cursor: pointer; }
#player .pl-seek-bms .bm:hover { border-top-color: var(--accent); }
#player.tts .pl-seek-track { background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 12px); }
#player.tts.playing .pl-seek-track { animation: pl-march 1s linear infinite; }
#player.tts .pl-seek-knob, #player.tts .pl-seek-fill { opacity: 0; }
#player .pl-progress > .icon { width: 1.8rem; height: 1.8rem; padding: 0; border-radius: 50%; font-size: .85rem; }
#player .pl-head, #player .pl-mid, #player .pl-wave, #player .pl-fx { display: none; }
#player .pl-head svg, #player .pl-right svg { width: 1.15rem; height: 1.15rem; fill: currentColor; display: block; }   /* ⤢ / ⤡: only the transport's svgs had a size */
#player .i-shrink, #player.big .i-grow, #player.full .i-grow { display: none; }
#player.big .i-shrink, #player.full .i-shrink { display: block; }
#player .pl-grip { display: flex; align-items: center; justify-content: center; gap: .4rem; height: 1.15rem; margin: -.1rem 0 .1rem; cursor: grab; touch-action: none; user-select: none; color: var(--fg2); }
#player .pl-grip:active { cursor: grabbing; }
#player .pl-grip .bar { width: 3.2rem; height: 5px; border-radius: 3px; background: var(--line); transition: background .15s, width .15s; }
#player .pl-grip:hover .bar { background: var(--accent); width: 4rem; }
#player .pl-grip .chev { width: .5rem; height: .5rem; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: translateY(2px) rotate(45deg); opacity: .7; }
#player.big .pl-grip .chev, #player.full .pl-grip .chev { transform: translateY(-2px) rotate(225deg); }
#player.full .pl-grip { height: 1.6rem; }
#player .pl-bmlist { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .75rem; padding: 0 .2rem .2rem; }
#player .pl-bmlist[hidden] { display: none; }
#player .pl-bmlist .bmi { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
#player .pl-bmlist .bmi button { border: 0; border-radius: 0; padding: .1rem .5rem; font-size: .75rem; background: transparent; }
#player .pl-bmlist .bmi button:hover { background: var(--bg3); }
#player .pl-bmlist .bmi .t { color: var(--warn); font-variant-numeric: tabular-nums; }
#player .pl-bmlist .bmi .ed, #player .pl-bmlist .bmi .rm { padding: .1rem .4rem; color: var(--fg2); border-left: 1px solid var(--line); }
#player .pl-bmlist .bmi .rm:hover { color: var(--err, #d33); }
#player .pl-list { display: flex; flex-direction: column; gap: .15rem; overflow: auto; min-width: 0; }
#player .pl-list .pli { text-align: left; border: 1px solid transparent; border-radius: 6px; padding: .2rem .5rem; font-size: .8rem; background: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg2); }
#player .pl-list .pli.song { color: var(--fg); } #player .pl-list .pli:hover { background: var(--bg3); }
#player .pl-list .pli.cur { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--fg); font-weight: 600; }
#player .pl-transport .icon.wide span { font-size: .72rem; }
#player .pl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .8rem; }
#player .pl-now { display: flex; align-items: center; gap: .6rem; min-width: 0; }
#player .art { width: 2.6rem; height: 2.6rem; border-radius: 8px; flex: 0 0 auto; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #ff7a59)); color: var(--accent-fg); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
#player .art.song { background: linear-gradient(135deg, #ff7a59, #ffb85c); color: #1d1d1f; }
#player .art.dir { background: var(--bg3); color: var(--fg2); }
#player .txt { min-width: 0; }
#player .title { font-family: var(--script-font); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
#player .sub { color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
#player .pl-transport { display: flex; align-items: center; gap: .3rem; justify-content: center; }
#player .pl-transport .icon { width: 2.2rem; height: 2.2rem; border-radius: 50%; padding: 0; justify-content: center; color: var(--fg); }
#player .pl-transport .icon.wide { width: auto; padding: 0 .55rem; border-radius: 999px; font-size: .75rem; color: var(--fg2); gap: .15rem; }
#player .pl-transport svg { width: 1.15rem; height: 1.15rem; fill: currentColor; display: block; }
#player .pl-transport .play { width: 3rem; height: 3rem; border-radius: 50%; padding: 0; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 45%, transparent); }
#player .pl-transport .play:hover { filter: brightness(1.08); }
#player .pl-transport .play svg { width: 1.5rem; height: 1.5rem; fill: currentColor; grid-area: 1 / 1; }
#player .pl-transport .play .i-pause { display: none; }
#player.playing .pl-transport .play .i-play { display: none; }
#player.playing .pl-transport .play .i-pause { display: block; }
#player .pl-right { display: flex; align-items: center; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; min-width: 0; }
#player .pl-tracks { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
#player .pl-tracks button { border-radius: 999px; padding: .1rem .6rem; font-size: .75rem; }
#player .pl-tracks button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
#player .dropdown.up .menu { top: auto; bottom: 120%; left: auto; right: 0; }
#player .dropdown .menu label { display: flex; gap: .4rem; align-items: center; white-space: nowrap; }
#player .dropdown .menu select { max-width: 9rem; }
#player .dropdown .menu input[type=range] { width: 80px; }
#player .dropdown .menu output { min-width: 3.4em; font-variant-numeric: tabular-nums; font-size: .8rem; }
#player.fx .pl-fx .val { color: var(--accent); }
/* ---- the big deck (desktop) */
#player.big { padding-top: .4rem; }
#player.big .pl-head { display: flex; align-items: center; gap: .3rem; height: 1.6rem; }
#player.big .pl-mid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .8rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
#player.big .pl-mid .pl-list { max-height: 7.5rem; padding: .2rem 0; }
#player.big .pl-text { display: block; max-height: 7.5rem; overflow: auto; padding: .2rem .4rem .4rem; font-family: var(--script-font); font-size: 1.05rem; line-height: 1.45; scroll-behavior: auto; }
#player .pl-text .who { font-weight: 700; font-size: .85rem; letter-spacing: .02em; color: var(--fg2); margin-bottom: .15rem; }
#player .pl-text .lbl { font-weight: 700; margin-top: .5rem; color: var(--fg2); font-size: .85rem; }
#player .pl-text .gap { height: .6rem; } #player .pl-text .mk { color: var(--accent); font-size: .8rem; margin-top: .4rem; } #player .pl-text .sd, #player .pl-text .body.dir { font-style: italic; color: var(--fg2); }
#player .pl-text .tail { height: 40%; }
#player.big .pl-wave { display: block; height: 84px; position: relative; margin: 0 .2rem; }
#player.big .pl-wave canvas { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
#player .pl-wave-hint { position: absolute; left: .5rem; top: .2rem; font-size: .72rem; pointer-events: none; }
#player.big .pl-progress { height: 1.4rem; }
#player.big .pl-transport .icon { width: 2.8rem; height: 2.8rem; } #player.big .pl-transport svg { width: 1.5rem; height: 1.5rem; }
#player.big .pl-transport .play { width: 3.8rem; height: 3.8rem; } #player.big .pl-transport .play svg { width: 1.9rem; height: 1.9rem; }
#player.big .title { font-size: 1.05rem; white-space: normal; max-height: 2.8em; } #player.big .art { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
#player.big .pl-fx, #player.full .pl-fx { display: flex; align-items: center; justify-content: center; gap: .25rem; margin-top: .3rem; font-size: .8rem; color: var(--fg2); }
#player .pl-fx .lbl { margin-left: .8rem; } #player .pl-fx .val { min-width: 3.6em; text-align: center; cursor: pointer; font-variant-numeric: tabular-nums; }
#player .pl-fx .icon { width: 1.7rem; height: 1.7rem; padding: 0; border-radius: 50%; }
body.player-big { padding-bottom: 24rem; }
.pl-fab { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 29; width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); cursor: pointer; }
.pl-fab svg { width: 1.6rem; height: 1.6rem; fill: currentColor; margin-left: .15rem; }
.pl-fab:hover { filter: brightness(1.08); }
body.has-player .pl-fab { display: none; }
@media (max-width: 900px) { .pl-fab { right: .8rem; bottom: .8rem; } }
body:has(.pl-fab):not(.has-player) { padding-bottom: 5rem; }   /* room under the last lines for the ▶ button */
/* ---- full screen (phones) */
#player.full { top: 0; z-index: 80; padding: env(safe-area-inset-top, 0) .8rem calc(env(safe-area-inset-bottom, 0) + .6rem); border-top: 0; overflow: hidden; }
#player.full .pl-head { display: flex; align-items: center; gap: .3rem; height: 2.4rem; }
#player.full .pl-head .icon { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
#player.full .pl-mid { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
#player.full .pl-mid .pl-list { flex: 0 0 auto; max-height: 7.2rem; border-top: 1px solid var(--line); padding-top: .3rem; margin-top: .3rem; }
#player.full .pl-mid .pl-list .pli { font-size: .9rem; padding: .25rem .5rem; }
#player.full .pl-text { display: block; flex: 1 1 auto; min-height: 0; overflow: auto; font-family: var(--script-font); font-size: 1.45rem; line-height: 1.5; padding: .4rem .2rem; }
#player.full .pl-text .who { font-size: 1rem; } #player.full .pl-text .body { font-size: 1.6rem; }
#player.full .pl-progress { height: 2.2rem; } #player.full .pl-progress .time { font-size: .9rem; } #player.full .pl-seek-track { height: 6px; } #player.full .pl-seek-knob { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
#player.full .pl-progress > .icon { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
#player.full .pl-row { grid-template-columns: 1fr; gap: .4rem; }
#player.full .pl-now { order: 1; } #player.full .pl-transport { order: 2; gap: .5rem; } #player.full .pl-right { order: 3; justify-content: center; }
#player.full .pl-transport .icon { width: 3.2rem; height: 3.2rem; } #player.full .pl-transport svg { width: 1.7rem; height: 1.7rem; }
#player.full .pl-transport .icon.wide { padding: 0 .7rem; font-size: .85rem; }
#player.full .pl-transport .play { width: 4.6rem; height: 4.6rem; } #player.full .pl-transport .play svg { width: 2.3rem; height: 2.3rem; }
#player.full .pl-right #player-close, #player.full .pl-right #player-size-2 { display: none; }
body.player-full { overflow: hidden; }
.book-cur { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.voice-menu { min-width: min(520px, 94vw); }
.voice-menu label { display: flex; gap: .5rem; align-items: center; padding: .3rem 0; margin: 0; }
@media (max-width: 900px) {
  #player { padding: 0 .6rem .45rem; }
  #player .pl-row { grid-template-columns: 1fr; gap: .3rem; }
  #player .pl-now { order: 1; }
  #player .pl-transport { order: 2; }
  #player .pl-right { order: 3; justify-content: center; }
  #player .pl-transport .play { width: 2.8rem; height: 2.8rem; }
  body.has-player { padding-bottom: 11rem; }
  body.has-player #follow-arrows { top: 40%; }
}

/* ---- ★ follow: one character, big arrows at the right edge */
#f-char .follow { margin-left: auto; padding-left: .6rem; cursor: pointer; opacity: .35; }
#f-char .follow.on, #f-char .follow:hover { opacity: 1; color: #e0b400; }
#follow-arrows { position: fixed; right: .8rem; top: 50%; transform: translateY(-50%); z-index: 25; display: none; flex-direction: column; align-items: center; gap: .3rem; }
#follow-arrows.on { display: flex; }
#follow-arrows button { width: 3.2rem; height: 3.2rem; border-radius: 50%; font-size: 1.5rem; background: var(--accent); color: var(--accent-fg); border: 0; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; }
#follow-arrows .who { font-size: .7rem; font-weight: 700; max-width: 5rem; text-align: center; cursor: pointer; color: var(--fg2); }
.follow-cur { box-shadow: inset 4px 0 0 #e0b400; }
body.has-player #follow-arrows { top: 45%; }

/* ---- document editor: syntax overlay + fullscreen */
.codewrap { position: relative; width: 100%; min-height: 55vh; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--bg2); }
.codewrap .codehl, .codewrap textarea { margin: 0; padding: .6rem .8rem; font-family: var(--script-font); font-size: .95rem; line-height: 1.4; white-space: pre; overflow: auto; tab-size: 4; box-sizing: border-box; width: 100%; height: 100%; }
.codewrap .codehl { position: absolute; inset: 0; pointer-events: none; color: var(--fg); }
.codewrap textarea { position: absolute; inset: 0; background: transparent; color: transparent; caret-color: var(--fg); border: 0; outline: 0; resize: none; }
.codewrap textarea::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.codehl .d-scene { font-weight: 700; color: var(--accent); }
.codehl .d-name { font-weight: 700; color: #c9a227; }
.codehl .d-par { color: var(--fg2); font-style: italic; }
.codehl .d-mark { color: var(--fg2); font-weight: 700; }
.codehl .d-song { color: #5aa0e0; font-weight: 700; }
.codehl .d-id { color: var(--fg2); opacity: .55; }
.codehl .d-ph { color: var(--warn); }
#dlg-doc.full { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; display: flex; flex-direction: column; }
#dlg-doc.full .codewrap { flex: 1; min-height: 0; }

/* ---- marks: personal highlights / frames / comments / sketches on any words (marks.js) */
mark.bsm { background: transparent; color: inherit; border-radius: 3px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.bsm.fill { background: color-mix(in srgb, var(--mc, #fff2a8) calc(var(--mark-alpha) * 100%), transparent); }
mark.bsm.frame { box-shadow: 0 0 0 1.5px var(--mc, #e0b400); padding: 0 .1em; }
mark.bsm.underline { text-decoration: underline; text-decoration-color: var(--mc, #e0b400); text-decoration-thickness: 3px; text-underline-offset: .15em; }
mark.bsm.noted::after { content: "✎"; font-size: .7em; vertical-align: super; margin-left: .1em; color: var(--fg2); }
mark.bsm.stale { outline: 1px dashed var(--warn); }
mark.bsm.cur { outline: 2px solid var(--accent); }
#mark-bubble { position: absolute; z-index: 40; display: flex; align-items: center; gap: .3rem; padding: .3rem .4rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
#mark-bubble[hidden], #mark-pop[hidden] { display: none; }
.sw { width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); cursor: pointer; display: inline-block; flex: 0 0 auto; }
.sw.on, .sw:hover { box-shadow: 0 0 0 2px var(--accent); }
#mark-pop { position: absolute; z-index: 41; width: min(420px, calc(100vw - 1.5rem)); background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: .6rem .7rem; font-size: .9rem; }
#mark-pop .head { display: flex; align-items: center; gap: .2rem; margin-bottom: .3rem; }
#mark-pop .head .grow { flex: 1; }
#mark-pop .quote { font-family: var(--script-font); font-size: .85rem; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
#mark-pop .text { white-space: pre-wrap; }
#mark-pop .text:empty::before { content: "No comment — click ✎ to add one."; color: var(--fg2); font-style: italic; }
#mark-pop img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-top: .4rem; background: #fff; }
#mark-pop .who { font-size: .75rem; margin-top: .3rem; }
#mark-pop .edit { display: grid; gap: .4rem; }
#mark-pop .edit[hidden] { display: none; }
#mark-pop .row1 { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
#mark-pop .row1 .grow { flex: 1; }
#mark-pop .sketch .tools { display: flex; align-items: center; gap: .1rem; }
#mark-pop .sketch .tools .grow { flex: 1; }
#mark-pop .sketch .tools button.on { background: var(--bg3); box-shadow: inset 0 0 0 2px var(--accent); }
#mark-pop canvas { width: 100%; height: auto; aspect-ratio: 640 / 240; background: #fff; border: 1px solid var(--line); border-radius: 6px; touch-action: none; cursor: crosshair; display: block; }
.marks-list .mk { display: grid; grid-template-columns: 1.2rem 1fr auto; gap: .2rem .5rem; align-items: start; padding: .4rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.marks-list .mk .dot { width: 1rem; height: 1rem; border-radius: 3px; margin-top: .2rem; }
.marks-list .mk .q { font-family: var(--script-font); font-size: .85rem; }
.marks-list .mk .c { color: var(--fg2); white-space: pre-wrap; }
.marks-list .mk .c img { max-height: 60px; display: block; margin-top: .2rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.marks-list .mk .w { color: var(--fg2); font-size: .75rem; }
.item.hl mark.bsm.fill { mix-blend-mode: multiply; }

/* ---- attachments of a mark: photos, voice memos, files */
.files { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.files:empty { display: none; }
.files .f { position: relative; display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; }
.files .f img { height: 72px; max-width: 160px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; cursor: zoom-in; background: #fff; }
.files .f audio { height: 32px; max-width: 220px; }
.files .f a.doc { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); font-size: .8rem; max-width: 220px; }
.files .f a.doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .f .rm { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--err); color: #fff; border: 0; font-size: .7rem; padding: 0; display: grid; place-items: center; cursor: pointer; }
.files .f.pending { outline: 2px dashed var(--warn); outline-offset: 2px; border-radius: 6px; }
#mark-pop .attach .tools { display: flex; align-items: center; gap: .25rem; }
#mark-pop .attach .tools .grow { flex: 1; }
#mark-pop .attach .tools label.btn { margin: 0; cursor: pointer; }
#mark-pop .attach button.on { background: var(--err); color: #fff; border-color: var(--err); animation: pulse 1s infinite; }
.marks-list .mk .c .att { color: var(--fg2); font-size: .8rem; }

/* ---- translation dropdown in the toolbar */
.tr-menu { min-width: 280px; }
.tr-menu label { display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.tr-menu label.chk { justify-content: flex-start; }
.tr-menu .sep { border-top: 1px solid var(--line); margin: .2rem 0; }
.badge .x { border: 0; background: transparent; padding: 0 0 0 .2rem; color: var(--fg2); cursor: pointer; font-size: .75rem; line-height: 1; }
.badge .x:hover { color: var(--err); }

/* ---- 🔈 marker: a real person recorded this line */
.item.is-voiced, .col.is-voiced { position: relative; }
.voiced { position: absolute; left: .1rem; top: .05rem; border: 0; background: transparent; padding: 0; font-size: .7rem; line-height: 1; cursor: pointer; opacity: .75; z-index: 1; }
.voiced:hover { opacity: 1; transform: scale(1.2); }
.voiced img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 1px var(--bg); }
.voiced.pic { opacity: .95; top: .1rem; }
.col.is-voiced > .voiced { left: -1.1rem; top: .15rem; }

/* ---- document editor: wrapping and unsaved lines */
.codewrap.wrap .codehl, .codewrap.wrap textarea { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.codehl .d-changed { display: inline-block; width: 100%; background: color-mix(in srgb, var(--warn) 18%, transparent); box-shadow: -4px 0 0 var(--warn); }

/* ---- recording studio: the versions of a line */
.versions { display: flex; flex-wrap: wrap; gap: .2rem .8rem; margin-top: .3rem; font-size: .8rem; align-items: center; }
.versions .ver { display: inline-flex; align-items: center; gap: .2rem; margin: 0; color: var(--fg); cursor: pointer; white-space: nowrap; }
.versions .ver input { margin: 0 .15rem 0 0; }
.versions .ver .icon { padding: 0 .25rem; font-size: .75rem; }
.lg-ver { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; margin-top: .3rem; font-size: .85rem; }
.lg-ver.def { border-color: var(--ok); }
.lg-ver .grow { min-width: 0; overflow-wrap: anywhere; }
#dlg-linegen { width: min(680px, 96vw); max-width: none; box-sizing: border-box; max-height: 94vh; overflow-y: auto; }
#dlg-linegen .row { flex-wrap: wrap; }
#dlg-linegen .row .field { min-width: 9rem; }

/* ---- 👁 Show menu: what is on the page */
.show-menu label { white-space: normal; }
.show-menu .sep { border-top: 1px solid var(--line); margin: .2rem 0; }
#f-show summary.on { border-color: var(--accent); color: var(--accent); }
.editor.hide-cues .item.cue { display: none; }
.editor .is-cut { opacity: .5; }
.editor .is-cut .t, .editor .is-cut .name, .editor .is-cut .label, .editor .is-cut .songtitle { text-decoration: line-through; text-decoration-thickness: 1px; }
.editor .item.is-cut::after { content: "✂"; position: absolute; right: .3rem; top: .2rem; font-size: .8rem; opacity: .7; }
.editor.hide-cuts .is-cut { display: none; }
.cutbtn.on { background: var(--accent, #5a3fbf); color: #fff; }
.srow .cutrow { visibility: hidden; margin-left: .3rem; padding: 0 .25rem; font-size: .75rem; line-height: 1.2; }
.srow:hover .cutrow, .srow.is-cut .cutrow { visibility: visible; }
.editor.hide-songs .item.song { display: none; }
.editor.hide-dirs .item.dir, .editor.hide-dirs .srow:has(> .sdir) { display: none; }
.editor.hide-pars .col.par, .editor.hide-pars .paren { display: none; }
.editor.hide-names .item.cue .name, .editor.hide-names .srow:has(> .label) { display: none; }
html.layout-eu .editor.hide-names .item.cue { grid-template-columns: 1fr 1fr; }
html.layout-eu .editor.hide-names .item.cue .col { grid-column: auto; }
html.layout-eu.tr-under .editor.hide-names .item.cue, html.layout-eu .editor.no-tr.hide-names .item.cue { grid-template-columns: 1fr; }
.editor.hide-subs .item.sub, .editor.hide-subs .item.end, .editor.hide-subs .srow:has(> .mark), .editor.hide-subs .srow:has(> .sub) { display: none; }
.editor.hide-notes .srow .note { display: none; }
.editor.hide-marks mark.bsm { background: transparent !important; box-shadow: none !important; text-decoration: none !important; outline: 0 !important; }
.editor.hide-marks mark.bsm::after { content: none; }
/* per-character highlight colours: --hl is set inline on the highlighted block; the dot opens the tint palette */
#f-char .menu label .cn { flex: 1; }
.hl-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid var(--line); padding: 0; cursor: pointer; background: color-mix(in srgb, var(--c, #ffd60a) calc(var(--hl-alpha) * 100% + 25%), var(--bg2)); flex: 0 0 auto; }
.hl-dot:hover { box-shadow: 0 0 0 2px var(--accent); }
#hl-palette { position: absolute; right: .5rem; z-index: 3; display: flex; gap: .3rem; padding: .35rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
#hl-palette[hidden] { display: none; }
#hl-palette .pal { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 1px solid var(--line); padding: 0; cursor: pointer; background: color-mix(in srgb, var(--c) calc(var(--hl-alpha) * 100% + 25%), var(--bg2)); }
#hl-palette .pal.on, #hl-palette .pal:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ---- app downloads */
.downloads .dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.downloads h4 { margin: 0 0 .3rem; display: flex; gap: .5rem; align-items: center; }
.downloads details > summary { cursor: pointer; color: var(--accent); }
.downloads ol li { margin: .3rem 0; }

#player-voices.warn { color: var(--warn); }

#media .trk { width: 1.9rem; height: 1.9rem; border-radius: 50%; padding: 0; vertical-align: middle; } #media tr.book-cur { outline: none; background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- singing studio */
#sing .sg-lyrics { max-height: 9rem; overflow: auto; font-family: var(--script-font); font-size: .95rem; line-height: 1.4; padding: .2rem .4rem .5rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
#sing .sg-lyrics .lbl { font-weight: 700; color: var(--fg2); font-size: .8rem; margin-top: .4rem; } #sing .sg-lyrics .lbl.mine { color: var(--accent); }
#sing .sg-lyrics .ln.mine { color: var(--fg); } #sing .sg-lyrics .ln { color: var(--fg2); } #sing .sg-lyrics .gap { height: .5rem; } #sing .sg-lyrics .mk { color: var(--accent); font-size: .8rem; }
#sing #sg-rec.on { background: #d33; border-color: #d33; color: #fff; animation: sg-blink 1s infinite; }
@keyframes sg-blink { 50% { opacity: .6; } }
#sing table td { vertical-align: middle; } #sing table input[type=range] { width: 90px; vertical-align: middle; }

.card .orig { font-size: .78rem; color: var(--fg2); margin: -.2rem 0 .1rem; font-style: italic; }

.badge.gen { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ---------------------------------------------------------------- voice wizard */
dialog.wizard { max-width: none; width: min(1040px, 96vw); max-height: 92vh; padding: 0; overflow: hidden; }
.wz { display: flex; flex-direction: column; max-height: 92vh; padding: 1rem 1.2rem; gap: .6rem; box-sizing: border-box; }
.wz-head { display: flex; align-items: center; gap: .5rem; }
.wz .grow { flex: 1; }
.wz-head h2 { margin: 0; font-size: 1.2rem; }
.wz p { margin: .2rem 0; }
.wz .chk { display: flex; gap: .4rem; align-items: center; margin: .3rem 0; font-size: .9rem; }
.wz-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.wz-choice .card { display: flex; flex-direction: column; gap: .4rem; margin: 0; }
.wz-choice .card h3 { margin: 0; }
.wz-choice .card button { align-self: flex-start; margin-top: auto; }
.wz-status { font-size: .9rem; }
.wz-progress { display: flex; gap: .6rem; align-items: center; }
.wz-progress .progress { flex: 1; }
.wz-body { display: grid; grid-template-columns: 230px 1fr; gap: .8rem; min-height: 0; flex: 1; overflow: hidden; }
.wz-side { overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; padding-right: .2rem; }
.wz-ch { display: flex; flex-direction: column; align-items: flex-start; gap: .05rem; text-align: left; font: inherit; font-size: .82rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); color: var(--fg); cursor: pointer; }
.wz-ch span { font-size: .78rem; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wz-ch.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wz-ch.todo b::after { content: " ·"; color: var(--warn); }
.wz-card { overflow-y: auto; padding-right: .3rem; }
.wz-title { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.wz-title h3 { margin: 0; margin-right: .3rem; }
.wz-summary { font-size: 1rem; line-height: 1.45; }
.wz .chips { display: flex; flex-wrap: wrap; gap: .25rem; margin: .3rem 0; }
.wz .chip { font-size: .78rem; padding: .05rem .5rem; border-radius: 999px; background: var(--bg3); }
.wz-voice { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .88rem; margin: .3rem 0; }
.wz-brief { font-size: .8rem; font-style: italic; }
.wz-now { margin: .5rem 0; padding: .35rem .6rem; border-radius: 8px; background: var(--bg3); font-size: .9rem; }
.wz-sugg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.wz-v { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; display: flex; flex-direction: column; gap: .25rem; background: var(--bg2); }
.wz-v.chosen { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }
.wz-v-head, .wz-v-ctl { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.wz-v-meta { font-size: .78rem; }
.wz-v-desc { font-size: .82rem; }
.wz-v-why { font-size: .84rem; }
.wz-score { display: inline-block; width: 46px; height: 6px; border-radius: 3px; background: var(--bg3); vertical-align: middle; overflow: hidden; }
.wz-score span { display: block; height: 100%; background: var(--accent); }
.wz-other { margin-top: .6rem; }
.wz-foot { display: flex; gap: .4rem; align-items: center; border-top: 1px solid var(--line); padding-top: .6rem; }
.wz-table td, .wz-table th { padding: .25rem .5rem; text-align: left; }
.wz-foot button { white-space: nowrap; }
@media (max-width: 720px) {
  dialog.wizard { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .wz { max-height: 100dvh; height: 100%; padding: .7rem .8rem; }
  .wz-choice { grid-template-columns: 1fr; }
  /* one scroll for the whole card on a phone; only the character strip scrolls sideways */
  .wz-body { display: flex; flex-direction: column; overflow-y: auto; }
  .wz-side { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: .2rem; flex: none; }
  .wz-ch { min-width: 120px; }
  .wz-card { overflow: visible; }
  .wz-sugg { grid-template-columns: 1fr; }
  .wz-foot { gap: .3rem; }
  .wz-foot button { padding: .35rem .6rem; font-size: .88rem; }
}

/* ---------------------------------------------------------------- learn mode */
.learn-bar .seg button { font: inherit; font-size: .85rem; padding: .3rem .6rem; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); cursor: pointer; }
.learn-bar .seg button:first-child { border-radius: 8px 0 0 8px; } .learn-bar .seg button:last-child { border-radius: 0 8px 8px 0; }
.learn-bar .seg button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.learn-pane { margin-top: .8rem; }
.learn-sub { position: static; margin: -.4rem 0 .6rem; padding: .2rem 0; gap: .6rem; font-size: .9rem; }
.learn-sub label { margin: 0; } .learn-sub .off { display: none !important; }
.ll-scene { margin: 1.2rem 0 .4rem; font-size: .85rem; color: var(--fg2); text-transform: uppercase; letter-spacing: .04em; }
.ll-row { padding: .5rem .7rem; border-left: 3px solid var(--line); margin: .35rem 0; border-radius: 0 8px 8px 0; background: var(--bg2); }
.ll-row .prev { font-size: .85rem; color: var(--fg2); margin-bottom: .2rem; }
.ll-row .prev b { color: var(--fg); font-weight: 600; }
.ll-row .mine { font-size: 1.02rem; line-height: 1.45; }
.ll-row .mine b { color: var(--accent); }
.ll-row .par { font-style: italic; color: var(--fg2); font-size: .88em; }
.ll-row .ll-score { float: right; font-size: .78rem; color: var(--fg2); }
.ll-row.good { border-left-color: var(--ok); } .ll-row.weak { border-left-color: var(--warn); }
.ll-row { cursor: pointer; } .ll-row:hover { background: var(--bg3); }
.ll-row.playing { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg2)); }
.ll-row.playing-prev .prev { color: var(--accent); }
button.toggle.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.ll-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .2rem 0 .6rem; }
.ll-export { margin: 1rem 0; } .ll-export .row { flex-wrap: wrap; row-gap: .5rem; } .ll-export label { margin: 0; }
.learn-card { max-width: 760px; margin: 0 auto; padding: 1.2rem 1.4rem; min-height: 260px; display: flex; flex-direction: column; gap: .8rem; }
.lc-top { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .8rem; }
.lc-top .grow { flex: 1; } #lc-scene { margin-left: auto; text-align: right; }
.lc-front { font-size: 1.15rem; line-height: 1.5; }
.lc-front .who, .lc-back .who { font-size: .8rem; color: var(--fg2); text-transform: uppercase; letter-spacing: .03em; display: block; margin-bottom: .2rem; }
.lc-front .head::after { content: " …"; color: var(--fg2); }
.lc-back { font-size: 1.15rem; line-height: 1.5; padding-top: .8rem; border-top: 1px dashed var(--line); }
.lc-back .par { font-style: italic; color: var(--fg2); font-size: .9em; }
.lc-mic { display: flex; gap: .5rem; align-items: center; font-size: .9rem; }
.lc-mic .dot, .lp-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--err); animation: lcpulse 1s infinite; }
@keyframes lcpulse { 50% { opacity: .3; } }
.lc-ctl { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.lc-ctl button.big { font-size: 1rem; padding: .5rem 1rem; }
.diff .miss { background: color-mix(in srgb, var(--err) 25%, transparent); text-decoration: line-through; border-radius: 3px; padding: 0 .1em; }
.diff .extra { color: var(--warn); font-style: italic; }
.diff .ok { color: var(--ok); }
.score { display: inline-block; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--bg3); }
.score.s3 { background: color-mix(in srgb, var(--ok) 25%, var(--bg3)); } .score.s2 { background: color-mix(in srgb, var(--warn) 30%, var(--bg3)); } .score.s1 { background: color-mix(in srgb, var(--err) 25%, var(--bg3)); }
.learn-panel { position: sticky; top: 50px; z-index: 30; margin-bottom: .8rem; padding: .7rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.lp-head { display: flex; align-items: center; gap: .5rem; }
.lp-line { font-size: 1.1rem; line-height: 1.45; min-height: 1.4em; }
.lp-line.masked { filter: blur(6px); user-select: none; }
.lp-heard { font-size: .95rem; }
.lp-score { font-size: .9rem; }
.lp-score .ai { margin-top: .3rem; padding: .4rem .6rem; border-left: 3px solid var(--accent); background: var(--bg3); border-radius: 0 6px 6px 0; }
.lp-ctl { display: flex; gap: .4rem; flex-wrap: wrap; }
.learn .item.cue.mine-line .col:not(.tr) .t.lmask { filter: blur(7px); cursor: pointer; user-select: none; }
.learn .item.cue.mine-line { box-shadow: inset 3px 0 0 var(--accent); }
.learn-bar:has(details.dropdown[open]) { z-index: 35; }   /* an open Characters / ⋯ menu above the trainer's sticky panel (z 30) */
.learn-card.flippable { cursor: pointer; }   /* a tap on the card = Flip (learn.js) */
body.learn-trainer .pl-fab, body.learn-cards .pl-fab { display: none; }   /* ▶ Start / the cards' own buttons; the floating ▶ would read past the stops */
/* fingers: the card's answers fill the row, nothing under 44px */
@media (max-width: 900px), (pointer: coarse) {
  .lc-ctl { gap: .5rem; }
  .lc-ctl button { min-height: 2.75rem; font-size: 1rem; padding: .45rem .9rem; }
  .lc-ctl button.big { flex: 1 1 0; min-height: 3.2rem; font-size: 1.05rem; }
}

/* ---------------------------------------------------------------- rehearsal */
.reh-chars { display: flex; flex-wrap: wrap; gap: .3rem; max-width: 520px; }
.reh-chars .chip { font: inherit; font-size: .85rem; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); color: var(--fg); cursor: pointer; }
.reh-chars .chip.absent { background: color-mix(in srgb, var(--warn) 30%, var(--bg2)); border-color: var(--warn); }
.reh-chars .chip.absent .star::before { content: "★"; } .reh-chars .chip .star { color: var(--warn); } .reh-chars .chip .star::before { content: ""; }
.reh-chars .chip:not(.absent) .star { color: var(--fg2); }
.reh-chars .sep, .reh-chars .chk { flex-basis: 100%; }
.reh-go { font-size: 1rem; padding: .45rem 1rem; }
.rehearsal .item.cue.absent-line { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------------------------------------------------------------- production (show) */
.stage-bar .sep-v { width: 1px; height: 24px; background: var(--line); margin: 0 .2rem; }
.stage-go { font-size: 1.1rem; padding: .5rem 1.2rem; font-weight: 700; }
.stage-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; align-items: start; margin-top: .8rem; }
.stage-side { position: sticky; top: 56px; }
.st-scene { margin: .8rem 0 .3rem; font-weight: 700; display: flex; gap: .5rem; align-items: center; }
.st-scene .muted { font-weight: 400; font-size: .8rem; }
.st-ev { display: grid; grid-template-columns: 28px 1fr auto; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; border: 1px solid transparent; }
.st-ev:hover { background: var(--bg3); }
.st-ev.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); }
.st-ev.done { opacity: .6; }
.st-ev .ic { font-size: 1.1rem; text-align: center; }
.st-ev .what { font-size: .92rem; }
.st-ev .what .at { font-size: .78rem; color: var(--fg2); }
.st-ev .what .lic { font-size: .72rem; color: var(--fg2); }
.st-ev .ctl { display: flex; gap: .25rem; align-items: center; }
.st-ev .ctl input[type=range] { width: 70px; }
.st-ev.playing .ic { color: var(--ok); }
.st-line { font-size: .8rem; color: var(--fg2); padding: .1rem .5rem .1rem 2.3rem; display: flex; gap: .4rem; align-items: center; }
.st-line .add { visibility: hidden; } .st-line:hover .add { visibility: visible; }
.st-lib { max-height: 50vh; overflow: auto; }
.st-li { display: grid; grid-template-columns: 28px 1fr auto; gap: .4rem; align-items: center; padding: .3rem .3rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.st-li .mood { font-size: .75rem; color: var(--fg2); }
.st-li .ctl { display: flex; gap: .2rem; }
.st-dlg { width: min(560px, 96vw); }
.st-dlg label { display: block; margin: .4rem 0; }
@media (max-width: 900px) { .stage-grid { grid-template-columns: 1fr; } .stage-side { position: static; } }
.stage-script > summary { font-size: .9rem; }
.audio-export .row { align-items: flex-end; }
.st-track { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; margin: .3rem 0 .6rem; border-radius: 8px; background: var(--bg3); font-size: .9rem; }
.st-track .ic { font-size: 1.1rem; }
.st-lyrics { margin: 0 0 .6rem 2.3rem; padding: .4rem .8rem; border-left: 2px solid var(--line); font-size: .9rem; line-height: 1.45; column-width: 260px; column-gap: 1.5rem; }
.st-lyrics .lbl { font-weight: 700; margin-top: .4rem; color: var(--accent); break-after: avoid; }
.st-lyrics .gap { height: .6rem; } .st-lyrics .mk { font-size: .8rem; color: var(--fg2); margin-top: .3rem; } .st-lyrics .sd { font-style: italic; color: var(--fg2); }
.chk.inline { display: inline-flex; gap: .3rem; align-items: center; font-weight: 400; font-size: .8rem; margin: 0 0 0 .5rem; color: var(--fg2); }
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.pad .cell { position: relative; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--bg3); display: flex; align-items: center; justify-content: center; text-align: center; padding: .4rem; cursor: pointer; user-select: none; font-size: .78rem; line-height: 1.2; overflow: hidden; transition: background .1s, transform .05s; }
.pad .cell:not(.empty) { background: color-mix(in srgb, var(--accent) 18%, var(--bg2)); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.pad .cell:not(.empty):active { transform: scale(.96); }
.pad .cell.on { background: var(--accent); color: var(--accent-fg); box-shadow: 0 0 0 2px var(--accent); }
.pad .cell.over { outline: 2px dashed var(--accent); }
.pad .cell .key { position: absolute; top: 3px; left: 6px; font-size: .68rem; color: var(--fg2); font-weight: 700; }
.pad .cell.on .key { color: var(--accent-fg); }
.pad .cell .nm { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.st-li[draggable] { cursor: grab; }
/* ---- show page: collapsible library, bottom player */
.st-libbox > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.st-libbox > summary::-webkit-details-marker { display: none; }
.st-libbox > summary::before { content: "▸"; color: var(--fg2); font-size: .9rem; }
.st-libbox[open] > summary::before { content: "▾"; }
.st-player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; gap: .2rem; padding: .45rem .9rem .5rem;
  background: color-mix(in srgb, var(--bg2) 92%, var(--accent)); border-top: 1px solid var(--line); box-shadow: 0 -8px 30px rgba(0,0,0,.22); backdrop-filter: blur(12px); }
.st-player[hidden] { display: none; }
.st-pl-row { display: flex; align-items: stretch; gap: .6rem; max-width: 760px; margin: 0 auto; width: 100%; }
.st-player .nav { width: 3.4rem; font-size: 1.3rem; border-radius: 12px; }
.st-player .big { flex: 1; display: flex; align-items: center; gap: .8rem; min-height: 3.6rem; padding: .3rem 1rem; border-radius: 14px; text-align: left; font-size: 1rem;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line)); }
.st-player .big .st { font-size: 1.6rem; width: 2rem; text-align: center; }
.st-player .big .tt { display: flex; flex-direction: column; min-width: 0; }
.st-player .big .tt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; }
.st-player .big .tt .muted { font-size: .78rem; }
.st-player.playing .big { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.st-player.playing .big .muted { color: color-mix(in srgb, var(--accent-fg) 80%, transparent); }
.st-pl-seek { display: flex; align-items: center; gap: .5rem; max-width: 760px; margin: 0 auto; width: 100%; font-size: .8rem; }
.st-pl-seek input[type=range] { flex: 1; }
.st-pl-seek .time { font-variant-numeric: tabular-nums; color: var(--fg2); min-width: 2.6rem; }
.st-pl-seek .time:nth-child(3) { text-align: right; }
.st-pl-seek select { font-size: .78rem; max-width: 10rem; }
.st-pl-seek .vol { display: inline-flex; align-items: center; gap: .25rem; margin: 0; font-size: .85rem; }
.st-pl-seek .vol input { width: 90px; }
@media (max-width: 700px) { .st-pl-seek { flex-wrap: wrap; } }
.st-ev.sel { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -2px; }
/* ---- admin dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.kpi { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kpi b { font-size: 1.5rem; line-height: 1.2; }
.kpi b.ok { color: var(--ok); } .kpi b.warn { color: var(--warn); } .kpi b.err { color: var(--err); }
.kpi span { font-size: .85rem; color: var(--fg); }
.kpi small { font-size: .74rem; color: var(--fg2); overflow-wrap: anywhere; }
.alerts-firing { border-color: var(--err); margin-bottom: 1rem; }
.alert-row { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; padding: .3rem 0; border-top: 1px solid var(--line); }
.alert-row:first-of-type { border-top: 0; }
table.users td { vertical-align: top; font-size: .85rem; }

/* ---- phones: the player's transport grows to finger size (the app's reader and the site on a phone alike) */
@media (max-width: 640px) {
  /* a 7-column grid: the scene buttons live in the flexible side columns, the five around ▶ are symmetric, so ▶
     sits exactly in the middle of the row whatever the width; only ⏮ ▶ ⏭ are finger-sized */
  #player .pl-transport { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto auto minmax(0, 1fr); align-items: center; justify-items: center; gap: .35rem; width: 100%; }
  /* explicit columns: without a script (Media) the scene buttons and 🔈 are hidden, and auto-placement would pull ▶ off the middle */
  #player .pl-transport #player-prev-scene { grid-column: 1; justify-self: end; } #player .pl-transport #player-prev-song { grid-column: 2; } #player .pl-transport #player-prev { grid-column: 3; }
  #player .pl-transport #player-toggle { grid-column: 4; } #player .pl-transport #player-next { grid-column: 5; } #player .pl-transport #player-next-song { grid-column: 6; }
  #player .pl-transport #player-next-scene { grid-column: 7; justify-self: start; }
  #player .pl-transport .icon { width: 3.1rem; height: 3.1rem; }
  #player .pl-transport svg { width: 1.7rem; height: 1.7rem; }
  #player .pl-transport .play { width: 4.3rem; height: 4.3rem; }
  #player .pl-transport .play svg { width: 2.2rem; height: 2.2rem; }
  #player .pl-transport .icon.wide { width: auto; height: 2.95rem; font-size: .7rem; padding: 0 .45rem; gap: .1rem; }
  #player .pl-transport .icon.wide svg { width: .95rem; height: .95rem; }
  #player .pl-transport .icon.wide span { font-size: .68rem; }
  .pl-fab { width: 4.2rem; height: 4.2rem; } .pl-fab svg { width: 2rem; height: 2rem; }
  body:has(.pl-fab):not(.has-player) { padding-bottom: 6rem; }
}
/* narrow phones (≤ 400px: iPhone SE / mini / standard, 360dp Android): the scene / song buttons keep their label, under
   the arrows, instead of losing it (four identical ◂◂ ▸▸ otherwise) and stay finger-tall; ⏮ ▶ ⏭ shrink a little to fit */
@media (max-width: 400px) {
  #player .pl-transport, #player.full .pl-transport { gap: .2rem; }
  #player .pl-transport .icon, #player.full .pl-transport .icon { width: 2.95rem; height: 2.95rem; }
  #player .pl-transport .play { width: 3.6rem; height: 3.6rem; }
  #player.full .pl-transport .play { width: 4rem; height: 4rem; }
  #player .pl-transport .icon.wide, #player.full .pl-transport .icon.wide { flex-direction: column; justify-content: center; width: auto; min-width: 2.95rem; height: 2.95rem; padding: 0 .2rem; gap: .1rem; line-height: 1; }
  #player .pl-transport .icon.wide span { font-size: .62rem; order: 2; }
}
/* ---- the one-row deck (Player.setMini, phones only — the learn trainer, whose panel has the controls): what is playing
   and ⏯; the grip above it (tap / drag up) brings the whole deck back */
#player.mini { padding-bottom: .35rem; }
#player.mini .pl-head, #player.mini .pl-mid, #player.mini .pl-wave, #player.mini .pl-progress, #player.mini .pl-right, #player.mini .pl-fx, #player.mini .pl-bmlist { display: none; }
#player.mini .pl-row { display: flex; align-items: center; gap: .6rem; }
#player.mini .pl-now { flex: 1 1 auto; min-width: 0; }
#player.mini .pl-transport { display: flex; flex: 0 0 auto; width: auto; }
#player.mini .pl-transport > :not(#player-toggle) { display: none; }
#player.mini .pl-transport .play { width: 2.9rem; height: 2.9rem; }
#player.mini .pl-transport .play svg { width: 1.5rem; height: 1.5rem; }
#player.mini .art { width: 2.1rem; height: 2.1rem; font-size: .95rem; }
body.has-player.player-mini { padding-bottom: 5.5rem; }

/* ---- toasts on a narrow screen (the site on a phone): full width, above the player */
@media (max-width: 640px) {
  #toasts { left: 1rem; right: 1rem; max-width: none; }
  body.has-player #toasts { bottom: 12rem; }
}
/* ---- keyboard focus and reduced motion (the OS "Reduce motion" setting: no pulsing, sliding sheets or drawers) */
button:focus-visible, .btn:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .recbtn.on, #sing #sg-rec.on, #mark-pop .attach button.on { outline: 3px solid var(--err); outline-offset: 2px; }   /* a steady "recording" sign instead of the blinking */
}
/* Notes: line picker (notes.js) */
.np-list { max-height: 16rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: .4rem; background: var(--bg2); }
.np-list .np-hint { padding: .5rem .6rem; font-size: .85rem; }
.np-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
           padding: .35rem .6rem; font: inherit; font-size: .85rem; color: var(--fg); cursor: pointer; }
.np-item:last-child { border-bottom: 0; }
.np-item:hover, .np-item:focus { background: var(--bg3); }
.np-sc { display: inline-block; min-width: 1.4rem; font-size: .75rem; }
.np-chosen { margin-top: .4rem; padding: .35rem .6rem; border: 1px solid var(--accent); border-radius: 6px; font-size: .85rem; }
/* learn: speed chips, the pause instead of my line, the translation under it, continue */
.learn-sub .seg { display: inline-flex; }
.learn-sub .seg button { font: inherit; font-size: .82rem; padding: .25rem .5rem; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); cursor: pointer; margin: 0; border-radius: 0; }
.learn-sub .seg button:first-child { border-radius: 8px 0 0 8px; } .learn-sub .seg button:last-child { border-radius: 0 8px 8px 0; }
.learn-sub .seg button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.learn-sub label.dim { opacity: .5; }
.ll-row .ll-tr { font-size: .82rem; color: var(--fg2); margin-top: .15rem; }
.ll-row.gap { border-left-color: var(--accent); }
.ll-row.gap .mine { filter: blur(5px); transition: filter .2s; }
.ll-row.gap::before { content: attr(data-turn); float: right; font-size: .78rem; color: var(--accent); font-weight: 600; }
#learn-scenes .menu { max-height: 60vh; overflow: auto; }

/* Versions → What changed (web/changes.html) */
.changes-sum { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.changes-scene h3 { margin: 0 0 .5rem; }
.ch-row { display: grid; grid-template-columns: 3.2rem 1fr; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.ch-row:first-of-type { border-top: 0; }
.ch-no { font: .8rem var(--mono, ui-monospace, monospace); color: var(--fg2); text-align: right; padding-top: .15rem; }
.ch-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .82rem; color: var(--fg2); }
.ch-meta b { color: var(--fg); }
.ch-text { font-family: var(--serif); font-size: 1rem; margin-top: .2rem; white-space: pre-wrap; }
.ch-text del { background: color-mix(in srgb, var(--err) 22%, transparent); opacity: .85; color: inherit; text-decoration: line-through; text-decoration-color: var(--err); border-radius: 3px; }
.ch-text ins { background: color-mix(in srgb, var(--ok) 30%, transparent); box-shadow: inset 0 -2px 0 var(--ok); color: inherit; text-decoration: none; border-radius: 3px; }
.ch-text del + ins { margin-left: .2em; }

/* Notes page: grouped by scene, the full line with the marked words */
.notes-scene { margin: 1rem 0 .4rem; font-size: 1rem; display: flex; gap: .5rem; align-items: center; }
.notes-scene:first-of-type { margin-top: 0; }
.note-card .note-line { font-family: var(--script-font, var(--serif)); font-size: .95rem; margin: .3rem 0; white-space: pre-wrap; }
.note-card .note-text { white-space: pre-wrap; }

/* ---------------------------------------------------------------- production layer: cue score + consoles (docs/PRODUCTION.md) */
.cq-bar { flex-wrap: wrap; gap: .5rem; }
.cq-help { font-size: .85rem; margin: .3rem 0 .6rem; }
.cq-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.cq-side { position: sticky; top: 4rem; max-height: calc(100vh - 5rem); overflow: auto; }
@media (max-width: 900px) { .cq-grid { grid-template-columns: 1fr; } .cq-side { position: static; max-height: none; } }
.cqscene { display: flex; align-items: center; gap: .4rem; margin: 1.2rem 0 .3rem; font-size: 1rem; }
.cqscene:first-child { margin-top: 0; }
.cqel { padding: .15rem .4rem; border-radius: 6px; border-left: 3px solid transparent; }
.cqel.flash { background: var(--hl); }
.cqel.k-dir .tx, .cqrow.k-sdir .tx { font-style: italic; color: var(--fg2); }
.cqel.k-song > .cqline .tx { font-weight: 600; }
.cqrow { margin-left: 2.6rem; font-size: .9rem; }
.cqline { display: flex; gap: .4rem; align-items: baseline; }
.cqline .no { font-variant-numeric: tabular-nums; color: var(--fg2); font-size: .75rem; min-width: 2.4rem; }
.cqline .tx { flex: 1; min-width: 0; }
.cqel.is-cut .tx, .cqrow.is-cut .tx { text-decoration: line-through; opacity: .55; }
.cqadd { visibility: hidden; display: inline-flex; gap: .2rem; }
.cqel:hover > .cqline .cqadd, .cqrow:hover .cqadd, .cqscene:hover .cqadd, .cqadd:focus-within { visibility: visible; }
.cqchips { display: flex; flex-wrap: wrap; gap: .25rem; margin: .15rem 0 .15rem 2.8rem; }
.cqchip { font-size: .78rem; padding: .05rem .45rem; border-radius: 4px; border: 1px solid var(--line); border-left: 4px solid #999; background: var(--bg2); cursor: pointer; text-align: left; }
.cqchip.d-lx, .cqtable tr.d-lx td:first-child, .pbc.d-lx { border-left-color: #d69e2e; }
.cqchip.d-sq, .cqtable tr.d-sq td:first-child { border-left-color: #3182ce; }
.cqchip.d-fs, .cqtable tr.d-fs td:first-child { border-left-color: #38a169; }
.cqchip.d-fly, .cqtable tr.d-fly td:first-child { border-left-color: #805ad5; }
.cqchip.oncut, .cqtable tr.oncut { outline: 1px dashed #c53030; }
.cqtable { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cqtable td { padding: .2rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.cqtable td:first-child { border-left: 4px solid #999; white-space: nowrap; }
.cqtable tr { cursor: pointer; }
.cq-dlg { max-width: 560px; width: calc(100vw - 2rem); }
.cqform .row { display: flex; flex-wrap: wrap; gap: .5rem; }
.cqsugg { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }

.console .con-bar { gap: .6rem; }
.con-title { font-size: 1.1rem; }
.con-live { color: #2f9e44; font-size: .8rem; }
.con-live.off { color: #c53030; }
.con-pos { font-size: 1.05rem; margin: .6rem 0; }
.con-pos .no { font-weight: 700; font-variant-numeric: tabular-nums; }
.con-pos .tx { margin-top: .2rem; }
.con-main { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .con-main { grid-template-columns: 1fr; } }
.con-card { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; background: var(--bg2); }
.con-k { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg2); display: flex; gap: .5rem; align-items: center; }
.con-cue .ref { font-size: 2.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.con-cue:not(.big) .ref { font-size: 1.6rem; }
.con-cue .lab { font-size: 1.25rem; margin: .2rem 0; }
.con-cue .meta { color: var(--fg2); font-size: .9rem; }
.con-cue .sbtext { color: #c05621; margin-top: .3rem; }
.con-cue .ctx { margin-top: .4rem; font-size: .9rem; }
.con-sb { display: none; font-weight: 800; padding: .05rem .5rem; border-radius: 4px; }
.con-sb.on { display: inline-block; background: #d69e2e; color: #000; }
.sb-standby { border-color: #d69e2e; box-shadow: 0 0 0 3px rgba(214, 158, 46, .35); }
.sb-go { border-color: #2f9e44; box-shadow: 0 0 0 4px rgba(47, 158, 68, .45); }
.sb-go .con-sb.on { background: #2f9e44; color: #fff; }
.con-go { display: block; width: 100%; margin: 1rem 0; padding: 1.4rem; font-size: 2.2rem; font-weight: 800; letter-spacing: .1em; border-radius: 12px; background: #2f9e44; color: #fff; border: 0; cursor: pointer; }
.con-go:disabled { background: #888; cursor: not-allowed; }
.con-go.small { font-size: 1.1rem; padding: .6rem; margin: .6rem 0 0; }
.con-uprow { padding: .2rem 0; border-bottom: 1px solid var(--line); }
/* cues the position ran past without a GO (show-state `missed`): amber chips under the Next card / in an SM department card */
.con-missed { margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.con-missed-k { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #c05621; margin-right: .2rem; }
.con-chip.missed { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: #fdebc8; color: #7b341e; border: 1px solid #d69e2e; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-theme=dark] .con-chip.missed { background: #4a3410; color: #fbd38d; }
.con-offline { margin: .4rem 0; padding: .5rem .8rem; border-radius: 8px; background: #fdebc8; color: #7b341e; border: 1px solid #d69e2e; font-size: .9rem; }
[data-theme=dark] .con-offline { background: #4a3410; color: #fbd38d; }
.con-outside { color: #7b341e; font-size: .9rem; }   /* the shared position is not in this package version */
[data-theme=dark] .con-outside { color: #fbd38d; }
.con-sm-controls { display: flex; gap: .6rem; margin: .4rem 0 1rem; }
.con-sm-controls button:not(.small) { font-size: 1.2rem; padding: .6rem 1.4rem; }
.con-depts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.sm-dept { border-left: 6px solid #999; }
.sm-dept.d-lx { border-left-color: #d69e2e; } .sm-dept.d-sq { border-left-color: #3182ce; } .sm-dept.d-fs { border-left-color: #38a169; } .sm-dept.d-fly { border-left-color: #805ad5; }
.con-outline { margin-top: 1rem; }
.con-outline > div { max-height: 50vh; overflow: auto; }
.con-osc { font-weight: 700; margin: .6rem 0 .2rem; }
.con-oel { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .15rem .3rem; font-size: .88rem; cursor: pointer; border-radius: 4px; }
.con-oel:hover { background: var(--line); }
.con-oel .no { color: var(--fg2); font-variant-numeric: tabular-nums; }
.cqacts { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; margin-top: .8rem; }
.cqacts .grow { flex: 1; }

/* ---- creative mode (Workshop, docs/CREATIVE_MODE_UI.md). body.ws = "you are in a sketch": a bar with words, a coloured
   top edge, a title prefix — never colour alone. --ws marks the sketch frame only; status and actions keep their tokens. */
body.ws .topbar { border-bottom: 3px solid var(--ws); }
.wsbar { position: sticky; top: 48px; z-index: 40; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .4rem 1rem;
         background: color-mix(in srgb, var(--ws) 14%, var(--bg2)); border-bottom: 1px solid var(--ws); font-size: .9rem; }
.wsbar .tag { background: var(--ws); color: var(--ws-fg); font-weight: 700; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 4px; white-space: nowrap; }
.wsbar .where { display: flex; gap: .4rem; align-items: center; min-width: 0; }
.wsbar .where label { margin: 0; font-size: .8rem; }
.wsbar .where select { font-weight: 600; max-width: 16rem; padding: .2rem .4rem; }
.wsbar .state { color: var(--fg2); font-size: .8rem; }
.wsbar .state .warn, .ws-warn { color: var(--warn); }
.wsbar .acts { margin-left: auto; display: flex; gap: .35rem; flex-wrap: nowrap; overflow-x: auto; }
.wsbar .acts > * { white-space: nowrap; }
body.ws .subnav a.active, body.ws .subnav a:hover { border-bottom-color: var(--ws); }
/* sticky things below the bar: workshop.js measures it into --ws-h (it wraps on narrow windows) */
body.ws .toolbar { top: calc(52px + var(--ws-h, 40px)); }
body.ws .editor .side, body.ws .panel { top: calc(56px + var(--ws-h, 40px)); max-height: calc(100vh - 70px - var(--ws-h, 40px)); }
.subnav a.ws-link { color: var(--ws); } .subnav a.ws-link.active, .subnav a.ws-link:hover { border-bottom-color: var(--ws); }
.badge.ws { color: var(--ws); border-color: var(--ws); }
.badge.live { color: var(--ok); border-color: var(--ok); }
.card.ws-card { border-left: 4px solid var(--ws); }
.sk-card { border-left: 4px solid var(--ws); display: flex; flex-direction: column; gap: .3rem; }
.sk-card.archived { border-left-color: var(--line); opacity: .75; }
.sk-card h2 { margin: 0; font-size: 1.1rem; }
.sk-card .foot { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; padding-top: .5rem; align-items: center; }
.sk-card .dropdown .menu { display: none; flex-direction: column; gap: .3rem; min-width: 180px; }
.sk-card .dropdown[open] .menu { display: flex; }
.sk-card .dropdown .menu button { text-align: left; }
.sk-new { border: 2px dashed var(--line); box-shadow: none; background: transparent; display: grid; place-items: center; text-align: center; min-height: 9rem; color: var(--fg); cursor: pointer; font: inherit; }
.sk-new:hover { border-color: var(--ws); }
.src-list label { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; margin-bottom: .4rem; color: var(--fg); font-size: .92rem; cursor: pointer; }
.src-list label:has(input:checked) { border-color: var(--ws); background: color-mix(in srgb, var(--ws) 8%, transparent); }
.src-list small { display: block; color: var(--fg2); }
.src-list select { margin-top: .3rem; }
.who-llm { display: inline-flex; align-items: center; gap: .25rem; } .who-llm::before { content: "✦"; color: var(--ws); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--line); align-items: start; font-size: .9rem; }
.tl li:first-child { border-top: 0; }
.tl li.focus { background: color-mix(in srgb, var(--ws) 8%, transparent); }
.tl .dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--bg3); display: grid; place-items: center; font-size: .75rem; }
.tl .dot.cp { background: var(--ws); color: var(--ws-fg); }
.tl .when { color: var(--fg2); font-size: .8rem; overflow-wrap: anywhere; }
.tl .ctl { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.pf { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.pf-scope label { display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: center; color: var(--fg); font-size: .92rem; padding: .25rem 0; margin: 0; }
.pf-scope .sub { padding-left: 1.6rem; } .pf-scope .sub .song { padding-left: 1.4rem; }
.pf-scope .sub[aria-disabled="true"] { opacity: .55; }
.pf-list { margin: .3rem 0 .8rem; padding-left: 1.1rem; font-size: .92rem; } .pf-list li { margin: .2rem 0; }
.pf-list li.warn { color: var(--warn); } .pf-list li.err { color: var(--err); }
.pf-skel span { display: block; height: .8rem; margin: .5rem 0; border-radius: 4px; background: var(--bg3); width: 80%; } .pf-skel span:nth-child(2) { width: 60%; } .pf-skel span:nth-child(3) { width: 70%; }
.conflict { border: 1px solid var(--err); border-radius: 6px; padding: .5rem .7rem; margin-top: .5rem; font-size: .9rem; }
.conflict .kv { margin-top: .3rem; }
.banner.ws { border-color: var(--ws); background: color-mix(in srgb, var(--ws) 12%, var(--bg2)); }
.doc-diff { max-height: 30vh; overflow: auto; font-family: var(--mono); font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; margin: .3rem 0; }
.doc-diff:empty { display: none; }
.doc-diff ins { display: block; text-decoration: none; background: color-mix(in srgb, var(--ok) 16%, transparent); }
.doc-diff del { display: block; background: color-mix(in srgb, var(--err) 14%, transparent); }
.doc-diff .skip { display: block; color: var(--fg2); }
dialog.ws-wide { max-width: 720px; }
@media (max-width: 700px) {
  .pf { grid-template-columns: 1fr; }
  .wsbar { padding: .4rem .6rem; }
  .wsbar .state { display: none; }
  .wsbar .acts { margin-left: 0; width: 100%; }
  .wsbar .where select { max-width: 11rem; }
  .wsbar .acts .btn, .wsbar .acts button { min-height: 2.1rem; }
  .tl li { grid-template-columns: 1.6rem 1fr; } .tl .ctl { grid-column: 2; justify-content: flex-start; }
  .wsbar { position: static; }
}

/* ---------------------------------------------------------------- audition (voice.html #audition, audition.js) */
.aud { display: grid; grid-template-columns: minmax(9rem, 1.2fr) repeat(var(--aud-cols, 3), minmax(4.5rem, 1fr)) auto; gap: .3rem .5rem; align-items: center; font-size: .88rem; margin-top: .8rem; }
.aud .h { color: var(--fg2); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud .v { font-weight: 600; min-width: 0; overflow-wrap: anywhere; } .aud .v small { display: block; font-weight: 400; color: var(--fg2); }
.aud .cell button { width: 100%; font-variant-numeric: tabular-nums; }
.aud .cell button.on { outline: 2px solid var(--accent); }
.aud .cell .err { color: var(--err); }
.aud .acts { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.aud .warnline { color: var(--warn); font-size: .75rem; }
.star { color: var(--fg2); font-size: 1.05rem; } .star[aria-pressed=true] { color: #d9a400; }
.aud-lines { display: flex; flex-direction: column; gap: .2rem; max-height: 16rem; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: .4rem; }
.aud-lines label { display: flex; gap: .4rem; align-items: baseline; font-size: .85rem; margin: 0; }
.aud-voices { display: flex; flex-direction: column; gap: .15rem; max-height: 18rem; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: .4rem; }
.aud-voices label { display: flex; gap: .4rem; align-items: center; margin: 0; font-size: .86rem; }
.aud-cost.err { color: var(--err); }
.aud .acts .more { display: none; }
@media (max-width: 640px) {
  .aud { grid-template-columns: minmax(5rem, 1fr) repeat(var(--aud-cols, 3), auto) auto; gap: .25rem .3rem; }
  .aud .h.ln { font-size: .65rem; }
  .aud .acts .cast-btn { display: none; } .aud .acts .more { display: inline-flex; }
}

/* ---------------------------------------------------------------- song takes (media.html .takes-card, songtakes.js) */
.takes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.cand { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 6px; margin-top: .3rem; font-size: .88rem; }
.cand.chosen { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 7%, transparent); }
.cand.playing { box-shadow: inset 3px 0 0 var(--accent); }
.cand .nm { min-width: 0; overflow-wrap: anywhere; }
.cand .ab { font: 700 .75rem var(--mono, monospace); width: 1.5rem; height: 1.5rem; border-radius: 4px; display: grid; place-items: center; background: var(--bg3); }
.cand .ctl { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.abbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); background: var(--bg2); }
.abbar .seg { display: inline-flex; }
.abbar .seg button { border-radius: 0; margin: 0; min-width: 2.2rem; font-weight: 700; }
.abbar .seg button:first-child { border-radius: 8px 0 0 8px; } .abbar .seg button:last-child { border-radius: 0 8px 8px 0; }
.abbar .seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.abbar .progress { flex: 1; cursor: pointer; min-width: 6rem; }
.abbar .kind { font-size: .75rem; }
@media (max-width: 640px) {
  .cand { grid-template-columns: auto 1fr; } .cand .ctl { grid-column: 1 / -1; justify-content: flex-start; }
  .abbar { position: sticky; bottom: 0; z-index: 2; padding-bottom: .4rem; }
}
