/* Scriptdesk. The page is laid out like a two-column shooting script:
   the notes (what is known) on the left, the script (what is said) on the right. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-ext-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }
@font-face { font-family: "Plex Condensed"; src: url("/fonts/ibm-plex-sans-condensed-latin-ext-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113; }

:root {
  --desk: #e7ecec;      /* the surface around the page */
  --notes: #f3f6f6;     /* the notes column */
  --sheet: #ffffff;     /* the script column */
  --ink: #17232b;
  --ink-2: #47565f;
  --ink-3: #74838b;
  --rule: #d3dbdb;
  --rule-soft: #e3e9e9;
  --cue: #0d5c70;       /* the paragraph being written */
  --good: #1c7350;
  --warn: #8f4f06;
  --warn-bg: #fbf0dc;
  --live: #d42a20;      /* recording, and nothing else */
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Plex Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --rail: 236px;
  --bar: 58px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --desk: #0d1418; --notes: #121b21; --sheet: #17222a;
    --ink: #e6edf0; --ink-2: #aab8bf; --ink-3: #76868f;
    --rule: #2a3942; --rule-soft: #212e36;
    --cue: #74c6d8; --good: #73cfa3; --warn: #e8a650; --warn-bg: #33270f; --live: #ff5b4f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font: 400 15px/1.45 var(--sans); min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cue); }
:focus-visible { outline: 2px solid var(--cue); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--sheet);
  padding: 8px 16px; border-radius: 6px; font-weight: 500; line-height: 1.2;
}
.btn:hover { opacity: .9; }
.btn.plain { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.plain:hover { border-color: var(--ink-3); opacity: 1; }
.btn:disabled { opacity: .5; cursor: default; }
.quiet { border: 0; background: none; padding: 2px 0; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); }
.quiet:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ------------------------------------------------------------ sign-in and the list of notes */

.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(360px, 100%); }
.wordmark { font: 600 34px/1.1 var(--serif); letter-spacing: -0.01em; margin: 0 0 6px; }
.login p { color: var(--ink-2); margin: 0 0 22px; }
.login form { display: grid; gap: 10px; }
.field {
  width: 100%; padding: 10px 12px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px;
}
.field:focus { outline: 2px solid var(--cue); outline-offset: 0; border-color: transparent; }
.error { color: var(--live); margin: 4px 0 0; min-height: 1.45em; }

.home { max-width: 860px; margin: 0 auto; padding: 56px 24px 80px; }
.home header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 34px; }
.home .who { color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.home .who input { width: 150px; padding: 5px 9px; }
.home h2 { font: 600 15px/1.3 var(--sans); color: var(--ink-2); margin: 0 0 10px; }
.sets { list-style: none; margin: 0 0 26px; padding: 0; border-top: 1px solid var(--rule); }
.sets li { border-bottom: 1px solid var(--rule); padding: 20px 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; align-items: start; }
.sets h3 { font: 600 23px/1.2 var(--serif); margin: 0; letter-spacing: -0.005em; }
.sets .meta { color: var(--ink-2); margin: 4px 0 0; }
.sets .drafts { grid-column: 1 / -1; display: flex; gap: 6px 18px; flex-wrap: wrap; color: var(--ink-2); }
.empty { padding: 28px 0; color: var(--ink-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 26px; }
.home footer { margin-top: 44px; color: var(--ink-3); display: flex; gap: 18px; }

dialog {
  border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); color: var(--ink);
  padding: 26px; width: min(620px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgba(10, 25, 33, .28);
}
dialog::backdrop { background: rgba(13, 24, 31, .5); }
dialog h2 { font: 600 24px/1.2 var(--serif); margin: 0 0 6px; }
dialog p { color: var(--ink-2); margin: 0 0 16px; }
dialog textarea.field { min-height: 150px; resize: vertical; font-size: 13.5px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; align-items: center; }
dialog .actions .error { margin-right: auto; }

/* ------------------------------------------------------------ the desk */

.desk { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px calc(var(--bar) + 16px) 18px;
  border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 18px;
}
.rail .back { color: var(--ink-3); text-decoration: none; }
.rail .back:hover { color: var(--ink); }
.rail h1 { font: 600 18px/1.25 var(--serif); margin: 6px 0 0; }
.rail .writer { color: var(--ink-3); margin: 4px 0 0; }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.rail .sec {
  width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px 8px; border-radius: 6px;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; color: var(--ink-2);
}
.rail .sec:hover { background: var(--notes); }
.rail .sec[aria-current="true"] { background: var(--sheet); color: var(--ink); box-shadow: inset 3px 0 0 var(--cue); }
.rail .sec .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.rail .sec .num { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail .sec .track { grid-column: 1 / -1; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.rail .sec .track i { display: block; height: 100%; width: 0; background: var(--ink-3); border-radius: 2px; }
.rail .sec.done .track i { background: var(--good); }
.rail .sec .warn { color: var(--warn); }
.rail .label { padding: 12px 8px 4px; color: var(--ink-3); font-weight: 500; }
.rail .total { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--rule); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rail .total strong { color: var(--ink); font-weight: 600; }

.main { min-width: 0; padding-bottom: calc(var(--bar) + 40px); }
.head { max-width: 1160px; margin: 0 auto; padding: 30px 32px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.head h2 { font: 600 30px/1.15 var(--serif); letter-spacing: -0.012em; margin: 0; }
.head .sub { color: var(--ink-2); margin: 6px 0 0; }
.head .tools { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.saved { color: var(--ink-3); min-width: 70px; text-align: right; }
.saved.bad { color: var(--live); }

.notice { max-width: 1096px; margin: 0 auto 14px; padding: 10px 14px; background: var(--warn-bg); color: var(--warn); border-radius: 6px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.notice .quiet { color: inherit; }

.rows { max-width: 1160px; margin: 0 auto; padding: 0 32px; }
.colhead { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.colhead span { padding: 0 22px 7px; }
.colhead span:first-child { padding-left: 18px; }

.row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); border-bottom: 1px solid var(--rule-soft); }
.note { background: var(--notes); padding: 18px 22px 16px 18px; color: var(--ink-2); cursor: text; }
.note .top { margin: 0; font-size: 15.5px; line-height: 1.45; }
.note .subs { margin: 7px 0 0; padding: 0 0 0 16px; list-style: none; font-size: 14.5px; }
.note .subs li { position: relative; margin-top: 5px; }
.note .subs li::before { content: ""; position: absolute; left: -13px; top: .68em; width: 6px; height: 1px; background: var(--ink-3); }
.row.active .note { color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.chip {
  border: 1px solid var(--rule); background: var(--sheet); border-radius: 4px; padding: 2px 7px 3px;
  font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--ink); max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative;
}
.chip:hover { border-color: var(--cue); color: var(--cue); }
.chip.used { color: var(--ink-3); font-weight: 400; background: transparent; border-color: transparent; padding-left: 16px; }
.chip.used::before { content: ""; position: absolute; left: 4px; top: 50%; width: 7px; height: 4px; margin-top: -4px; border-left: 1.5px solid var(--good); border-bottom: 1.5px solid var(--good); transform: rotate(-45deg); }
.keys .row.active .chip[data-n]::after { content: attr(data-n); margin-left: 6px; color: var(--cue); font-weight: 600; }

.script { background: var(--sheet); padding: 14px 22px 12px 26px; position: relative; min-width: 0; }
.script::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.row.active .script::before { background: var(--cue); }
.row.recording .script::before { background: var(--live); animation: tally 1.4s ease-in-out infinite; }
@keyframes tally { 50% { opacity: .35; } }
.script textarea {
  display: block; width: 100%; border: 0; background: transparent; resize: none; overflow: hidden; outline: none;
  font: 400 19px/1.62 var(--serif); font-optical-sizing: auto; color: var(--ink); padding: 2px 0; min-height: 35px;
}
.script textarea::placeholder { color: var(--ink-3); opacity: .75; font-size: 16px; }
.under { display: flex; gap: 14px; align-items: baseline; min-height: 22px; color: var(--ink-3); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.under .skip { margin-left: auto; font-size: 13.5px; visibility: hidden; }
.row.active .under .skip, .row[data-state="skipped"] .under .skip, .row:hover .under .skip { visibility: visible; }
.row[data-state="written"] .under .skip { display: none; }
.row[data-state="skipped"] .note, .row[data-state="covered"] .note { opacity: .55; }
.row[data-state="skipped"] .note .top { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.under .busy { color: var(--cue); }

.flags { display: grid; gap: 4px; margin-top: 4px; }
.flag { margin: 0; padding: 5px 9px; background: var(--warn-bg); color: var(--warn); border-radius: 4px; font-size: 13.5px; display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.flag .quiet { color: inherit; white-space: nowrap; }
.flag.fail { background: transparent; color: var(--live); padding-left: 0; }

.pager { max-width: 1160px; margin: 26px auto 0; padding: 0 32px; display: flex; justify-content: space-between; gap: 12px; }

/* ------------------------------------------------------------ the bar along the bottom */

.bar {
  position: fixed; left: var(--rail); right: 0; bottom: 0; height: var(--bar); z-index: 5;
  background: var(--ink); color: var(--sheet); display: flex; align-items: center; gap: 26px; padding: 0 28px 0 18px;
  font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) { .bar { background: #080d10; color: var(--ink); border-top: 1px solid var(--rule); } }
.bar .stat { white-space: nowrap; }
.bar .stat b { font-weight: 600; font-size: 17px; }
.bar .stat span { opacity: .65; margin-left: 5px; }
.bar .check { margin-left: auto; }
.bar .check.has b { color: #f3b85c; }
.bar .hint { opacity: .55; font-size: 13.5px; }

.mic {
  --level: 0;
  display: inline-flex; align-items: center; gap: 9px; border: 1px solid rgba(255, 255, 255, .28); background: transparent;
  color: inherit; border-radius: 999px; padding: 7px 16px 7px 12px; font-weight: 500; min-width: 138px;
}
.mic:hover { border-color: rgba(255, 255, 255, .6); }
.mic .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .7; flex: none; }
.mic kbd { font: inherit; opacity: .55; margin-left: auto; }
.recording .mic { background: var(--live); border-color: var(--live); color: #fff; }
.recording .mic .dot { opacity: 1; background: #fff; box-shadow: 0 0 0 calc(var(--level) * 9px) rgba(255, 255, 255, .32); }
.recording .mic kbd { opacity: .8; }

#toasts { position: fixed; left: 50%; bottom: calc(var(--bar) + 16px); transform: translateX(-50%); display: grid; gap: 8px; z-index: 30; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: var(--sheet); padding: 10px 14px; border-radius: 6px; box-shadow: 0 8px 26px rgba(10, 25, 33, .3); }

/* ------------------------------------------------------------ read through */

.read { width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: hidden; }
.read[open] { display: flex; flex-direction: column; }
.read .readhead { padding: 22px 28px 16px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.read .readhead h2 { margin: 0; flex: 1 1 240px; }
.read .scroll { overflow-y: auto; padding: 8px 28px 30px; }
.read table { width: 100%; border-collapse: collapse; margin: 14px 0 6px; font-variant-numeric: tabular-nums; }
.read th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 4px 10px 6px 0; border-bottom: 1px solid var(--rule); }
.read td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; color: var(--ink-2); }
.read td:first-child { color: var(--ink); font-weight: 500; }
.read td .quiet { text-align: left; }
.read td.warn { color: var(--warn); }
.read .issues { margin: 2px 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: 13.5px; }
.read .issues b { color: var(--warn); font-weight: 500; }
.read h3 { font: 600 21px/1.25 var(--serif); margin: 34px 0 10px; }
.read .scroll > p { font: 400 18px/1.62 var(--serif); color: var(--ink); margin: 0 0 14px; max-width: 68ch; }
.read .none { color: var(--ink-3); font: inherit; }

/* ------------------------------------------------------------ narrow screens */

@media (max-width: 900px) {
  :root { --rail: 0px; }
  .desk { display: block; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 14px 16px; gap: 10px; }
  .rail ol { display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .rail .sec { min-width: 130px; }
  .rail .label, .rail .total { display: none; }
  .head { padding: 20px 16px 14px; flex-direction: column; align-items: flex-start; }
  .head h2 { font-size: 24px; }
  .rows, .pager { padding: 0 16px; }
  .colhead { display: none; }
  .row { grid-template-columns: 1fr; }
  .bar { gap: 14px; padding: 0 12px; }
  .bar .hint, .bar .stat span { display: none; }
  .mic { min-width: 0; }
  .mic kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .row.recording .script::before { animation: none; }
}
