:root {
  --void: #07080c;
  --ink: #f4ece1;
  --mute: #9a9186;
  --line: rgba(244, 236, 225, 0.08);
  --now: #f2c07a;
  --glow: rgba(242, 192, 122, 0.38);
  --glass: rgba(10, 10, 14, 0.42);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  height: 100svh;
  background: var(--void);
  color: var(--ink);
  font: 15px/1.45 "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#world {
  position: fixed; inset: 0; z-index: 0;
  background: #050507;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.entering #world,
body.in #world {
  opacity: 1;
  visibility: visible;
}
body.entering #world { animation: roomIn 1.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes roomIn {
  from { opacity: 0; transform: scale(1.07); filter: blur(10px); }
  to { opacity: 1; transform: none; filter: none; }
}
.scene-layer {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
  overflow: hidden;
  background: #050507;
}
.scene-layer.on { opacity: 1; z-index: 1; }
.scene-layer.preview { opacity: 0.42; z-index: 2; }
.scene-layer img,
.scene-layer video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(1.03);
  opacity: 0;
  pointer-events: none;
}
.scene-layer.ready img,
.scene-layer.ready video { opacity: 1; }
.grain, .vignette, .wash {
  pointer-events: none; position: fixed; inset: 0;
}
.grain {
  z-index: 6;
  opacity: 0.11;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  z-index: 5;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 18%, rgba(5,5,8,0.35) 58%, #050508 92%),
    linear-gradient(180deg, rgba(5,5,8,0.35) 0%, transparent 18%, transparent 72%, rgba(5,5,8,0.72) 100%);
}
.wash {
  z-index: 4;
  background: linear-gradient(180deg, rgba(7,8,12,0.18), rgba(7,8,12,0.08));
}

#gate {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: #07080c;
  transition: opacity 1.1s ease, visibility 1.1s;
}
body.entering #gate,
body:not(.boot) #gate {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.gate-card {
  text-align: center;
  padding: 28px 36px 32px;
  max-width: 34rem;
}
.gate-card .kicker {
  margin: 0 0 18px;
  letter-spacing: 0.42em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--mute);
}
#gate-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
  font-weight: 400;
  font-size: clamp(56px, 9vw, 92px);
  letter-spacing: 0.18em;
  line-height: 1;
}
#gate-en {
  margin: 10px 0 0;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--now);
}
#gate-blurb {
  margin: 22px auto 0;
  max-width: 22em;
  color: var(--mute);
  font-size: 14px;
  letter-spacing: 0.06em;
}
#enter {
  margin-top: 34px;
  border: 1px solid rgba(242, 192, 122, 0.5);
  background: rgba(242, 192, 122, 0.08);
  color: var(--now);
  padding: 14px 40px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.38em;
  font: inherit;
  font-size: 14px;
  transition: background 0.25s, transform 0.25s;
}
#enter:hover { background: rgba(242, 192, 122, 0.1); }
#enter:disabled { opacity: 0.35; cursor: wait; }
body.loading #enter { opacity: 0.35; pointer-events: none; display: none; }

#loader { margin-top: 34px; }
#loader[hidden] { display: none; }
.boot-meter {
  width: 96px; height: 96px;
  margin: 0 auto 16px;
  position: relative;
}
.boot-svg { width: 96px; height: 96px; display: block; transform: rotate(-90deg); }
.boot-track, .boot-arc {
  fill: none;
  stroke-width: 2.2;
}
.boot-track { stroke: rgba(242, 192, 122, 0.16); }
.boot-arc {
  stroke: var(--now);
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 0.35s ease;
  filter: drop-shadow(0 0 6px rgba(242, 192, 122, 0.45));
}
.boot-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 1px;
  letter-spacing: 0.08em;
  color: var(--now);
}
.boot-pct em {
  font-style: normal;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.boot-pct span { font-size: 10px; opacity: 0.7; margin-top: 6px; }
#load-line {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--mute);
}
.boot-steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  color: rgba(154, 145, 134, 0.55);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.boot-steps li.on { color: var(--now); }
.boot-steps li.done { color: rgba(244, 236, 225, 0.72); }

.chrome, .now-copy, .score, .hud {
  position: relative; z-index: 8;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}
body.entering .chrome,
body.entering .now-copy,
body.entering .score,
body.entering .hud,
body.in .chrome,
body.in .now-copy,
body.in .score,
body.in .hud {
  opacity: 1; transform: none; pointer-events: auto;
}
body.entering .chrome { transition: opacity 0.9s ease 0.35s, transform 0.9s ease 0.35s; }
body.entering .now-copy { transition: opacity 1s ease 0.5s, transform 1s ease 0.5s; }
body.entering .score { transition: opacity 0.9s ease 0.7s, transform 0.9s ease 0.7s; }
body.entering .hud { transition: opacity 0.8s ease 0.85s, transform 0.8s ease 0.85s; }
body.in .chrome, body.in .now-copy, body.in .score, body.in .hud {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.chrome {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 28px 0;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand h1 {
  margin: 0; font-weight: 400; letter-spacing: 0.22em; font-size: 15px;
}
.kicker {
  margin: 0 0 2px; font-size: 10px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--mute);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3a3a3a;
}
.pulse.on {
  background: var(--now);
  box-shadow: 0 0 16px var(--glow);
  animation: beat 1.8s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.82); opacity: 0.7; }
}
.transport { display: flex; gap: 16px; align-items: center; color: var(--mute); font-size: 12px; letter-spacing: 0.08em; }
.listeners {
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(242,192,122,0.22);
  background: rgba(7,8,12,0.38);
  backdrop-filter: blur(10px);
}
#mute {
  border: 1px solid rgba(232,223,210,0.18);
  background: transparent; color: var(--mute);
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  letter-spacing: 0.2em; font: inherit; font-size: 12px;
}
#mute:hover { color: var(--ink); }

.now-copy {
  position: absolute;
  left: 36px; bottom: 286px;
  max-width: min(28rem, 46vw);
  pointer-events: none;
}
.now-en {
  margin: 0 0 6px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--now);
}
#now-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
  font-weight: 400;
  font-size: clamp(36px, 5vw, 58px);
  letter-spacing: 0.16em;
}
#now-blurb {
  margin: 10px 0 0;
  color: var(--mute);
  font-size: 13px;
  max-width: 22em;
}

.score {
  position: absolute;
  left: 0; right: 0; bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 24px;
  pointer-events: none;
}
.score .dock, .score .stage { pointer-events: auto; }
.dock {
  position: relative;
  left: auto; right: auto; bottom: auto;
  display: flex; gap: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
  z-index: 2;
}
.scene {
  position: relative;
  width: 92px; height: 58px;
  padding: 0; border: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #111;
  color: var(--ink);
  font: inherit;
  opacity: 0.62;
  outline: 1px solid rgba(244,236,225,0.08);
  transition: opacity 0.25s, outline-color 0.25s, transform 0.25s;
}
.scene img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(0.8);
}
.scene span {
  position: absolute; left: 8px; bottom: 6px;
  font-size: 11px; letter-spacing: 0.12em;
  text-shadow: 0 1px 8px #000;
}
.scene.on { opacity: 1; outline-color: var(--now); }
.scene.pending { opacity: 1; outline-style: dashed; outline-color: var(--now); }
.scene:hover { opacity: 1; transform: translateY(-2px); }

.stage {
  position: relative;
  left: auto; right: auto; bottom: auto;
  height: 132px;
  pointer-events: none;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8,8,12,0.22), rgba(5,6,10,0.48));
  outline: 1px solid rgba(244,236,225,0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
#roll { width: 100%; height: 100%; display: block; opacity: 0.96; }

.hud {
  position: absolute;
  left: 28px; right: 28px; bottom: 10px;
  display: flex; justify-content: space-between; gap: 16px;
  color: var(--mute); font-size: 11px; letter-spacing: 0.08em;
}
#chord { color: rgba(244,236,225,0.78); }

@media (max-width: 720px), (pointer: coarse) and (max-height: 900px) {
  html, body {
    height: 100svh;
    max-height: 100svh;
  }
  body {
    display: flex;
    flex-direction: column;
  }
  #gate-title {
    font-size: clamp(40px, 14vw, 64px);
    letter-spacing: 0.1em;
  }
  .chrome {
    position: relative;
    flex: 0 0 auto;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 0;
  }
  .brand h1 { font-size: 13px; letter-spacing: 0.16em; }
  .transport { gap: 8px; font-size: 11px; }
  .listeners { padding: 5px 10px; letter-spacing: 0.12em; }
  #mute { padding: 6px 12px; letter-spacing: 0.14em; }
  .now-copy {
    position: relative;
    left: auto;
    bottom: auto;
    max-width: none;
    padding: 12px 16px 0;
    flex: 0 0 auto;
  }
  #now-title {
    font-size: clamp(28px, 8vw, 36px);
    letter-spacing: 0.1em;
  }
  #now-blurb { display: none; }
  .score {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: auto;
    padding: 0 12px;
    flex: 0 0 auto;
    gap: 8px;
  }
  .dock {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 2px;
  }
  .dock::-webkit-scrollbar { display: none; }
  .scene { width: 64px; height: 42px; flex: 0 0 auto; }
  .scene span { font-size: 10px; left: 6px; bottom: 4px; }
  .stage { height: 84px; border-radius: 12px; }
  .hud {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 6px 14px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    font-size: 10px;
  }
}
