/* ----------------------------------------------------------------
   my next stop, reel maker
   Same design system as the map: one sans stack, flat surfaces,
   soft shadows, one accent, tactile buttons. Self-contained so the
   page loads without the site stylesheet.
   ---------------------------------------------------------------- */

:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f1f3f5;
  --ink: #1b1e22;
  /* 5.0:1 on the panel-2 surface, so muted metadata still clears AA */
  --muted: #5f6974;
  --line: #e4e7eb;
  --accent: #0e7a6c;
  --accent-soft: #e3f2ef;
  --accent-ink: #ffffff;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --elev-1: 0 1px 2px rgba(16, 20, 24, .07), 0 4px 14px rgba(16, 20, 24, .07);
  --elev-2: 0 2px 6px rgba(16, 20, 24, .09), 0 12px 36px rgba(16, 20, 24, .16);
}

:root[data-theme="dark"] {
  --bg: #14171a;
  --panel: #1e2126;
  --panel-2: #272b31;
  --ink: #eceff2;
  --muted: #9aa4af;
  --line: #33383f;
  --accent: #34b3a0;
  --accent-soft: #123029;
  --accent-ink: #06231f;
  --elev-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .4);
  --elev-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 36px rgba(0, 0, 0, .55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171a;
    --panel: #1e2126;
    --panel-2: #272b31;
    --ink: #eceff2;
    --muted: #9aa4af;
    --line: #33383f;
    --accent: #34b3a0;
    --accent-soft: #123029;
    --accent-ink: #06231f;
    --elev-1: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .4);
    --elev-2: 0 2px 6px rgba(0, 0, 0, .45), 0 12px 36px rgba(0, 0, 0, .55);
  }
}

/* ----- base ----- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button, a, select, label, input { touch-action: manipulation; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--accent-ink); }
.reel-top, .card, .dlg, button { user-select: none; -webkit-user-select: none; }

.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: 0 0 auto; }
.btn .ic, .icon-btn .ic { width: 16px; height: 16px; }

.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: calc(12px + var(--sal)); top: -60px; z-index: 200;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 16px; box-shadow: var(--elev-2);
  text-decoration: none;
}
.skip-link:focus { top: calc(var(--sat) + 12px); }

/* ----- buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; padding: 12px 20px; font-weight: 650; letter-spacing: .1px;
  min-height: 46px; text-decoration: none;
  transition: transform .14s cubic-bezier(.2,.9,.3,1.3), box-shadow .18s ease, background .12s ease;
}
.btn .ic { transition: transform .15s ease; }
.btn-wide { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  box-shadow: var(--elev-1);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--elev-2); }
.btn-primary:hover .ic { transform: translateY(1px); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-primary:disabled { opacity: .5; transform: none; cursor: default; box-shadow: none; }
@supports (background: color-mix(in srgb, red, blue)) {
  .btn-primary {
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--accent) 86%, #fff) 0%,
      var(--accent) 45%,
      color-mix(in srgb, var(--accent) 84%, #000) 100%);
    border-color: color-mix(in srgb, var(--accent) 62%, #000);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32),
                0 1px 2px rgba(10, 14, 13, .18),
                0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
  }
  .btn-primary:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32),
                0 2px 4px rgba(10, 14, 13, .2),
                0 10px 26px color-mix(in srgb, var(--accent) 42%, transparent);
  }
  .btn-primary:active {
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .24), 0 1px 2px rgba(10, 14, 13, .14);
  }
}

.btn-ghost {
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(16, 20, 24, .06);
}
.btn-ghost:hover { background: var(--panel-2); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(0) scale(.98); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; font-size: 16px;
  background: var(--panel); border: 1px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto;
  transition: background .12s ease, transform .12s ease;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* ----- shell ----- */
/* Horizontal insets matter too: viewport-fit=cover puts a landscape notch
   right where the leftmost controls sit. */
.wrap {
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: calc(var(--sat) + 12px) calc(16px + var(--sar)) 24px calc(16px + var(--sal));
}

.reel-top { display: flex; align-items: center; gap: 10px; }
.brand {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  text-decoration: none; color: var(--ink);
}
.brand-mark { width: 22px; height: 22px; color: var(--accent); }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.pill-accent {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 4px 11px;
  font-size: 12px; font-weight: 650; letter-spacing: .01em;
}
.top-theme { margin-left: auto; }

.intro { grid-area: intro; padding: 18px 2px 4px; }
.intro h1 { font-size: clamp(26px, 6vw, 34px); font-weight: 700; letter-spacing: -.025em; }
.intro-sub { color: var(--muted); font-size: 14.5px; margin-top: 6px; max-width: 44ch; }

.grid { display: flex; flex-direction: column; gap: 14px; }
.col-left { display: flex; flex-direction: column; gap: 14px; }
.col-right { min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--elev-1);
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.card-head { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.txt {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--ink);
  padding: 12px 14px; font: inherit; font-size: 16px; outline: none;
  transition: border-color .12s ease, background .12s ease;
}
.txt:focus { border-color: var(--accent); background: var(--panel); }
.txt::placeholder { color: var(--muted); }

/* ----- combobox ----- */
.combo { position: relative; }
.combo-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; height: 48px;
  transition: border-color .12s ease, background .12s ease;
}
.combo-box:focus-within { border-color: var(--accent); background: var(--panel); }
.combo-box .ic { width: 18px; height: 18px; color: var(--muted); }
.combo-box input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  color: var(--ink); font: inherit; font-size: 16px; height: 100%;
}
.combo-box input::placeholder { color: var(--muted); }

.combo-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 70;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--elev-2);
  overflow-y: auto; max-height: min(52dvh, 340px);
  padding: 6px;
}
.rs-group + .rs-group { margin-top: 4px; }
.rs-head {
  font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px 5px;
}
.rs-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 10px; min-height: 44px;
  cursor: pointer;
}
.rs-item:hover, .rs-item.is-active { background: var(--panel-2); }
.rs-item.is-active { box-shadow: inset 0 0 0 1px var(--accent); }
.rs-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--accent); flex: 0 0 auto; }
.rs-pin { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.rs-main { min-width: 0; flex: 1; }
.rs-name { font-size: 14.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-msg { padding: 12px 10px; font-size: 13.5px; color: var(--muted); }

/* ----- stops list ----- */
.stops { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; }
.stops:empty { display: none; }
.stops-empty { font-size: 13.5px; color: var(--muted); }

.stop-item { position: relative; }
.stop-item.is-dragging { z-index: 5; }
.stop-item.is-dragging .stop-row {
  background: var(--panel); box-shadow: var(--elev-2); border-color: var(--accent);
}

.stop-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 9px 10px;
  min-height: 56px;
}
.stop-num {
  width: 30px; height: 30px; border-radius: 10px; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  cursor: grab; touch-action: none;
}
.stop-num:active { cursor: grabbing; }
.stop-main { flex: 1; min-width: 0; }
/* one control, two targets: the text and the pencil both open the editor */
.stop-label-row {
  display: flex; align-items: center; gap: 2px; min-width: 0;
  width: 100%; text-align: left; min-height: 30px;
  border-radius: 8px; padding: 0 2px;
  transition: background .12s ease;
}
.stop-label-row:hover { background: var(--line); }
.stop-label {
  font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stop-edit {
  width: 24px; height: 24px; display: grid; place-items: center;
  color: var(--muted); flex: 0 0 auto; opacity: .55;
  transition: opacity .12s ease, color .12s ease;
}
.stop-label-row:hover .stop-edit { opacity: 1; color: var(--ink); }
.stop-edit .ic { width: 14px; height: 14px; }
.stop-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-input {
  width: 100%; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--panel); color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 600; padding: 4px 8px; outline: none;
}

.stop-acts { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.row-btn {
  width: 40px; height: 44px; border-radius: 9px; color: var(--muted);
  display: grid; place-items: center;
  opacity: 0; transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.row-btn .ic { width: 16px; height: 16px; }
.row-btn:hover { background: var(--line); color: var(--ink); }
.row-btn:disabled { opacity: 0; cursor: default; }
.stop-row:hover .row-btn, .row-btn:focus-visible { opacity: 1; }
.stop-row:hover .row-btn:disabled { opacity: .25; }
.row-remove:hover { color: #d4482c; }
@media (hover: none) {
  .row-btn { opacity: 1; }
  .row-btn:disabled { opacity: .25; }
}

.drop-line {
  position: absolute; left: 4px; right: 4px; height: 2px;
  background: var(--accent); border-radius: 99px; pointer-events: none; z-index: 6;
}
.drop-line::before {
  content: ""; position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 99px; background: var(--accent);
}

/* leg connector: the dashed rail lines up under the number badge */
.leg {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  padding: 6px 0 6px 14px; margin-left: 25px;
  border-left: 2px dashed var(--line);
}

/* one control shows the leg's travel mode; the picker unfolds under it */
.mode-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  height: 36px; padding: 0 7px 0 8px; border-radius: 10px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 2px rgba(16, 20, 24, .06);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.mode-trigger:hover { background: var(--panel-2); }
.mode-trigger[aria-expanded="true"] {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
}
.mode-trigger .mode-ic { width: 20px; height: 20px; }
.mode-chev { width: 14px; height: 14px; color: var(--muted); transition: transform .12s ease; }
.mode-trigger[aria-expanded="true"] .mode-chev { color: var(--accent); transform: rotate(180deg); }

.leg-picker {
  flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 3px;
  padding: 2px 0;
}
.mode-btn {
  width: 36px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; color: var(--muted);
  border: 1px solid transparent;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.mode-btn svg, .mode-ic { width: 19px; height: 19px; display: block; }
.mode-btn:hover { background: var(--panel-2); color: var(--ink); }
.mode-btn[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.leg-km { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* the router had no road for this leg: say so, and offer another go */
.leg-note { font-size: 12px; color: var(--muted); }
.leg-retry {
  font-size: 12px; font-weight: 650; color: var(--accent);
  min-height: 28px; padding: 0 7px; border-radius: 8px;
  transition: background .12s ease;
}
.leg-retry:hover { background: var(--accent-soft); }

/* the road route for this leg is still on the wire */
.leg-spin {
  width: 12px; height: 12px; border-radius: 99px; flex: 0 0 auto;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: leg-spin .7s linear infinite;
}
@keyframes leg-spin { to { transform: rotate(360deg); } }

/* Every small control keeps its tight visual size and wins a 44px pointer
   target through an invisible extension. Nothing moves, only hit testing
   grows, so the mode picker's eight icons still fit a 360px phone. */
.stop-num, .stop-label-row, .row-btn, .mode-btn, .mode-trigger, .leg-retry { position: relative; }
.stop-num::after,
.stop-label-row::after,
.row-btn::after,
.mode-btn::after,
.mode-trigger::after,
.leg-retry::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
}
.stop-num::after { left: -7px; right: -7px; top: -7px; bottom: -7px; }
.stop-label-row::after { top: -7px; bottom: -7px; }
.row-btn::after { left: -2px; right: -2px; }
.mode-btn::after { left: -2px; right: -2px; top: -2px; bottom: -2px; }
.mode-trigger::after { top: -4px; bottom: -4px; }
.leg-retry::after { top: -8px; bottom: -8px; }

/* ----- style cards ----- */
.style-row {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.style-card {
  flex: 0 0 auto; width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 14px; padding: 4px 4px 6px;
  border: 1px solid transparent;
  transition: transform .12s ease;
}
.style-card:hover { transform: translateY(-2px); }
.style-card canvas {
  width: 96px; height: 128px; border-radius: 12px; display: block;
  border: 1px solid var(--line); box-shadow: var(--elev-1);
}
.style-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.style-card[aria-checked="true"] canvas { box-shadow: 0 0 0 2px var(--accent), var(--elev-1); border-color: var(--accent); }
.style-card[aria-checked="true"] .style-name { color: var(--accent); }

/* ----- segmented ----- */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
}
.seg-btn {
  flex: 1; min-width: 0; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; padding: 8px 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-glyph { width: 15px; height: 15px; }
.seg-btn[aria-checked="true"] {
  background: var(--panel); color: var(--ink);
  box-shadow: var(--elev-1);
}
:root[data-theme="dark"] .seg-btn[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
/* Same treatment for a system-dark visitor who never touched the toggle,
   mirroring the token block above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg-btn[aria-checked="true"] {
    background: var(--accent-soft); color: var(--accent);
  }
}

/* ----- preview ----- */
.preview-hold { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.phone {
  border-radius: 24px; border: 1px solid var(--line);
  box-shadow: var(--elev-2); background: var(--panel);
  padding: 6px; line-height: 0;
  max-width: 100%;
}
.phone canvas { border-radius: 18px; display: block; max-width: 100%; }

.empty {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--elev-1);
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
.empty-title { font-size: 16px; font-weight: 650; }
.empty-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.empty-steps li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.step-n {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
}

.playbar {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--elev-1); padding: 8px 12px 8px 8px;
}
.play-btn { width: 44px; height: 44px; color: var(--accent); }
.timecode { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* 44px tall for the thumb target; the playbar is already that tall because
   of the play button, so the row does not grow. */
.seek {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 44px; background: none; outline: none; margin: 0;
}
.seek::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right,
    var(--accent) 0 calc(var(--pct, 0) * 1%), var(--line) calc(var(--pct, 0) * 1%) 100%);
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -5px; border-radius: 99px;
  background: var(--accent); border: 2px solid var(--panel); box-shadow: var(--elev-1);
}
.seek::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
.seek::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--accent); }
.seek::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 99px; border: 2px solid var(--panel);
  background: var(--accent); box-shadow: var(--elev-1);
}

/* ----- mobile sticky export ----- */
.export-bar {
  position: sticky; bottom: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--line);
  padding: 10px calc(16px + var(--sar)) calc(10px + var(--sab)) calc(16px + var(--sal));
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .export-bar { background: var(--bg); }
}
@supports (backdrop-filter: blur(8px)) {
  .export-bar { backdrop-filter: blur(10px); }
}

/* ----- footer ----- */
.reel-foot {
  margin-top: 26px; padding: 16px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.foot-links { display: flex; gap: 14px; margin-top: 4px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--accent); }

/* ----- export dialog ----- */
dialog:not([open]) { display: none; }
dialog[open] { display: block; }
.reel-dlg {
  border: 0; padding: 0; margin: 0;
  width: 100%; max-width: 460px; max-height: 88dvh;
  background: var(--panel); color: var(--ink);
  border-radius: 20px 20px 0 0;
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); top: auto;
  box-shadow: var(--elev-2);
  overflow-y: auto;
}
.reel-dlg::backdrop { background: rgba(10, 12, 14, .5); }
.ex-wrap { padding: 20px 18px calc(18px + var(--sab)); display: flex; flex-direction: column; gap: 14px; }
.ex-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.ex-pane { display: flex; flex-direction: column; gap: 14px; }
.ex-stage { font-size: 14px; color: var(--muted); }
.ex-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-bar {
  height: 8px; border-radius: 99px; background: var(--panel-2);
  overflow: hidden; border: 1px solid var(--line);
}
.ex-bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s ease; }
.ex-video {
  width: 100%; max-height: 46dvh; border-radius: 14px; background: #000;
  display: block; object-fit: contain;
}
.ex-meta { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ex-note { font-size: 12.5px; color: var(--muted); }
.ex-acts { display: flex; flex-direction: column; gap: 8px; }

/* ----- toasts and announcements ----- */
.live {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--sab) + 84px); z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--elev-2);
  padding: 10px 12px 10px 16px; font-size: 13.5px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-show { opacity: 1; transform: translateY(0); }
.toast-act {
  color: var(--accent); font-weight: 650; font-size: 13px;
  padding: 6px 10px; border-radius: 9px; min-height: 44px; min-width: 44px;
}
.toast-act:hover { background: var(--accent-soft); }

/* ----- breakpoints ----- */
@media (min-width: 980px) {
  .wrap { padding: calc(var(--sat) + 18px) calc(24px + var(--sar)) 40px calc(24px + var(--sal)); }
  .grid {
    display: grid; gap: 8px 28px;
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-areas: "intro preview" "controls preview";
    align-items: start;
  }
  .col-left { grid-area: controls; }
  .col-right { grid-area: preview; position: sticky; top: 24px; }
  .intro { padding: 6px 2px 10px; }
  .export-bar { display: none; }
}

/* Small phones: buy back the width the leg rail and the aspect glyphs take,
   and lay the picker out as two even rows of four instead of a ragged wrap. */
@media (max-width: 420px) {
  .leg { margin-left: 18px; padding-left: 11px; }
  .leg-picker { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
  .mode-btn { width: 40px; }
}
@media (max-width: 379px) {
  .seg-glyph { display: none; }
  .seg-btn { font-size: 12px; padding: 8px 3px; }
}

/* Mobile keeps the DOM order: header, intro, preview, playback, stops,
   style, options, footer. Only the toast stack has to clear the
   sticky export bar. */
@media (max-width: 979px) {
  .live { bottom: calc(var(--sab) + 96px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  /* A ring that cannot turn is just a stray dot, so pending says so in
     type instead. The span stays aria-hidden, so nothing new is announced. */
  .leg-spin {
    width: auto; height: auto; border: 0; border-radius: 0;
    font-size: 12px; line-height: 1; color: var(--muted);
  }
  .leg-spin::before { content: "\2026"; }
}
