/* IsoCue app styles. Brand colors live in tokens.css. */
:root {
  --field: #EAE5DA;
  --border: #D6D0C3;
  --ok: #1F9D74;
  --meter-off: #C9C3B6;
  --chip-bg: #F6E3C9;
  --chip-ink: #7A4A0C;
  --body-2: #57524A;

  --p-band: #17191C;
  --p-line: #2A2D32;
  --p-panel: #1A1C20;
  --p-track: #25272B;
  --p-soft: #C9C4B9;
  --p-dim: #8C887F;
  --p-faint: #6B6862;
  --p-done: #5C5A54;
  --p-skip: #3A3833;
  --p-next: #CFCAC0;
  --p-cur: #FFFFFF;

  --missed: #F2A93B;
  --adlib: #7FB2FF;
  --skipped: #B08CF5;
  --font-size: 64px;
  --line-h: 1.3;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--isocue-paper);
  color: var(--isocue-ink);
  font-family: var(--isocue-font);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--isocue-ink); outline-offset: 2px; }

/* ---------- Shell ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0; padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
  border-bottom: 1px solid var(--isocue-line);
}
.wordmark { display: block; height: 22px; width: auto; }
.crumbs { flex: 1; display: flex; justify-content: center; gap: 8px; font-size: 14px; color: var(--isocue-muted); min-width: 0; }
.crumbs strong { color: var(--isocue-ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mic-pill {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 999px; background: var(--field); font-size: 13px; font-weight: 600;
  max-width: 260px;
}
.mic-pill span:not(.bars) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; flex-shrink: 0; }
.bars i { width: 3px; height: 4px; border-radius: 2px; background: var(--meter-off); transition: height .08s linear, background .08s; }
.bars i.on { background: var(--ok); }

.btn {
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-dark { background: var(--isocue-ink); color: var(--isocue-paper); border-color: var(--isocue-ink); padding-left: 14px; }
.btn-dark:hover { background: #000; }
.btn-block { width: 100%; }
.btn-lg { height: 58px; font-size: 18px; font-weight: 800; }
.tally-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--isocue-tally); box-shadow: 0 0 0 4px rgba(224,67,43,.25); flex-shrink: 0; }
.btn-lg .tally-dot { width: 14px; height: 14px; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--field); }
.icon-btn.dark { background: rgba(255,255,255,.08); color: var(--isocue-paper); }
.link-btn { border: 0; background: none; padding: 0; color: var(--isocue-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--isocue-ink); }

.workspace { flex: 1; display: flex; min-height: 0; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--isocue-muted); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 280px; flex-shrink: 0; padding: 20px 16px; display: flex; flex-direction: column; gap: 14px;
  border-right: 1px solid var(--isocue-line); overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--field); color: var(--isocue-muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--isocue-ink); outline: none; }
.script-list { display: flex; flex-direction: column; gap: 4px; }
.script-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 12px; border-radius: 12px; border: 1px solid transparent; background: transparent;
}
.script-item:hover { background: rgba(255,255,255,.45); }
.script-item[aria-current="true"] { background: var(--isocue-surface); border-color: var(--isocue-line); }
.script-item .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.script-item .name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-item[aria-current="true"] .name { font-weight: 700; }
.script-item .meta { font-size: 12px; color: var(--isocue-muted); }
.script-item .chev { display: none; color: var(--isocue-muted); }
.empty-list { font-size: 13px; color: var(--isocue-muted); padding: 12px; }
.mobile-head, .mobile-title, .fab, .mobile-bar, .mobile-start, .tabbar { display: none; }

/* ---------- Editor ---------- */
.editor { flex: 1; min-width: 0; background: var(--isocue-surface); overflow-y: auto; display: flex; flex-direction: column; align-items: center; }
.editor-inner { width: min(720px, 100% - 48px); padding: 48px 0; display: flex; flex-direction: column; gap: 24px; flex: 1; }
.editor-head { display: flex; flex-direction: column; gap: 8px; }
.title-input {
  border: 0; background: transparent; outline: none; padding: 0; width: 100%;
  font-size: 32px; font-weight: 800; letter-spacing: -.02em;
}
.title-input::placeholder { color: #B5AFA3; }
.meta-row { display: flex; gap: 16px; align-items: center; font-size: 13px; color: var(--isocue-muted); }
.body-input {
  border: 0; outline: none; background: transparent; resize: none; padding: 0; width: 100%;
  font-size: 21px; line-height: 1.7; font-weight: 500; min-height: 320px; overflow: hidden;
}
.body-input::placeholder { color: #B5AFA3; }
.cue-hint { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--isocue-paper); font-size: 13px; line-height: 1.5; color: var(--body-2); }
.cue-hint code { font-family: var(--isocue-font); font-weight: 700; color: var(--isocue-ink); }
.chip { flex-shrink: 0; padding: 2px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Settings ---------- */
.settings { width: 340px; flex-shrink: 0; padding: 24px; display: flex; flex-direction: column; gap: 22px; border-left: 1px solid var(--isocue-line); overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field-label, .field-row label { font-size: 14px; font-weight: 700; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.value { color: var(--isocue-muted); }
.hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--isocue-muted); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--field); }
.segmented button { height: 36px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; }
.segmented button[aria-checked="true"] { background: var(--isocue-ink); color: var(--isocue-paper); font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--isocue-ink); margin: 0; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; height: 32px; }
.stepper button { width: 32px; height: 30px; border: 0; background: none; font-size: 16px; font-weight: 700; }
.stepper output { min-width: 22px; text-align: center; font-weight: 700; }
.toggles { display: flex; flex-direction: column; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px;
  border-top: 1px solid var(--isocue-line); font-size: 14px; font-weight: 600; cursor: pointer;
}
.toggles .toggle-row:last-child { border-bottom: 1px solid var(--isocue-line); }
.switch {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0;
  width: 44px; height: 26px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background .15s;
}
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--isocue-surface); transition: transform .15s; }
.switch:checked { background: var(--isocue-ink); }
.switch:checked::after { transform: translateX(18px); background: var(--isocue-paper); }
.select { border: 0; background: transparent; color: var(--isocue-muted); font-size: 14px; text-align: right; cursor: pointer; }
.swatch { -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 50%; padding: 0; background: none; cursor: pointer; }
.swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch::-moz-color-swatch { border: 0; border-radius: 50%; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--field); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.commands-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.commands-card dt { font-weight: 700; white-space: nowrap; }
.commands-card dd { margin: 0; color: var(--body-2); }

/* ---------- Ready sheet ---------- */
.ready { position: fixed; inset: 0; z-index: 30; background: #1C1D21; color: var(--isocue-paper); display: flex; flex-direction: column; }
.ready-top { display: flex; align-items: center; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) 16px 12px; }
.ready-title { font-size: 15px; font-weight: 700; }
.ready-preview {
  margin: 8px 16px; padding: 16px; border-radius: 16px; background: rgba(0,0,0,.35);
  font-weight: 700; line-height: 1.3; max-height: 32vh; overflow: hidden;
}
.sheet {
  margin-top: auto; background: var(--isocue-paper); color: var(--isocue-ink);
  border-radius: 24px 24px 0 0; padding: 12px 20px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.sheet > .toggle-row + .toggle-row { margin-top: -16px; border-bottom: 1px solid var(--isocue-line); }
.sheet > .btn { margin-top: 8px; }
.grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 4px; }

/* ---------- Prompter ---------- */
.prompter {
  position: fixed; inset: 0; z-index: 40; background: var(--isocue-prompter-bg); color: var(--isocue-paper);
  display: flex; flex-direction: column; overflow: hidden; user-select: none; -webkit-user-select: none;
}
.p-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 16px; transition: opacity .3s; }
.p-exit { height: 36px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--p-line); background: transparent; color: var(--p-soft); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.p-title { flex: 1; text-align: center; font-size: 14px; font-weight: 600; color: var(--p-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-status { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px 0 12px; border-radius: 999px; background: rgba(224,67,43,.14); border: 1px solid rgba(224,67,43,.4); color: var(--isocue-paper); font-family: inherit; }
.p-status-live { display: flex; align-items: center; gap: 10px; }
.p-status-end { display: none; font-size: 13px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.p-status:hover, .p-status:focus-visible { background: rgba(224,67,43,.26); border-color: rgba(224,67,43,.7); }
.p-status:hover .p-status-live, .p-status:focus-visible .p-status-live { display: none; }
.p-status:hover .p-status-end, .p-status:focus-visible .p-status-end { display: inline; }
.p-status:hover .dot, .p-status:focus-visible .dot { border-radius: 2px; }
@media (hover: none) {
  .p-status-end { display: inline; padding-left: 10px; border-left: 1px solid rgba(243,240,232,.25); }
}
.p-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--isocue-tally); box-shadow: 0 0 0 4px rgba(224,67,43,.3); }
.p-status-label { font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.p-status .bars { height: 16px; align-items: center; }
.p-status .bars i { background: #6B6862; }
.p-status .bars i.on { background: var(--isocue-paper); }
.p-status.off { background: transparent; border-color: var(--p-line); }
.p-status.off .dot { background: var(--p-faint); box-shadow: none; }
.p-status.off .p-status-label { color: var(--p-soft); }
.p-time { font-family: var(--isocue-font-mono); font-size: 14px; color: var(--p-soft); white-space: nowrap; }
.p-time span { color: var(--p-faint); }
.p-icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--p-line); background: transparent; color: var(--p-soft); display: flex; align-items: center; justify-content: center; }

.p-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; }
.p-flip { position: absolute; inset: 0; }
.prompter.mirrored .p-flip { transform: scaleX(-1); }
.p-band { position: absolute; left: 0; right: 0; background: linear-gradient(transparent, var(--p-band) 24%, var(--p-band) 76%, transparent); pointer-events: none; }
.p-marker { position: absolute; pointer-events: none; }
.p-text {
  position: absolute; left: 0; right: 0; top: 0; margin: 0 auto;
  width: min(1160px, 100% - 280px);
  font-size: var(--font-size); line-height: var(--line-h); font-weight: 700; letter-spacing: -.01em;
  will-change: transform; overflow-wrap: break-word;
}
.p-para { margin: 0 0 calc(var(--font-size) * .5); }
.p-cue {
  display: table; margin: calc(var(--font-size) * .12) 0 calc(var(--font-size) * .3);
  padding: .25em .9em; border-radius: 999px; border: 1.5px solid #6B5A3E; color: #D9B77E;
  font-size: max(13px, calc(var(--font-size) * .25)); font-weight: 800; letter-spacing: .1em; line-height: 1.4; text-transform: uppercase;
}
.p-cue.past { border-color: var(--p-skip); color: var(--p-faint); }
.w { color: var(--p-next); transition: color .45s ease; }
.w.slot { color: var(--p-next); }
.hl .w.done { color: var(--p-done); }
.hl .w.near { color: var(--p-dim); }
.w.skipped { color: var(--p-skip); }
.w.cur { color: var(--p-cur); text-decoration: underline; text-decoration-color: var(--isocue-tally); text-decoration-thickness: max(3px, calc(var(--font-size) * .075)); text-underline-offset: calc(var(--font-size) * .18); text-decoration-skip-ink: none; }

.p-fade { position: absolute; left: 0; right: 0; height: 90px; pointer-events: none; }
.p-fade.top { top: 0; background: linear-gradient(var(--isocue-prompter-bg) 30%, transparent); }
.p-fade.bottom { bottom: 0; background: linear-gradient(transparent, var(--isocue-prompter-bg) 85%); }

.p-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(14,15,17,.82); font-size: min(34vw, 260px); font-weight: 800; color: var(--isocue-paper); }
.p-notice { position: absolute; left: 50%; top: 76px; transform: translateX(-50%); max-width: min(560px, 100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--p-panel); border: 1px solid var(--p-line); color: var(--p-soft); font-size: 14px; line-height: 1.45; text-align: center; z-index: 6; }
.p-toast { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; background: var(--isocue-paper); color: var(--isocue-ink); font-size: 14px; font-weight: 700; z-index: 6; white-space: nowrap; }

.p-foot { position: relative; z-index: 5; padding: 0 24px 12px; display: flex; flex-direction: column; align-items: center; gap: 20px; transition: opacity .3s; }
.p-progress { width: min(1160px, 100%); height: 4px; border-radius: 2px; background: var(--p-track); }
.p-progress div { width: 0; height: 4px; border-radius: 2px; background: var(--isocue-tally); transition: width .3s; }
.p-toolbar { height: 64px; padding: 0 8px; border-radius: 999px; background: var(--p-panel); border: 1px solid var(--p-line); display: flex; align-items: center; gap: 6px; }
.p-toolbar button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; color: var(--p-soft); display: flex; align-items: center; justify-content: center; }
.p-toolbar button:hover { background: rgba(255,255,255,.06); }
.p-toolbar button.play { width: 52px; height: 52px; margin: 0 8px; background: var(--isocue-paper); color: var(--isocue-ink); }
.p-toolbar .i-play { display: none; }
.prompter.paused .p-toolbar .i-play { display: block; }
.prompter.paused .p-toolbar .i-pause { display: none; }
.p-toolbar button[aria-pressed="true"] { color: var(--isocue-tally); }
.p-toolbar .txt { font-size: 15px; font-weight: 800; }
.p-toolbar .txt.lg { font-size: 19px; }
.p-toolbar .sep { width: 1px; height: 28px; background: var(--p-line); margin: 0 6px; }
.p-keys { font-size: 12px; color: var(--p-faint); }
.prompter.idle .p-head, .prompter.idle .p-foot { opacity: 0; }
.prompter.idle { cursor: none; }

/* ---------- Recap (live) ---------- */
.p-recap {
  position: absolute; top: 76px; right: 24px; z-index: 6; width: 320px;
  background: rgba(30,32,37,.92); border: 1px solid #3A3D44; border-radius: 16px;
  color: var(--p-soft); opacity: .85; transition: opacity .3s;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.p-recap:hover, .p-recap.open { opacity: 1; }
.p-recap-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; background: none; color: inherit; text-align: left; }
.p-recap-title { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--p-soft); }
.p-recap-counts { flex: 1; display: flex; justify-content: flex-end; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--p-dim); }
.p-recap-counts .n-missed, .p-recap-counts .n-added, .p-recap-counts .n-skipped { padding: 3px 9px; border-radius: 999px; }
.p-recap-list .skip-item { color: var(--skipped); }
.p-recap-list .skip-item b { font-weight: 700; }
.p-recap-counts .n-missed { color: var(--missed); background: color-mix(in srgb, var(--missed) 18%, transparent); }
.p-recap-counts .n-added { color: var(--adlib); background: color-mix(in srgb, var(--adlib) 18%, transparent); }
.p-recap-counts .n-skipped { color: var(--skipped); background: color-mix(in srgb, var(--skipped) 18%, transparent); }
.p-recap .chev { flex-shrink: 0; color: var(--p-soft); transition: transform .2s; }
.p-recap.open .chev { transform: rotate(180deg); }
.p-recap-list { list-style: none; margin: 0; padding: 0 14px 12px; max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; }
.p-recap-list li { padding-top: 6px; border-top: 1px solid var(--p-line); }
.p-recap-list .empty { border: 0; color: var(--p-faint); }
.ctx { color: var(--p-faint); }
del.miss { color: var(--missed); text-decoration: line-through; text-decoration-thickness: 1.5px; }
ins.add { color: var(--adlib); text-decoration: none; font-style: italic; }
.prompter.idle .p-recap:not(.open) { opacity: .6; }

/* ---------- Review ---------- */
.modal-card.review-card { width: min(960px, 100%); height: min(920px, 100dvh - 32px); overflow: hidden; padding: 28px; }
.segmented.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: rgba(21,23,26,.1); font-size: 12px; }
.segmented button[aria-checked="true"] .tab-count { background: rgba(243,240,232,.2); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--isocue-muted); margin-bottom: 14px; }
.review-card .rough { background: rgba(242,169,59,.16); border-bottom: 2px solid rgba(242,169,59,.6); border-radius: 3px; padding: 2px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.retake { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 12px; background: var(--isocue-surface); border: 1px solid var(--isocue-line); }
.retake .txt { flex: 1; min-width: 0; }
.retake q { display: block; font-size: 16px; line-height: 1.5; quotes: none; }
.retake .why { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.retake .why span { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--field); color: var(--body-2); }
.retake .btn { flex-shrink: 0; }
.review-head { display: flex; align-items: center; justify-content: space-between; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.segmented.two { grid-template-columns: 1fr 1fr; }
.review-body { flex: 1; min-height: 120px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.review-list { display: flex; flex-direction: column; gap: 8px; }
.change {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--isocue-surface); border: 1px solid var(--isocue-line); cursor: pointer;
}
.change input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--isocue-ink); flex-shrink: 0; }
.change .txt { flex: 1; font-size: 15px; line-height: 1.5; }
.change .act { display: block; font-size: 12px; color: var(--isocue-muted); margin-top: 2px; }
.review-card .ctx { color: var(--isocue-muted); }
.review-card del.miss { color: #B26A00; background: color-mix(in srgb, var(--missed) 22%, transparent); border-radius: 4px; padding: 0 3px; }
.review-card ins.add { color: #1D5FC4; background: color-mix(in srgb, var(--adlib) 25%, transparent); border-radius: 4px; padding: 0 3px; font-style: normal; font-weight: 700; }
.review-script { font-size: 19px; line-height: 1.8; max-width: 760px; }
.review-script p { margin: 0 0 14px; }
.review-script .chip { display: inline-block; vertical-align: 1px; }
.review-script .unread, .legend .unread { color: #A8A296; }
.review-card .skip { color: color-mix(in srgb, var(--skipped) 70%, #3A2466); background: color-mix(in srgb, var(--skipped) 16%, transparent); border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.stats.five { grid-template-columns: repeat(5, 1fr); }
.list-heading { margin: 8px 0 0; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--isocue-muted); }
.list-heading:first-child { margin-top: 0; }
.retake.skipped { border-left: 4px solid var(--skipped); }
.review-card .heard { text-decoration: underline dotted rgba(107,102,92,.55); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.misheard-list { margin-top: 8px; border-top: 1px solid var(--isocue-line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.misheard-list summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--isocue-muted); padding: 4px 0; }
.misheard-list .change { opacity: .8; margin-top: 8px; }
.toggle-row:has(small) { padding: 10px 0; }
.toggle-row small { display: block; margin-top: 3px; line-height: 1.35; font-size: 12px; font-weight: 500; color: var(--isocue-muted); }
.review-empty { padding: 24px 8px; text-align: center; color: var(--isocue-muted); font-size: 15px; }
.review-foot { display: flex; justify-content: flex-end; gap: 10px; }
.btn:disabled { opacity: .4; cursor: default; }

/* ---------- Summary ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(14,15,17,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: min(420px, 100%); background: var(--isocue-paper); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-card h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--isocue-surface); border: 1px solid var(--isocue-line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 24px; font-weight: 800; }
.stat span { font-size: 12px; color: var(--isocue-muted); }
.stat .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* ---------- Tablet ---------- */
@media (max-width: 1180px) {
  .settings { width: 300px; }
  .sidebar { width: 240px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .topbar { display: none; }
  .workspace { display: block; position: relative; overflow: hidden; }
  .sidebar, .editor, .settings {
    position: absolute; inset: 0; width: auto; border: 0; display: none;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .app[data-view="list"] .sidebar { display: flex; }
  .app[data-view="edit"] .editor { display: flex; }
  .app[data-view="settings"] .settings { display: flex; }

  .sidebar { padding: max(24px, env(safe-area-inset-top)) 20px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
  .mobile-title { display: block; margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -.03em; }
  .sidebar-head { display: none; }
  .search { height: 46px; border-radius: 14px; font-size: 16px; }
  .search input { font-size: 16px; }
  .script-list { gap: 10px; }
  .script-item { background: var(--isocue-surface); border-color: var(--isocue-line); border-radius: 16px; padding: 16px; }
  .script-item[aria-current="true"] { background: var(--isocue-surface); }
  .script-item .name { font-size: 17px; font-weight: 700; }
  .script-item .meta { font-size: 13px; }
  .script-item .chev { display: block; }
  .fab {
    display: inline-flex; align-items: center; gap: 10px; position: fixed; right: 20px;
    bottom: calc(92px + env(safe-area-inset-bottom)); height: 54px; padding: 0 22px 0 18px;
    border-radius: 999px; border: 0; background: var(--isocue-ink); color: var(--isocue-paper);
    font-size: 16px; font-weight: 700; box-shadow: 0 8px 24px rgba(21,23,26,.2); z-index: 5;
  }

  .editor { padding-bottom: 0; background: var(--isocue-surface); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: max(12px, env(safe-area-inset-top)) 16px 0; }
  .save-state { font-size: 13px; color: var(--isocue-muted); }
  .editor-inner { width: 100%; padding: 16px 20px 24px; gap: 16px; }
  .title-input { font-size: 28px; }
  .body-input { font-size: 18px; min-height: 240px; }
  .mobile-start { display: block; position: sticky; bottom: 0; width: 100%; padding: 12px 20px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--isocue-surface) 30%); }
  .mobile-start .btn { height: 54px; font-size: 16px; }
  .app[data-view="edit"] .tabbar { display: none; }

  .settings { padding: max(24px, env(safe-area-inset-top)) 20px calc(100px + env(safe-area-inset-bottom)); }
  .settings .mobile-title { margin-top: 24px; }
  .settings > .eyebrow { display: none; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--isocue-surface); border-top: 1px solid var(--isocue-line);
    padding: 10px 0 max(12px, env(safe-area-inset-bottom));
  }
  .tabbar button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--isocue-muted); }
  .tabbar button[aria-current="true"] { color: var(--isocue-ink); font-weight: 700; }

  .p-head { padding: max(8px, env(safe-area-inset-top)) 12px 0; gap: 8px; height: auto; min-height: 56px; }
  .p-title, .p-keys { display: none; }
  .p-head .p-status { margin-left: auto; }
  .p-status { height: 32px; padding: 0 10px; gap: 8px; }
  .p-status-label { font-size: 12px; }
  .p-time { font-size: 12px; }
  .p-text { width: calc(100% - 64px); }
  .p-foot { padding: 0 16px max(12px, env(safe-area-inset-bottom)); gap: 14px; }
  .p-toolbar { height: 56px; gap: 0; padding: 0 4px; }
  .p-toolbar button { width: 40px; height: 40px; }
  .p-toolbar button.play { width: 46px; height: 46px; margin: 0 4px; }
  .p-toolbar .sep { margin: 0 2px; }
  .p-recap { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); right: 12px; width: min(320px, 100% - 24px); }
  .modal-card.review-card { padding: 20px; height: calc(100dvh - 24px); }
  .segmented.three button { font-size: 12px; padding: 0 4px; }
  .segmented.three .tab-count { display: none; }
  .retake { flex-direction: column; align-items: stretch; }
  .stats.four, .stats.five { grid-template-columns: 1fr 1fr; }
  .review-foot .btn { flex: 1; }
}
@media (max-width: 380px) {
  .p-toolbar [data-action="restart"] { display: none; }
  .p-time { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Offline mode panel ---------- */
.offline-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 16px; border: 1.5px dashed var(--border); background: transparent; margin-top: 4px; }
.offline-head { display: flex; gap: 12px; align-items: flex-start; }
.offline-head svg { flex-shrink: 0; margin-top: 2px; color: var(--isocue-muted); }
.offline-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.offline-head p { margin: 2px 0 0; font-size: 13px; color: var(--isocue-muted); }
.offline-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--body-2); }
.offline-status { margin: 0; font-size: 13px; line-height: 1.5; font-weight: 600; }
.offline-status:empty { display: none; }
.offline-card .btn { align-self: flex-start; }
.offline-card .toggle-row { border-bottom: 1px solid var(--isocue-line); }
.dl { display: flex; flex-direction: column; gap: 6px; }
.dl-bar { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; position: relative; }
.dl-bar i { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px; background: var(--isocue-ink); animation: dl-slide 1.3s ease-in-out infinite; }
.dl.done .dl-bar i { width: 100%; left: 0; animation: none; }
@keyframes dl-slide { 0% { left: -35%; } 100% { left: 100%; } }
#dlText { font-size: 12px; color: var(--isocue-muted); font-family: var(--isocue-font-mono); }

.step-label { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--isocue-muted); }
.step-label span { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--field); color: var(--isocue-ink); letter-spacing: 0; }
.update-banner {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: var(--isocue-surface); border: 1px solid var(--isocue-line); box-shadow: 0 10px 30px rgba(21,23,26,.18);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.update-banner .btn { height: 34px; padding: 0 16px; }
@media (max-width: 820px) { .update-banner { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* Shown on open in browsers with no speech recognition (Firefox). */
.browser-note {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 59;
  width: min(560px, calc(100vw - 32px)); display: flex; align-items: center; gap: 16px; padding: 14px 14px 14px 18px;
  border-radius: 16px; background: var(--isocue-surface); border: 1px solid var(--isocue-line);
  border-left: 4px solid var(--isocue-tally); box-shadow: 0 10px 30px rgba(21,23,26,.18); font-size: 14px; line-height: 1.5;
}
.browser-note p { margin: 0; flex: 1; }
.browser-note .btn { height: 34px; padding: 0 16px; flex-shrink: 0; }
@media (max-width: 820px) { .browser-note { bottom: calc(96px + env(safe-area-inset-bottom)); } }
