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

:root {
  --bg: #160905;
  --gold: #c98c0a;
  --gold-dim: rgba(201, 140, 10, 0.35);
  --cream: #f0dfc0;
  --cream-dim: rgba(240, 223, 192, 0.55);
  --velvet: #580c18;
  --velvet-dark: #360810;
  --wood: #3a1a07;
  --wood-light: #5a2c10;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family: 'Cormorant Garamond', Georgia, serif;
}

/* ── SHELL ─────────────────────────────────────────── */
#lounge {
  width: 100%; height: 100vh;
  display: grid;
  grid-template-rows: 2.8rem 1fr 27vh 2.8rem;
  background:
    radial-gradient(ellipse at 20% 55%, rgba(88, 12, 24, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 78% 25%, rgba(60, 25, 5, 0.25) 0%, transparent 50%),
    linear-gradient(180deg, #220e07 0%, #160905 60%, #0c0503 100%);
  overflow: hidden;
  position: relative;
}

/* Subtle wood-panel vertical lines */
#lounge::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg,
    transparent, transparent 70px,
    rgba(0,0,0,0.04) 70px, rgba(0,0,0,0.04) 72px);
  pointer-events: none; z-index: 0;
}

/* ── TOP BAR ────────────────────────────────────────── */
#top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.2rem;
  border-bottom: 1px solid var(--gold-dim);
  background: rgba(0,0,0,0.35);
  z-index: 10; position: relative;
}

#lounge-title {
  font-size: 1.05rem; font-weight: 600;
  color: var(--gold); letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(201,140,10,0.5);
}

#now-playing { display: flex; flex-direction: column; align-items: flex-end; gap: 0.05rem; }

#track-title { font-size: 0.9rem; font-style: italic; color: var(--cream); }
#track-meta  { font-size: 0.7rem; color: var(--cream-dim); }

/* ── MAIN ROW ───────────────────────────────────────── */
#main-row {
  display: grid;
  grid-template-columns: 7% 1fr 7% 21%;
  overflow: hidden;
  position: relative; z-index: 1;
}

/* ── CURTAINS ───────────────────────────────────────── */
.curtain {
  background: linear-gradient(180deg, var(--velvet) 0%, var(--velvet-dark) 100%);
  position: relative; overflow: hidden;
}

#curtain-l { border-radius: 0 0 45% 0; box-shadow: inset -6px 0 18px rgba(0,0,0,0.6), 4px 0 10px rgba(0,0,0,0.35); }
#curtain-r { border-radius: 0 0 0 45%; box-shadow: inset  6px 0 18px rgba(0,0,0,0.6), -4px 0 10px rgba(0,0,0,0.35); }

.curtain::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg,
    transparent, transparent 14px,
    rgba(0,0,0,0.1) 14px, rgba(0,0,0,0.1) 15px);
}

#curtain-l::after {
  content: ''; position: absolute; top: 0; right: 0; width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--gold), rgba(160,110,10,0.5), var(--gold));
}
#curtain-r::after {
  content: ''; position: absolute; top: 0; left: 0; width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--gold), rgba(160,110,10,0.5), var(--gold));
}

/* ── STAGE ──────────────────────────────────────────── */
#stage {
  display: flex; align-items: center; justify-content: center;
  padding: 0.5rem 0;
  background: radial-gradient(ellipse at 50% 90%, rgba(201,140,10,0.06) 0%, transparent 65%);
}

#stage-frame {
  width: 100%; height: 100%;
  border: 2px solid var(--gold-dim);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.85), 0 0 70px rgba(0,0,0,0.5);
}

#stage-frame iframe,
#youtube-player { width: 100%; height: 100%; border: none; display: block; }

/* ── OVERLAY ────────────────────────────────────────── */
#overlay {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(8,3,1,0.9);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.3s;
}
#overlay:hover { background: rgba(8,3,1,0.8); }

#overlay-inner { text-align: center; pointer-events: none; }
#overlay-icon { font-size: 3rem; margin-bottom: 0.6rem; }
#overlay-title {
  font-size: 1.3rem; color: var(--gold); letter-spacing: 0.06em;
  text-shadow: 0 0 18px rgba(201,140,10,0.45);
}
#overlay-hint { font-size: 0.8rem; color: var(--cream-dim); margin-top: 0.35rem; font-style: italic; }

/* ── FIREPLACE WING ─────────────────────────────────── */
#fireplace-wing {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding: 0.5rem 0.5rem 0.6rem;
  position: relative;
  background: radial-gradient(ellipse at 50% 80%, rgba(255,70,10,0.07) 0%, transparent 60%);
}

#sconce {
  position: absolute; top: 1.2rem; right: 1rem;
  font-size: clamp(1rem, 2.2vw, 1.7rem);
  filter: drop-shadow(0 0 10px rgba(255,180,30,0.7));
  animation: sconcePulse 3s ease-in-out infinite;
}
@keyframes sconcePulse {
  0%,100% { filter: drop-shadow(0 0 8px rgba(255,180,30,0.7)); }
  50%     { filter: drop-shadow(0 0 16px rgba(255,180,30,1));   }
}

#fireplace { width: 75%; max-width: 96px; display: flex; flex-direction: column; align-items: center; }

#firebox {
  width: 100%;
  height: clamp(60px, 8vw, 120px);
  background: linear-gradient(180deg, #1a0803 0%, #0d0401 100%);
  border: 2px solid rgba(120,60,15,0.4);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  position: relative; overflow: hidden;
}

.flame {
  position: absolute; bottom: 0;
  border-radius: 50% 50% 20% 20%;
  transform-origin: bottom center;
  animation: flicker ease-in-out infinite;
}
.f1 { left: 10%; width: 30%; height: 55%; background: linear-gradient(180deg, #ff5500, #cc2200); filter: blur(1px); animation-duration: 0.72s; }
.f2 { left: 28%; width: 40%; height: 88%; background: linear-gradient(180deg, #ffaa00, #ff5500, #cc2200); z-index: 2; animation-duration: 0.51s; }
.f3 { left: 57%; width: 28%; height: 50%; background: linear-gradient(180deg, #ffdd00, #ff8800); filter: blur(1px); animation-duration: 0.88s; }

@keyframes flicker {
  0%,100% { transform: scaleX(1)    scaleY(1)    rotate(-2deg); }
  33%     { transform: scaleX(0.85) scaleY(1.1)  rotate(2deg);  }
  66%     { transform: scaleX(1.1)  scaleY(0.9)  rotate(-1deg); }
}

/* Ember glow at base */
#firebox::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 35%;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,60,5,0.55) 0%, transparent 70%);
  animation: emberPulse 1.8s ease-in-out infinite;
}
@keyframes emberPulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

#mantle {
  width: 120%; height: 10px;
  background: linear-gradient(180deg, #7a5010, #4a2d08);
  border-radius: 2px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.55);
  position: relative;
}
#candle {
  position: absolute; top: -1.5rem; left: 50%; transform: translateX(-50%);
  font-size: 1.2rem;
  animation: candleGlow 2.1s ease-in-out infinite;
}
@keyframes candleGlow {
  0%,100% { filter: drop-shadow(0 0 6px rgba(255,170,20,0.7)); }
  50%     { filter: drop-shadow(0 0 12px rgba(255,170,20,1));   }
}
#hearth { width: 110%; height: 8px; background: #2a1208; border-radius: 0 0 4px 4px; }

/* ── AUDIENCE ───────────────────────────────────────── */
#audience {
  display: flex; align-items: flex-end; justify-content: center;
  gap: clamp(0.2rem, 1vw, 0.8rem);
  padding: 0 2% 0.4rem;
  position: relative; overflow: hidden; z-index: 1;
}

/* Rug hint */
#audience::before {
  content: '';
  position: absolute; bottom: 0; left: 8%; width: 84%; height: 55%;
  background: radial-gradient(ellipse at 50% 90%, rgba(100,18,10,0.22) 0%, transparent 70%);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.seat {
  display: flex; flex-direction: column; align-items: center;
  flex: 0 1 14%; max-width: 80px; min-width: 44px;
  position: relative;
}

.animal-wrap {
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  animation: sway ease-in-out infinite;
}
@keyframes sway {
  0%,100% { transform: rotate(-1.8deg) translateY(0); }
  50%     { transform: rotate(1.8deg)  translateY(-2px); }
}

.animal-emoji { font-size: clamp(1.8rem, 3.5vw, 3rem); line-height: 1.1; z-index: 2; }
.animal-item  { font-size: clamp(0.7rem, 1.3vw, 1rem); margin-top: -0.2em; text-align: center; }

/* Chair */
.chair-back  { width: 100%; height: clamp(18px, 3.5vw, 30px); background: linear-gradient(180deg, var(--wood-light), var(--wood)); border-radius: 3px 3px 0 0; margin-top: -3px; border: 1px solid rgba(180,100,20,0.18); }
.chair-seat  { width: 108%; margin-left: -4%; height: clamp(10px, 2vw, 16px); background: linear-gradient(180deg, #4a2208, #2d1205); border-radius: 1px; }
.chair-legs  { display: flex; justify-content: space-between; padding: 0 14%; }
.chair-leg   { width: 3px; height: clamp(6px, 1.2vw, 11px); background: var(--wood); border-radius: 0 0 2px 2px; }
.animal-name { font-size: clamp(0.5rem, 0.9vw, 0.7rem); color: var(--cream-dim); margin-top: 0.15rem; font-style: italic; letter-spacing: 0.03em; }

/* Reaction bubble */
.bubble {
  position: absolute; bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  background: rgba(12,5,2,0.93);
  border: 1px solid var(--gold-dim);
  border-radius: 8px; padding: 0.18rem 0.55rem;
  font-size: clamp(0.55rem, 1vw, 0.72rem);
  color: var(--cream); white-space: nowrap;
  opacity: 0; transition: opacity 0.35s;
  pointer-events: none; font-style: italic; z-index: 20;
}
.bubble.show { opacity: 1; }
.bubble::after {
  content: ''; position: absolute; bottom: -5px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 7px; height: 7px;
  background: rgba(12,5,2,0.93);
  border-right: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
}

/* ── TRACK BAR ──────────────────────────────────────── */
#track-bar {
  display: flex; align-items: center;
  padding: 0 0.7rem; gap: 0.45rem;
  border-top: 1px solid rgba(201,140,10,0.15);
  background: rgba(0,0,0,0.5);
  z-index: 10; position: relative;
}

.nav-btn {
  background: rgba(201,140,10,0.12);
  border: 1px solid rgba(201,140,10,0.35);
  color: var(--gold); width: 1.8rem; height: 1.8rem;
  border-radius: 50%; cursor: pointer;
  font-size: 1.1rem; font-family: inherit;
  transition: background 0.2s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-btn:hover { background: rgba(201,140,10,0.25); }

#tracklist {
  display: flex; gap: 0.3rem;
  overflow-x: auto; flex: 1;
  scrollbar-width: none; padding: 0.3rem 0;
}
#tracklist::-webkit-scrollbar { display: none; }

.ttrack {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(240,223,192,0.65);
  padding: 0.2rem 0.65rem; border-radius: 3px;
  cursor: pointer; font-family: inherit;
  font-size: 0.72rem; white-space: nowrap;
  transition: all 0.2s; flex-shrink: 0;
}
.ttrack:hover { background: rgba(255,255,255,0.08); color: var(--cream); }
.ttrack.active { background: rgba(201,140,10,0.18); border-color: rgba(201,140,10,0.5); color: var(--gold); }

/* ── FLOATING NOTES ─────────────────────────────────── */
#notes-layer {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 30; overflow: hidden;
}
.note {
  position: absolute; color: rgba(201,140,10,0.65);
  animation: floatUp linear forwards;
  text-shadow: 0 0 8px rgba(201,140,10,0.3);
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0.75; }
  100% { transform: translateY(-130px) rotate(var(--spin)); opacity: 0; }
}

/* ── VIDEO WRAP ─────────────────────────────────────── */
#video-wrap {
  position: absolute; inset: 0;
}

#video-wrap.warp-active {
  filter: url(#psych-warp);
}

/* ── PSYCHEDELIC OVERLAY ────────────────────────────── */
#psychedelic-canvas {
  position: absolute; inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
  display: none;
}
#psychedelic-canvas.active {
  display: block;
  opacity: 0.32;
}

#stage-controls {
  position: absolute;
  bottom: 0.45rem;
  left: 0.5rem;
  z-index: 6;
  display: flex;
  gap: 0.35rem;
}

#psychedelic-toggle,
#echo-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  background: rgba(4,1,1,0.72);
  border: 1px solid rgba(201,140,10,0.25);
  border-radius: 3px;
  padding: 0.14rem 0.4rem;
  font-size: 0.62rem;
  color: rgba(240,223,192,0.45);
  user-select: none;
  transition: border-color 0.2s, color 0.2s;
  font-family: inherit;
}
#psychedelic-toggle:hover,
#echo-toggle:hover {
  border-color: rgba(201,140,10,0.45);
  color: rgba(240,223,192,0.75);
}
#psychedelic-toggle.active,
#echo-toggle.active {
  border-color: var(--gold);
  color: var(--gold);
  text-shadow: 0 0 8px rgba(201,140,10,0.5);
}
#psychedelic-toggle input[type="checkbox"],
#echo-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  cursor: pointer;
  width: 0.7rem;
  height: 0.7rem;
  flex-shrink: 0;
}

#echo-bpm {
  margin-left: 0.25rem;
  font-size: 0.55rem;
  opacity: 0.7;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 560px) {
  #fireplace-wing { display: none; }
  #main-row { grid-template-columns: 6% 1fr 6%; }
}

/* ── AD SLOT ─────────────────────────────────────────── */
#opera-lounge-ad-slot {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 220px;
  z-index: 20;
}
