/* ==========================================================================
   EDL Tool Suite – Design System
   One stylesheet for every page (shell, tools, landing, docs).
   No external fonts / CDNs (DSGVO, offline use).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Brand */
  --brand-navy: #000436;
  --brand-red: #ff5050;

  /* Surfaces */
  --bg: #050816;
  --bg-elev: #0a1030;
  --surface: #0e1638;
  --surface-2: #131d47;
  --surface-3: #1a2658;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text: #eef1ff;
  --text-muted: #9aa6cf;
  --text-dim: #6c78a3;

  /* Semantics */
  --accent: var(--brand-red);
  --accent-hover: #ff6b6b;
  --accent-soft: rgba(255, 80, 80, 0.16);
  --focus: #7aa2ff;
  --ok: #3ecf8e;
  --warn: #ffb547;
  --danger: #ff4d6d;
  --danger-soft: rgba(255, 77, 109, 0.14);

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);

  /* Shape & depth */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.6);

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 140ms;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 0% -10%, rgba(40, 60, 140, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(255, 80, 80, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

a { color: #9db7ff; text-underline-offset: 2px; }
a:hover { color: #c3d3ff; }
code, kbd, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { background: rgba(255, 255, 255, 0.06); padding: 0.1em 0.35em; border-radius: 6px; font-size: 0.9em; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0.05em 0.4em; text-align: center;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); font-size: 0.82em;
}
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------------------------------------------------- */

.page {
  width: min(1180px, 100% - 2 * var(--sp-4));
  margin: var(--sp-5) auto var(--sp-6);
}
.page--narrow { width: min(820px, 100% - 2 * var(--sp-4)); }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.page-title { margin: 0; font-size: var(--fs-xl); font-weight: 680; letter-spacing: 0.01em; }
.page-sub { margin: 2px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

.stack { display: grid; gap: var(--sp-4); }
.stack-sm { display: grid; gap: var(--sp-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.split { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }

@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page { width: calc(100% - 2 * var(--sp-3)); margin-top: var(--sp-3); }
}

/* ---------- Card -------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-2);
}
.card + .card { margin-top: var(--sp-4); }
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-2); margin-bottom: var(--sp-3);
}
.card-title {
  margin: 0; font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--text-muted);
}
.card-sub { margin: 0; font-size: var(--fs-sm); color: var(--text-dim); }

/* ---------- Forms ------------------------------------------------------- */

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.hint { font-size: var(--fs-xs); color: var(--text-dim); }

.input, .select, textarea.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font: inherit;
  font-size: max(16px, var(--fs-md)); /* 16px prevents iOS focus zoom */
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
@media (min-width: 900px) { .input, .select, textarea.input { font-size: var(--fs-md); } }
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.22);
}
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input--mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.input--sm, .select--sm { min-height: 32px; padding: 4px 8px; border-radius: var(--r-sm); }
textarea.input { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: var(--fs-sm); }

.select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select option { background: var(--surface); color: var(--text); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

input[type="range"] { accent-color: var(--accent); }

/* ---------- Buttons ------------------------------------------------------ */

.btn {
  --btn-bg: var(--surface-2);
  --btn-bd: var(--border-strong);
  --btn-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 1.1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-md);
  cursor: pointer; user-select: none; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  touch-action: manipulation;
}
.btn:hover { background: var(--surface-3); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn--primary { --btn-bg: var(--accent); --btn-bd: transparent; --btn-fg: #fff; box-shadow: 0 6px 18px rgba(255, 80, 80, 0.25); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { --btn-bg: transparent; --btn-bd: var(--border); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn--danger { --btn-bg: var(--danger-soft); --btn-bd: rgba(255, 77, 109, 0.5); --btn-fg: #ffc9d3; }
.btn--danger:hover { background: rgba(255, 77, 109, 0.25); }
.btn--sm { min-height: 32px; padding: 5px 10px; border-radius: var(--r-sm); font-size: var(--fs-xs); }
.btn--icon { min-width: 40px; padding: 8px; }
.btn--icon.btn--sm { min-width: 32px; padding: 4px; }
.btn--block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: rgba(255, 80, 80, 0.55); }

.btn-group { display: inline-flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 3px; gap: 3px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-md);
}
.segmented button {
  min-height: 34px; padding: 6px 14px; border: 0; border-radius: 9px;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted);
  background: transparent; cursor: pointer;
}
.segmented button[aria-selected="true"], .segmented button[aria-pressed="true"] {
  background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-1);
}

/* ---------- Badges / chips --------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
}
.badge--ok { color: #b8f5d8; border-color: rgba(62, 207, 142, 0.45); background: rgba(62, 207, 142, 0.1); }
.badge--warn { color: #ffe1b0; border-color: rgba(255, 181, 71, 0.45); background: rgba(255, 181, 71, 0.1); }
.badge--danger { color: #ffc9d3; border-color: rgba(255, 77, 109, 0.45); background: var(--danger-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Timecode display ------------------------------------------- */

.tc-display {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 1.2rem + 4vw, 3.6rem); font-weight: 600; letter-spacing: 0.06em;
  text-align: center; padding: var(--sp-4) var(--sp-3);
  border-radius: var(--r-lg); border: 1px solid var(--border);
  background: linear-gradient(180deg, #060a1f, #0b1436);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-2);
}
.tc-display--sm { font-size: clamp(1.2rem, 1rem + 1.5vw, 1.8rem); padding: var(--sp-3); }
.tc-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-2); }

/* ---------- Swatches & palette ----------------------------------------- */

.swatch {
  width: 26px; height: 26px; flex: 0 0 26px; padding: 0;
  border-radius: 7px; border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}
.swatch[aria-pressed="true"] { outline: 2px solid #fff; outline-offset: 2px; }
.palette {
  position: fixed; z-index: 1000;
  display: grid; grid-template-columns: repeat(4, 30px); gap: 6px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
}
.palette .swatch { width: 30px; height: 30px; }

/* ---------- Marker list ------------------------------------------------- */

.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mrow {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 26px 140px minmax(0, 1fr) auto;
  padding: 6px 8px; border-radius: var(--r-md);
  background: var(--bg-elev); border: 1px solid var(--border);
}
.mrow:hover { border-color: var(--border-strong); }
.mrow.is-active { border-color: rgba(255, 80, 80, 0.6); box-shadow: 0 0 0 2px var(--accent-soft); }
.mrow-actions { display: flex; gap: 4px; }
.mrow .input { min-height: 34px; padding: 4px 8px; border-radius: var(--r-sm); }
.mrow-new { animation: row-in 260ms var(--ease); }
@keyframes row-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .mrow { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "c t a" "c m a"; }
  .mrow > .swatch { grid-area: c; align-self: start; margin-top: 4px; }
  .mrow > .mrow-tc { grid-area: t; }
  .mrow > .mrow-text { grid-area: m; }
  .mrow > .mrow-actions { grid-area: a; flex-direction: column; }
}

.empty {
  padding: var(--sp-5); text-align: center; color: var(--text-dim);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md); font-size: var(--fs-sm);
}

/* ---------- Table ------------------------------------------------------- */

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}
.table tr:last-child td { border-bottom: 0; }
.table tr.is-selected td { background: rgba(122, 162, 255, 0.08); }
.table .input { min-height: 32px; padding: 3px 8px; border-radius: var(--r-sm); }
.col-check { width: 36px; }
.col-color { width: 44px; }
.col-tc { width: 150px; }
.col-act { width: 48px; text-align: right; }

/* ---------- Dropzone ---------------------------------------------------- */

.dropzone {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: var(--sp-5); border-radius: var(--r-lg);
  border: 1.5px dashed var(--border-strong); background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone strong { color: var(--text); font-size: var(--fs-md); }

/* ---------- Banner / notice -------------------------------------------- */

.notice {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--surface-2);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.notice strong { color: var(--text); }
.notice--warn { border-color: rgba(255, 181, 71, 0.45); background: rgba(255, 181, 71, 0.08); }
.notice--info { border-color: rgba(122, 162, 255, 0.4); background: rgba(122, 162, 255, 0.07); }

/* ---------- Dialog ------------------------------------------------------ */

dialog.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
}
dialog.dialog::backdrop { background: rgba(2, 4, 14, 0.7); backdrop-filter: blur(4px); }
.dialog-body { padding: var(--sp-4); display: grid; gap: var(--sp-3); }
.dialog-title { margin: 0; font-size: var(--fs-lg); }
.dialog-text { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }

/* ---------- Toast ------------------------------------------------------- */

.toast-host {
  position: fixed; z-index: 2000; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none;
}
.toast {
  min-width: 220px; max-width: min(520px, 92vw); padding: 10px 14px;
  border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: rgba(14, 22, 56, 0.97); box-shadow: var(--shadow-3);
  font-size: var(--fs-sm); text-align: center;
  animation: toast-in 200ms var(--ease);
}
.toast--ok { border-color: rgba(62, 207, 142, 0.55); }
.toast--error { border-color: rgba(255, 77, 109, 0.6); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all 200ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Menu (send-to etc.) --------------------------------------- */

.menu { position: relative; display: inline-block; }
.menu-list {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 50; min-width: 200px;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
}
.menu-list--down { bottom: auto; top: calc(100% + 6px); }
.menu-list button {
  width: 100%; display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-3); }

/* ---------- Footer ------------------------------------------------------ */

.foot {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); justify-content: space-between; align-items: center;
  margin-top: var(--sp-5); padding-top: var(--sp-3); border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-dim);
}
.foot a { color: var(--text-muted); }

/* ---------- Docs / prose ------------------------------------------------ */

.prose { max-width: 72ch; }
.prose h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-3); }
.prose h2 { font-size: var(--fs-lg); margin: var(--sp-5) 0 var(--sp-2); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); }
.prose p, .prose li { color: #d3d9f3; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 4px; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin: var(--sp-3) 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }

/* ---------- Utilities --------------------------------------------------- */

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }

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

/* ==========================================================================
   Tool chrome (standalone header vs. embedded in the app shell)
   ========================================================================== */

.tool-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 8px max(var(--sp-4), env(safe-area-inset-right)) 8px max(var(--sp-4), env(safe-area-inset-left));
  background: rgba(0, 4, 54, 0.92); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.tool-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; text-decoration: none; }
.tool-brand img { border-radius: 6px; }
.is-embedded .standalone-only { display: none !important; }
.is-embedded body { background: var(--bg); }
.is-embedded .page { margin-top: var(--sp-4); }
html:not(.is-embedded) .embedded-only { display: none !important; }

/* ==========================================================================
   EDL Live
   ========================================================================== */

.live-top { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); margin-bottom: var(--sp-4); }
.live-top .card + .card { margin-top: 0; }
.live-top .tc-display { font-size: clamp(2.1rem, 1rem + 3.6vw, 3.5rem); letter-spacing: 0.04em; }
@media (max-width: 960px) { .live-top { grid-template-columns: 1fr; } }
.live-preset { width: auto; min-width: 190px; }
.live-edit-bar { margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--bg-elev); border: 1px dashed var(--border-strong); }

.marker-grid {
  --mb-scale: 1;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(calc(132px * var(--mb-scale)), 1fr));
}
.marker-slot { display: grid; gap: 4px; }
.marker-slot-ctl { display: flex; gap: 4px; justify-content: center; }
.marker-btn {
  --mc: #007fe3;
  position: relative;
  display: grid; place-items: center; gap: 4px;
  min-height: calc(84px * var(--mb-scale));
  padding: calc(10px * var(--mb-scale)) 10px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--mc) 75%, transparent);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--mc) 42%, transparent), color-mix(in srgb, var(--mc) 14%, #070b22) 70%);
  color: #fff; font: inherit; font-weight: 650; font-size: calc(0.95rem * var(--mb-scale));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer; touch-action: manipulation; user-select: none;
  transition: transform 90ms var(--ease), box-shadow var(--t-fast), filter var(--t-fast);
}
.marker-btn:hover { filter: brightness(1.12); }
.marker-btn:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.marker-btn[aria-disabled="true"] { cursor: default; opacity: 0.75; filter: saturate(0.7); }
.marker-btn-emoji { font-size: calc(1.5rem * var(--mb-scale)); line-height: 1; }
.marker-btn-label { line-height: 1.15; text-align: center; }
.marker-btn-key {
  position: absolute; top: 6px; right: 6px; min-width: 1.4em; padding: 0 4px;
  font-size: 0.68rem; line-height: 1.4; border-radius: 5px; border: 0;
  background: rgba(0, 0, 0, 0.35); color: rgba(255, 255, 255, 0.85);
}
@media (hover: none) { .marker-btn-key { display: none; } }

/* ==========================================================================
   EDL Player
   ========================================================================== */

.player-sources { grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(0, 1.2fr); align-items: end; }
@media (max-width: 1100px) { .player-sources { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .player-sources { grid-template-columns: 1fr; } }
.player-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--r-md); background: #000; border: 1px solid var(--border);
}
.player-media, .player-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-empty, .player-consent {
  position: absolute; inset: 0; display: grid; place-content: center; gap: var(--sp-3);
  padding: var(--sp-4); text-align: center;
}
.player-consent { background: linear-gradient(180deg, #0b1230, #050816); }
.player-consent h2 { margin: 0; font-size: var(--fs-lg); }
.player-consent p { margin: 0 auto; max-width: 52ch; color: var(--text-muted); font-size: var(--fs-sm); }
.player-consent .row { justify-content: center; }
.player-tc { flex: 1 1 auto; text-align: left; }
.player-add .swatch { width: 40px; height: 40px; flex-basis: 40px; border-radius: var(--r-md); }
.player-side { position: sticky; top: var(--sp-4); }
.player-list { max-height: min(62vh, 720px); overflow: auto; padding-right: 2px; }
.player-list .mrow { grid-template-columns: 26px 128px minmax(0, 1fr) auto; }
@media (max-width: 960px) { .player-side { position: static; } .player-list { max-height: none; } }

/* ==========================================================================
   EDL Editor / Converter / LTC
   ========================================================================== */

.row--center { justify-content: center; }
.editor-table { max-height: min(64vh, 760px); }
.editor-tools .card + .card { margin-top: 0; }
.editor-chip {
  --mc: #007fe3;
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px 4px 6px;
  border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--mc) 60%, transparent);
  background: color-mix(in srgb, var(--mc) 16%, transparent); color: var(--text);
  font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}
.editor-chip:hover { background: color-mix(in srgb, var(--mc) 28%, transparent); }
.editor-chip-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--mc); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }

.convert-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.convert-kind { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-muted); padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.convert-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ltc-panel .card + .card { margin-top: 0; }
.ltc-info > div { display: grid; gap: 2px; }
.ltc-info .mono { font-size: var(--fs-md); }
.tc-display.is-stale { color: var(--text-dim); }
.meter { height: 6px; border-radius: 3px; background: var(--bg-elev); overflow: hidden; border: 1px solid var(--border); }
.meter-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), #c6f26b 75%, var(--warn)); transition: width 90ms linear; }
.meter-bar.is-hot { background: linear-gradient(90deg, var(--ok), var(--warn) 60%, var(--danger)); }
.ltc-cmp { align-items: start; }
.ltc-cmp-mid .tc-display { font-size: clamp(1.6rem, 1rem + 2vw, 2.6rem); }

/* grid children must be allowed to shrink (long <pre>/inputs) */
.grid > *, .split > *, .row > .grow { min-width: 0; }
.row > .input, .row > .select.grow { width: auto; flex: 1 1 160px; }
.player-yt .row, .player-add { flex-wrap: nowrap; }
.player-add .input { flex: 1 1 auto; }
.player-yt .row .input, .player-add .input { flex: 1 1 0; min-width: 0; }
.stack > *, .stack-sm > * { min-width: 0; }
.stack, .stack-sm { grid-template-columns: minmax(0, 1fr); }
.field { grid-template-columns: minmax(0, 1fr); }
.split > .card + .card, .grid > .card + .card, .live-top > .card + .card { margin-top: 0; }

/* workspace hints inside tools */
.badge--ws { color: #ffd0d0; border-color: rgba(255, 80, 80, 0.45); background: var(--accent-soft); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.mrow.is-outside { opacity: 0.55; }
.convert-row.is-ws { border-color: rgba(255, 80, 80, 0.5); background: linear-gradient(90deg, var(--accent-soft), var(--bg-elev) 60%); }
.convert-row .mrow-actions { align-items: center; }
.badge--ws { cursor: pointer; }
