:root {
  color-scheme: dark;
  --card: rgba(16, 21, 40, 0.88);
  --text: #f4f7ff;
  --muted: #9cabd2;
  --line: rgba(108, 138, 255, 0.35);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: #050814;
}
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}
.bg-fx::before,
.bg-fx::after {
  content: "";
  position: absolute;
  inset: 0;
}
body.bg-electric-grid { background: radial-gradient(circle at 30% 20%, #243f99, #060910 62%); }
.bg-fx.fx-electric::before {
  background:
    linear-gradient(rgba(66, 246, 255, 0.18) 1px, transparent 1px) 0 0/42px 42px,
    linear-gradient(90deg, rgba(66, 246, 255, 0.18) 1px, transparent 1px) 0 0/42px 42px;
  animation: gridMove 8s linear infinite;
}
.bg-fx.fx-electric::after {
  background: radial-gradient(circle at 50% 50%, rgba(117, 225, 255, 0.2), transparent 45%);
  animation: electricPulse 2.4s ease-in-out infinite;
}
@keyframes gridMove { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(42px, 42px, 0); } }
@keyframes electricPulse { 0%,100% { opacity: 0.2; filter: hue-rotate(0deg); } 50% { opacity: 0.45; filter: hue-rotate(26deg); } }
body.bg-rain-fern { background: radial-gradient(circle at 70% 80%, rgba(30, 90, 65, 0.8), #060b11 68%); }
.bg-fx.fx-rain::before {
  background: repeating-linear-gradient(170deg, rgba(214, 244, 255, 0.45) 0 2px, transparent 2px 18px);
  background-size: 180px 180px;
  filter: blur(0.2px);
  animation: rainFall 1.8s linear infinite;
}
.bg-fx.fx-rain::after {
  background:
    radial-gradient(circle at 16% 86%, rgba(45, 120, 70, 0.5), transparent 24%),
    radial-gradient(circle at 62% 93%, rgba(55, 145, 84, 0.45), transparent 26%),
    radial-gradient(circle at 84% 90%, rgba(38, 102, 60, 0.45), transparent 23%);
  animation: fernSway 5s ease-in-out infinite;
}
@keyframes rainFall { from { transform: translateY(-180px); } to { transform: translateY(180px); } }
@keyframes fernSway { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-8px); } }
body.bg-starfield { background: radial-gradient(circle at 50% 50%, #111b3f, #04050a 60%); }
.bg-fx.fx-starfield::before {
  background:
    radial-gradient(3px 3px at 10% 15%, #fff, transparent 72%),
    radial-gradient(4px 4px at 80% 20%, #fff, transparent 72%),
    radial-gradient(3px 3px at 35% 70%, #fff, transparent 72%),
    radial-gradient(5px 5px at 70% 80%, #cce8ff, transparent 72%),
    radial-gradient(circle at 82% 24%, rgba(124, 95, 255, 0.35), transparent 20%),
    radial-gradient(circle at 14% 76%, rgba(77, 170, 255, 0.3), transparent 24%);
  animation: starsWarp 6s linear infinite, starsTwinkle 2.2s ease-in-out infinite;
}
.bg-fx.fx-starfield::after {
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 55%);
  animation: warpPulse 2.5s ease-in-out infinite;
}
@keyframes starsWarp { from { transform: scale(1) translateY(0); } to { transform: scale(1.25) translateY(22px); } }
@keyframes warpPulse { 0%,100% { opacity: 0.2; } 50% { opacity: 0.5; } }
@keyframes starsTwinkle { 0%,100% { opacity: 0.85; } 50% { opacity: 1; } }
body.bg-light-phenomena { background: #070915; }
.bg-fx.fx-lights::before {
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 255, 214, 0.36), transparent 35%),
    radial-gradient(circle at 78% 30%, rgba(130, 115, 255, 0.36), transparent 38%),
    radial-gradient(circle at 50% 80%, rgba(255, 112, 160, 0.28), transparent 36%);
  animation: auroraDrift 7s ease-in-out infinite;
}
.bg-fx.fx-lights::after {
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-100%);
  animation: lightSweep 4s ease-in-out infinite;
}
@keyframes auroraDrift { 0%,100% { filter: hue-rotate(0deg); transform: translateX(0); } 50% { filter: hue-rotate(-35deg); transform: translateX(-20px); } }
@keyframes lightSweep { 0% { transform: translateX(-120%); } 60%,100% { transform: translateX(120%); } }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(2, 4, 12, 0.82);
  backdrop-filter: blur(10px);
}
.gate-card {
  width: min(560px, 92vw);
  border: 1px solid #3952a5;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.98), rgba(10, 15, 31, 0.95));
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(110, 145, 255, 0.12);
  padding: 26px;
}
.gate-logo { width: 170px; margin-bottom: 8px; }
body:not(.locked) .access-gate { display: none; }
body.locked #appRoot { filter: blur(3px); pointer-events: none; user-select: none; }

.app { max-width: 1240px; margin: 0 auto; padding: 22px; }
.card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  margin-top: 16px;
  box-shadow: 0 18px 40px rgba(2, 6, 19, 0.32), inset 0 0 0 1px rgba(255,255,255,0.03);
}
.sub-card {
  margin-top: 0;
  background: linear-gradient(180deg, rgba(10, 15, 31, 0.96), rgba(12, 18, 35, 0.84));
  border-radius: 18px;
}
.hero { display: grid; gap: 18px; }
.compact-hero { padding: 18px 20px; }
.hero-brand { display: flex; gap: 16px; align-items: center; }
.hero-brand.single-column { flex-direction: row; }
.logo { width: 210px; max-width: 100%; display: block; }
.title-wrap.left { text-align: left; }
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: #8fdcff;
  font-weight: 800;
}
h1 { margin: 0; font-size: clamp(2.1rem, 4vw, 3.6rem); letter-spacing: .04em; }
h2, h3 { margin-top: 0; }
.subtitle { color: #dce6ff; margin-top: 10px; font-weight: 500; max-width: 48rem; line-height: 1.5; }
.slim-card { padding: 14px 18px; }
.main-stage-stack { display: grid; gap: 16px; }
.performance-card.compact-performance { padding-bottom: 14px; }
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.compact-heading { margin-bottom: 8px; }
.mini-status {
  max-width: 340px;
  color: #c6d6ff;
  font-size: 0.95rem;
  text-align: right;
}
.mini-status.left-align { text-align: left; max-width: none; }
.load-grid,
.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.single-focus-grid { grid-template-columns: minmax(280px, 420px); }
.load-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.single-line-load { padding: 14px 16px; }
.single-line-load label { margin: 0; }
.single-line-load button { margin-top: 0; width: auto; min-width: 148px; padding-inline: 22px; }
.customization-grid .full-span { grid-column: 1 / -1; }
label { display: block; font-size: .95rem; color: var(--muted); margin: 10px 0; }
.toggle-inline { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: #cfe1ff; }
.toggle-inline input { width: auto; margin: 0; }
input, select, button, textarea {
  margin-top: 6px;
  border-radius: 14px;
  border: 1px solid #3a467b;
  background: rgba(10, 14, 30, 0.92);
  color: var(--text);
  padding: 12px 14px;
  width: 100%;
}
input:focus, select:focus, button:focus, textarea:focus {
  outline: none;
  border-color: #6cd9ff;
  box-shadow: 0 0 0 2px rgba(88, 214, 255, 0.18), 0 0 20px rgba(47, 200, 255, 0.1);
}
button {
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(62, 245, 255, 0.35), rgba(62, 245, 255, 0.06) 16%),
    linear-gradient(135deg, #2c4bff, #11d8ff 55%, #7cffcb);
  border: 1px solid rgba(134, 245, 255, 0.48);
  color: #f7fbff;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 0 16px rgba(53, 193, 255, 0.25), 0 10px 22px rgba(6, 12, 31, 0.38);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 0 20px rgba(85, 226, 255, 0.4), 0 12px 26px rgba(6, 12, 31, 0.42);
  filter: saturate(1.08);
}
button:active:not(:disabled) { transform: translateY(1px) scale(0.995); }
button.secondary {
  background: linear-gradient(135deg, #20284c, #415cae 55%, #64baff);
  border: 1px solid #7ea4ff;
}
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.row { display: flex; gap: 10px; margin-top: 8px; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.single-line-controls { flex-wrap: nowrap; }
.controls-row { margin-top: 14px; align-items: end; }
.record-controls { align-items: end; }
.webcam-preview {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  border: 1px solid rgba(101, 138, 255, 0.45);
  background: linear-gradient(180deg, rgba(5, 8, 18, 0.94), rgba(8, 12, 26, 0.98));
  object-fit: cover;
}
.side-preview { min-height: 420px; }
.webcam-side-cell { display: grid; gap: 12px; align-content: start; }
.webcam-side-cell.webcam-live .webcam-placeholder { display: none; }
.webcam-side-cell.webcam-live .webcam-preview[hidden],
.webcam-side-cell.webcam-live #webcamLiveNote[hidden] { display: block; }
.webcam-placeholder { display: grid; gap: 12px; }
.webcam-placeholder iframe {
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(101, 138, 255, 0.45);
  border-radius: 16px;
  background: #050814;
}
.webcam-side-header { display: grid; gap: 8px; }
.webcam-side-note,
.webcam-preview-meta { line-height: 1.45; }
.unified-recording-strip { padding: 16px; }
.unified-record-controls { align-items: end; }
.unified-record-actions { margin-top: 14px; }
.recording-note { margin: 14px 0 0; }
.led-button-row button { min-height: 52px; }
.compact-row button { min-height: 48px; }
.main-control-row > button { flex: 0.85; min-width: 0; }
.sidechain-spotlight {
  flex: 1.6;
  min-width: 300px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 95, 95, 0.72);
  background: radial-gradient(circle at top, rgba(255, 82, 82, 0.3), rgba(75, 8, 20, 0.9) 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 196, 196, 0.14), 0 0 26px rgba(255, 71, 71, 0.28), 0 12px 24px rgba(32, 5, 10, 0.42);
  animation: sidechainPulse 1.8s ease-in-out infinite;
}
.sidechain-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(240px, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}
.sidechain-row-header { display: grid; gap: 8px; }
.spotlight-kicker {
  margin: 0 0 6px;
  color: #ffd2d2;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 900;
}
.sidechain-control-label {
  margin: 0;
  align-self: stretch;
  color: #fff2f2;
  font-size: 1.05rem;
  font-weight: 800;
}
.sidechain-select {
  border-color: rgba(255, 128, 128, 0.92);
  background: linear-gradient(180deg, rgba(65, 6, 16, 0.96), rgba(36, 4, 14, 0.98));
  box-shadow: inset 0 0 0 1px rgba(255, 205, 205, 0.08), 0 0 18px rgba(255, 84, 84, 0.22);
}
.sidechain-select:focus {
  border-color: #ff8f8f;
  box-shadow: 0 0 0 2px rgba(255, 120, 120, 0.22), 0 0 24px rgba(255, 84, 84, 0.26);
}
.spotlight-challenge {
  margin: 0;
  color: #ffe3e3;
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 600;
}
@keyframes sidechainPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 196, 196, 0.14), 0 0 22px rgba(255, 71, 71, 0.24), 0 12px 24px rgba(32, 5, 10, 0.42); }
  50% { box-shadow: inset 0 0 0 1px rgba(255, 225, 225, 0.22), 0 0 34px rgba(255, 71, 71, 0.42), 0 14px 28px rgba(32, 5, 10, 0.5); }
}
.gain-readout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid #3a467b;
  border-radius: 14px;
  margin-top: 24px;
  background: rgba(10, 14, 30, 0.92);
  font-weight: 800;
}
.meter-area { display: grid; gap: 12px; margin-bottom: 14px; }
.compact-meters { max-width: 760px; }
.inline-meters { margin-bottom: 0; }
.banner-meters { grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; }
.banner-meters p { margin: 0 0 6px; font-size: 0.82rem; color: #d7e4ff; }
.meter { width: 100%; height: 12px; border-radius: 999px; background: #2a325b; overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, #2be58f, #70ffc3); transition: width .1s linear; box-shadow: 0 0 12px rgba(43,229,143,0.28); }
.fill.blue { background: linear-gradient(90deg, #5087ff, #84b0ff); box-shadow: 0 0 12px rgba(80,135,255,0.3); }
.fill.gold { background: linear-gradient(90deg, #e7ba34, #ffe08a); box-shadow: 0 0 12px rgba(231,186,52,0.28); }
#status {
  color: #d8e4ff;
  background: rgba(10, 18, 40, 0.82);
  border: 1px solid #2f407d;
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 14px;
}
.small { color: var(--muted); font-size: .9rem; }
.gate-help code,
code {
  color: #9fd6ff;
  background: rgba(16, 20, 42, 0.85);
  border: 1px solid #33518d;
  border-radius: 6px;
  padding: 2px 6px;
}
.lyrics-section.hero-lyrics { margin-top: 0; }
.lyrics-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.compact-banner-row { align-items: stretch; gap: 10px; }
.inline-title-block { min-width: 210px; }
.lyrics-title-block h2 { margin-bottom: 0; font-size: clamp(1.35rem, 2.2vw, 1.9rem); }
.lyrics-performance-panel {
  flex: 1;
  min-width: 340px;
  background: rgba(11, 17, 41, 0.95);
  border: 1px solid #3d58b0;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(122, 161, 255, 0.18), 0 0 24px rgba(45, 124, 255, 0.14);
}
.scoreboard-label {
  margin: 0 0 10px;
  color: #c8d8ff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 0.8rem;
}
.scoreboard-digits {
  font-family: "Courier New", monospace;
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  font-weight: 900;
  color: #ff533d;
  text-align: right;
  letter-spacing: .14em;
  text-shadow: 0 0 8px rgba(255, 83, 61, .6), 0 0 20px rgba(255, 83, 61, .24);
}
.lyrics-scoreboard-panel {
  min-width: 240px;
  background: rgba(11, 17, 41, 0.95);
  border: 1px solid #3d58b0;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(122, 161, 255, 0.18), 0 0 24px rgba(45, 124, 255, 0.14);
}
.small-digits { font-size: clamp(2.4rem, 5vw, 3.5rem); }
.lyrics-grid { display: grid; gap: 14px; }
.lyrics-grid.single-column { grid-template-columns: 1fr; }
.split-lyrics-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr); align-items: stretch; }
.lyrics-cell {
  min-height: 280px;
  border: 1px solid #334278;
  border-radius: 16px;
  background: rgba(11, 17, 36, 0.85);
  padding: 14px;
}
.lyrics-main-cell { min-height: 420px; }
.lyrics-meta-row { align-items: center; }
.lyrics-editor {
  width: 100%;
  min-height: 440px;
  resize: vertical;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.lyrics-ad-placeholder {
  min-height: 150px;
  border: 1px dashed #5774cc;
  border-radius: 12px;
  padding: 14px;
  background: rgba(20, 26, 49, 0.65);
}
.promo-video-embed { margin: 14px 0; }
.promo-video-embed iframe {
  width: 100%;
  min-height: 260px;
  border: 1px solid rgba(101, 138, 255, 0.35);
  border-radius: 16px;
  background: #050814;
}

@media (max-width: 980px) {
  .hero-brand.single-column { flex-direction: column; align-items: flex-start; }
  .single-focus-grid { grid-template-columns: 1fr; }
  .mini-status { text-align: left; max-width: none; }
  .load-row { grid-template-columns: 1fr; }
  .sidechain-row,
  .lyrics-header-row,
  .section-heading { flex-direction: column; align-items: stretch; }
  .sidechain-row { grid-template-columns: 1fr; }
  .split-lyrics-grid { grid-template-columns: 1fr; }
  .lyrics-performance-panel,
  .lyrics-scoreboard-panel { min-width: 0; }
  .banner-meters { grid-template-columns: 1fr; }
  .side-preview { min-height: 320px; }
}
@media (max-width: 640px) {
  .app { padding: 14px; }
  .logo { width: 170px; }
  .gain-readout { margin-top: 6px; }
  .lyrics-scoreboard-panel { width: 100%; min-width: 0; }
  .scoreboard-digits { font-size: 2.35rem; }
  .lyrics-editor { min-height: 360px; }
  .single-line-controls { flex-wrap: wrap; }
  .main-control-row > button,
  .sidechain-spotlight { flex: 1 1 100%; min-width: 0; }
}
