/* חדר כותבים
   Layout idea: a quiet desk, one white page of script on it, pen-ink for
   actions and a yellow marker for the one thing that should catch the eye. */

@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-latin.woff2') format('woff2');
  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;
}

:root {
  /* Neutrals: script paper on a desk, warmed slightly toward the marker */
  --bg: #F4F2EC;
  --surface: #FFFFFF;
  --ink: #171B2B;
  --ink-soft: #454A5C;
  --ink-mute: #636878;
  --line: #E0DDD2;
  --line-strong: #C7C3B5;
  /* Brand: the blue-black of pen ink. Touch: a highlighter */
  --brand: #1F2B55;
  --brand-hover: #151E42;
  --on-brand: #FFFFFF;
  --brand-soft: #E7E9F2;
  --marker: #FFD93B;
  --marker-soft: #FFEE9E;
  /* Status, apart from the brand */
  --ok: #1B6E47;
  --ok-soft: #DAEEE0;
  --warn: #85540B;
  --warn-soft: #F5E7CB;
  --bad: #B03636;
  --bad-soft: #F8E3E3;

  --font: 'Heebo', system-ui, 'Segoe UI', Arial, sans-serif;
  --fs-h1: 30px;
  --fs-h2: 20px;
  --fs-body: 16px;
  --fs-small: 14px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-float: 0 14px 36px rgba(23, 27, 43, .16);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; line-height: 1.2; font-weight: 800; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
bdi { unicode-bidi: isolate; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.noscript { padding: var(--s6); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-block: 20px; }
.wordmark { font-weight: 900; font-size: 22px; line-height: 1.2; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark b { font-weight: 900; box-shadow: inset 0 -.46em 0 var(--marker); padding-inline: .08em; }
.who { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-small); color: var(--ink-soft); min-width: 0; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 46px; padding-inline: 22px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; color: var(--ink);
  font-weight: 700; font-size: 15px; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), transform .08s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-line { background: var(--surface); border-color: var(--line-strong); }
.btn-line:hover:not(:disabled) { border-color: var(--ink); }
.btn-text { padding-inline: 10px; color: var(--brand); font-weight: 600; }
.btn-text:hover:not(:disabled) { background: var(--brand-soft); }
.btn-danger { color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn-sm { height: 36px; padding-inline: 14px; font-size: 14px; }
.btn-sm.btn-text { padding-inline: 8px; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm.btn-icon { width: 36px; }
.btn[aria-pressed="true"].btn-line { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 600; font-size: var(--fs-small); }
.field .help { font-size: 13px; color: var(--ink-mute); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); font-size: 16px; line-height: 1.5;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.textarea { resize: vertical; display: block; }
.input::placeholder, .textarea::placeholder { color: var(--ink-mute); opacity: 1; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.select { appearance: none; padding-inline-end: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23454A5C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: left 10px center; }
.select-sm { min-height: 40px; padding-block: 6px; font-size: 15px; width: auto; max-width: 100%; }
.ltr { direction: ltr; text-align: right; }
.error { color: var(--bad); font-size: var(--fs-small); font-weight: 600; }

/* ---------- segmented control, tabs, pills ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.seg button { height: 34px; padding-inline: 14px; border: 0; border-radius: 6px; background: none; font-weight: 600; font-size: 14px; color: var(--ink-soft); white-space: nowrap; transition: background-color .16s var(--ease), color .16s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 26px; }
.tab { padding: 8px 0; border: 0; background: none; font-weight: 600; font-size: 17px; color: var(--ink-mute); white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { color: var(--ink); font-weight: 800; }
.tab[aria-pressed="true"] .tab-label { box-shadow: inset 0 -.46em 0 var(--marker); padding-inline: .1em; }
.tab-count { margin-inline-start: 6px; font-weight: 400; font-size: 14px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.tab-add { font-size: 15px; color: var(--brand); }

.pill { display: inline-flex; align-items: center; height: 26px; padding-inline: 11px; border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.pill-idea { color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill-dev { background: var(--warn-soft); color: var(--warn); }
.pill-ready { background: var(--ok-soft); color: var(--ok); }

/* ---------- join ---------- */
.join { max-width: 440px; padding-block: clamp(40px, 12vh, 120px) var(--s7); display: grid; gap: var(--s6); }
.join .wordmark { font-size: clamp(38px, 9vw, 54px); }
.join-lead { font-size: 18px; color: var(--ink-soft); max-width: 30ch; }
.join form { display: grid; gap: var(--s5); }
.join .btn { justify-self: start; }

/* ---------- home ---------- */
.home { padding-block: var(--s5) var(--s8); }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; margin-block-end: var(--s7); }
.home-head h1 .soft { display: block; color: var(--ink-mute); font-weight: 600; }
.filters { display: grid; gap: var(--s4); margin-block-end: var(--s5); }
.filters-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3) var(--s5); flex-wrap: wrap; }
.search { position: relative; flex: 0 1 280px; min-width: 180px; }
.search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); pointer-events: none; }
.search .input { min-height: 42px; padding-block: 6px; padding-inline-start: 40px; }
.inline-add { display: inline-flex; align-items: center; gap: 6px; }
.inline-add .input { min-height: 38px; padding-block: 4px; width: 170px; }

.rows-head, .row { display: grid; grid-template-columns: minmax(0, 1fr) 112px 92px 172px 80px 120px; gap: 20px; align-items: center; padding-inline: 12px; }
.rows-head { padding-block: 10px; font-size: 13px; font-weight: 600; color: var(--ink-mute); border-bottom: 1px solid var(--line-strong); }
.row { padding-block: 18px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; transition: background-color .16s var(--ease); }
.row:hover { background: var(--surface); }
.row-title { font-weight: 700; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.row-snippet { margin-block-start: 2px; color: var(--ink-mute); font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: contents; }
.row-cell { font-size: var(--fs-small); color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.row-cell.num { white-space: nowrap; }
.row-cell.mute { color: var(--ink-mute); }
.row-cell .who-by { display: block; color: var(--ink-mute); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.empty { padding-block: var(--s7); display: grid; gap: var(--s4); justify-items: start; max-width: 46ch; }
.empty p { color: var(--ink-soft); font-size: 18px; }
.skeleton { display: grid; gap: 0; }
.skeleton i { display: block; height: 76px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--line), var(--line)) no-repeat 12px 22px / 38% 14px, linear-gradient(var(--line), var(--line)) no-repeat 12px 46px / 62% 10px; opacity: .7; }
[dir="rtl"] .skeleton i { background-position: right 12px top 22px, right 12px top 46px; }

/* ---------- dialog ---------- */
dialog { width: 100%; max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); overflow: auto; }
dialog::backdrop { background: rgba(23, 27, 43, .46); }
dialog h2 { font-size: 24px; margin-block-end: var(--s5); }
.form { display: grid; gap: 20px; }
.form-two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.form-actions { display: flex; gap: var(--s2); align-items: center; margin-block-start: var(--s2); flex-wrap: wrap; }
.dialog-lead { color: var(--ink-soft); margin-block: calc(var(--s3) * -1) var(--s5); }
.cat-list { display: grid; gap: var(--s2); }
.cat-item { display: flex; gap: var(--s2); align-items: center; }
.cat-item .input { min-height: 42px; padding-block: 6px; }
.link-box { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--bg); font-size: 15px; overflow-wrap: anywhere; user-select: all; }

/* ---------- toast ---------- */
#toasts { position: fixed; inset-inline: 0; bottom: 20px; z-index: 60; display: grid; justify-items: center; gap: var(--s2); pointer-events: none; padding-inline: var(--s4); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s4); max-width: 100%; padding: 12px 18px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-size: 15px; box-shadow: var(--shadow-float); animation: rise .28s var(--ease); }
.toast button { border: 0; background: none; color: var(--marker); font-weight: 700; padding: 4px 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- idea page ---------- */
.idea-page { padding-block: var(--s2) var(--s8); }
.back { display: inline-flex; align-items: center; gap: 6px; padding-block: 8px; font-weight: 600; font-size: var(--fs-small); color: var(--ink-soft); text-decoration: none; }
.back:hover { color: var(--ink); }
.idea-head { display: grid; gap: var(--s4); margin-block: var(--s3) var(--s6); }
.idea-title { display: flex; align-items: flex-start; gap: var(--s2); }
.idea-title h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 900; overflow-wrap: anywhere; cursor: text; border-radius: 6px; }
.idea-title h1:hover { background: var(--brand-soft); box-shadow: 0 0 0 6px var(--brand-soft); }
.idea-title .input { font-size: clamp(22px, 3vw, 30px); font-weight: 800; min-height: 56px; }
.idea-meta { display: flex; align-items: center; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.idea-updated { font-size: 13px; color: var(--ink-mute); }

.idea-tabs { display: none; }
.idea { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 44px; align-items: start; }
.idea-main { min-width: 0; }
.idea-side { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; display: grid; gap: var(--s7); padding-block-end: var(--s4); padding-inline: 2px; scrollbar-width: thin; }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.side-sub { margin-block: 4px var(--s2); color: var(--ink-soft); font-size: var(--fs-small); }
.saved { font-size: 13px; font-weight: 600; color: var(--ok); opacity: 0; transition: opacity .2s; }
.saved.on { opacity: 1; }

/* script tools */
.tools { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s2); padding-block: 10px; background: var(--bg); }
.tools .grow { flex: 1; }
.speed { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); height: 36px; }
.speed button { width: 34px; height: 34px; border: 0; background: none; display: grid; place-items: center; border-radius: 6px; color: var(--ink-soft); }
.speed button:hover:not(:disabled) { color: var(--ink); background: var(--brand-soft); }
.speed button:disabled { opacity: .35; cursor: default; }
.speed-value { min-width: 78px; text-align: center; font-size: 13px; font-weight: 600; white-space: nowrap; }
.progress { display: flex; align-items: center; gap: var(--s3); margin-block: 2px var(--s3); font-size: 13px; color: var(--ink-mute); }
.progress-track { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; background: var(--ok); border-radius: 2px; transition: width .4s var(--ease); }

/* the page of text */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 44px 56px 60px; }
.script { font-size: var(--script-fs, 18px); line-height: 1.8; }
.blk { position: relative; margin-block-end: 1.05em; border-radius: 4px; transition: background-color .16s var(--ease), box-shadow .16s var(--ease); }
.blk:last-child { margin-block-end: 0; }
.blk-text { white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.blk.active { background: var(--brand-soft); box-shadow: 0 0 0 7px var(--brand-soft); }
.blk-edit { position: absolute; inset-inline-start: -44px; top: 0; width: 44px; height: 1.8em; display: grid; place-items: center; border: 0; background: none; color: var(--ink-mute); opacity: 0; transition: opacity .16s var(--ease), color .16s var(--ease); }
.blk:hover .blk-edit, .blk-edit:focus-visible { opacity: 1; }
.blk-edit:hover { color: var(--brand); }
@media (hover: none) { .blk-edit { display: none; } }

.mk { border-radius: 3px; padding-block: .1em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mk-done { background: var(--ok-soft); color: var(--ink-soft); }
.mk-note { background: var(--marker-soft); cursor: pointer; }
.mk-note.mk-done { color: var(--ink-soft); box-shadow: inset 0 -2px 0 var(--ok); }
.mk-note.hot, .mk-pend { background: var(--marker); }

.blk.editing { margin-inline: -12px; }
.blk-input, .full-input { display: block; width: 100%; padding: 8px 12px; border: 1px solid var(--brand); border-radius: var(--r-sm); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); font-size: inherit; line-height: inherit; resize: none; overflow: hidden; }
.blk-input:focus, .full-input:focus { outline: none; }
.full-input { min-height: 46vh; padding: 16px 18px; }
.blk-actions { display: flex; align-items: center; gap: var(--s2); margin-block: var(--s2) var(--s1); font-size: 16px; line-height: 1.4; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--ink-mute); margin-inline-start: var(--s2); }
.hint kbd { font: 600 12px var(--font); padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg); }
@media (hover: none) { .hint { display: none; } }
.conflict { margin-block-start: var(--s3); padding: 14px 16px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--ink); font-size: 15px; line-height: 1.5; display: grid; gap: var(--s2); }
.saved-chip { position: absolute; inset-inline-end: 0; top: -1.5em; font-size: 13px; font-weight: 700; color: var(--ok); animation: chip 1.8s var(--ease) forwards; pointer-events: none; }
@keyframes chip { 0% { opacity: 0; transform: translateY(4px); } 15%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.script-empty { display: grid; gap: var(--s4); justify-items: start; padding-block: var(--s4); font-size: 16px; line-height: 1.6; }
.script-empty p { color: var(--ink-soft); font-size: 18px; }
.idea-foot { margin-block-start: var(--s6); display: flex; justify-content: flex-end; }

/* floating helper next to the text */
.floater { position: absolute; z-index: 30; inset-inline: auto; }
.floater.bar { display: flex; gap: 2px; padding: 4px; border-radius: 10px; background: var(--ink); box-shadow: var(--shadow-float); animation: rise .18s var(--ease); }
.floater.bar button { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 14px; border: 0; border-radius: 7px; background: none; color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap; }
.floater.bar button:hover { background: rgba(255, 255, 255, .14); }
.floater.bar button:focus-visible { outline-color: var(--marker); }
.floater.card { width: 340px; max-width: calc(100vw - 24px); padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-float); display: grid; gap: var(--s3); animation: rise .18s var(--ease); }
.floater.sheet { position: fixed; top: auto !important; left: 12px !important; right: 12px; bottom: 12px; width: auto; max-width: none; }
.floater.bar.sheet { justify-content: center; }
.floater .note { padding-block: 0 12px; }
.floater .note:last-child { padding-block-end: 0; border-bottom: 0; }
.floater .note + .note { padding-block-start: 12px; }
.floater.bar.sheet button { flex: 1; justify-content: center; height: 46px; }
.floater .textarea { min-height: 84px; }
.floater-actions { display: flex; gap: var(--s2); align-items: center; }

/* cast: one row per character, like a call sheet */
.cast-head, .cast-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; column-gap: 10px; }
.cast-head { padding-block: 8px; font-size: 13px; font-weight: 600; color: var(--ink-mute); border-bottom: 1px solid var(--line-strong); }
.cast-row { align-items: start; padding-block: 8px; border-bottom: 1px solid var(--line); }
.bare { display: block; width: 100%; min-height: 34px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; font-size: 15px; line-height: 1.5; resize: none; overflow: hidden; }
.cast-row .bare { margin-inline-start: -8px; width: calc(100% + 8px); }
.cast-name { font-weight: 700; font-size: 16px; }
.cast-role { grid-column: 1 / 3; min-height: 30px; font-size: 14px; color: var(--ink-soft); }
.bare::placeholder { color: var(--ink-mute); opacity: 1; font-weight: 400; }
.bare:hover { background: var(--brand-soft); }
.bare:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.cast-add { margin-block-start: var(--s4); }

/* notes */
.notes-list { border-top: 1px solid var(--line); }
.note { padding-block: 14px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.note.hot { background: var(--surface); box-shadow: 0 0 0 8px var(--surface); border-radius: 4px; }
.note-quote { justify-self: start; max-width: 100%; border: 0; padding: 1px 5px; border-radius: 3px; background: var(--marker-soft); font-size: var(--fs-small); line-height: 1.5; text-align: start; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
button.note-quote:hover { background: var(--marker); }
.note-quote.loose { background: none; padding-inline: 0; color: var(--ink-mute); cursor: default; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: 13px; color: var(--ink-mute); }
.note-meta .grow { flex: 1; }
.note-form { display: grid; gap: var(--s2); margin-block-start: var(--s4); }
.note-form .textarea { min-height: 48px; resize: none; overflow: hidden; }
.note-form .btn { justify-self: start; }
.notes-none { padding-block: 14px; color: var(--ink-mute); font-size: var(--fs-small); border-bottom: 1px solid var(--line); }
.resolved-toggle { margin-block-start: var(--s3); }
.note.is-resolved .note-body { color: var(--ink-mute); }

/* reading mode: only the text */
body.reading .topbar, body.reading .back, body.reading .idea-meta, body.reading .idea-side, body.reading .idea-tabs, body.reading .idea-foot, body.reading .progress { display: none; }
body.reading .idea { grid-template-columns: minmax(0, 1fr); max-width: 780px; margin-inline: auto; }
body.reading .idea-head { max-width: 780px; margin-inline: auto; margin-block: var(--s5) var(--s3); }
body.reading .idea-title h1 { font-size: 24px; font-weight: 800; }
body.reading .paper { border-color: transparent; padding-block-end: 55vh; }
body.reading .script { font-size: var(--read-fs, 22px); line-height: 1.9; }
.only-reading, .only-narrow { display: none; }
body.reading .only-reading { display: inline-flex; }
body.reading .not-reading { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 980px) {
  .idea { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .idea-side { position: static; max-height: none; overflow: visible; }
  .idea-tabs { display: flex; margin-block-end: var(--s4); border-bottom: 1px solid var(--line-strong); gap: 2px 28px; }
  .idea[data-tab="text"] .idea-side { display: none; }
  .idea[data-tab="cast"] .idea-main, .idea[data-tab="cast"] .notes { display: none; }
  .idea[data-tab="notes"] .idea-main, .idea[data-tab="notes"] .cast { display: none; }
  body.reading .idea-main { display: block !important; }
  .rows-head { display: none; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-inline: 4px; }
  .row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
  .row-cell .who-by { display: inline; }
  .only-narrow { display: inline; }
  .row-cell:empty { display: none; }
  .rows { border-top: 1px solid var(--line-strong); }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; --fs-h1: 26px; }
  .topbar { padding-block: 14px; }
  .home-head { margin-block-end: var(--s6); }
  .home-head .btn { width: 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); gap: 22px; }
  .tabs::-webkit-scrollbar { display: none; }
  .filters-row { align-items: stretch; }
  .filters-row .seg { width: 100%; }
  .filters-row .seg button { flex: 1; padding-inline: 6px; }
  .search { flex: 1 1 100%; }
  .paper { padding: 22px 18px 32px; margin-inline: -4px; }
  body.reading .paper { padding-inline: 8px; }
  .tools { gap: 6px; }
  .tools .btn-sm { padding-inline: 10px; }
  .tools .wide { display: none; }
  .speed-value { min-width: 30px; }
  .edit-all { width: 36px; padding: 0; }
  .blk-edit { display: none; }
  #toasts { bottom: auto; top: 12px; }
  .form-two { grid-template-columns: 1fr; }
  dialog { padding: 22px 18px; }
  .blk.editing { margin-inline: -8px; }
  .blk-input { padding-inline: 8px; }
}
@media (min-width: 641px) { .tools .narrow { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
