/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #EAEEE8;
  --surface: #FFFFFF;
  --surface-2: #F3F6F1;
  --ink: #1B2622;
  --muted: #5A6762;
  --line: #D3DAD1;
  --accent: #36453B;
  --accent-ink: #FFFFFF;
  --playhead: #D0393B;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(27, 38, 34, .08);
  /* Brand colours from the logo. The orange is too light for small text on
     white, so small orange text uses the darker --brand-accent-text. */
  --brand: #36453B;
  --brand-accent: #F08700;
  --brand-accent-text: #9A5200;
  --radius: 12px;
  --nav-height: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121815;
    --surface: #1A221F;
    --surface-2: #212B27;
    --ink: #E4EBE7;
    --muted: #98A6A0;
    --line: #303C37;
    --accent: #9DBFA5;
    --accent-ink: #13201A;
    --playhead: #FF6B6B;
    --danger: #E5534B;
    --shadow: none;
    --brand: #CFE0D3;
    --brand-accent: #F08700;
    --brand-accent-text: #F08700;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121815;
  --surface: #1A221F;
  --surface-2: #212B27;
  --ink: #E4EBE7;
  --muted: #98A6A0;
  --line: #303C37;
  --accent: #9DBFA5;
  --accent-ink: #13201A;
  --playhead: #FF6B6B;
  --danger: #E5534B;
  --shadow: none;
  --brand: #CFE0D3;
  --brand-accent: #F08700;
  --brand-accent-text: #F08700;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--nav-height) + 12px); }

body {
  margin: 0;
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2 { margin: 0 0 10px; line-height: 1.25; }
h2 { font-size: 1rem; }

.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small-text { font-size: .85rem; }
.tabular { font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }

.app { max-width: 1440px; margin: 0 auto; padding: 18px 16px 40px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Controls
   ========================================================================== */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 12px;
  line-height: 1.2;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: .85rem; }
.btn.icon { min-width: 36px; padding: 6px 8px; font-size: 1.05rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.danger-outline:hover { border-color: var(--danger); }

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: .85rem;
  text-decoration: underline;
}

.field, select, textarea, input[type="number"] {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 6px 8px;
}
textarea { width: 100%; min-height: 64px; resize: vertical; padding: 8px; }

label.inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }

kbd {
  font-family: inherit;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  background: var(--surface-2);
}

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Navigation bar and footer
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 12;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.navbar-inner {
  max-width: 1440px;
  min-height: var(--nav-height);
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand img { display: block; border-radius: 9px; box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0, 0, 0, .12); }
.brand-name { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.brand-name span { color: var(--brand-accent); }
.video-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.status { color: var(--muted); font-size: .85rem; }
.work-only { display: flex; align-items: center; gap: 6px; }

.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}
.site-footer nav { display: flex; gap: 16px; }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--ink); }

.boot-error { max-width: 560px; margin: 24px auto; padding: 18px 20px; border-color: var(--danger); }
.boot-error a { color: var(--accent); }

/* Account and login */
.account { display: flex; align-items: center; gap: 8px; }
.account-email { color: var(--muted); font-size: .85rem; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login { display: flex; justify-content: center; padding: 24px 0 40px; }
.login-card { width: 100%; max-width: 440px; padding: 28px 28px 20px; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.login-card > p { margin: 0 0 8px; }
.login-error { margin: 12px 0 0; color: var(--danger); font-weight: 700; }
.login-card code { font-size: .8rem; overflow-wrap: anywhere; }
.login-card a { color: var(--accent); }
.login-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Hanko's login form, themed with the app's colours */
hanko-auth {
  --color: var(--ink);
  --color-shade-1: var(--muted);
  --color-shade-2: var(--line);
  --brand-color: var(--accent);
  --brand-color-shade-1: color-mix(in srgb, var(--accent) 85%, var(--ink));
  --brand-contrast-color: var(--accent-ink);
  --background-color: var(--surface);
  --error-color: var(--danger);
  --link-color: var(--accent);
  --font-family: inherit;
  --font-size: 15px;
  --border-radius: 8px;
  --container-padding: 0;
  --container-max-width: 100%;
}

/* Legal pages (Impressum) */
.legal { max-width: 760px; }
.legal-text { padding: 28px 32px; }
.legal-text h1 { font-size: 1.6rem; margin-bottom: 18px; }
.legal-text h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.legal-text p { margin: 0 0 8px; }
.legal-text ul { margin: 0 0 8px; padding-left: 1.3em; }
.legal-text li { margin-bottom: 4px; }
.legal-text a { color: var(--accent); }
a.btn { color: inherit; text-decoration: none; }
a.btn.primary { color: var(--accent-ink); }
@media (max-width: 600px) {
  .legal-text { padding: 20px 18px; }
}

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; font-size: .8em; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 15;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .2);
}
.menu-list button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 6px; }
.menu-list button:hover { background: var(--surface-2); }

/* ==========================================================================
   Start screen
   ========================================================================== */
.start { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }

.drop {
  padding: 48px 28px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.drop.over { border-color: var(--accent); background: var(--surface-2); }
.drop h1 { font-size: 1.5rem; margin-bottom: 8px; }
.drop p { color: var(--muted); max-width: 52ch; margin: 0 auto 18px; }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.drop .hint { margin: 16px auto 0; }

.saved { padding: 18px; }
.saved ul { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.saved li:first-child { border-top: 0; }
.saved .info { flex: 1; min-width: 0; }
.saved .name { font-weight: 700; overflow-wrap: anywhere; }
.saved .meta { color: var(--muted); font-size: .85rem; }
.saved .actions { display: flex; flex-direction: column; gap: 6px; }
.backup { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.thumb {
  position: relative;
  flex: none;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  background: #0D1210;
  touch-action: pan-y;
  cursor: pointer;
}
.thumb canvas { display: block; width: 100%; height: 100%; }
.thumb-time {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: .72rem;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  padding: 1px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
}
.thumb.active .thumb-time { opacity: 1; }
.thumb.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: .72rem;
  line-height: 1.3;
  color: #B7C2BD;
  cursor: default;
}

/* ==========================================================================
   Work screen: player
   ========================================================================== */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }

.player { padding: 12px; }
.stage { position: relative; }
video { display: block; width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.video-layer { position: absolute; display: none; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.controls .group { display: flex; gap: 4px; }
.ctl { min-width: 40px; height: 38px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 0 10px; }
.ctl:hover { border-color: var(--muted); }
.ctl:disabled { opacity: .45; cursor: not-allowed; }
.ctl.play { min-width: 64px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.timecode { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.timecode .big { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.timecode .small { color: var(--muted); font-size: .85rem; }

.review-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#reviewSecs { width: 66px; }

.keys { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }

/* Pins placed in the video */
.pin-layer { cursor: crosshair; }
.pin { position: absolute; width: 18px; height: 18px; transform: translate(-50%, -50%); touch-action: none; }
.pin .dot-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--c);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55);
  cursor: grab;
}
.pin .label {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px 2px 9px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  cursor: grab;
}
.pin.flip .label { left: auto; right: 22px; }
.pin .label button { border: 0; background: none; color: #fff; padding: 0 5px; font-weight: 700; line-height: 1.2; }
.pin.ghost .dot-marker { background: #fff; box-shadow: 0 0 0 2px var(--accent); }
.pin.dragging .dot-marker, .pin.dragging .label { cursor: grabbing; }
.pin-layer.holding .pin .dot-marker { animation: pop .45s ease-out; }
@keyframes pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* Tag picker */
.picker {
  position: absolute;
  z-index: 5;
  width: 260px;
  max-height: 310px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.picker input { border: 0; border-bottom: 1px solid var(--line); padding: 10px; background: var(--surface); outline: none; }
.picker-options { overflow: auto; padding: 4px; }
.picker-group { font-size: .75rem; color: var(--muted); padding: 7px 8px 2px; }
.picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: .9rem;
}
.picker-option:hover { background: var(--surface-2); }
.picker-option.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.picker-option.selected::after { content: "✓"; margin-left: auto; color: var(--muted); }

.swatch { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* Active ranges shown on the video */
.range-layer { pointer-events: none; }
.range-stack { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; max-width: min(62%, 420px); }
.range-pill {
  pointer-events: auto;
  max-width: 100%;
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 6px;
  padding: 4px 9px 5px;
  background: rgba(12, 18, 16, .56);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .78rem;
  line-height: 1.25;
  text-align: left;
}
.range-pill .title, .range-pill .note { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-pill .title { font-weight: 700; }
.range-pill .note { opacity: .85; }
.range-pill .progress { display: block; height: 2px; margin-top: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .25); }
.range-pill .progress i { display: block; height: 100%; background: rgba(255, 255, 255, .85); }

/* Observation mode badge */
.hold-layer { pointer-events: none; }
.hold-badge {
  pointer-events: auto;
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 160px;
  border: 0;
  border-radius: 8px;
  padding: 6px 11px 7px;
  background: rgba(12, 18, 16, .62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .8rem;
  text-align: left;
}
.hold-badge .row { display: flex; justify-content: space-between; gap: 12px; }
.hold-badge b { font-variant-numeric: tabular-nums; }
.hold-badge .bar { display: block; height: 3px; margin: 5px 0 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .25); }
.hold-badge .bar i { display: block; height: 100%; width: 100%; background: #fff; }
.hold-badge .skip { opacity: .8; font-size: .74rem; }

/* Range dialog */
.range-dialog {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--c, var(--accent));
  border-radius: 10px;
  background: var(--surface-2);
}
.rd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rd-head h2 { margin: 0; }
.rd-span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin: 8px 0 10px; font-size: .9rem; }
.rd-span .muted { margin-right: 4px; }
#rangeLabel { width: 100%; background: var(--surface); padding: 8px; }
#rangeNote { background: var(--surface); min-height: 54px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; max-height: 118px; overflow: auto; }
.suggestion { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: .84rem; }
.suggestion:hover { border-color: var(--muted); }
.suggestion.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.suggestion.removable::after, .tag.removable::after { content: " ×"; font-weight: 700; }
.rd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }

/* ==========================================================================
   Work screen: sidebar
   ========================================================================== */
.side { padding: 14px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--nav-height) + 12px); }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.side-head h2 { margin: 0; }

.category { margin-top: 12px; }
.category-name { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: .82rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  border: 1.5px solid var(--c);
  background: color-mix(in srgb, var(--c) 9%, transparent);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: .88rem;
  line-height: 1.25;
}
.tag[aria-pressed="true"] { background: var(--c); color: #fff; font-weight: 700; }

.add-tag { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.add-tag input { flex: 1; min-width: 120px; }
.note-label { display: block; margin: 14px 0 6px; font-size: .85rem; color: var(--muted); }
.side-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline { margin-top: 16px; padding: 12px; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; }
.tl-head h2 { margin: 0; }
.tl-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tl-labels { border-right: 1px solid var(--line); background: var(--surface-2); }
.tl-label {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-label.ruler-label { color: var(--muted); }
.tl-label.lane-label { font-weight: 700; }
.tl-scroll { overflow-x: auto; position: relative; }
.tl-inner { position: relative; min-width: 100%; }

.tl-ruler { height: 30px; position: relative; border-bottom: 1px solid var(--line); background: var(--surface-2); cursor: ew-resize; touch-action: none; }
.tick {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 2px 0 0 3px;
  border-left: 1px solid var(--line);
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.tick-mark { position: absolute; bottom: 0; width: 2px; height: 8px; background: var(--muted); transform: translateX(-1px); pointer-events: none; }

.tl-lane {
  height: 30px;
  position: relative;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  cursor: crosshair;
  touch-action: none;
}
.lane-hint { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: .76rem; color: var(--muted); pointer-events: none; white-space: nowrap; }

.range-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 6px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1.5px solid var(--c);
  border-radius: 5px;
  background: color-mix(in srgb, var(--c) 24%, var(--surface));
  cursor: grab;
}
.range-bar .text { padding: 0 9px; font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.range-bar .handle { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.range-bar .handle.start { left: 0; }
.range-bar .handle.end { right: 0; }
.range-bar.draft {
  --c: var(--accent);
  top: 34px;
  bottom: auto;
  height: 22px;
  border-style: dashed;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  pointer-events: none;
}

.tl-row { height: 30px; position: relative; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl-row:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.tl-dot {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--c);
  transform: translate(-50%, -50%);
}
.tl-dot:hover { transform: translate(-50%, -50%) scale(1.35); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--playhead); transform: translateX(-1px); pointer-events: none; }
.tl-empty { margin: 0; padding: 14px; font-size: .9rem; }

/* ==========================================================================
   Lists and summary
   ========================================================================== */
.lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.lower .panel { padding: 14px; }

.entry-list { list-style: none; margin: 0 0 18px; padding: 0; max-height: 300px; overflow: auto; }
.entry-list.markers { max-height: 420px; margin-bottom: 0; }
.entry-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 6px; border-top: 1px solid var(--line); }
.entry-list li.with-bar { grid-template-columns: 4px auto minmax(0, 1fr) auto; }
.entry-list li:first-child { border-top: 0; }
.entry-list li.current { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 8px; }
.entry-list li.empty { display: block; color: var(--muted); }
.entry-list .bar { align-self: stretch; border-radius: 2px; background: var(--c); }
.entry-list .title { font-weight: 700; overflow-wrap: anywhere; }
.entry-list .meta { color: var(--muted); font-size: .82rem; }
.entry-note { margin-top: 3px; font-size: .85rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }

.tc-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 3px 7px; font-size: .85rem; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 4px 1px 9px;
  border: 1.5px solid var(--c);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 9%, transparent);
  font-size: .82rem;
}
.chip.placed::before { content: ""; width: 7px; height: 7px; margin-left: -3px; border-radius: 50%; border: 2px solid var(--c); }
.chip button { border: 0; background: none; padding: 0 4px; font-weight: 700; color: var(--muted); line-height: 1; }

.summary h2 + table, .summary table + h2 { margin-top: 0; }
.summary h2.sub { margin-top: 16px; }
.summary table { width: 100%; border-collapse: collapse; }
.summary td { padding: 6px 4px; border-top: 1px solid var(--line); font-size: .9rem; }
.summary tr:first-child td { border-top: 0; }
.summary td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.summary td.share { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; width: 3.5em; }
.summary button { border: 0; background: none; padding: 0; text-align: left; display: flex; align-items: center; gap: 6px; }

/* ==========================================================================
   Toast and modal
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 90vw;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-size: .9rem;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast-action { border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; }

.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .45); }
.modal-box {
  width: 100%;
  max-width: 440px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.modal-box h2 { font-size: 1.1rem; margin-bottom: 8px; }
.modal-box p { margin: 0; color: var(--muted); white-space: pre-line; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.noscript { padding: 16px; text-align: center; }

/* ==========================================================================
   Responsive and motion
   ========================================================================== */
@media (max-width: 960px) {
  .work { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 860px) {
  .start, .lower { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .navbar { position: static; }
  .navbar .status { order: 11; flex-basis: 100%; }
  .account-email { display: none; }
  .login-card { padding: 22px 18px 16px; }
  .menu-list { right: auto; left: 0; }
  .tl-body { grid-template-columns: 104px minmax(0, 1fr); }
  .range-stack { left: 5px; bottom: 5px; }
  .range-pill { font-size: .7rem; padding: 3px 7px 4px; }
  .video-name { max-width: 100%; order: 10; flex-basis: 100%; }
}
@media (max-width: 460px) {
  .thumb { width: 118px; }
}
@media (hover: none) and (pointer: coarse) {
  .keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pin-layer.holding .pin .dot-marker { animation: none; }
  .switch .track, .switch .track::after, .toast { transition: none; }
  .tl-dot:hover { transform: translate(-50%, -50%); }
}
