:root {
  color-scheme: dark;
  --paper: #f4efe6;
  --muted: rgba(244, 239, 230, 0.68);
  --glass: rgba(15, 13, 11, 0.58);
  --glass-strong: rgba(14, 12, 10, 0.78);
  --stroke: rgba(255, 255, 255, 0.15);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #0e0d0c;
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 560px;
  isolation: isolate;
  overflow: hidden;
}

.scene-stack, .scene-image, .scene-motion, .rain-layer, .grain, .vignette, .bottom-shade {
  position: absolute;
  inset: 0;
}
.scene-stack { z-index: -2; background: #181512; }
.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.025);
  transition: opacity 1050ms ease, transform 8s ease;
  filter: saturate(.94) contrast(1.02) brightness(.9);
}
.scene-image.is-active { opacity: 1; transform: scale(1.045); }
.scene-motion {
  background: linear-gradient(115deg, rgba(255,184,95,.045), transparent 36%, rgba(40,76,112,.06));
  mix-blend-mode: screen;
  animation: breathe 10s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes breathe { from { opacity: .35; } to { opacity: .8; } }

.rain-layer {
  opacity: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(105deg, transparent 0 14px, rgba(255,255,255,.09) 15px, transparent 16px 31px),
    repeating-linear-gradient(103deg, transparent 0 21px, rgba(255,255,255,.055) 22px, transparent 23px 43px);
  background-size: 330px 500px, 470px 680px;
  transform: translateY(-20%);
  animation: rain 1.05s linear infinite;
  mix-blend-mode: screen;
  transition: opacity .8s ease;
}
.rain-layer.is-visible { opacity: .24; }
@keyframes rain { to { background-position: -35px 500px, -55px 680px; } }
.grain {
  opacity: .08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: grainShift .7s steps(2) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0,0) scale(1.03); }
  25% { transform: translate(-1%,1%) scale(1.03); }
  50% { transform: translate(1%,-1%) scale(1.03); }
  75% { transform: translate(1%,1%) scale(1.03); }
}
.vignette {
  pointer-events: none;
  background: radial-gradient(circle at 50% 43%, transparent 30%, rgba(0,0,0,.1) 68%, rgba(0,0,0,.43) 105%);
}
.bottom-shade {
  pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.13) 36%, transparent 67%),
              linear-gradient(to right, rgba(0,0,0,.3), transparent 36%);
}

.topbar {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: clamp(22px, 4vw, 58px);
  right: clamp(22px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  background: rgba(17,15,13,.4);
  backdrop-filter: blur(14px);
  font-weight: 760;
  letter-spacing: -.04em;
}
.brand-copy { display: grid; line-height: 1.04; }
.brand-copy strong { font-size: 14px; letter-spacing: .01em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.channel-link {
  color: var(--paper);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 11px 14px;
  background: rgba(18,16,14,.35);
  backdrop-filter: blur(12px);
  transition: background .2s ease, transform .2s ease;
}
.channel-link:hover { background: rgba(18,16,14,.62); transform: translateY(-1px); }

.listener-pill {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: rgba(18,16,14,.42);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,.85);
  font-size: 11px;
  letter-spacing: .04em;
  text-shadow: 0 2px 18px rgba(0,0,0,.55);
  pointer-events: none;
  user-select: none;
}
.listener-pill__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff5d5d;
  box-shadow: 0 0 0 0 rgba(255,93,93,.6);
  animation: listenerPulse 1.8s ease-in-out infinite;
}
.listener-pill__count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  min-width: 10px;
  text-align: right;
}
.listener-pill__label {
  text-transform: lowercase;
  opacity: .78;
}
@keyframes listenerPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,93,93,.55); }
  70%  { box-shadow: 0 0 0 8px rgba(255,93,93,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,93,93,0); }
}

.scene-copy {
  position: absolute;
  left: clamp(24px, 5vw, 76px);
  bottom: clamp(330px, 35vh, 390px);
  width: min(600px, calc(100vw - 48px));
  text-shadow: 0 2px 24px rgba(0,0,0,.5);
  transition: opacity .28s ease, transform .28s ease;
}
.scene-copy.is-changing { opacity: 0; transform: translateY(8px); }
.eyebrow, .now-playing {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.68);
}
.scene-copy h1 {
  margin: 0;
  max-width: 700px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5.4vw, 76px);
  font-weight: 400;
  line-height: .96;
  letter-spacing: -.035em;
}
.scene-description {
  margin: 16px 0 0;
  width: min(520px, 100%);
  color: rgba(255,255,255,.72);
  font-size: clamp(13px, 1.15vw, 16px);
  line-height: 1.6;
}

.scene-nav {
  position: absolute;
  right: clamp(24px, 4vw, 58px);
  bottom: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-button, .scene-count, .player-button, .play-button {
  border: 1px solid var(--stroke);
  background: rgba(18,16,14,.48);
  backdrop-filter: blur(18px);
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.icon-button:hover, .scene-count:hover, .player-button:hover, .play-button:hover {
  background: rgba(33,29,25,.76);
  border-color: rgba(255,255,255,.28);
}
.icon-button:active, .scene-count:active, .player-button:active, .play-button:active { transform: scale(.97); }
.icon-button { width: 44px; height: 44px; border-radius: 50%; font-size: 17px; }
.scene-count {
  height: 44px;
  min-width: 76px;
  border-radius: 999px;
  padding: 0 16px;
  color: rgba(255,255,255,.76);
  font-size: 12px;
  letter-spacing: .09em;
}
.scene-count #sceneNumber { color: #fff; }
.slash { padding: 0 5px; opacity: .4; }

.player-card {
  position: absolute;
  left: clamp(24px, 4vw, 58px);
  bottom: 34px;
  width: min(420px, calc(100vw - 48px));
  min-height: 168px;
  display: block;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.08);
  box-shadow: var(--shadow);
}
/* YouTube iframe is hidden off-screen so its audio plays without showing the video. */
.audio-stage {
  position: absolute;
  width: 1px; height: 1px;
  left: -9999px; top: -9999px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
.player-content {
  min-width: 0;
  padding: 21px 22px 17px;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  gap: 12px;
}
.track-meta { min-width: 0; display: grid; }
.track-meta .now-playing { margin-bottom: 5px; }
.track-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}
.track-source { margin-top: 5px; color: var(--muted); font-size: 11px; }
.controls-row { display: flex; align-items: center; gap: 8px; }
.player-button { width: 36px; height: 36px; border-radius: 50%; font-size: 13px; }
.play-button {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(244,239,230,.94);
  color: #15120f;
  border-color: transparent;
  font-size: 14px;
}
.play-button:hover { background: #fff; border-color: transparent; }
.progress-row { display: grid; grid-template-columns: 34px 1fr 34px; gap: 8px; align-items: center; }
.progress-row span { color: rgba(255,255,255,.55); font-size: 10px; font-variant-numeric: tabular-nums; }
.range {
  width: 100%;
  height: 3px;
  appearance: none;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; border-radius: 50%; background: #f4efe6; }
.range::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: #f4efe6; }
.volume-row { display: flex; align-items: center; gap: 8px; }
.volume-icon { font-size: 12px; color: rgba(255,255,255,.58); }
.range--volume { width: 86px; }

.enter-button {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px 15px 15px;
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(17,15,13,.62);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  cursor: pointer;
  transition: opacity .4s ease, transform .25s ease, background .2s ease;
}
.enter-button:hover { background: rgba(24,21,18,.78); transform: translate(-50%, -50%) scale(1.02); }
.enter-button.is-hidden { opacity: 0; pointer-events: none; }
.enter-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: #f3eee5; color: #171411; padding-left: 2px;
}
.enter-button span:last-child { display: grid; text-align: left; }
.enter-button strong { font-size: 13px; font-weight: 650; }
.enter-button small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(0,0,0,.36);
  backdrop-filter: blur(4px);
}
.scene-drawer {
  position: fixed;
  z-index: 20;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--stroke);
  border-radius: 28px;
  background: rgba(15,13,11,.88);
  backdrop-filter: blur(30px) saturate(1.2);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 34px));
  transition: transform .46s cubic-bezier(.22,.8,.25,1);
  overflow-y: auto;
}
.scene-drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.drawer-head .now-playing { margin-bottom: 7px; }
.drawer-head h2 { margin: 0; font-family: Georgia, serif; font-weight: 400; font-size: 30px; letter-spacing: -.02em; }
.drawer-close { font-size: 24px; }
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scene-card {
  position: relative;
  min-height: 162px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  background: #171513;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.scene-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .2s ease; opacity: .76; }
.scene-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.78), transparent 66%); }
.scene-card:hover img { transform: scale(1.04); opacity: .92; }
.scene-card.is-current { border-color: rgba(255,255,255,.5); }
.scene-card-copy { position: absolute; z-index: 2; left: 14px; right: 12px; bottom: 13px; }
.scene-card-copy span { display: block; color: rgba(255,255,255,.57); font-size: 9px; letter-spacing: .15em; text-transform: uppercase; margin-bottom: 4px; }
.scene-card-copy strong { display: block; font-size: 13px; line-height: 1.2; }
.drawer-note { margin: 18px 3px 0; color: rgba(255,255,255,.45); font-size: 11px; line-height: 1.55; }

@media (max-width: 1040px) {
  .scene-copy { bottom: 280px; }
}

@media (max-width: 780px) {
  body { overflow: hidden; }
  .app { min-height: 620px; }
  .topbar { top: max(18px, env(safe-area-inset-top)); left: 18px; right: 18px; }
  .brand-copy small { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .channel-link { padding: 9px 11px; font-size: 10px; }
  .listener-pill {
    top: calc(max(18px, env(safe-area-inset-top)) + 56px);
    padding: 7px 12px 7px 10px;
    font-size: 10px;
  }
  .scene-copy { left: 20px; bottom: 365px; width: calc(100vw - 40px); }
  .scene-copy h1 { font-size: clamp(36px, 11vw, 54px); }
  .scene-description { font-size: 13px; max-width: 440px; }
  .player-card {
    left: 14px;
    right: 14px;
    bottom: max(72px, calc(env(safe-area-inset-bottom) + 68px));
    width: auto;
    min-height: 0;
    border-radius: 20px;
  }
  .player-content { padding: 14px 16px 13px; gap: 9px; }
  .track-title { font-size: 13px; }
  .volume-row { display: none; }
  .scene-nav {
    left: 50%; right: auto; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  }
  .scene-drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: min(82vh, 740px); transform: translateY(calc(100% + 18px)); }
  .scene-drawer.is-open { transform: translateY(0); }
}

@media (max-width: 520px) {
  .scene-copy { bottom: 365px; }
  .scene-description { max-width: 92%; }
  .scene-grid { grid-template-columns: 1fr; }
  .scene-card { min-height: 132px; }
  .enter-button { width: calc(100vw - 44px); justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
