/* ============================================================
   SlidesRecorder — design system
   ============================================================ */

:root {
  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 9px;
  --accent: #6c5cf7;
  --accent-2: #9d7bff;
  --accent-soft: rgba(108, 92, 247, 0.12);
  --accent-grad: linear-gradient(135deg, #6c5cf7 0%, #9d7bff 100%);
  --rec: #ff4d5e;
  --ok: #22c07a;
  --warn: #f5a623;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg: #f3f4f9;
  --bg-2: #e9ebf3;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --text: #171a21;
  --muted: #6d7382;
  --faint: #9aa0af;
  --border: rgba(23, 26, 33, 0.09);
  --border-strong: rgba(23, 26, 33, 0.16);
  --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.05), 0 2px 8px rgba(20, 22, 40, 0.05);
  --shadow-md: 0 2px 6px rgba(20, 22, 40, 0.06), 0 10px 28px rgba(20, 22, 40, 0.09);
  --shadow-lg: 0 6px 16px rgba(20, 22, 40, 0.08), 0 24px 60px rgba(20, 22, 40, 0.14);
  --topbar-bg: rgba(255, 255, 255, 0.75);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0d0f15;
  --bg-2: #12141c;
  --surface: #171a24;
  --surface-2: #1e222e;
  --text: #eceef4;
  --muted: #9aa1b2;
  --faint: #646b7c;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(13, 15, 21, 0.72);
  --accent-soft: rgba(138, 122, 255, 0.16);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
  min-height: 100vh;
}

::selection { background: var(--accent-soft); }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; }

button { font-family: inherit; }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 247, 0.4);
  flex-shrink: 0;
}

.logo-mark svg { width: 17px; height: 17px; }

/* step indicator */
.steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.step .n {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--border);
  color: var(--muted);
}

.step.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.step.active .n { background: var(--accent-grad); color: #fff; }

.step.done { color: var(--muted); }
.step.done .n { background: var(--ok); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.steps + .topbar-right { margin-left: 0; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun { display: none; }
html[data-theme="dark"] .icon-btn .sun { display: block; }
html[data-theme="dark"] .icon-btn .moon { display: none; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-grad);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 92, 247, 0.35);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(108, 92, 247, 0.45); }
.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-soft {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn-soft:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger { background: var(--rec); color: #fff; box-shadow: 0 4px 16px rgba(255, 77, 94, 0.35); }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(255, 77, 94, 0.45); }

.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 15px; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }

/* ---------- Chips / status ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip-ready   { background: rgba(34, 192, 122, 0.13); color: var(--ok); }
.chip-draft   { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip-processing { background: rgba(245, 166, 35, 0.13); color: var(--warn); }
.chip-failed  { background: rgba(255, 77, 94, 0.13); color: var(--rec); }

/* ---------- Page scaffolding ---------- */

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 36px 28px 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-head h1 { font-size: 27px; }
.page-head .sub { color: var(--muted); margin-top: 5px; font-size: 14.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: background 0.35s ease, border-color 0.35s ease;
}

/* ---------- Dashboard ---------- */

.filters { display: flex; gap: 8px; margin-bottom: 22px; }

.filter {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter:hover { color: var(--text); border-color: var(--border-strong); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
}

.rec-card {
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.rec-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.thumb {
  aspect-ratio: 16 / 9;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thumb .play {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.25s ease;
}

.thumb .play svg { width: 20px; height: 20px; margin-left: 3px; }
.rec-card:hover .play { opacity: 1; transform: scale(1); }

.thumb .dur {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(10, 10, 18, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.thumb.has-img { background: #101321; }
.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .mock-cam {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 26%;
  aspect-ratio: 16/10;
  border-radius: 8px;
  background: rgba(255,255,255,0.28);
  border: 1.5px solid rgba(255,255,255,0.5);
}

.g1 { background: linear-gradient(135deg, #667eea, #764ba2); }
.g2 { background: linear-gradient(135deg, #f6875f, #dd5789); }
.g3 { background: linear-gradient(135deg, #43b8ac, #3178a6); }
.g4 { background: linear-gradient(135deg, #5b6ee8, #48c6ef); }
.g5 { background: linear-gradient(135deg, #b06ab3, #4568dc); }

.rec-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.rec-body .t { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.rec-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rec-meta .d { color: var(--faint); font-size: 12.5px; }

.new-card {
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 240px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.22s ease;
  box-shadow: none;
}

.new-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-3px); }

.new-card .plus {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-grad);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(108, 92, 247, 0.4);
}

.new-card .plus svg { width: 22px; height: 22px; }
.new-card span { font-weight: 650; font-size: 14.5px; }

/* ---------- Setup screen ---------- */

.setup-grid {
  display: grid;
  grid-template-columns: 8fr 4fr;   /* 8/12 devices, 4/12 checklist & test */
  gap: 24px;
  align-items: start;
}

/* camera + screen side by side, microphone full-width below */
.device-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.device-card.full { grid-column: 1 / -1; }

.details-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* custom autocomplete (native datalist can't be themed) */
.combo { position: relative; }
.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.combo-item {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s ease;
}
.combo-item:hover, .combo-item.active { background: var(--accent-soft); color: var(--accent); }
.combo-item b { font-weight: 700; }
.combo-empty { padding: 9px 12px; font-size: 13px; color: var(--faint); }

@media (max-width: 720px) {
  .device-stack { grid-template-columns: 1fr; }
  .details-row { grid-template-columns: 1fr; }
}

.device-card { padding: 20px; }

.device-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.device-head .ic {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.device-head .ic svg { width: 18px; height: 18px; }
.device-head h3 { font-size: 15.5px; flex: 1; }

.stat {
  font-size: 12px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
}
.stat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.stat.ok { color: var(--ok); } .stat.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,192,122,.18); }
.stat.warn { color: var(--warn); } .stat.warn::before { background: var(--warn); }

.field {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888ea0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.field:hover, .field:focus { border-color: var(--accent); outline: none; }

.preview-box {
  margin-top: 13px;
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  border: 1px solid var(--border);
  position: relative;
  display: grid;
  place-items: center;
}

.preview-box video { width: 100%; height: 100%; object-fit: cover; display: block; }

.ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 13.5px;
  text-align: center;
  padding: 18px;
}
.ph svg { width: 30px; height: 30px; opacity: 0.6; }

/* mic level meter */
.meter { display: flex; align-items: flex-end; gap: 4px; height: 44px; margin-top: 13px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.meter i {
  flex: 1;
  background: var(--border-strong);
  border-radius: 3px;
  height: 18%;
  transition: height 0.09s ease, background 0.09s ease;
}
.meter i.on { background: var(--accent); }
.meter i.hot { background: var(--warn); }

/* checklist */
.checklist { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.checklist h3 { font-size: 15.5px; margin-bottom: 10px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  transition: all 0.25s ease;
}

.check-item .box {
  width: 23px;
  height: 23px;
  border-radius: 8px;
  border: 1.7px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.check-item .box svg { width: 13px; height: 13px; }

.check-item.done { color: var(--text); }
.check-item.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }

/* test recording */
.test-card { padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.test-card h3 { font-size: 15.5px; }
.test-card p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 300px; }

.rec-btn {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: transparent;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease;
}
.rec-btn:hover { transform: scale(1.05); }

.rec-btn .ring { position: absolute; inset: 0; }
.rec-btn .ring circle { fill: none; stroke-width: 4; }
.rec-btn .ring .track { stroke: var(--border-strong); }
.rec-btn .ring .prog { stroke: var(--rec); stroke-linecap: round; stroke-dasharray: 226; stroke-dashoffset: 226; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.3s linear; }

.rec-btn .core {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 5px 18px rgba(255, 77, 94, 0.45);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rec-btn.recording .core { border-radius: 14px; width: 34px; height: 34px; }

.test-video { width: 100%; border-radius: var(--r-md); overflow: hidden; background: #000; aspect-ratio: 16/9; }
.test-video video { width: 100%; height: 100%; display: block; }

.test-actions { display: flex; gap: 10px; }

.hint { font-size: 12.5px; color: var(--faint); }

.continue-wrap { display: flex; flex-direction: column; gap: 10px; }
.continue-wrap .btn { width: 100%; }
.skip-link { text-align: center; font-size: 12.5px; color: var(--faint); cursor: pointer; }
.skip-link:hover { color: var(--muted); text-decoration: underline; }

.sticky-col { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Recording screen ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 70; /* above the sticky topbar */
  background: #0a0b10;
  color: #eceef4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  z-index: 10;
}

.stage-top .back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #9aa1b2;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  transition: all 0.2s ease;
}
.stage-top .back:hover { color: #fff; background: rgba(255,255,255,0.09); }
.stage-top .back svg { width: 14px; height: 14px; }

.timer-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 20px;
  border-radius: 999px;
  background: rgba(23, 25, 36, 0.8);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(14px);
}

.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--rec); }
.rec-dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
.rec-dot.paused { background: var(--warn); animation: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.55); }
  50% { box-shadow: 0 0 0 9px rgba(255, 77, 94, 0); }
}

.timer { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

.rec-state { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--rec); }
.rec-state.paused { color: var(--warn); }

.save-ind {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #9aa1b2;
  padding: 8px 14px;
  border-radius: 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.save-ind svg { width: 14px; height: 14px; color: var(--ok); }
.save-ind b { color: #cfd3de; font-variant-numeric: tabular-nums; font-weight: 650; }

.stage-main { flex: 1; min-height: 0; position: relative; padding: 8px 24px 110px; display: grid; }

.screenview {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #171b2b, #1d1630);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
}
/* absolute layer: the stream's intrinsic size can never stretch the layout,
   so the control bar stays on screen; contain keeps the aspect ratio */
.screenview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.demo-slide {
  width: min(680px, 80%);
  aspect-ratio: 16/9;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 40px 46px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.demo-slide .bar { height: 26px; width: 55%; border-radius: 8px; background: linear-gradient(90deg, rgba(157,123,255,.75), rgba(108,92,247,.5)); }
.demo-slide .line { height: 12px; border-radius: 6px; background: rgba(255,255,255,0.12); }
.demo-slide .line.w1 { width: 88%; } .demo-slide .line.w2 { width: 72%; } .demo-slide .line.w3 { width: 80%; } .demo-slide .line.w4 { width: 46%; }

.pip {
  position: absolute;
  right: 44px;
  bottom: 130px;
  width: 224px;
  aspect-ratio: 16/10;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #2b2f45, #232030);
  border: 1.5px solid rgba(255,255,255,0.2);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  cursor: grab;
  z-index: 20;
  display: grid;
  place-items: center;
  transition: box-shadow 0.2s ease;
}
.pip:active { cursor: grabbing; box-shadow: 0 20px 55px rgba(0,0,0,0.7); }
.pip video { width: 100%; height: 100%; object-fit: cover; }
.pip .you {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--accent-grad);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff;
}
.pip .tag { position: absolute; left: 10px; bottom: 8px; font-size: 11px; font-weight: 650; color: rgba(255,255,255,0.85); background: rgba(0,0,0,0.45); padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(4px); }

.controlbar {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 22px;
  background: rgba(23, 25, 36, 0.85);
  border: 1px solid rgba(255,255,255,0.11);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  z-index: 30;
}

.ctl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 19px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.07);
  color: #e8eaf2;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s ease;
}
.ctl:hover { background: rgba(255,255,255,0.13); transform: translateY(-1px); }
.ctl svg { width: 16px; height: 16px; }
.ctl.stop { background: var(--rec); color: #fff; box-shadow: 0 5px 18px rgba(255,77,94,0.4); }
.ctl.stop:hover { box-shadow: 0 8px 24px rgba(255,77,94,0.55); }
.ctl .kbd {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  color: #b9bece;
}

.ctl-sep { width: 1px; height: 26px; background: rgba(255,255,255,0.12); margin: 0 3px; }

.marker-count {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 11px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: #9aa1b2; font-size: 12.5px; font-weight: 600;
}
.marker-count .pin-ic { width: 13px; height: 13px; color: var(--rec); }
.marker-count b { color: #fff; }

/* start overlay */
.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 16, 0.72);
  backdrop-filter: blur(10px);
  transition: opacity 0.4s ease;
}
.start-overlay.hide { opacity: 0; pointer-events: none; }

.start-box { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.start-box h2 { font-size: 24px; color: #fff; }
.start-box p { margin: 0; color: #9aa1b2; font-size: 14px; max-width: 340px; }

.countdown {
  font-size: 120px;
  font-weight: 800;
  color: #fff;
  animation: cd 1s ease-in-out infinite;
  letter-spacing: -0.04em;
}
@keyframes cd { 0% { transform: scale(0.8); opacity: 0; } 25% { transform: scale(1.06); opacity: 1; } 85% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }

/* crash recovery card (record screen start overlay) */
.recover-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(245, 166, 35, 0.09);
  border: 1px solid rgba(245, 166, 35, 0.35);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 400px;
  text-align: left;
  animation: toast-in 0.4s ease;
}
.recover-card b { color: var(--text); }
.recover-actions { display: flex; gap: 9px; }

/* toast */
.toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 9px; align-items: center; }

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  animation: toast-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.stage ~ .toasts .toast, .toasts.on-dark .toast { background: rgba(30, 33, 46, 0.95); color: #fff; border-color: rgba(255,255,255,0.14); }
.toast svg { width: 16px; height: 16px; color: var(--rec); }
.toast.out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.96); } }

/* ---------- Editor ---------- */

.editor-wrap {
  width: 100%;
  padding: 22px 24px 40px;
  display: grid;
  /* minmax(0,…) lets the timeline shrink instead of shoving the sidebar off-screen */
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-rows: auto auto;
  gap: 18px;
}

.previewzone { grid-column: 1; padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.pz-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pz-head h3 { font-size: 15px; }

.seg {
  display: flex;
  padding: 4px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 650;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.seg button svg { width: 14px; height: 14px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* review preview: screen large + webcam beside it (never overlapping content) */
.review-preview {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  height: 42vh;
  min-height: 240px;
}
.rp-screen {
  position: relative;
  height: 100%;
  aspect-ratio: 16 / 9;
  max-width: calc(100% - 236px);
  border-radius: var(--r-md);
  background: #101321;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.rp-screen .mini-slide { width: 60%; display: flex; flex-direction: column; gap: 9px; }
.rp-screen .mini-slide .bar { height: 13px; width: 52%; border-radius: 4px; background: linear-gradient(90deg, rgba(157,123,255,.8), rgba(108,92,247,.5)); }
.rp-screen .mini-slide .line { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.14); }
.rp-cam {
  position: relative;
  width: 220px;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #2b2f45, #232030);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.rp-cam .you { width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--accent-grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; }

/* marker rows with production notes */
.mk-edit { display: flex; align-items: center; gap: 7px; padding: 5px 0; }
.mk-time {
  border: none; cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.mk-time:hover { border-color: var(--accent); }
.mk-note {
  flex: 1; min-width: 0;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}
.mk-note:focus { outline: none; border-color: var(--accent); }
.mk-del {
  width: 26px; height: 26px; flex-shrink: 0;
  border: none; border-radius: 7px;
  background: transparent; color: var(--faint);
  display: grid; place-items: center; cursor: pointer;
  transition: all 0.15s ease;
}
.mk-del svg { width: 13px; height: 13px; }
.mk-del:hover { background: rgba(255, 77, 94, 0.12); color: var(--rec); }

/* ---------- compose screen ---------- */

.compose-wrap { width: 100%; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.compose-head { display: flex; align-items: center; gap: 14px; padding: 13px 18px; flex-wrap: wrap; }
.stage-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }

/* main column + right control pane */
.compose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}
.compose-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.compose-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 86px; }
.side-pane { padding: 18px; display: flex; flex-direction: column; gap: 9px; }
.side-pane h3 { font-size: 14px; margin-bottom: 2px; }

@media (max-width: 1080px) {
  .compose-grid { grid-template-columns: 1fr; }
  .compose-side { position: static; }
}

.stage16 {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc(66vh * 16 / 9));
  background: #0b0d14;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  touch-action: none;
  user-select: none;
}
.vlayer, .chrome { position: absolute; inset: 0; }
.vlayer video { background: #171b28; }
.vlayer video#vCam { z-index: 1; }

.tpl-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;   /* clicks reach the boxes below */
}

.chrome { z-index: 3; }
.vbox {
  position: absolute;
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: 5px;
  cursor: move;
}
.vbox .tag {
  position: absolute;
  top: -1px;
  left: -1px;
  padding: 2px 8px;
  border-radius: 5px 0 7px 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(15, 17, 26, 0.75);
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}
.vbox.sel { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.vbox.sel .tag { background: var(--accent); color: #fff; }

.hnd {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid var(--accent);
  display: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}
.vbox.sel .hnd { display: block; }
.hnd[data-c="tl"] { left: -7px; top: -7px; cursor: nwse-resize; }
.hnd[data-c="tr"] { right: -7px; top: -7px; cursor: nesw-resize; }
.hnd[data-c="bl"] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.hnd[data-c="br"] { right: -7px; bottom: -7px; cursor: nwse-resize; }

/* speaker name (Liberation Sans = metric-identical free Arial) */
@font-face {
  font-family: 'Liberation Sans';
  src: url('../fonts/LiberationSans-Bold.ttf') format('truetype');
  font-weight: 700;
}
.speaker-overlay {
  position: absolute;
  z-index: 2;                 /* with the template layer, under the chrome */
  pointer-events: none;
  display: flex;
  align-items: center;
  font-family: 'Liberation Sans', Arial, sans-serif;
  font-weight: 700;
  overflow: hidden;
  line-height: 1.25;
  word-break: break-word;
}

/* admin: template name-area editor (modal, 50% scale stage) */
.modal.tpl-modal { max-width: 1012px; width: 1012px; }
.tpl-stage {
  position: relative;
  width: 960px;
  height: 540px;
  border-radius: 12px;
  overflow: hidden;
  background: #101321;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  user-select: none;
}
.tpl-stage img { width: 100%; height: 100%; display: block; }
.tpl-stage .na-box { pointer-events: auto; cursor: move; }
.modal-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; }
.na-box {
  position: absolute;
  display: flex;
  align-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.65);
  font-family: 'Liberation Sans', Arial, sans-serif;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  padding: 0 2px;
  pointer-events: none;
}
.na-box .na-text { width: 100%; word-break: break-word; }
.tpl-stage .hnd { display: block; }   /* corner handles always visible in the template editor */
.tpl-meta-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 10px; flex: 1; align-content: start; }
.tpl-meta-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.tpl-meta-form .f-input { padding: 8px 10px; }

/* webcam correction modal */
.wc-modal { max-width: 640px; }
.wc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.wc-head .hint { flex: 1; }
.wc-frame {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #0b0d14;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
}
.wc-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wc-loading {
  position: absolute;
  top: 10px; right: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.wc-presets { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.wc-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; margin-bottom: 8px; }
.wc-slider { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; padding: 3px 0; }
.wc-slider label { font-size: 12px; font-weight: 650; color: var(--muted); grid-column: 1 / -1; }
.wc-slider input[type="range"] { width: 100%; accent-color: var(--accent); }
.wc-val { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); min-width: 44px; text-align: right; }

.vimeo-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
}
.vimeo-check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* render status */
.render-status { font-size: 13px; font-weight: 650; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.render-status a { font-weight: 700; }
.spin-mini {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  display: inline-block; animation: spin 0.8s linear infinite;
}

/* intro/outro stills */
.bumper-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 4;               /* covers videos + template while a still is showing */
  pointer-events: none;
  background: #0b0d14;
}
.bumper-card { display: flex; align-items: center; gap: 26px; padding: 13px 18px; flex-wrap: wrap; }
.bumper-item { display: flex; align-items: center; gap: 11px; }
.bumper-item > b { font-size: 13.5px; }
.bumper-dur { display: inline-flex; align-items: center; gap: 6px; }

.modal.save-modal { max-width: 440px; }

/* read-only output timeline on the compose screen */
.tl-ro .clip { pointer-events: none; cursor: default; }

/* admin template manager */
.tpl-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.tpl-row:last-child { border-bottom: none; }
.tpl-thumb { width: 96px; aspect-ratio: 16/9; border-radius: 8px; object-fit: cover; background: #101321; border: 1px solid var(--border); flex-shrink: 0; }
.tpl-row b { flex: 1; font-size: 13.5px; }

/* confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 16, 0.55);
  backdrop-filter: blur(6px);
  animation: toast-in 0.2s ease;
}
.modal {
  max-width: 460px;
  width: calc(100% - 40px);
  padding: 26px 28px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal p { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.modal p b { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

.tool:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.dl-btn { width: 100%; justify-content: flex-start; margin-top: 7px; }

/* keyboard shortcuts card */
.shortcuts { padding: 18px; }
.shortcuts h3 { font-size: 14.5px; margin-bottom: 10px; }
.sc-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0;
  font-size: 12.5px; color: var(--muted);
}
.sc-row .keys { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); }
.sc-row kbd {
  font-family: inherit;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  color: var(--text);
}

.canvas-mock {
  aspect-ratio: 16 / 9;
  width: min(100%, calc(44vh * 16 / 9));
  margin: 0 auto;
  border-radius: var(--r-md);
  background: #101321;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.cm-screen {
  position: absolute;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d2440, #251d3e);
  border: 1px solid rgba(255,255,255,0.1);
  display: grid;
  place-items: center;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.cm-screen .mini-slide { width: 70%; display: flex; flex-direction: column; gap: 9px; }
.cm-screen .mini-slide .bar { height: 13px; width: 52%; border-radius: 4px; background: linear-gradient(90deg, rgba(157,123,255,.8), rgba(108,92,247,.5)); }
.cm-screen .mini-slide .line { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.14); }

.cm-cam {
  position: absolute;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, #2b2f45, #232030);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: grid;
  place-items: center;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.cm-cam .you { width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--accent-grad); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: clamp(10px, 2vw, 18px); }

/* layout variants */
.canvas-mock[data-layout="pip"] .cm-screen { inset: 0; border-radius: 0; border: none; }
.canvas-mock[data-layout="pip"] .cm-cam { width: 21%; aspect-ratio: 16/10; right: 2.6%; bottom: 4%; }
.canvas-mock[data-layout="side"] .cm-screen { left: 2.5%; top: 8%; bottom: 8%; width: 62%; }
.canvas-mock[data-layout="side"] .cm-cam { right: 2.5%; top: 8%; bottom: 8%; width: 30%; }
.canvas-mock[data-layout="screen"] .cm-screen { inset: 0; border-radius: 0; border: none; }
.canvas-mock[data-layout="screen"] .cm-cam { width: 21%; aspect-ratio: 16/10; right: 2.6%; bottom: 4%; opacity: 0; transform: scale(0.8); pointer-events: none; }

.cm-graphic {
  position: absolute;
  z-index: 3;
  left: 5%;
  top: 7%;
  padding: 7px 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.92);
  color: #171a21;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(-6px);
  transition: all 0.3s ease;
}
.cm-graphic.show { opacity: 1; transform: none; }

.transport { display: flex; align-items: center; gap: 14px; }

.t-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(108,92,247,0.4);
  transition: transform 0.15s ease;
}
.t-btn:hover { transform: scale(1.07); }
.t-btn svg { width: 17px; height: 17px; }

.t-time { font-variant-numeric: tabular-nums; font-size: 13.5px; font-weight: 650; color: var(--muted); }
.t-time b { color: var(--text); }

/* sidebar */
.side { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; gap: 18px; }

.props { padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.props h3 { font-size: 14.5px; display: flex; align-items: center; gap: 9px; }
.props h3 .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }
.props .empty { color: var(--faint); font-size: 13px; text-align: center; padding: 18px 0; }

.prop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.prop-row label { color: var(--muted); font-weight: 550; }
.prop-row .val { font-weight: 650; font-variant-numeric: tabular-nums; }
.prop-row input[type="text"] {
  width: 150px; padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-family: inherit;
}
.prop-row input:focus { outline: none; border-color: var(--accent); }

.marker-list { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.marker-list h3 { font-size: 14.5px; margin-bottom: 6px; }

.mk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.18s ease;
  font-size: 13px;
}
.mk-row:hover { background: var(--surface-2); }
.mk-row .pin-ic { width: 14px; height: 14px; color: var(--rec); flex-shrink: 0; }
.mk-row .mt { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.mk-row .ml { color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row .go { color: var(--faint); font-size: 11.5px; font-weight: 650; opacity: 0; transition: opacity 0.15s; }
.mk-row:hover .go { opacity: 1; color: var(--accent); }

/* timeline */
.timeline-card { grid-column: 1; padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 12px; user-select: none; }

.tl-toolbar { display: flex; align-items: center; gap: 8px; }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s ease;
}
.tool svg { width: 14px; height: 14px; }
.tool:hover { color: var(--text); border-color: var(--border-strong); }
.tool.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.tl-hint { margin-left: auto; font-size: 12px; color: var(--faint); }

.tl-scroll { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }

.tl { position: relative; min-width: 100%; width: 1400px; padding-bottom: 14px; }

.ruler { position: relative; height: 30px; border-bottom: 1px solid var(--border); }
.ruler .tick { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; padding-left: 6px; border-left: 1px solid var(--border); }

.pins { position: absolute; top: 0; height: 30px; left: 0; right: 0; pointer-events: none; }
.pin { position: absolute; top: 3px; transform: translateX(-50%); color: var(--rec); pointer-events: all; cursor: pointer; }
.pin svg { width: 15px; height: 15px; filter: drop-shadow(0 2px 4px rgba(255,77,94,0.4)); }
.pin:hover { transform: translateX(-50%) scale(1.25); }

.track { display: flex; align-items: center; height: 56px; padding: 7px 0; position: relative; border-bottom: 1px solid var(--border); }
.track:last-child { border-bottom: none; }

.track-label {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 92px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  height: 100%;
}
.track-label svg { width: 13px; height: 13px; }

.track-body { position: relative; flex: 1; height: 100%; }

.clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  transition: border-color 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}

.clip.screen-clip { background: linear-gradient(180deg, #6c5cf7, #5a4ad9); }
.clip.cam-clip { background: linear-gradient(180deg, #2fa4c9, #2380a8); }
.clip.gfx-clip { background: linear-gradient(180deg, #e8913a, #d1782a); }

.clip .wave { position: absolute; inset: auto 0 3px 0; height: 14px; opacity: 0.4; }

.clip.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(108,92,247,0.35); z-index: 3; }

.clip.removed { filter: grayscale(1) brightness(0.72); opacity: 0.5; }
.clip.removed::after {
  content: "removed";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(0,0,0,0.22) 8px 16px);
}

.handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 11px;
  cursor: ew-resize;
  display: none;
  place-items: center;
  z-index: 4;
}
.handle::after { content: ""; width: 4px; height: 55%; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.handle.l { left: 0; } .handle.r { right: 0; }
.clip.selected .handle { display: grid; }

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--rec);
  z-index: 8;
  pointer-events: none;
}
.playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 13px;
  height: 15px;
  background: var(--rec);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

.tl.cut-mode .clip { cursor: crosshair; }

/* ---------- Processing ---------- */

.proc-wrap { max-width: 660px; margin: 0 auto; padding: 48px 24px 80px; }

.proc-card { padding: 34px; display: flex; flex-direction: column; gap: 24px; }

.proc-head { display: flex; align-items: center; gap: 16px; }
.proc-head .spin-wrap { width: 52px; height: 52px; flex-shrink: 0; position: relative; }
.proc-head h2 { font-size: 20px; }
.proc-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.spinner { width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.success-badge {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--ok);
  display: grid; place-items: center; color: #fff;
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 20px rgba(34,192,122,0.4);
}
.success-badge svg { width: 24px; height: 24px; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.stage-list { display: flex; flex-direction: column; gap: 3px; }

.stage-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 550;
  color: var(--faint);
  transition: all 0.3s ease;
}
.stage-item .si {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.3s ease;
  font-size: 11px;
}
.stage-item .si svg { width: 13px; height: 13px; }

.stage-item.done { color: var(--muted); }
.stage-item.done .si { background: var(--ok); border-color: var(--ok); color: #fff; }

.stage-item.running { color: var(--text); background: var(--accent-soft); }
.stage-item.running .si { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }

.stage-item .pct { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); font-size: 13px; }

.stage-item.failed { color: var(--rec); }
.stage-item.failed .si { border-color: var(--rec); color: var(--rec); animation: none; }

.progress { height: 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent-grad); transition: width 0.4s ease; }

.result { display: none; flex-direction: column; gap: 20px; }
.result.show { display: flex; animation: toast-in 0.4s ease; }

.player {
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 16/9;
  position: relative;
  background: linear-gradient(135deg, #1d2440, #2a1d45);
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--border);
}
.player .bigplay {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
  display: grid; place-items: center; color: #fff;
  transition: all 0.2s ease;
}
.player:hover .bigplay { transform: scale(1.08); background: rgba(255,255,255,0.26); }
.player .bigplay svg { width: 26px; height: 26px; margin-left: 4px; }
.player .p-cam { position: absolute; right: 3%; bottom: 5%; width: 20%; aspect-ratio: 16/10; border-radius: 9px; background: rgba(255,255,255,0.22); border: 1.5px solid rgba(255,255,255,0.4); }
.player .p-dur { position: absolute; left: 14px; bottom: 12px; color: rgba(255,255,255,0.9); font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; background: rgba(0,0,0,0.4); padding: 3px 9px; border-radius: 7px; backdrop-filter: blur(4px); }

.result-actions { display: flex; gap: 11px; flex-wrap: wrap; }

/* ---------- Login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 36px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; }
.login-logo .logo-mark svg { width: 24px; height: 24px; }
.login-logo h1 { font-size: 22px; }
.login-logo p { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

.f-label { display: block; font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 14px 0 6px; }
.f-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.f-input:focus { outline: none; border-color: var(--accent); }
.f-color { width: 46px; height: 38px; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }

/* swatch + hex text field, kept in sync (the text field is the submitted value) */
.hexpick { display: inline-flex; align-items: center; gap: 8px; }
.hexpick input[type="text"] { width: 98px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; text-transform: lowercase; }
.hexpick .f-color { flex-shrink: 0; }

.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* split login: trainers left, staff right */
.login-card.wide { max-width: 800px; }
.login-split {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0 30px;
  align-items: stretch;
  margin-top: 4px;
}
.login-vbar { width: 1px; background: var(--border); }
.login-col h4 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.login-col-sub { margin: 0 0 10px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.btn-orange {
  background: linear-gradient(135deg, #e8913a, #d1782a);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 145, 58, 0.4);
}
.btn-orange:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(232, 145, 58, 0.5); }

@media (max-width: 640px) {
  .login-split { grid-template-columns: 1fr; }
  .login-vbar { width: auto; height: 1px; margin: 20px 0; }
}

.form-msg { padding: 11px 14px; border-radius: var(--r-md); font-size: 13.5px; margin-bottom: 14px; line-height: 1.5; }
.form-msg.err { background: rgba(255, 77, 94, 0.1); color: var(--rec); border: 1px solid rgba(255, 77, 94, 0.3); }
.form-msg.ok  { background: rgba(34, 192, 122, 0.1); color: var(--ok); border: 1px solid rgba(34, 192, 122, 0.3); }
.form-msg.dev { background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent); word-break: break-all; }
.form-msg.dev code { font-size: 12px; }

/* ---------- Admin ---------- */

.admin-tag {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  margin-left: 2px;
}

.admin-nav { display: flex; gap: 4px; margin-left: 16px; }
.admin-nav a {
  padding: 8px 15px; border-radius: 11px;
  color: var(--muted); font-size: 13.5px; font-weight: 650;
  transition: all 0.2s ease;
}
.admin-nav a:hover { color: var(--text); background: var(--surface-2); }
.admin-nav a.active { color: var(--accent); background: var(--accent-soft); }

.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip-name { font-size: 13px; font-weight: 650; }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; border-radius: 10px; flex-shrink: 0; }

/* compact icon actions in table rows */
.row-actions { display: inline-flex; gap: 6px; align-items: center; }
.row-actions form { display: inline-flex; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.icon-btn.danger:hover { color: var(--rec); border-color: rgba(255, 77, 94, 0.4); background: rgba(255, 77, 94, 0.08); }

.page-wide { max-width: 1360px; }
.muted { color: var(--faint); font-size: 12.5px; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; position: relative; }
.stat-ic {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 12px;
}
.stat-ic svg { width: 17px; height: 17px; }
.stat-ic.i1 { background: rgba(108, 92, 247, 0.13); color: #6c5cf7; }
.stat-ic.i2 { background: rgba(47, 164, 201, 0.13); color: #2fa4c9; }
.stat-ic.i3 { background: rgba(255, 77, 94, 0.12); color: #ff4d5e; }
.stat-ic.i4 { background: rgba(232, 145, 58, 0.13); color: #e8913a; }
.stat-ic.i5 { background: rgba(34, 192, 122, 0.12); color: #22c07a; }
.stat-ic.i6 { background: rgba(157, 123, 255, 0.14); color: #9d7bff; }
.stat-n { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-n .stat-sub { font-size: 14px; font-weight: 650; color: var(--faint); }
.stat-l { font-size: 12.5px; color: var(--muted); font-weight: 550; margin-top: 3px; }
.stat-delta { color: var(--ok); font-weight: 700; font-size: 11.5px; }

/* dashboard columns */
.dash-cols { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; margin-bottom: 22px; }

.chart-card { padding: 20px 22px; display: flex; flex-direction: column; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chart-head h3 { font-size: 15px; }
.chart-legend { display: flex; gap: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .lg::before { content: ""; width: 8px; height: 8px; border-radius: 3px; }
.lg-ready::before { background: var(--ok); }
.lg-proc::before { background: var(--warn); }
.lg-fail::before { background: var(--rec); }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; flex: 1; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bar-col i {
  display: block; width: 100%;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  min-height: 3px;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.bar-col i.zero { background: var(--border); }
.bar-col:hover i { filter: brightness(1.15); transform: scaleY(1.02); transform-origin: bottom; }
.bars-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--faint); }

.feed-card { padding: 20px 22px; }
.feed-card h3 { font-size: 15px; margin-bottom: 14px; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; background: var(--faint); }
.feed-dot.recording { background: var(--rec); }
.feed-dot.render { background: var(--ok); }
.feed-dot.login { background: var(--accent); }
.feed-dot.impersonation { background: var(--warn); }
.feed-t { font-size: 13px; }
.feed-t b { font-weight: 650; }
.feed-m { font-size: 11.5px; color: var(--faint); margin-top: 1px; }

/* tables */
.table-card { padding: 20px 22px; }
.table-card h3 { font-size: 15px; margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--faint); padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.15s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }
.row-off { opacity: 0.45; }
.client-cell, .member-cell { display: flex; align-items: center; gap: 11px; }
.color-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

/* clients page */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.client-card { display: flex; align-items: center; gap: 14px; padding: 18px; transition: all 0.2s ease; color: var(--text); }
.client-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.client-swatch {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
}
.client-swatch.lg { width: 56px; height: 56px; border-radius: 17px; font-size: 18px; }
.client-card-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.client-head { display: flex; align-items: center; gap: 16px; }

.form-card { padding: 20px 22px; }
.form-card h3 { font-size: 15px; margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin-top: 18px; }

.client-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.client-side { display: flex; flex-direction: column; gap: 16px; }
.member-add { display: grid; grid-template-columns: 1.2fr 1.4fr 0.9fr auto; gap: 9px; margin-top: 16px; }
.mini-rec { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-rec:last-child { border-bottom: none; }
.mini-rec b { font-weight: 600; }

.del-btn {
  width: 28px; height: 28px;
  border: none; border-radius: 8px;
  background: transparent; color: var(--faint);
  display: grid; place-items: center; cursor: pointer;
  transition: all 0.15s ease;
}
.del-btn svg { width: 15px; height: 15px; }
.del-btn:hover { background: rgba(255, 77, 94, 0.12); color: var(--rec); }

.switcher {
  width: auto; max-width: 180px;
  padding: 8px 34px 8px 12px;
  font-size: 13px; font-weight: 600;
  border-radius: 11px;
}

/* impersonation banner */
.impersonate-banner {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 9px 20px;
  background: linear-gradient(90deg, #e8913a, #d1782a);
  color: #fff; font-size: 13px; font-weight: 650;
}
.impersonate-banner a {
  color: #fff; text-decoration: underline; font-weight: 700;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .editor-wrap { grid-template-columns: 1fr; }
  .dash-cols, .client-cols { grid-template-columns: 1fr; }
  .member-add { grid-template-columns: 1fr 1fr; }
  .side { grid-column: 1; grid-row: auto; flex-direction: row; }
  .side > * { flex: 1; }
}

@media (max-width: 860px) {
  .setup-grid { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
  .steps { display: none; }
  .side { flex-direction: column; }
}
