/* ============================================================================
   Slipstream theme — modern SaaS dashboard.
   Light: airy white/slate.  Dark: deep navy-charcoal + cyan→violet glow.
   Tokens first, components second. No external assets, system fonts only.
   ========================================================================== */

:root {
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6fb;
  --bg-glow-a: rgba(34, 211, 238, 0.07);
  --bg-glow-b: rgba(139, 92, 246, 0.07);
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef7;
  --text: #0f172a;
  --text-dim: #5b6b83;
  --text-faint: #93a3ba;
  --border: #e3e9f2;
  --border-strong: #c9d4e3;

  --accent: #22d3ee;
  --accent2: #8b5cf6;
  --accent-mid: #60a5fa;
  --accent-grad: linear-gradient(135deg, #22d3ee 0%, #60a5fa 45%, #8b5cf6 100%);
  --accent-ink: #06202a;

  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 2px 4px rgba(15, 23, 42, 0.06), 0 14px 36px rgba(15, 23, 42, 0.11);
  --glow-accent: 0 6px 22px rgba(34, 211, 238, 0.30), 0 2px 8px rgba(139, 92, 246, 0.18);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --sidebar-w: 234px;
  --topbar-h: 64px;
  --speed: 120ms;
  --ease: cubic-bezier(0.3, 0.7, 0.3, 1);

  /* aliases (both spellings resolve, in both themes) */
  --muted: var(--text-dim);
  --surface2: var(--surface-2);
  --surface3: var(--surface-3);
  --err: var(--danger);
  --error: var(--danger);
}

[data-theme='dark'] {
  --bg: #0a0f1e;
  --bg-glow-a: rgba(34, 211, 238, 0.09);
  --bg-glow-b: rgba(139, 92, 246, 0.10);
  --surface: #101a2e;
  --surface-2: #16213a;
  --surface-3: #1c2947;
  --text: #e7edf8;
  --text-dim: #93a3bd;
  --text-faint: #5d6d89;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --accent-ink: #041318;

  --shadow-1: 0 1px 2px rgba(2, 6, 17, 0.5), 0 6px 18px rgba(2, 6, 17, 0.45);
  --shadow-2: 0 2px 6px rgba(2, 6, 17, 0.55), 0 18px 44px rgba(2, 6, 17, 0.6);
  --glow-accent: 0 0 26px rgba(34, 211, 238, 0.30), 0 4px 18px rgba(139, 92, 246, 0.25);
}

/* ------------------------------- base ---------------------------------- */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 85% -10%, var(--bg-glow-b), transparent 60%),
    radial-gradient(900px 450px at -10% 20%, var(--bg-glow-a), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 0.4em; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15.5px; } h4 { font-size: 14px; }
p { margin: 0 0 0.75em; }
a { color: var(--accent-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
::selection { background: rgba(34, 211, 238, 0.28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------ boot splash ----------------------------- */

.boot-splash {
  min-height: 100vh; display: flex; flex-direction: column; gap: 22px;
  align-items: center; justify-content: center;
}
.boot-spinner, .spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ app frame ------------------------------- */

.app-frame { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px 14px; gap: 4px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-name {
  font-size: 17px; font-weight: 800; letter-spacing: -0.02em;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-top: -3px; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  color: var(--text-dim); font-weight: 550; text-decoration: none;
  transition: color var(--speed) var(--ease), background var(--speed) var(--ease);
  border: 0; background: transparent; width: 100%; text-align: left; font-family: inherit; font-size: 14px;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 13%, transparent), color-mix(in srgb, var(--accent2) 9%, transparent));
}
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3.5px;
  border-radius: 0 4px 4px 0; background: var(--accent-grad);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}
.sidebar-spacer { flex: 1; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; }

.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.topbar-spacer { flex: 1; }

.page {
  padding: 26px; max-width: 1240px; width: 100%; margin: 0 auto;
  animation: page-in var(--speed) var(--ease) both;
}
@keyframes page-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.hamburger { display: none; }

@media (max-width: 880px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(78vw, 280px);
    transform: translateX(-102%); transition: transform 180ms var(--ease);
    box-shadow: var(--shadow-2); height: 100dvh;
  }
  .app-frame.sidebar-open .sidebar { transform: none; }
  .scrim {
    position: fixed; inset: 0; z-index: 39; background: rgba(3, 7, 18, 0.55);
    opacity: 0; pointer-events: none; transition: opacity 180ms var(--ease);
  }
  .app-frame.sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .hamburger { display: inline-flex; }
  .page { padding: 16px; }
  .topbar { padding: 0 14px; }
}

/* ------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 550 14px/1 var(--font); letter-spacing: 0.005em;
  padding: 9px 15px; border-radius: 10px; cursor: pointer; user-select: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-1);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease), border-color var(--speed) var(--ease), filter var(--speed) var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: scale(0.97); box-shadow: var(--shadow-1); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.btn-primary {
  border: 0; color: #fff;
  background: linear-gradient(120deg, #22d3ee, #60a5fa, #8b5cf6, #60a5fa, #22d3ee);
  background-size: 300% 100%;
  animation: grad-drift 7s linear infinite;
  box-shadow: var(--glow-accent);
  text-shadow: 0 1px 2px rgba(4, 20, 30, 0.35);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: var(--glow-accent), var(--shadow-1); }
@keyframes grad-drift { to { background-position: 300% 0; } }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 38%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* -------------------------------- cards --------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.card-pad { padding: 18px; }
.card-hover { cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.card-title { font-size: 13px; font-weight: 650; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 12px; }

.section { margin-bottom: 26px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------ chips/badges ---------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; }
.chip-ok    { color: var(--ok);    background: color-mix(in srgb, var(--ok) 12%, transparent);    border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.chip-warn  { color: var(--warn);  background: color-mix(in srgb, var(--warn) 13%, transparent);  border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.chip-bad   { color: var(--danger);background: color-mix(in srgb, var(--danger) 11%, transparent);border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.chip-info  { color: var(--info);  background: color-mix(in srgb, var(--info) 12%, transparent);  border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.chip-accent{ color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, transparent); border-color: color-mix(in srgb, var(--accent2) 30%, transparent); }

.tier-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent;
}
.tier-pit-crew { background: var(--surface-3); color: var(--text-dim); border-color: var(--border-strong); }
.tier-race-team {
  color: #067a92; background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
[data-theme='dark'] .tier-race-team { color: #67e8f9; }
.tier-factory-works {
  color: #7a5200; border: 1px solid rgba(245, 179, 66, 0.55);
  background: linear-gradient(120deg, rgba(250, 204, 21, 0.22), rgba(245, 158, 11, 0.30), rgba(250, 204, 21, 0.22));
}
[data-theme='dark'] .tier-factory-works { color: #fbd77a; }

/* ------------------------------- inputs --------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.input, .select, .textarea {
  font: 450 14px/1.4 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px; width: 100%;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.textarea { resize: vertical; min-height: 90px; }
.input-sm { padding: 6px 9px; font-size: 13px; border-radius: 8px; }
.field-err { color: var(--danger); font-size: 12.5px; }

/* -------------------------------- tabs ---------------------------------- */

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 11px; }
.tab {
  flex: 1; text-align: center; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font: 600 13.5px var(--font); color: var(--text-dim); border: 0; background: transparent;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ------------------------------- modal ---------------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(3, 7, 18, 0.58); backdrop-filter: blur(6px);
  animation: fade-in var(--speed) var(--ease) both;
}
.modal {
  width: 100%; max-width: 480px; max-height: min(86vh, 780px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-2); padding: 22px;
  animation: modal-in 160ms var(--ease) both;
}
.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16.5px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } }

/* ------------------------------- toasts --------------------------------- */

.toast-stack {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px; pointer-events: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-2); padding: 10px 16px;
  font-size: 13.5px; font-weight: 550; max-width: min(90vw, 480px);
  animation: toast-in 200ms var(--ease) both;
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--info); }
.toast-ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.toast-error::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.toast.out { animation: toast-out 180ms var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* ------------------------------ skeleton -------------------------------- */

.skeleton {
  border-radius: var(--radius-sm); position: relative; overflow: hidden;
  background: var(--surface-2);
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--text) 7%, transparent) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 160% 0; } to { background-position: -60% 0; } }

/* ----------------------------- empty state ------------------------------ */

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 8px; padding: 54px 24px; color: var(--text-dim);
}
.empty-state svg { width: 120px; height: 90px; margin-bottom: 8px; }
.empty-state h3 { color: var(--text); margin: 0; }
.empty-state p { max-width: 380px; font-size: 13.5px; margin: 0 0 8px; }

/* ---------------------------- theme toggle ------------------------------ */

.theme-toggle { position: relative; width: 36px; height: 36px; overflow: hidden; }
.theme-toggle svg {
  position: absolute; inset: 0; margin: auto; width: 17px; height: 17px;
  transition: transform 300ms var(--ease), opacity 200ms var(--ease);
}
.theme-toggle .icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.5); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme='dark'] .theme-toggle .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }
[data-theme='dark'] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }

/* ------------------------------ user chip ------------------------------- */

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; box-shadow: var(--shadow-1); font-family: inherit;
  transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.user-chip:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12.5px; font-weight: 750; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.user-chip-name { font-size: 13px; font-weight: 650; color: var(--text); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 6px; animation: modal-in 140ms var(--ease) both;
}
.user-menu .nav-item { padding: 8px 10px; }

/* ------------------------------ video grid ------------------------------ */

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.video-card { overflow: hidden; display: flex; flex-direction: column; }
.video-thumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); }
.video-card:hover .video-thumb img { transform: scale(1.04); }
.video-thumb .thumb-fallback { color: var(--text-faint); }
.video-thumb .thumb-fallback svg { width: 34px; height: 34px; }
.dur-chip {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(3, 7, 18, 0.75); color: #fff; font: 650 11px/1 var(--mono);
  padding: 4px 7px; border-radius: 6px; letter-spacing: 0.04em;
}
.video-card-body { padding: 12px 14px 13px; display: flex; flex-direction: column; gap: 7px; }
.video-card-title { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* upload dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; color: var(--text-dim); cursor: pointer;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--text);
}
.dropzone svg { width: 30px; height: 30px; margin: 0 auto 10px; opacity: 0.7; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div {
  height: 100%; border-radius: 99px; background: var(--accent-grad);
  transition: width 160ms var(--ease); box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

/* apex shortcut card */
.apex-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent);
  background: linear-gradient(110deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), color-mix(in srgb, var(--accent2) 10%, var(--surface)));
}
.apex-card svg { width: 26px; height: 26px; color: var(--accent2); flex: none; }

/* ----------------------------- video detail ----------------------------- */

.detail-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.player-wrap { border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-2); }
.player-wrap video { width: 100%; max-height: 62vh; display: block; background: #000; }

.moment-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  cursor: pointer; transition: background var(--speed) var(--ease);
}
.moment-row:hover { background: var(--surface-2); }
.moment-ico {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-mid);
}
.moment-ico svg { width: 14px; height: 14px; }
.score-bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; width: 56px; flex: none; }
.score-bar > div { height: 100%; background: var(--accent-grad); border-radius: 99px; }

.clip-suggest {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}

/* caption variant cards */
.variant-card {
  display: flex; gap: 11px; padding: 12px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.variant-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.variant-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.variant-radio {
  width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2px solid var(--border-strong); transition: all var(--speed) var(--ease);
}
.variant-card.selected .variant-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.variant-hook { font-weight: 700; font-size: 13.5px; }
.variant-body { color: var(--text-dim); font-size: 13px; white-space: pre-wrap; }
.variant-tags { color: var(--accent-mid); font-size: 12px; }

/* ------------------------------- editor --------------------------------- */

.editor-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 980px) { .editor-grid { grid-template-columns: 1fr; } }

.stage-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.stage {
  position: relative; width: 270px; height: 480px; border-radius: 18px; overflow: hidden;
  background: #05070f; box-shadow: var(--shadow-2), 0 0 0 1px var(--border);
  flex: none;
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.stage-overlay-text {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  max-width: 82%; text-align: center; pointer-events: none; z-index: 3;
  color: #fff; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  background: rgba(4, 8, 18, 0.55); border-radius: 7px; padding: 4px 8px;
  font-size: 12px; line-height: 1.25; white-space: pre-wrap; word-break: break-word;
}
.stage-overlay-text.slot-cta {
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.85), rgba(139, 92, 246, 0.85));
  font-size: 10.5px; border-radius: 999px; padding: 5px 11px;
}
.stage-overlay-text.hidden-now { opacity: 0.22; }

/* safe-area overlay */
.safe-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 5; font-family: var(--font); }
.safe-shade { position: absolute; background: rgba(239, 68, 68, 0.16); backdrop-filter: saturate(0.6); }
.safe-line { position: absolute; background: #ef4444; opacity: 0.9; box-shadow: 0 0 6px rgba(239, 68, 68, 0.8); }
.safe-label {
  position: absolute; color: #fecaca; font-size: 8.5px; font-weight: 750;
  letter-spacing: 0.09em; text-transform: uppercase; text-shadow: 0 1px 2px rgba(0,0,0,.8);
}

.trim-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.overlay-slot { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.overlay-slot-head { display: flex; align-items: center; justify-content: space-between; }
.overlay-slot-head .slot-name { font-size: 12px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim); }
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.switch { position: relative; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3);
  border: 1px solid var(--border-strong); transition: background var(--speed) var(--ease);
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform var(--speed) var(--ease);
}
.switch input:checked + .track { background: var(--accent-grad); border-color: transparent; }
.switch input:checked ~ .knob { transform: translateX(16px); }

/* ------------------------------- login ---------------------------------- */

.login-split { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); min-height: 100vh; }
@media (max-width: 880px) { .login-split { grid-template-columns: 1fr; } .login-hero { min-height: 260px; } }

.login-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px; color: #eaf6ff;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(139, 92, 246, 0.45), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(34, 211, 238, 0.35), transparent 55%),
    linear-gradient(160deg, #0b1120 10%, #131b34 55%, #0b1120);
}
.speed-lines { position: absolute; inset: -20%; pointer-events: none; opacity: 0.5; transform: rotate(-14deg); }
.speed-lines i {
  position: absolute; height: 3px; border-radius: 99px; display: block;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: speed 3.2s linear infinite;
  opacity: 0;
}
.speed-lines i:nth-child(2n) { background: linear-gradient(90deg, transparent, var(--accent2), transparent); }
.speed-lines i:nth-child(3n) { height: 2px; }
@keyframes speed {
  0% { transform: translateX(-40vw); opacity: 0; }
  12% { opacity: 0.9; }
  70% { opacity: 0.8; }
  100% { transform: translateX(70vw); opacity: 0; }
}
.login-hero .hero-brand { display: flex; align-items: center; gap: 12px; position: absolute; top: 40px; left: 48px; }
.login-hero h1 {
  position: relative; font-size: clamp(28px, 4vw, 44px); line-height: 1.12; letter-spacing: -0.03em;
  font-weight: 800; margin-bottom: 12px; max-width: 480px;
}
.login-hero h1 em {
  font-style: normal;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-hero .hero-sub { position: relative; color: #a9bad6; max-width: 430px; font-size: 15px; }
.hero-points { position: relative; display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.hero-points .row { color: #c6d4ea; font-size: 13.5px; }
.hero-points svg { width: 15px; height: 15px; color: var(--accent); flex: none; }

.login-form-col { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 400px; }

/* ------------------------------ sparkline ------------------------------- */

.sparkline-wrap { position: relative; }
.spark-marker { cursor: pointer; }

/* ------------------------------ misc bits ------------------------------- */

.kbd {
  font: 650 11px var(--mono); background: var(--surface-2); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--text-dim);
}
.divider { height: 1px; background: var(--border); border: 0; margin: 14px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.char-count { font-size: 11.5px; color: var(--text-faint); text-align: right; }
.char-count.over { color: var(--danger); font-weight: 700; }

.upsell {
  border: 1px dashed color-mix(in srgb, var(--accent2) 45%, transparent);
  background: color-mix(in srgb, var(--accent2) 7%, transparent);
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--text-dim);
}
.upsell b { color: var(--text); }

/* --------------------------- reduced motion ----------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn-primary { animation: none; background: linear-gradient(120deg, #22d3ee, #8b5cf6); }
  .speed-lines { display: none; }
}
