/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:        #f2f1ee;
  --panel:     #ffffff;
  --panel-hd:  #fafaf8;
  --border:    #e4e3df;
  --border-2:  #d0ceca;
  --ink:       #1a1918;
  --ink-2:     #4a4845;
  --ink-3:     #9a9895;
  --primary:   #1a56db;
  --primary-bg:#eff4ff;
  --rec:       #e3341a;
  --rec-bg:    #fff2f0;
  --success:   #1a7f47;
  --r:         10px;
  --r-sm:      6px;
  --topbar-h:  52px;
  --sidebar-w: 248px;
  --ease:      cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  z-index: 100;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
  flex-shrink: 0;
  font-size: 13px;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.app-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  flex-shrink: 0;
}
.app-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.app-name {
  font-family: 'Tiro Devanagari Hindi', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0;
}
.app-name-dot {
  color: var(--primary);
  font-weight: 800;
  margin: 0 0.5px;
}
.app-name-suffix {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ink-3);
  vertical-align: middle;
  margin-left: 2px;
}
.project-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 10px;
  border-radius: 999px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-badge:empty { display: none; }
.project-title-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;  /* push Google area to the right */
}
.project-topbar-btn { font-size: 14px; color: var(--ink-3); }
.project-topbar-btn:hover { color: var(--ink); }
.topbar-rename-input {  height: 26px;
  border: none;
  border-bottom: 1.5px solid var(--primary);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 4px;
  outline: none;
  min-width: 80px;
  max-width: 180px;
  border-radius: 0;
}

/* ── Google sign-in area (topbar right) ───────────────────── */
.google-user-area {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  position: relative;
}
.google-signin-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}
.google-signin-btn:hover { background: var(--bg); border-color: var(--ink-3); }
.google-user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  cursor: pointer;
  user-select: none;
  transition: background 120ms;
}
.google-user-chip:hover { background: #e8e6e2; }
.google-user-chip.hidden { display: none; }
.chip-caret { font-size: 9px; color: var(--ink-3); }
.google-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.google-user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Dropdown */
.google-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13);
  width: 240px;
  z-index: 300;
  overflow: hidden;
  animation: popup-in 120ms var(--ease);
}
.google-dropdown.hidden { display: none; }
.google-dropdown-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
.google-avatar-lg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.google-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.google-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.google-dropdown-email {
  font-size: 11px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.google-dropdown-divider { height: 1px; background: var(--border); }
.google-dropdown-channel { }
.google-dropdown-channel.hidden { display: none; }
.google-dropdown-channel-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
}
.yt-channel-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.yt-channel-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.google-dropdown-drive-link {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 120ms;
}
.google-dropdown-drive-link:hover { background: var(--bg); color: var(--accent); }
.google-dropdown-signout {
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms;
}
.google-dropdown-signout:hover { background: var(--bg); color: var(--rec); }

/* ── Sidebar overlay ───────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.35);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease);
  backdrop-filter: blur(1px);
}
.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 99;
  transform: translateX(-100%);
  transition: transform 230ms var(--ease);
  overflow: hidden;
}
.sidebar.visible { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-hd);
  flex-shrink: 0;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.sidebar-create {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.project-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}
.project-nav-item { display: block; }
.project-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 130ms, color 130ms;
}
.project-nav-btn:hover { background: var(--bg); color: var(--ink); }
.project-nav-btn.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}
.item-empty {
  padding: 10px 16px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-style: italic;
}

/* ── Workspace layout ──────────────────────────────────────── */
.workspace {
  margin-top: var(--topbar-h);
  display: flex;
  flex-direction: row;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ── Panel resizer (drag handle) ─────────────────────────── */
.panel-resizer {
  flex: 0 0 5px;
  width: 5px;
  cursor: col-resize;
  background: var(--border);
  transition: background 200ms;
  position: relative;
  z-index: 20;
}
.panel-resizer::after {
  content: '';
  position: absolute;
  inset: 0 -4px;
}
.panel-resizer:hover,
.panel-resizer.resizing { background: var(--primary); }

/* ── Panels ────────────────────────────────────────────────── */
.panel {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative; /* anchor for panel-popup */
}
#panel-reference {
  border-right: 1px solid var(--border);
  overflow: visible; /* allow floating add-ref-popup to escape panel bounds */
}

/* Fixed reference player */
.ref-player-section {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.ref-player {
  aspect-ratio: 16/9;
  position: relative;
  background: #111;
  overflow: hidden;
}
.ref-player video,
.ref-player .embed-wrap { position: absolute; inset: 0; width: 100%; height: 100%; }
.ref-player video { object-fit: contain; }
.ref-player audio {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 100%;
}
.now-playing-label {
  font-size: 11.5px;
  color: var(--ink-3);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now-playing-label:empty { display: none; }

.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 13px;
  background: var(--panel-hd);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: visible; /* popup floats below */
}
.panel-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.2px;
  line-height: 1;
}
.panel-sub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
}

.panel-body {
  flex: 1;
  overflow: hidden;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
/* Record panel: fixed webcam+controls, then scrollable takes */
.rec-panel-body { padding: 0; gap: 0; }
.rec-fixed {
  flex-shrink: 0;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.takes-list-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 16px 14px;
  gap: 6px;
  min-height: 0;
}

/* ── Add-source sections ───────────────────────────────────── */
.add-section { display: flex; flex-direction: column; gap: 6px; }
.add-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}
.input-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.w-120 { width: 118px; flex-shrink: 0; }
.w-full { width: 100%; justify-content: center; }

/* ── Add-reference popup ───────────────────────────────────── */
.add-ref-popup {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}.add-ref-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.add-ref-hd-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
}.add-ref-row { display: flex; gap: 6px; align-items: center; }
/* YouTube search results */
.yt-search-results {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
}
.yt-search-results.hidden { display: none; }
.yt-search-loading {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}
.yt-search-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 100ms;
}
.yt-search-item:last-child { border-bottom: none; }
.yt-search-item:hover { background: var(--bg); }
.yt-search-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #eee;
}
.yt-search-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.yt-search-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.yt-search-channel {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.add-ref-or {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
}
.add-ref-or::before, .add-ref-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.panel-hd-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-sm {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

/* ── Inputs ────────────────────────────────────────────────── */
.ipt {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 140ms, box-shadow 140ms;
  min-width: 0;
}
.ipt::placeholder { color: var(--ink-3); }
.ipt:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
  background: #fff;
}
input[type="file"].ipt {
  padding: 0 8px;
  line-height: 32px;
  cursor: pointer;
  font-size: 12px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 130ms, border-color 130ms, transform 80ms;
  flex-shrink: 0;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: #1446b3; border-color: #1446b3; }
.btn-ghost {
  background: var(--panel);
  color: var(--ink-2);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--ink); border-color: var(--border-2); }
.btn-rec {
  background: var(--rec);
  color: #fff;
  border-color: var(--rec);
  font-weight: 600;
}
.btn-rec:hover:not(:disabled) { background: #c82c14; border-color: #c82c14; }

/* ── Track list (references + takes) ──────────────────────── */
.list-section { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.list-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  flex-shrink: 0;
}
.track-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
  min-height: 0;
}
.track-list .item-empty {
  padding: 11px 14px;
  color: var(--ink-3);
  font-style: italic;
  font-size: 12.5px;
}
.track-list .item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
}
.track-list .item-row:last-child { border-bottom: none; }
.track-list .item-row:hover { background: #fff; }
.track-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.track-type.yt  { background: #ffeef0; color: #c0392b; }
.track-type.vid { background: #fff3e0; color: #b05b00; }
.track-type.aud { background: #edfbf1; color: var(--success); }
.item-action {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  text-align: left;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-action:hover { color: var(--primary); }

/* ── Item row controls ─────────────────────────────────────── */
.item-drag {
  font-size: 14px;
  color: var(--ink-3);
  cursor: grab;
  flex-shrink: 0;
  padding: 0 2px;
  user-select: none;
  line-height: 1;
}
.item-drag:hover { color: var(--ink-2); }
.item-play-btn {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 9px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms, color 120ms;
  padding: 0;
}
.item-play-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.item-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
  padding: 2px 4px;
  border-radius: 3px;
}
.item-name:hover { background: rgba(26,86,219,0.06); color: var(--primary); }
.item-name-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.item-delete-btn {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: none;
  background: none;
  color: #bbb;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: color 120ms, background 120ms;
  opacity: 0;
  transition: opacity 120ms, color 120ms, background 120ms;
}
.track-list .item-row:hover .item-delete-btn { opacity: 1; }
.item-delete-btn:hover { color: var(--rec); background: rgba(227,52,26,0.08); }
.item-delete-btn.confirming { opacity: 1; color: var(--rec); background: rgba(227,52,26,0.12); }
.item-row.drag-over { background: rgba(26,86,219,0.07); outline: 2px dashed rgba(26,86,219,0.3); outline-offset: -2px; }
.item-row.dragging { opacity: 0.4; }
/* Now-playing highlight */
.item-row.ref-playing { background: rgba(26,86,219,0.05); }
.item-row.ref-playing .item-play-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  position: relative;
}
.item-row.ref-playing .item-name { color: var(--primary); font-weight: 500; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0; } }
.item-row.ref-playing .item-play-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: pulse 1.2s ease-out infinite;
  pointer-events: none;
}
/* Same highlight for recording takes */
.item-row.rec-playing { background: rgba(26,86,219,0.05); }
.item-row.rec-playing .item-play-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  position: relative;
}
.item-row.rec-playing .item-name { color: var(--primary); font-weight: 500; }
.item-row.rec-playing .item-play-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: pulse 1.2s ease-out infinite;
  pointer-events: none;
}
.item-duration {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: ui-monospace, monospace;
  flex-shrink: 0;
}
.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.item-yt-link {
  font-size: 11px;
  font-weight: 500;
  color: #c0392b;
  text-decoration: none;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(255,0,0,0.07);
  border: 1px solid rgba(255,0,0,0.2);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 120ms;
}
.item-yt-link:hover { background: rgba(255,0,0,0.15); }
.item-dl {
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: background 120ms;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 120ms, background 120ms;
}
.track-list .item-row:hover .item-dl { opacity: 1; }
.item-dl:hover { background: var(--bg); color: var(--ink); }

/* ── Player wrapper ────────────────────────────────────────── */
.player-wrap {
  border-radius: var(--r);
  overflow: hidden;
  background: #111;
  aspect-ratio: 16/9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 13px;
  text-align: center;
  padding: 24px;
  position: absolute;
  inset: 0;
  justify-content: center;
}
.player-idle-icon {
  font-size: 28px;
  opacity: 0.35;
  line-height: 1;
}
.cam-icon { font-size: 22px; }
.cam-active { background: rgba(22,163,74,0.1) !important; border-color: rgba(22,163,74,0.45) !important; color: #16a34a !important; }
.player-idle strong { color: #999; }
.player-idle span { color: #777; }
video { display: block; width: 100%; height: 100%; object-fit: cover; }
audio { display: block; width: 100%; background: #1a1918; padding: 10px; }
.embed-wrap { width: 100%; height: 100%; }
.embed-wrap iframe { display: block; width: 100%; height: 100%; border: none; }

.webcam-wrap { background: #0b0b0b; }
.playback-wrap video { object-fit: contain; }
.rec-video-player { object-fit: contain !important; }

/* ── Recording controls ────────────────────────────────────── */
.rec-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rec-dot-sm {
  width: 8px; height: 8px;
  background: currentColor;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Recording indicator pill ──────────────────────────────── */
.rec-pill {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--rec);
  background: var(--rec-bg);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(227,52,26,.2);
  letter-spacing: 0.02em;
}
.rec-pill.show { display: inline-flex; }
.rec-dot {
  width: 7px; height: 7px;
  background: var(--rec);
  border-radius: 50%;
  flex-shrink: 0;
  animation: blink 900ms infinite;
}
@keyframes blink { 0%,100% { opacity:1 } 50% { opacity:.3 } }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1918;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity 180ms, transform 180ms;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--rec); }

/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Panel-contained popup ─────────────────────────────────── */
.panel-popup {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #111;
  display: flex;
  flex-direction: column;
  animation: popup-in 160ms var(--ease);
}
@keyframes popup-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.popup-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #1c1b19;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.popup-title {
  font-size: 13px;
  font-weight: 500;
  color: #c8c6c3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.popup-close-btn {
  color: #666 !important;
  flex-shrink: 0;
}
.popup-close-btn:hover {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}
.popup-player {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 0;
}
.popup-player video,
.popup-player .embed-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.popup-player video { object-fit: contain; }
.popup-player audio {
  position: absolute;
  bottom: 50%;
  transform: translateY(50%);
  width: 100%;
  z-index: 1;
}

/* ── A/B Loop controls ─────────────────────────────────────── */
.loop-bar {
  display: flex;
  flex-direction: column;
  background: #1c1b19;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.loop-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
}
.loop-row + .loop-row {
  border-top: 1px solid rgba(255,255,255,0.06);
}
.loop-clip-row { padding: 6px 12px; }
.loop-sep {
  width: 1px;
  height: 14px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.loop-play-btn { min-width: 30px; font-size: 10px; }
.loop-play-btn.playing { color: #7ba7ff; border-color: rgba(26,86,219,0.5); background: rgba(26,86,219,0.15); }
.loop-clip-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #555; flex-shrink: 0; }
.clip-label-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: #ccc;
  font: inherit;
  font-size: 11.5px;
  padding: 0 8px;
}
.clip-label-input::placeholder { color: #444; }
.clip-label-input:focus { outline: none; border-color: rgba(26,86,219,0.6); background: rgba(255,255,255,0.09); }
.clip-select {
  height: 24px;
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: #999;
  font: inherit;
  font-size: 11px;
  padding: 0 4px;
  cursor: pointer;
}
.clip-select:focus { outline: none; }
.clip-select option { background: #1c1b19; color: #ccc; }
.loop-del-clip-btn { color: #555; opacity: 0.7; }
.loop-del-clip-btn:not(:disabled):hover { color: #e06060; background: rgba(220,60,60,0.12); border-color: rgba(220,60,60,0.3); opacity: 1; }
.loop-del-clip-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.loop-btn {
  height: 26px;
  min-width: 26px;
  padding: 0 9px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #999;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms;
}
.loop-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.loop-btn.set { border-color: rgba(26,86,219,.5); color: #7ba7ff; }
.loop-pt {
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
  color: #666;
  min-width: 34px;
  text-align: center;
}
.loop-pt.set { color: #c8c6c3; }
.loop-arrow { color: #444; font-size: 12px; }
.loop-toggle {
  margin-left: auto;
  height: 26px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #888;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: all 130ms;
}
.loop-toggle:hover { background: rgba(255,255,255,0.12); color: #ccc; }
.loop-toggle.active {
  background: rgba(26,86,219,0.25);
  border-color: rgba(26,86,219,0.6);
  color: #7ba7ff;
}
.loop-reset-btn { color: #555; padding: 0 8px; }
.loop-reset-btn:hover { color: #e06060; background: rgba(220,60,60,0.12); border-color: rgba(220,60,60,0.3); }
.loop-divider { flex: 1; min-width: 8px; }

/* YouTube IFrame API creates an <iframe> inside embed-wrap; make it fill the container */
.embed-wrap iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: none; }

/* ── Note popup ──────────────────────────────────────── */
.note-popup {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 380px;
  height: 320px;
  min-width: 260px;
  min-height: 180px;
  z-index: 400;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  animation: popup-in 120ms var(--ease);
}
.note-popup-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--panel-hd);
  border-radius: 10px 10px 0 0;
  cursor: move;
  user-select: none;
}
.note-popup-title { font-size: 12px; font-weight: 600; color: var(--ink-2); flex-shrink: 0; }
.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  margin-left: 4px;
}
.notes-fmt-btn {
  height: 22px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  padding: 0 5px;
  white-space: nowrap;
  text-decoration: none;
}
.notes-fmt-btn:hover { background: var(--border); border-color: var(--border-2); color: var(--ink); }
.notes-fmt-btn.active { background: var(--border); border-color: var(--border-2); color: var(--primary); }
.notes-toolbar-sep { width: 1px; height: 14px; background: var(--border-2); margin: 0 3px; }
.notes-autosave { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.notes-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
/* Quill editor layout inside the notes popup */
#notes-editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#notes-editor .ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 6px 8px;
}
#notes-editor .ql-container.ql-snow {
  border: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 13px;
}
#notes-editor .ql-editor {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  min-height: 80px;
  padding: 10px 12px;
}

/* ── Confirmation modal ────────────────────────────────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-box {
  background: var(--bg);
  border-radius: var(--r);
  border: 1px solid var(--border);
  padding: 24px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: popup-in 140ms var(--ease);
}
.confirm-message { font-size: 14px; color: var(--ink); line-height: 1.5; margin: 0; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── YouTube Upload Modal ──────────────────────────────────── */
.yt-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.yt-modal.hidden { display: none; }
.yt-modal-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(440px, 94vw);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  animation: popup-in 140ms var(--ease);
}
.yt-modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.yt-modal-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.yt-modal-body { display: flex; flex-direction: column; gap: 10px; }
.yt-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}
.yt-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--ink);
  font-size: 13px;
  padding: 6px 9px;
  outline: none;
  transition: border-color 0.15s;
}
.yt-input:focus { border-color: var(--primary); }
.yt-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--ink);
  font-size: 13px;
  padding: 6px 9px;
  outline: none;
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.yt-textarea:focus { border-color: var(--primary); }
.yt-privacy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.yt-label-text { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.yt-radio {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.yt-progress-wrap { display: flex; align-items: center; gap: 10px; }
.yt-progress-wrap.hidden { display: none; }
.yt-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.yt-progress-fill {
  height: 100%;
  width: 0%;
  background: #ff0000;
  border-radius: 3px;
  transition: width 0.2s ease;
}
.yt-progress-label { font-size: 11px; color: var(--ink-dim); white-space: nowrap; min-width: 80px; }
.yt-result {
  font-size: 13px;
  color: #4ade80;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.yt-result.hidden { display: none; }
.yt-result a { color: #60a5fa; text-decoration: underline; }
.yt-error {
  font-size: 12px;
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 5px;
  padding: 7px 10px;
}
.yt-error.hidden { display: none; }
.yt-modal-ft { display: flex; justify-content: flex-end; gap: 8px; }
.item-yt-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 4px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 120ms, color 120ms, background 120ms, border-color 120ms;
}
.track-list .item-row:hover .item-yt-btn { opacity: 1; }
.item-yt-btn:hover { color: #c0392b; border-color: rgba(255,0,0,0.35); background: rgba(255,0,0,0.06); }

/* ── Toolbox Open Button (in panel header) ─────────────────── */
.toolbox-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms var(--ease);
  flex-shrink: 0;
}
.toolbox-open-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

/* ── Toolbox Drawer ────────────────────────────────────────── */
.toolbox-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 300px;
  height: calc(100vh - var(--topbar-h));
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 98;
  transform: translateX(100%);
  transition: transform 260ms var(--ease);
  box-shadow: -6px 0 28px rgba(0,0,0,.07);
}
.toolbox-drawer.open { transform: translateX(0); }

.toolbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 97;
  background: transparent;
}
.toolbox-backdrop.hidden { display: none; }

.toolbox-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-hd);
  flex-shrink: 0;
}
.toolbox-hd-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
}
.toolbox-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-2);
}

.toolbox-nav {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  overflow-x: auto;
}
.toolbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms var(--ease);
}
.toolbox-tab.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}
.toolbox-tab:hover:not(.active) { background: var(--bg); }

.toolbox-panes { flex: 1; overflow-y: auto; }
.tool-pane { padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.tool-pane.hidden { display: none; }

/* ── Pitch Tuner ───────────────────────────────────────────── */
.tuner-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.tuner-ring {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  border: 3px solid var(--border-2);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 250ms, box-shadow 250ms;
}
.tuner-ring.in-tune {
  border-color: #22c55e;
  box-shadow: 0 0 30px rgba(34,197,94,.22);
}
.tuner-ring.close {
  border-color: #f59e0b;
  box-shadow: 0 0 24px rgba(245,158,11,.18);
}
.tuner-ring.off {
  border-color: var(--rec);
  box-shadow: 0 0 20px rgba(227,52,26,.15);
}

.tuner-note-group {
  display: flex;
  align-items: flex-start;
  line-height: 1;
}
.tuner-note {
  font-size: 64px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -3px;
  line-height: 1;
}
.tuner-octave {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-3);
  margin-top: 10px;
}
.tuner-freq {
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tuner-meter-wrap { width: 100%; }
.tuner-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-3);
  margin-bottom: 5px;
  padding: 0 2px;
}
.tuner-meter-track {
  width: 100%;
  height: 10px;
  background: linear-gradient(to right,
    #ef4444 0%, #f97316 18%, #fde68a 38%,
    #86efac 48%, #22c55e 50%, #86efac 52%,
    #fde68a 62%, #f97316 82%, #ef4444 100%);
  border-radius: 5px;
  position: relative;
}
.tuner-meter-center {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 2px;
  height: 18px;
  background: var(--ink);
  transform: translateX(-50%);
  border-radius: 1px;
  opacity: .35;
}
.tuner-needle {
  position: absolute;
  top: -6px;
  width: 4px;
  height: 22px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 70ms linear;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.tuner-cents-label {
  text-align: center;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.tuner-status-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 20px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-3);
  border: 1px solid var(--border);
  transition: all 250ms;
}
.tuner-status-badge.in-tune { background: #dcfce7; color: #166534; border-color: #86efac; }
.tuner-status-badge.close   { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tuner-status-badge.off     { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.tuner-start-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms;
}
.tuner-start-btn:hover { background: #1347ba; }
.tuner-start-btn.active { background: var(--rec); }
.tuner-start-btn.active:hover { background: #c4290f; }

/* ── Metronome ─────────────────────────────────────────────── */
.metro-beats {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  min-height: 48px;
}
.metro-beat {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-2);
  transition: background 60ms, border-color 60ms, transform 60ms, box-shadow 60ms;
  flex-shrink: 0;
}
.metro-beat.accent {
  width: 34px;
  height: 34px;
  border-width: 2.5px;
}
.metro-beat.active {
  background: var(--ink-3);
  border-color: var(--ink-2);
  transform: scale(1.08);
}
.metro-beat.accent.active {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(26,86,219,.35);
  transform: scale(1.15);
}

.metro-bpm-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.metro-step-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 120ms;
  line-height: 1;
  user-select: none;
}
.metro-step-btn:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.metro-step-btn:active { transform: scale(.9); }

.metro-bpm-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 88px;
}
.metro-bpm-value {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metro-bpm-unit {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-3);
  margin-top: 3px;
}

.metro-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right,
    var(--primary) 0%,
    var(--primary) var(--pct, 37.78%),
    var(--border-2) var(--pct, 37.78%),
    var(--border-2) 100%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.metro-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.22);
  cursor: pointer;
}
.metro-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.22);
  cursor: pointer;
}

.metro-section { display: flex; flex-direction: column; gap: 8px; }
.metro-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ink-3);
}
.metro-sig-btns { display: flex; gap: 5px; }
.metro-sig-btn {
  flex: 1;
  padding: 7px 0;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}
.metro-sig-btn.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}
.metro-sig-btn:hover:not(.active) { background: var(--bg); }

.metro-controls { display: flex; gap: 8px; }
.metro-tap-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms;
  user-select: none;
}
.metro-tap-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.metro-tap-btn:active { transform: scale(.96); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .workspace { flex-direction: column; height: auto; overflow: visible; }
  .panel-resizer { display: none; }
  #panel-reference { border-right: none; border-bottom: 1px solid var(--border); }
  .panel { min-height: auto; }
  .panel-body { max-height: none; }
  .toolbox-drawer { width: 100%; }
}

/* ── Login gate ─────────────────────────────────────────────── */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-gate.hidden { display: none; }

/* Hide entire app shell until sign-in completes */
body.app-locked #app-shell { display: none; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  text-align: center;
}
.login-logo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
}
.login-title {
  font-family: 'Tiro Devanagari Hindi', serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
}
.login-dot { color: var(--ink-3); }
.login-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.btn-gate-signin {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 7px;
  padding: 10px 24px;
  cursor: pointer;
  width: 100%;
  transition: opacity 150ms;
}
.btn-gate-signin:hover { opacity: 0.88; }
.btn-gate-signin:disabled { opacity: 0.5; cursor: not-allowed; }
.login-gate-hint {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
  text-align: center;
  line-height: 1.5;
}
.login-gate-error {
  font-size: 12px;
  color: var(--rec);
  margin-top: 2px;
}

/* ── Video Maximize Overlay ───────────────────────────────────────────────── */
.video-maximize-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.93);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-maximize-overlay.hidden { display: none; }
.video-maximize-overlay video {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 6px;
  outline: none;
  background: #000;
}
.btn-maximize-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
}
.btn-maximize-close:hover { background: rgba(255,255,255,0.25); }
.btn-maximize {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms;
  pointer-events: none;
}
.btn-maximize.visible { pointer-events: auto; }
.ref-player:hover .btn-maximize.visible,
.webcam-wrap:hover .btn-maximize.visible { opacity: 1; }
.video-maximize-overlay iframe {
  width: 88vw;
  height: 82vh;
  border: none;
  border-radius: 6px;
}
