:root {
  --bg-deep: #010204;
  --bg-mid: #04060c;
  --glass-obsidian: rgba(7, 9, 15, 0.62);
  --glass-card: rgba(10, 13, 21, 0.68);
  --glass-recessed: rgba(2, 4, 8, 0.88);
  --cyan: #00F0FF;
  --cyan-glow: rgba(0, 240, 255, 0.36);
  --emerald: #00FF9D;
  --emerald-glow: rgba(0, 255, 157, 0.32);
  --gold: #FFD700;
  --violet: #8B5CF6;
  --red: #FF3355;
  --white: #F8FAFC;
  --muted: #98A4BD;
  --dim: #46506D;
  --border: rgba(255, 255, 255, 0.14);
  --rim-top: rgba(255, 255, 255, 0.34);
  --rim-soft: rgba(255, 255, 255, 0.08);
}

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

@keyframes liquidShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes liquidAuraDrift {
  0% { transform: translate3d(-4%, -3%, 0) scale(1); }
  50% { transform: translate3d(4%, 3%, 0) scale(1.06); }
  100% { transform: translate3d(-4%, -3%, 0) scale(1); }
}

@keyframes recPulse { 0% { opacity: 0.25; } 100% { opacity: 1; } }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(22px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

html {
  background: #010204;
  color-scheme: dark;
}

body {
  background: #010204;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  overflow-x: hidden;
  position: relative;
}

/* Fallback CSS Liquid Obsidian backdrop */
body::before {
  content: "";
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 40% at 22% 18%, rgba(0, 240, 255, 0.11), transparent 65%),
    radial-gradient(42% 38% at 78% 24%, rgba(139, 92, 246, 0.13), transparent 68%),
    radial-gradient(48% 45% at 52% 82%, rgba(0, 255, 157, 0.08), transparent 70%),
    #010204;
  animation: liquidAuraDrift 16s ease-in-out infinite;
}

#liquidBgShader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.94;
}

/* THICK VAULTED iOS OBSIDIAN AAA CRYSTAL SHELL (Compact ~73% single-screen lock @ 100% zoom) */
.hud-container {
  width: 100%;
  max-width: 1180px;
  position: relative;
  z-index: 2;
  isolation: isolate;
  background:
    linear-gradient(172deg, rgba(255, 255, 255, 0.085) 0%, rgba(14, 18, 28, 0.56) 14%, rgba(5, 7, 13, 0.76) 62%, rgba(2, 3, 7, 0.88) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.17);
  border-radius: 28px;
  padding: 13px 20px;
  box-shadow:
    inset 0 2px 1.5px var(--rim-top),
    inset 0 12px 28px rgba(255, 255, 255, 0.035),
    inset 0 -8px 20px rgba(0, 0, 0, 0.88),
    inset 2px 0 8px rgba(255, 255, 255, 0.04),
    inset -2px 0 8px rgba(0, 0, 0, 0.65),
    0 6px 0 rgba(3, 5, 10, 0.94),
    0 28px 80px rgba(0, 0, 0, 0.94),
    0 0 48px rgba(0, 240, 255, 0.05);
  backdrop-filter: blur(42px) saturate(185%);
  -webkit-backdrop-filter: blur(42px) saturate(185%);
}

/* CNC Legion / Studio corner micro-rivets */
.chassis-rivets {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.chassis-rivets span {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.35), rgba(14, 18, 26, 0.95) 65%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.12);
}
.chassis-rivets span:nth-child(1) { top: 9px; left: 10px; }
.chassis-rivets span:nth-child(2) { top: 9px; right: 10px; }
.chassis-rivets span:nth-child(3) { bottom: 9px; left: 10px; }
.chassis-rivets span:nth-child(4) { bottom: 9px; right: 10px; }

/* Subtle vaulted specular glass arc inside top edge */
.hud-container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(110% 34% at 50% 0%, rgba(255, 255, 255, 0.09), transparent 68%);
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-title {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 3.5px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 2px 16px rgba(0, 240, 255, 0.25);
}

.header-actions-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.header-dl-btn {
  padding: 6px 12px !important;
  font-size: 9.5px !important;
  letter-spacing: 0.7px !important;
}

/* RECESSED CRYSTAL DOCK + 3D BEVELED SQUIRCLE TABS */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding: 5px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(1, 2, 5, 0.92) 0%, rgba(6, 9, 16, 0.84) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 3px 9px rgba(0, 0, 0, 0.96),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px);
}

.tab-btn {
  --mx: 50%;
  --my: 20%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 7px 11px;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(24, 30, 44, 0.88) 0%, rgba(8, 11, 18, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex: 1 1 auto;
  text-align: center;
  box-shadow:
    0 0 0 1.5px rgba(1, 2, 4, 0.92),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2.5px 4px rgba(0, 0, 0, 0.88),
    0 3px 8px rgba(0, 0, 0, 0.7);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.2s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.tab-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, transparent 45%),
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.24), transparent 58%);
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.tab-btn:hover {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.3);
}
.tab-btn:hover::after { opacity: 1; }

.tab-btn.active {
  background: linear-gradient(125deg, rgba(0, 240, 255, 0.24), rgba(10, 15, 26, 0.95), rgba(0, 255, 157, 0.24));
  background-size: 240% 240%;
  animation: liquidShift 5.5s ease infinite;
  border-color: rgba(0, 240, 255, 0.72);
  color: var(--white);
  box-shadow:
    0 0 0 1.5px rgba(1, 2, 4, 0.95),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.38),
    inset 0 -3px 6px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(0, 240, 255, 0.26);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* COMPACT 2x DEEPLY EMBEDDED STAGE WITH ROUNDED TOP-RIGHT CHAMFER ("CHATA") */
.stage-recess-wrap {
  width: 100%;
  margin-bottom: 10px;
  filter:
    drop-shadow(0 2px 0 rgba(255, 255, 255, 0.17))
    drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.96))
    drop-shadow(0 16px 32px rgba(0, 0, 0, 0.85));
}

.stage-frame {
  width: 100%;
  height: clamp(220px, 31vh, 330px);
  background: radial-gradient(circle at 50% 45%, #050810 0%, #000000 100%);
  border-radius: 20px;
  clip-path: url(#stageChamferClip);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 12px 28px rgba(0, 0, 0, 0.98),
    inset 0 -10px 24px rgba(0, 0, 0, 0.95),
    inset 8px 0 20px rgba(0, 0, 0, 0.92),
    inset -8px 0 20px rgba(0, 0, 0, 0.92);
}

.stage-chamfer-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}

canvas#renderCanvas,
video#previewVideo {
  width: 100%;
  height: 100%;
}
canvas#renderCanvas {
  display: block;
  object-fit: cover;
  object-position: center;
}
video#previewVideo {
  display: none;
  object-fit: contain;
}

.rec-indicator {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 7, 12, 0.84);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 51, 85, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 18px rgba(0, 0, 0, 0.65);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(18px);
  z-index: 10;
}
.rec-indicator.active { opacity: 1; }

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
  animation: recPulse 0.8s infinite alternate;
}

.stage-hud-cluster {
  position: absolute;
  top: 12px;
  right: 78px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.stage-hud-pill {
  background: rgba(8, 12, 20, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.stage-hud-pill:hover { color: var(--white); border-color: rgba(0, 240, 255, 0.48); }
.stage-hud-pill.on {
  color: var(--emerald);
  border-color: rgba(0, 255, 157, 0.5);
  background: rgba(0, 255, 157, 0.12);
}

.fps-badge {
  background: rgba(8, 12, 20, 0.86);
  border: 1px solid rgba(0, 240, 255, 0.42);
  padding: 4px 10px;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(18px);
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  color: var(--cyan);
}

.stage-guides-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.stage-guides-overlay.visible { opacity: 1; }

/* THICK DOMED 3D SQUIRCLE CONTROL CARDS & CUSTOM DARK GLASS SELECTORS */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.control-card {
  --mx: 50%;
  --my: 20%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  min-width: 0;
  overflow: visible;
  z-index: 20;
  isolation: isolate;
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.06) 0%, rgba(15, 20, 32, 0.68) 28%, rgba(5, 7, 13, 0.86) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 8px 11px;
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.22),
    inset 0 -3px 8px rgba(0, 0, 0, 0.85),
    0 3px 0 rgba(2, 4, 8, 0.9),
    0 10px 22px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(26px) saturate(170%);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.22s ease;
}

.control-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.12), transparent 62%);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.control-card:hover { border-color: rgba(0, 240, 255, 0.42); }
.control-card:hover::after { opacity: 1; }

.control-label {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.4px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-only-select {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  pointer-events: none !important;
}

.kpr-select { position: relative; width: 100%; min-width: 0; }
.kpr-select-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.92), rgba(2, 4, 8, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--white);
  padding: 6px 10px;
  border-radius: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.88), 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kpr-select-trigger:hover,
.kpr-select.open .kpr-select-trigger {
  border-color: var(--cyan);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.88), 0 0 12px rgba(0, 240, 255, 0.24);
}
.kpr-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.kpr-select-chevron { color: var(--cyan); font-size: 10px; transition: transform 0.2s ease; }
.kpr-select.open .kpr-select-chevron { transform: rotate(180deg); }

.kpr-select-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 210px;
  max-height: 230px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: rgba(5, 7, 13, 0.96);
  border: 1px solid rgba(0, 240, 255, 0.45);
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.2),
    0 18px 44px rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(28px);
  z-index: 80;
}
.kpr-select.open .kpr-select-menu { display: block; }
.kpr-select-group {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 6px 8px 3px;
  text-transform: uppercase;
}
.kpr-select-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 9px;
  padding: 6px 9px;
  color: var(--white);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.kpr-select-opt:hover:not(.is-disabled) { background: rgba(0, 240, 255, 0.16); color: var(--cyan); }
.kpr-select-opt.selected { background: rgba(0, 255, 157, 0.16); color: var(--emerald); font-weight: 700; }
.kpr-select-opt.is-disabled {
  opacity: 0.36;
  cursor: not-allowed;
  color: var(--muted);
}
.kpr-opt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpr-opt-lock {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.85);
  color: #f59e0b;
  white-space: nowrap;
}
.kpr-select.is-disabled .kpr-select-trigger {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}
.control-card.is-media-locked {
  opacity: 0.56;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.14);
}
.media-lock-badge {
  margin-top: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #f59e0b;
}
.media-mode-pill {
  display: none;
  margin: 10px auto 0;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.media-mode-pill.is-image {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.09);
  border: 1px solid rgba(0, 240, 255, 0.36);
}
.media-mode-pill.is-video {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--emerald);
  background: rgba(0, 255, 157, 0.09);
  border: 1px solid rgba(0, 255, 157, 0.36);
}

select, input:not([type="checkbox"]):not([type="range"]) {
  width: 100%;
  background: rgba(2, 4, 9, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--white);
  padding: 6px 10px;
  border-radius: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.88), 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select:focus, input:focus {
  border-color: var(--cyan);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.88), 0 0 12px rgba(0, 240, 255, 0.22);
}

/* ENGRAVED ACTION ZONES + CNC DIVIDERS + 3D BEVEL KEYS */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(1, 2, 5, 0.92) 0%, rgba(6, 9, 16, 0.82) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.96),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.zone-divider {
  width: 2px;
  height: 28px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.95));
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.06);
}

.keycap-hint {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.38);
  color: inherit;
  opacity: 0.78;
}

.btn {
  --mx: 50%;
  --my: 18%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.8px;
  padding: 8px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transform-style: preserve-3d;
  transform: perspective(750px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  backdrop-filter: blur(18px);
}

/* Specular bevel dome + live pointer light reflection placed cleanly behind text */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.04) 42%, transparent 62%),
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, 0.34), transparent 56%);
  mix-blend-mode: screen;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.btn-primary {
  background: linear-gradient(120deg, #00F0FF 0%, #00FF9D 34%, #0284C7 68%, #7C3AED 100%);
  background-size: 280% 280%;
  animation: liquidShift 5.5s ease infinite;
  border-color: rgba(255, 255, 255, 0.48);
  color: #020408;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.16),
    inset 0 2px 1.5px rgba(255, 255, 255, 0.65),
    inset 0 -3px 6px rgba(0, 32, 52, 0.55),
    0 8px 20px rgba(0, 240, 255, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.85);
}

.btn-primary:hover:not(:disabled) {
  transform: perspective(750px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-1px);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 2px 2px rgba(255, 255, 255, 0.78),
    inset 0 -3px 7px rgba(0, 32, 52, 0.6),
    0 12px 28px rgba(0, 240, 255, 0.46),
    0 6px 14px rgba(0, 0, 0, 0.88);
}

.btn-secondary {
  background: linear-gradient(145deg, rgba(24, 30, 44, 0.94) 0%, rgba(7, 9, 16, 0.98) 54%, rgba(16, 24, 38, 0.95) 100%);
  background-size: 240% 240%;
  animation: liquidShift 8s ease infinite;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--white);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.12),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.28),
    inset 0 -3.5px 7px rgba(0, 0, 0, 0.92),
    inset 1.5px 0 3px rgba(255, 255, 255, 0.06),
    inset -1.5px 0 3px rgba(0, 0, 0, 0.65),
    0 7px 16px rgba(0, 0, 0, 0.82);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(0, 240, 255, 0.58);
  transform: perspective(750px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-1px);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(0, 240, 255, 0.24),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.38),
    inset 0 -3.5px 7px rgba(0, 0, 0, 0.92),
    0 10px 24px rgba(0, 240, 255, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.88);
}

.btn-danger {
  background: linear-gradient(125deg, #FF3355 0%, #9F1239 50%, #FF5577 100%);
  background-size: 260% 260%;
  animation: liquidShift 5s ease infinite;
  border-color: rgba(255, 180, 195, 0.45);
  color: #FFF;
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.14),
    inset 0 2px 1.5px rgba(255, 255, 255, 0.42),
    inset 0 -3.5px 7px rgba(65, 0, 15, 0.72),
    0 8px 20px rgba(255, 51, 85, 0.36),
    0 4px 10px rgba(0, 0, 0, 0.86);
}

.btn-danger:hover:not(:disabled) {
  transform: perspective(750px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-1px);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    inset 0 2px 2px rgba(255, 255, 255, 0.56),
    inset 0 -3.5px 8px rgba(65, 0, 15, 0.8),
    0 12px 28px rgba(255, 51, 85, 0.52);
}

.btn-download-pro {
  background: linear-gradient(125deg, #00FF9D 0%, #00F0FF 48%, #FFD700 100%);
  background-size: 260% 260%;
  animation: liquidShift 4.5s ease infinite;
  border-color: rgba(255, 255, 255, 0.58);
  color: #020408;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 2px 1.5px rgba(255, 255, 255, 0.72),
    inset 0 -3px 6px rgba(0, 40, 28, 0.52),
    0 10px 26px rgba(0, 255, 157, 0.36),
    0 4px 12px rgba(0, 0, 0, 0.88);
}

.btn-download-pro:hover:not(:disabled):not(.is-disabled) {
  transform: perspective(750px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-1.5px);
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.95),
    0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 2px 2px rgba(255, 255, 255, 0.85),
    inset 0 -3px 7px rgba(0, 40, 28, 0.6),
    0 14px 34px rgba(0, 255, 157, 0.54),
    0 0 22px rgba(255, 215, 0, 0.32);
}

.btn.is-disabled {
  opacity: 0.42;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(1, 2, 5, 0.9) !important;
}

.btn:active:not(:disabled),
.tab-btn:active,
.vault-btn:active {
  transform: perspective(750px) translateY(1.5px) scale(0.978) !important;
  box-shadow:
    0 0 0 2px rgba(1, 2, 5, 0.96),
    inset 0 4px 9px rgba(0, 0, 0, 0.92),
    0 2px 6px rgba(0, 0, 0, 0.75) !important;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 0 0 2px rgba(1, 2, 5, 0.9) !important;
}

/* MULTI-FORMAT DOWNLOAD DROPDOWN */
.export-dropdown { position: relative; display: inline-block; }
.export-menu {
  display: none;
  position: absolute;
  bottom: 118%;
  left: 0;
  min-width: 260px;
  background: rgba(6, 9, 16, 0.95);
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 18px;
  padding: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 20px 50px rgba(0, 0, 0, 0.94);
  z-index: 100;
  backdrop-filter: blur(28px);
}
.export-menu.show { display: block; }
.export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--white);
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.16s ease;
}
.export-item:hover {
  background: rgba(0, 240, 255, 0.16);
  color: var(--cyan);
  transform: translateX(3px);
}
.export-item .fmt-tag {
  font-weight: 700;
  color: var(--emerald);
  font-size: 9.5px;
  background: rgba(0, 255, 157, 0.12);
  padding: 3px 8px;
  border-radius: 8px;
}

/* TELEMETRY BAR (Engraved bottom crystal strip) */
.telemetry-bar {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(2, 3, 6, 0.92), rgba(7, 10, 17, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.92),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  color: var(--muted);
}
.stat-val { color: var(--white); font-weight: 700; }

/* VAULT / HISTORIAL GRID */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.vault-card {
  --mx: 50%;
  --my: 20%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(16, 20, 32, 0.72) 0%, rgba(5, 7, 13, 0.88) 100%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  padding: 14px;
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.2),
    inset 0 -3px 10px rgba(0, 0, 0, 0.85),
    0 14px 34px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(24px);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: border-color 0.22s ease, transform 0.22s ease;
}
.vault-card:hover {
  border-color: rgba(0, 240, 255, 0.55);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-2px);
}
.vault-thumb {
  width: 100%;
  height: 155px;
  background: #000;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.vault-info { font-family: 'Fira Code', monospace; font-size: 11px; color: var(--muted); }
.vault-title { font-weight: 700; color: var(--white); font-size: 13px; margin-bottom: 5px; word-break: break-all; }
.vault-actions { display: flex; gap: 8px; margin-top: 10px; }

.vault-btn {
  --mx: 50%;
  --my: 20%;
  --rx: 0deg;
  --ry: 0deg;
  flex: 1;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(24, 30, 44, 0.92) 0%, rgba(8, 11, 18, 0.96) 100%);
  color: var(--white);
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow:
    0 0 0 1.5px rgba(1, 2, 5, 0.92),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 5px rgba(0, 0, 0, 0.85),
    0 4px 10px rgba(0, 0, 0, 0.65);
  transition: all 0.18s ease;
}
.vault-btn:hover { background: var(--cyan); color: #000; border-color: var(--cyan); }
.vault-btn.del:hover { background: var(--red); color: #FFF; border-color: var(--red); }
.vault-btn.pin { border-color: rgba(0, 255, 157, 0.35); color: var(--emerald); }
.vault-btn.pin:hover { background: var(--emerald); color: #020408; border-color: var(--emerald); }
.vault-card.is-pinned { border-color: rgba(0, 255, 157, 0.38); }
.vault-card.is-expired { border-color: rgba(245, 158, 11, 0.36); opacity: 0.9; }
.vault-thumb-expired {
  width: 100%;
  height: 155px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px dashed rgba(245, 158, 11, 0.42);
  background: linear-gradient(160deg, rgba(20, 14, 8, 0.72), rgba(6, 8, 14, 0.92));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #fde68a;
}
.vault-pin-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(0, 255, 157, 0.14);
  color: var(--emerald);
  border: 1px solid rgba(0, 255, 157, 0.35);
}

/* COMPACT ROUNDED-SQUARE DROPZONE */
.dropzone {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 195px;
  border: 2px dashed rgba(0, 240, 255, 0.36);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(2, 4, 8, 0.9), rgba(6, 10, 18, 0.78));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  text-align: center;
  padding: 16px;
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.88), inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}
.dropzone > *:not(.dz-water-canvas) {
  position: relative;
  z-index: 2;
}
.dz-water-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}
.dropzone.dz-absorbing {
  animation: dzAbsorbPlunge 0.66s cubic-bezier(0.22, 1, 0.36, 1);
  border-color: var(--cyan) !important;
}
@keyframes dzAbsorbPlunge {
  0%   { transform: scale(1); box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.88); }
  22%  { transform: scale(0.986); box-shadow: inset 0 0 38px rgba(0, 240, 255, 0.34), 0 0 34px rgba(0, 255, 157, 0.32); }
  58%  { transform: scale(1.004); box-shadow: inset 0 4px 20px rgba(0, 255, 157, 0.2), 0 0 24px rgba(0, 240, 255, 0.22); }
  100% { transform: scale(1); }
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--emerald);
  background: linear-gradient(160deg, rgba(0, 255, 157, 0.09), rgba(4, 6, 12, 0.82));
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.88), 0 0 30px rgba(0, 255, 157, 0.2);
}
.dz-icon { font-size: 38px; margin-bottom: 8px; }
.dz-title { font-family: 'Orbitron', monospace; font-weight: 700; font-size: 14px; color: var(--white); margin-bottom: 5px; }
.dz-sub { font-family: 'Fira Code', monospace; font-size: 11px; color: var(--muted); }

.progress-bar-bg {
  width: 100%;
  height: 9px;
  background: rgba(2, 4, 8, 0.88);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 10px;
  display: none;
}
.progress-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--emerald), var(--violet));
  background-size: 200% 100%;
  animation: liquidShift 3s ease infinite;
  transition: width 0.2s ease;
}

.engine-panel {
  padding: 22px;
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.16), transparent 42%),
    linear-gradient(165deg, rgba(14, 17, 29, 0.72), rgba(4, 6, 12, 0.88));
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.22),
    inset 0 -4px 12px rgba(0, 0, 0, 0.82),
    0 20px 50px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(26px);
}
.engine-kicker {
  font-family: 'Fira Code', monospace;
  color: var(--violet);
  letter-spacing: 3px;
  font-size: 10px;
  font-weight: 700;
}
.engine-title {
  font-family: 'Orbitron', monospace;
  font-size: 24px;
  margin: 8px 0;
  letter-spacing: 3px;
}
.engine-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  max-width: 920px;
}
.engine-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.boundary-note {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--emerald);
  border-radius: 14px;
  background: rgba(0, 255, 157, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  line-height: 1.55;
}

/* SQUIRCLE BADGES, TOASTS & CAPABILITY CHIPS */
.hud-badge {
  font-family: 'Fira Code', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--emerald);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(6, 10, 16, 0.85));
  border: 1px solid rgba(0, 255, 157, 0.36);
  border-radius: 10px;
  padding: 5px 11px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(0, 0, 0, 0.55);
}

.toast-stack {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 370px;
}
.toast {
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 11px 15px;
  border-radius: 14px;
  color: var(--white);
  background: rgba(6, 9, 16, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 14px 36px rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(22px);
  animation: toastIn 0.25s ease;
}
.toast.error   { border-color: rgba(255, 51, 85, 0.55);  border-left: 4px solid var(--red); }
.toast.notice  { border-color: rgba(0, 240, 255, 0.45);  border-left: 4px solid var(--cyan); }
.toast.success { border-color: rgba(0, 255, 157, 0.5);   border-left: 4px solid var(--emerald); }

.caps-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.cap-chip {
  font-family: 'Fira Code', monospace;
  font-size: 9.5px;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  background: rgba(6, 9, 16, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -1px 2px rgba(0, 0, 0, 0.8);
}
.cap-chip.on  { color: var(--emerald); border-color: rgba(0, 255, 157, 0.42); background: rgba(0, 255, 157, 0.08); }
.cap-chip.off { color: var(--dim); }

.proc-readout { font-family: 'Fira Code', monospace; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ===== V3.0 WORKFLOW: SQUARE RECESSED HERO CAVITY, PRO AUDIO RACK, UNIFIED TIMELINE ===== */
.quick-hero-bar {
  --mx: 50%;
  --my: 20%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
  padding: 9px 14px;
  margin-bottom: 10px;
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(2, 3, 6, 0.94) 0%, rgba(7, 10, 17, 0.86) 100%);
  border: 1px solid rgba(0, 240, 255, 0.22);
  box-shadow:
    inset 0 4px 12px rgba(0, 0, 0, 0.96),
    inset 0 1px 2px rgba(0, 0, 0, 0.98),
    inset 0 -1px 0 rgba(255, 255, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px);
}
.quick-hero-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(0, 240, 255, 0.12), transparent 55%);
}
.quick-hero-copy {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--white);
  min-width: 0;
}
.quick-hero-copy span { color: var(--muted); display: block; font-size: 10px; margin-top: 2px; }
.quick-hero-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: nowrap; }

.audio-mixer-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0;
  margin-bottom: 10px;
  padding: 7px 14px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(2, 3, 6, 0.92), rgba(7, 10, 16, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.92),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px);
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
}
.audio-channel { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; }
.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--white);
  white-space: nowrap;
}
.vu-meter-box { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.vu-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.92);
}
.vu-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--emerald) 0%, var(--cyan) 65%, var(--gold) 88%, var(--red) 100%);
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 10px);
  mask-image: repeating-linear-gradient(90deg, #000 0 7px, transparent 7px 10px);
  transition: width 75ms linear;
}
.vu-peak {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 3px;
  background: #FFF;
  box-shadow: 0 0 6px var(--gold);
  opacity: 0;
  pointer-events: none;
  transition: left 90ms linear, opacity 0.2s ease;
}
.vu-scale {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: var(--dim);
  line-height: 1;
}
.gain-fader {
  width: 68px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.stage-trim-dock {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 13px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(2, 4, 8, 0.92), rgba(8, 12, 20, 0.9));
  border: 1px solid rgba(0, 255, 157, 0.34);
  box-shadow:
    inset 0 3px 10px rgba(0, 0, 0, 0.94),
    inset 0 -1px 0 rgba(255, 255, 255, 0.14),
    0 12px 28px rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(24px);
}
.stage-trim-dock.open { display: flex; }
.trim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--emerald);
}

.trim-timeline-wrap {
  position: relative;
  height: 36px;
  padding-top: 8px;
}
.trim-track-bg {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 6px;
  background: rgba(2, 4, 8, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.9);
}
.trim-active-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
.trim-dual-input {
  position: absolute;
  left: 0;
  top: 4px;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.trim-dual-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: #F8FAFC;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  cursor: ew-resize;
}
.trim-dual-input.trim-out::-webkit-slider-thumb {
  border-color: var(--emerald);
  box-shadow: 0 0 10px var(--emerald-glow);
}
.trim-dual-input::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: #F8FAFC;
  border: 2px solid var(--cyan);
  cursor: ew-resize;
}
.trim-ruler {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  color: var(--dim);
}
.trim-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.estimate-pill {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px dashed rgba(0, 240, 255, 0.42);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--cyan);
  display: none;
  text-align: center;
}

.inspector-shell {
  max-width: 920px;
  width: 100%;
  margin: 14px auto 0;
  padding: 12px;
  border-radius: 22px;
  background: rgba(6, 9, 18, 0.72);
  border: 1.5px solid rgba(0, 240, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 20px 44px rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(16px);
}
.inspector-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.inspector-pill-group {
  display: flex;
  gap: 4px;
  background: rgba(10, 14, 24, 0.85);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.inspector-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.inspector-pill:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}
.inspector-pill.active {
  color: #041016;
  background: linear-gradient(135deg, var(--cyan), var(--emerald));
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
}
.compare-wrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: #04060b;
  aspect-ratio: 16 / 9;
  user-select: none;
  touch-action: none;
  cursor: ew-resize;
}
.compare-wrap.can-pan {
  cursor: grab;
}
.compare-wrap.is-grabbing {
  cursor: grabbing;
}
.compare-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  pointer-events: none;
  z-index: 4;
}
.compare-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 12, 22, 0.92);
  border: 1.5px solid var(--cyan);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.6);
}
.compare-slider-bar {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--cyan);
  cursor: ew-resize;
  height: 6px;
}
.inspector-proof-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.proof-pill {
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(8, 12, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--white);
}
.proof-pill.is-gain {
  color: var(--emerald);
  border-color: rgba(0, 255, 157, 0.45);
  box-shadow: 0 0 10px rgba(0, 255, 157, 0.18);
}
.proof-pill-accent {
  color: var(--cyan);
  border-color: rgba(0, 240, 255, 0.35);
}
.inspector-notice {
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.btn-demo-forensic {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.32), rgba(0, 240, 255, 0.24));
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: var(--white);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.28);
}
.btn-demo-forensic:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.45);
}
.readiness-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.readiness-pill {
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 22, 0.72);
  color: var(--muted);
}
.readiness-pill.on {
  color: var(--emerald);
  border-color: rgba(0, 255, 157, 0.42);
  background: rgba(0, 255, 157, 0.08);
}
.profile-intent-hint {
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--cyan);
  opacity: 0.9;
}
.preflight-strip {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.preflight-pill {
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9px;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--white);
}
.preflight-pill.is-accent {
  color: var(--cyan);
  border-color: rgba(0, 240, 255, 0.42);
  background: rgba(0, 240, 255, 0.08);
}
.preflight-pill.is-eta {
  color: var(--gold);
  border-color: rgba(250, 204, 21, 0.42);
  background: rgba(250, 204, 21, 0.08);
}
.preflight-pill.is-emerald {
  color: var(--emerald);
  border-color: rgba(0, 255, 157, 0.45);
  background: rgba(0, 255, 157, 0.1);
}
.bg-subcontrols {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 255, 157, 0.25);
  background: rgba(6, 10, 18, 0.78);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.bg-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--cyan);
}
.bg-color-input {
  width: 36px;
  height: 28px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}
.batch-dock {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(0, 240, 255, 0.34);
  background: linear-gradient(165deg, rgba(8, 12, 22, 0.88), rgba(4, 6, 12, 0.94));
  backdrop-filter: blur(20px);
}
.batch-dock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.batch-dock-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.batch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 185px;
  overflow-y: auto;
}
.batch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
}
.batch-row-name {
  color: var(--white);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}
.batch-row-meta { color: var(--muted); font-size: 10px; }
.batch-row-state { font-weight: 700; font-size: 10.5px; color: var(--cyan); }
.batch-row-state.done { color: var(--emerald); }
.batch-row-state.err { color: var(--red); }
.gpu-temp-cool { color: var(--emerald) !important; }
.gpu-temp-warm { color: var(--gold) !important; }
.gpu-temp-hot { color: var(--red) !important; }
.sovereign-footer {
  margin-top: 10px;
  padding: 10px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sovereign-footer a {
  color: var(--cyan);
  text-decoration: none;
}
.sovereign-footer a:hover {
  text-decoration: underline;
}
.compare-tag {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  border-radius: 9px;
  z-index: 4;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  font-weight: 700;
  background: rgba(4, 6, 12, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--white);
  backdrop-filter: blur(12px);
}
.compare-tag.left { left: 10px; }
.compare-tag.right { right: 10px; color: var(--emerald); border-color: rgba(0, 255, 157, 0.45); }

/* --- BG STUDIO Surgical Matte Brush & 400% Loupe --- */
.retouch-panel {
  margin: 14px auto;
  max-width: 960px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 255, 157, 0.36);
  background: linear-gradient(165deg, rgba(6, 12, 22, 0.92), rgba(4, 7, 14, 0.96));
  backdrop-filter: blur(20px);
  text-align: left;
}
.retouch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  color: var(--white);
}
.retouch-group { display: flex; gap: 6px; align-items: center; }
.retouch-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
}
.retouch-field input[type="range"] { width: 82px; accent-color: var(--emerald); }
.retouch-field select {
  background: rgba(12, 18, 32, 0.92);
  color: var(--white);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 8px;
  padding: 3px 6px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
}
.retouch-check { color: var(--cyan); cursor: pointer; }
.retouch-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--white);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  cursor: pointer;
}
.retouch-btn.is-active {
  border-color: var(--emerald);
  background: rgba(0, 255, 157, 0.16);
  color: var(--emerald);
}
.retouch-btn[data-mode="erase"].is-active {
  border-color: var(--red);
  background: rgba(255, 64, 110, 0.16);
  color: #ff6b8b;
}
.retouch-btn.retouch-save {
  border-color: rgba(0, 240, 255, 0.55);
  background: rgba(0, 240, 255, 0.14);
  color: var(--cyan);
}
.retouch-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #060912;
  min-height: 220px;
}
.retouch-canvas {
  display: block;
  max-width: 100%;
  max-height: 520px;
  cursor: crosshair;
  touch-action: none;
}
.retouch-canvas.is-checker {
  background-image:
    linear-gradient(45deg, #232b3e 25%, transparent 25%),
    linear-gradient(-45deg, #232b3e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #232b3e 75%),
    linear-gradient(-45deg, transparent 75%, #232b3e 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #131926;
}
.retouch-loupe {
  position: absolute;
  display: none;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72), 0 0 12px rgba(0, 240, 255, 0.35);
  z-index: 6;
}
.retouch-status {
  margin-top: 8px;
  font-family: 'Fira Code', monospace;
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .zone-divider { display: none; }
}

@media (max-width: 900px) {
  .tab-btn { flex: 1 1 auto; }
  .controls-grid { grid-template-columns: 1fr 1fr !important; }
  .quick-hero-bar, .quick-hero-actions { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  body { padding: 8px 10px; }
  .hud-container { padding: 14px 12px; border-radius: 22px; }
  .controls-grid { grid-template-columns: 1fr 1fr !important; }
  .btn-group { flex-wrap: wrap; }
  .brand-title { font-size: 17px; }
  .stage-frame { height: 220px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .tab-btn.active,
  .progress-bar-fill {
    animation: none !important;
  }
}
