/* CadreScripts Studio. Brand: docs/BRAND.md (the editor's): dark amber, white, black, charcoal grey; Inter for the
   interface, Source Serif 4 for the transcript. Every colour pair below is one the brand file measured. */
:root {
  --amber: #a35c00; --amber-press: #8a4d00; --amber-ink: #7a4500; --amber-soft: #fbeed6; --amber-tint: #fdf6ea; --amber-light: #e8952a;
  --bg: #f7f7f7; --surface: #fff; --s2: #f4f4f4; --s3: #ececec; --line: #e2e2e2; --line2: #8f8f8f;
  --ink: #1a1a1a; --ink2: #3d3d3d; --muted: #5c5c5c; --chrome: #282828; --chrome2: #333;
  --sp0: #2557c7; --sp1: #0f7b6c; --sp2: #8a3ffc; --sp3: #b0306a; --sp4: #5a6b00; --sp5: #00708a;
  --sp6: #5b4bb7; --sp7: #b8430b; --sp8: #0b6aa3; --sp9: #3f7a12; --sp10: #a3184f; --sp11: #4a5668;   /* (d): 12 speakers */
  --ok-bg: #e3f4ec; --ok-ink: #11623d; --moved-bg: #e9f4f1; --moved-ink: #0b5d52;
  --cut: #6e6962; --fill-tint: #fff4dc; --fill-line: #b86f00; --sel: #dce7fb; --lo: #6e93e0;
  --r: 10px; --shadow: 0 10px 30px rgba(0, 0, 0, .14);
  --ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --doc: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
/* (g) themes: html[data-theme] is set before the first paint by js/theme.js (System follows the device; Light, Dark,
   High contrast are chosen in the menu). High contrast: the editor's values (black on white, dark amber #7a3d00). */
:root[data-theme="dark"] {
    --bg: #141414; --surface: #1c1c1c; --s2: #242424; --s3: #2c2c2c; --line: #333; --line2: #6b6b6b;
    --ink: #f2f2f2; --ink2: #c8c8c8; --muted: #a1a1a1; --chrome: #0a0a0a; --chrome2: #242424;
    --amber-ink: #e8952a; --amber-soft: #2a2419; --amber-tint: #221d14; --cut: #8f8a82; --fill-tint: #2d2414; --fill-line: #e8952a;
    --sel: #23324f; --sp0: #7aa2ff; --sp1: #3fc1ad; --sp2: #b98cff; --sp3: #f07aac; --sp4: #b6c94a; --sp5: #4cc3dd;
    --sp6: #a99cff; --sp7: #ff9a5c; --sp8: #5cc0ff; --sp9: #9fd46a; --sp10: #ff7aa8; --sp11: #a9b4c4;
    --bad: #ff8a80; --ok-bg: #143524; --ok-ink: #7bd8a6; --moved-bg: #143524; --moved-ink: #7bd8a6; color-scheme: dark;
}
:root[data-theme="contrast"] {
    --bg: #fff; --s2: #fff; --s3: #d0d0d0; --line: #000; --line2: #000; --ink: #000; --ink2: #000; --muted: #1f1f1f;
    --amber: #7a3d00; --amber-press: #5c2e00; --amber-ink: #7a3d00; --amber-soft: #fff2db; --amber-tint: #fff2db; --amber-light: #ffb84d;
    --chrome: #000; --chrome2: #1f1f1f; --cut: #3d3d3d; --fill-tint: #fff2db; --fill-line: #7a3d00; --sel: #cfe3f7; --lo: #0b4f8a;
    --sp0: #0b4f8a; --sp1: #0a5e3c; --sp2: #4a2fb0; --sp3: #8a1a4c; --sp4: #3b5108; --sp5: #08585e; --sp6: #2c3e9a;
    --sp7: #8c2c0c; --sp8: #164f44; --sp9: #5e3a14; --sp10: #6f1f72; --sp11: #3d3d3d; --bad: #9b0000;
    --ok-bg: #e7f3ea; --ok-ink: #0b5a1e; --moved-bg: #e7f3ea; --moved-ink: #0b5a1e;
}
[data-theme="contrast"] :focus-visible { outline: 3px solid #000; box-shadow: 0 0 0 6px #ffe600; }
[data-theme="contrast"] a:not(.brand), [data-theme="contrast"] .linkish { text-decoration: underline; }
[data-theme="dark"] :is(.play, .who) { background: #f2f2f2; color: #141414; }   /* a black circle vanishes on the dark page */
[data-theme="contrast"] :is(.chip, .card, .projects a, .steps li, dialog, .menu-list, .find) { border: 1px solid #000; }
* { box-sizing: border-box; }
html [hidden] { display: none !important; }   /* wins over any class that sets display (e.g. .check) */
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--amber); }
kbd { font: 600 11px/1 var(--ui); padding: 3px 5px; border-radius: 4px; background: var(--s3); color: var(--ink2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.center { text-align: center; }
.msg { min-height: 1.2em; margin: 8px 0 0; color: var(--bad, #b42318); font-size: 14px; }

/* ---------------- buttons ---------------- */
.primary, .ghost, .soft, .chip { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap; }
.primary { background: var(--amber); color: #fff; }
.primary:hover { background: var(--amber-press); }
.primary:disabled { opacity: .55; cursor: default; }
.ghost { background: var(--surface); border-color: var(--line2); }
.ghost:hover { background: var(--s2); }
.ghost:disabled { opacity: .55; cursor: default; background: var(--surface); }
.soft { background: var(--amber-soft); color: var(--amber-ink); }
.chip { min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); border-color: var(--line); font-weight: 500; }
.icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; }
.icon:hover { background: var(--s2); }
.icon:disabled { opacity: .35; cursor: default; }
.wide { width: 100%; }
.count { background: var(--amber); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 12px; }
.count:empty { display: none; }

.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--s3); }
.seg.wide { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------------- top bar ---------------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 18px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.word { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.word b { color: var(--amber); font-weight: 700; }
.word span { font-weight: 500; color: var(--muted); }
.title-wrap { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.title { flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; font-weight: 600; font-size: 15px; background: transparent; }
.title:hover, .title:focus { border-color: var(--line2); background: var(--surface); }
.saved { font-size: 12px; color: var(--muted); white-space: nowrap; }
.saved.warn { color: var(--bad, #b42318); }
.bar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.who { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: var(--chrome); color: #fff; font-weight: 600; }
.menu-list { position: absolute; right: 0; top: 46px; min-width: 240px; padding: 6px; background: var(--chrome); border-radius: 12px; box-shadow: var(--shadow); display: grid; }
.menu-list a, .menu-list button { display: block; text-align: left; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: #fff; text-decoration: none; font-size: 14px; }
.menu-list a:hover, .menu-list button:hover { background: var(--chrome2); }
/* (g) the menu's account line and Theme; the footer; Studio's question dialog */
.acct { padding: 8px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--chrome2); color: #fff; display: grid; overflow-wrap: anywhere; }
.acct small { color: #b3b3b3; font-size: 12px; }
.theme { padding: 6px 12px 8px; color: #b3b3b3; font-size: 12px; display: grid; gap: 6px; }
.menu-list .theme .seg { background: var(--chrome2); }
.menu-list .theme .seg button { padding: 0 8px; min-height: 30px; color: #d9d9d9; font-size: 12px; text-align: center; }
.menu-list .theme .seg button[aria-pressed="true"] { background: #fff; color: #1a1a1a; }
.foot { display: none; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 20px 16px 28px; font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--ink); }
html[data-screen="home"] .foot, html[data-screen="signin"] .foot { display: flex; }
.primary.danger { background: var(--bad, #b42318); }
[data-theme="dark"] .primary.danger { background: #b42318; }
.howto { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14px; color: var(--ink2); }
.howto b { color: var(--ink); margin-right: 4px; }
.handoff.quiet { padding: 0; background: none; border: 0; }

/* screens: one shows at a time (html[data-screen]) */
.screen { display: none; }
html[data-screen="signin"] .signin, html[data-screen="home"] .home, html[data-screen="editor"] .editor { display: block; }
html[data-screen="editor"] .editor { display: grid; }
[data-show="editor"] { display: none !important; }
html[data-screen="editor"] [data-show="editor"] { display: inline-flex !important; }
html[data-screen="editor"] .title-wrap[data-show="editor"] { display: flex !important; }
html[data-screen="signin"] [data-show="in"], html[data-screen="loading"] [data-show="in"] { display: none; }

/* ---------------- sign in ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.narrow { max-width: 440px; margin: 7vh auto; }
.mark { display: block; margin-bottom: 14px; }
.signin h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
.lead { color: var(--ink2); margin: 0 0 18px; }
form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input[type=email], input[type=password], input[inputmode], input[type=number], select, .grid2 input, .field {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--surface); }
.signin .primary { margin-top: 14px; min-height: 46px; }
.fine { font-size: 13px; color: var(--muted); margin: 16px 0 0; }

/* ---------------- home ---------------- */
.home-grid { max-width: 1100px; margin: 0 auto; padding: 32px 22px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; }
.home h1 { font-size: 30px; margin: 0 0 18px; letter-spacing: -.01em; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 240px; padding: 24px; text-align: center;
  border: 2px dashed var(--line2); border-radius: 16px; background: var(--surface); cursor: pointer; }
.drop svg { width: 30px; height: 30px; color: var(--amber); }
.drop span { color: var(--muted); font-size: 14px; }
.drop.over { border-color: var(--amber); background: var(--amber-tint); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.opts label { margin: 0; font-size: 14px; }
.opts select { width: auto; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }
.progress { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--chrome); color: #fff; }
.progress-text { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 8px; }
.progress-text span { color: #b3b3b3; }
.track { height: 6px; border-radius: 3px; background: #3b3832; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--amber-light); transition: width .3s; }
/* (g) the projects list: kind, name, length, last edit, state; Rename / Delete in a menu */
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.proj { position: relative; display: flex; align-items: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.proj:hover, .proj:focus-within { border-color: var(--line2); }
.proj > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 4px 12px 14px; text-decoration: none; color: var(--ink); }
.proj > a > svg { color: var(--muted); }
.p-t { flex: 1; min-width: 0; }
.projects b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.projects small { color: var(--muted); font-size: 12px; }
.projects em { font-style: normal; color: var(--amber-ink); font-weight: 600; }
.p-tag { flex: none; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--s3); color: var(--ink2); }
.p-tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.p-tag.busy { background: var(--amber-soft); color: var(--amber-ink); }
.p-menu summary { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); font-size: 18px; margin-right: 4px; }
.p-menu summary:hover { background: var(--s2); color: var(--ink); }
.p-menu .menu-list { top: 44px; min-width: 150px; z-index: 5; }
.p-empty { padding: 16px; border: 1px dashed var(--line2); border-radius: 12px; color: var(--muted); font-size: 14px; }
.p-find { margin-bottom: 10px; min-height: 38px; }
.plan-note { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--s2); font-size: 13px; color: var(--ink2); }
.plan-note:empty { display: none; }
.promise, .human { margin-top: 14px; padding: 14px; border-radius: 12px; font-size: 13px; color: var(--ink2); }
.promise { background: var(--amber-tint); border: 1px solid var(--amber-soft); }
.human { border: 1px solid var(--line); background: var(--surface); }
.promise b, .human b { display: block; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.promise p, .human p { margin: 0; }
.steps { list-style: none; counter-reset: st; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { counter-increment: st; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.steps li::before { content: counter(st); display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; background: var(--amber-soft); color: var(--amber-ink); font-weight: 700; font-size: 12px; margin-bottom: 8px; }
.steps b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }

/* ---------------- editor ---------------- */
.editor { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - 61px); }
.side { grid-row: 1; padding: 18px; border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; gap: 22px; }
.player { display: grid; gap: 12px; }
.video { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video video { width: 100%; height: 100%; object-fit: contain; display: block; }
.transport { display: flex; align-items: center; gap: 12px; }
.play { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--chrome); color: #fff; display: flex; align-items: center; justify-content: center; }
.play svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.play .i-pause, .playing .play .i-play { display: none; }
.playing .play .i-pause { display: block; }
.times { flex: 1; min-width: 0; }
.now { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 16px; }
.of { color: var(--muted); font-weight: 400; }
.was { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.was b { color: var(--amber-ink); }
.speakers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.speakers li { display: flex; align-items: center; gap: 8px; }
.speakers i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.speakers input { flex: 1; min-height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.doc { grid-row: 1; position: relative; overflow: auto; }
.tools { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 32px; background: var(--bg); border-bottom: 1px solid var(--line); }
.find { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border-radius: 10px; background: var(--s3); flex: 1 1 220px; max-width: 340px; color: var(--muted); }
.find input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; color: var(--ink); font-size: 14px; }
.find-count { font-size: 13px; color: var(--muted); }
.legend { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.legend i { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.lg-fill { background: var(--fill-tint); border-bottom: 2px dotted var(--fill-line); }
.lg-lo { border-bottom: 2px solid var(--lo); }
.lg-fix { border-bottom: 2px solid var(--sp1); }
.legend s { color: var(--cut); }
#helpBtn { width: 32px; height: 32px; border: 1px solid var(--line2); border-radius: 50%; font-weight: 700; color: var(--ink2); }
#cutsBtn .slash { display: none; }
#cutsBtn[aria-pressed="true"] { background: var(--amber-soft); color: var(--amber-ink); }
#cutsBtn[aria-pressed="true"] .slash { display: block; }
.tx .spn { font-weight: 600; cursor: pointer; border-radius: 4px; }
.tx .spn:hover, .tx .spk time:hover { text-decoration: underline; }
.state { margin: 18px 32px 0; padding: 14px 16px; border-radius: 12px; background: var(--amber-tint); color: var(--ink2); font-size: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.state:empty { display: none; }
.tx { max-width: 860px; padding: 24px 32px 120px; font: 19px/1.8 var(--doc); outline: none; user-select: text; }
.tx .p { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; margin: 0 0 22px; }
.tx .spk { display: block; font: 600 13px/1.4 var(--ui); padding-top: 6px; }
.tx .spk.sp0 { color: var(--sp0); } .tx .spk.sp1 { color: var(--sp1); } .tx .spk.sp2 { color: var(--sp2); }
.tx .spk.sp3 { color: var(--sp3); } .tx .spk.sp4 { color: var(--sp4); } .tx .spk.sp5 { color: var(--sp5); }
.tx .spk.sp6 { color: var(--sp6); } .tx .spk.sp7 { color: var(--sp7); } .tx .spk.sp8 { color: var(--sp8); }
.tx .spk.sp9 { color: var(--sp9); } .tx .spk.sp10 { color: var(--sp10); } .tx .spk.sp11 { color: var(--sp11); }
.tx .spk time { display: block; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; cursor: pointer; }
.tx .words { margin: 0; }
.tx .w { border-radius: 3px; cursor: text; }
.tx .w.fl { background: var(--fill-tint); box-shadow: inset 0 -2px 0 var(--fill-line); }
.tx .w.lo { box-shadow: inset 0 -2px 0 var(--lo); }
.tx .w.fixed { box-shadow: inset 0 -2px 0 var(--sp1); }
.tx .w.joined { display: inline-block; width: 0; }
.tx .w.cut { color: var(--cut); text-decoration: line-through; text-decoration-color: var(--line2); background: transparent; box-shadow: none; }
.hidecuts .tx .w.cut, .hidecuts .tx .gap.cutgap { display: none; }
.tx .w.now { background: var(--amber); color: #fff; }
.tx .w.hit { outline: 2px solid var(--amber); }
.tx .gap { display: inline-block; font: 600 11px/1 var(--ui); padding: 3px 7px; border-radius: 999px; background: var(--s3); color: var(--ink2); vertical-align: 3px; margin: 0 2px; user-select: none; }
.tx .gap.short { background: var(--amber-soft); color: var(--amber-ink); }
.tx .moved { display: inline-block; font: 600 12px/1 var(--ui); padding: 5px 9px; border-radius: 999px; background: var(--moved-bg); color: var(--moved-ink); margin-bottom: 4px; user-select: none; }
.tx ::selection { background: var(--sel); }
.empty { color: var(--muted); font: 15px/1.6 var(--ui); }
.selbar { position: fixed; z-index: 30; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; background: var(--chrome); box-shadow: var(--shadow); }
.selbar button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 13px; font-weight: 500; }
.selbar button:hover { background: var(--chrome2); }
.selbar kbd { background: #444; color: #ddd; }
.selinfo { font-size: 12px; color: #b3b3b3; padding: 0 8px; }
.movebar { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--chrome); color: #fff; box-shadow: var(--shadow); }
.moving .tx .w { cursor: crosshair; }
.timeline { grid-column: 1 / -1; grid-row: 2; padding: 10px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.timeline canvas { display: block; width: 100%; height: 64px; cursor: pointer; }
.keys { font-size: 12px; color: var(--muted); text-align: right; }
.tl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.tl-mode button { min-height: 26px; padding: 0 10px; font-size: 12px; }

/* ---------------- phones and tablets ---------------- */
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; height: auto; min-height: calc(100vh - 61px); }
  .side { grid-row: 1; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; gap: 12px; }
  .side section { display: none; }
  .doc { grid-row: 2; overflow: visible; }
  .tools { padding: 10px 14px; }
  .legend { display: none; }
  .tx { padding: 16px 14px 120px; font-size: 18px; }
  .tx .p { grid-template-columns: 1fr; gap: 2px; }
  .timeline { grid-row: 3; position: sticky; bottom: 0; }
  .keys { display: none; }
  .bar { padding: 8px 10px; gap: 6px 8px; }
  .word { display: none; }
  .bar-actions { margin-left: 0; width: 100%; justify-content: space-between; gap: 4px; flex-wrap: nowrap; }
  .bar .primary, .bar .soft { padding: 0 12px; }
  .bar .primary svg, .bar .soft svg { display: none; }
  html[data-screen="home"] .bar-actions { width: auto; margin-left: auto; }
  .bar-actions .ghost#cutsBtn { display: none !important; }
  .selbar { left: 8px !important; right: 8px; top: auto !important; bottom: 104px; justify-content: space-around; }
  .timeline { padding: 6px 12px 8px; }
  .timeline canvas { height: 46px; }
  .tl-row { margin-top: 4px; }
  .tx { padding-bottom: 200px; }
  .selinfo { display: none; }
  .selbar kbd { display: none; }   /* no keyboard on a phone: room for every button */
  .selbar button { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
