:root {
  --bg: #0a0b0e;
  --fg: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.55);
  --faint: rgba(244, 241, 234, 0.28);
  --line: rgba(244, 241, 234, 0.12);
  --glass: rgba(14, 16, 22, 0.55);
  --glass-strong: rgba(12, 14, 20, 0.72);
  --accent: #e8e0d4;
  --accent-soft: rgba(232, 224, 212, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --blur: 20px;
  --sans: "DM Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* —— Loading —— */
#load {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #141820 0%, #0a0b0e 70%);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}

#load.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.load-inner { text-align: center; width: min(280px, 80vw); }

.load-brand {
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.load-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-style: italic;
  margin-bottom: 0.35rem;
}

.load-sub {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 1.5rem;
}

/* —— Room transition veil —— */
#veil {
  position: absolute;
  inset: 0;
  z-index: 35;
  background: #050504;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease);
}
#veil.on {
  opacity: 1;
  pointer-events: auto;
}

/* —— Journey —— */
.hud-journey {
  position: absolute;
  top: calc(5.2rem + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  text-align: center;
  width: min(420px, calc(100% - 2rem));
  pointer-events: none;
}
.hud-journey .journey-dots {
  pointer-events: auto;
}

.room-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  margin-bottom: 0.25rem;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
}

.room-verse {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.journey-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.32rem;
  max-width: min(28rem, calc(100vw - 2rem));
}

.journey-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(244, 241, 234, 0.35);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.2s var(--ease);
}
.journey-dot:hover { transform: scale(1.15); }
.journey-dot.active {
  background: var(--fg);
  border-color: var(--fg);
  box-shadow: 0 0 12px rgba(244, 241, 234, 0.45);
}
.journey-dot.done {
  background: rgba(244, 241, 234, 0.35);
  border-color: rgba(244, 241, 234, 0.35);
}
.journey-dot.next {
  border-color: rgba(232, 212, 168, 0.9);
  box-shadow: 0 0 10px rgba(232, 212, 168, 0.45);
  animation: next-pulse 1.6s ease-in-out infinite;
}
@keyframes next-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.85; }
}

.next-bar {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  pointer-events: auto;
}

.btn-next-room {
  appearance: none;
  border: 1px solid rgba(232, 212, 168, 0.55);
  background: rgba(10, 9, 8, 0.78);
  color: var(--fg);
  border-radius: 14px;
  padding: 0.65rem 1.1rem 0.7rem;
  cursor: pointer;
  min-width: min(260px, 80vw);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.2s var(--ease);
  text-align: center;
}
.btn-next-room:hover {
  border-color: rgba(232, 212, 168, 0.95);
  background: rgba(232, 212, 168, 0.12);
  transform: translateY(-1px);
}
.btn-next-room:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}
.next-kicker {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.next-name {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 0.15rem;
}
.next-keys {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-transform: uppercase;
}

.btn-face-exit {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(10, 9, 8, 0.65);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.65rem 0.95rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
}
.btn-face-exit:hover {
  color: var(--fg);
  border-color: rgba(244, 241, 234, 0.4);
}

/* —— Door prompt —— */
.door-prompt {
  position: absolute;
  left: 50%;
  bottom: calc(12.5rem + var(--safe-b));
  transform: translateX(-50%);
  z-index: 20;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  animation: prompt-in 0.4s var(--ease);
}
.door-prompt[hidden] { display: none !important; }

.door-prompt-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}

.btn-enter {
  appearance: none;
  border: 1px solid rgba(232, 212, 168, 0.55);
  background: rgba(12, 10, 8, 0.65);
  color: var(--fg);
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  text-decoration: none;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.2s var(--ease);
}
.btn-enter:hover {
  background: rgba(232, 212, 168, 0.15);
  border-color: rgba(232, 212, 168, 0.9);
  transform: translateY(-1px);
}

@keyframes prompt-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* —— Finale —— */
.finale {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: rgba(5, 5, 4, 0.72);
  backdrop-filter: blur(10px);
}
.finale[hidden] { display: none !important; }
.finale .eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.finale h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-bottom: 0.6rem;
}
.finale-copy {
  color: var(--muted);
  max-width: 26rem;
  line-height: 1.5;
  margin-bottom: 1.75rem;
  font-size: 0.92rem;
}
.finale-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: min(20rem, 100%);
}
.finale-actions .btn-continue {
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.finale-actions .btn-continue-soft {
  border-color: rgba(244, 241, 234, 0.28);
  background: rgba(244, 241, 234, 0.05);
  font-size: 0.88rem;
}
.finale-actions .btn-continue-soft:hover {
  border-color: rgba(232, 212, 170, 0.55);
  background: rgba(232, 212, 170, 0.1);
}
.finale-note {
  margin-top: 1rem;
  max-width: 22rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: var(--faint);
}

/* Free bonus track unlock panel */
.bonus-panel {
  width: min(22rem, 100%);
  margin: 0 auto 1.35rem;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 212, 170, 0.45);
  background: rgba(232, 212, 170, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.bonus-eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(232, 212, 170, 0.9);
  margin-bottom: 0.35rem;
}
.bonus-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}
.bonus-credits {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 212, 170, 0.88);
  line-height: 1.4;
  margin: 0.15rem 0 0.55rem;
}
.bonus-copy {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0.9rem;
}
.bonus-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.bonus-actions .btn-continue {
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.bonus-status {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--faint);
  line-height: 1.4;
}
.bonus-panel.is-pending .bonus-eyebrow {
  color: var(--muted);
}
.bonus-panel.is-pending {
  border-color: rgba(244, 241, 234, 0.2);
  background: rgba(244, 241, 234, 0.04);
}
/* Stay in the experience — secondary but clearly tappable */
.btn-tour-again {
  appearance: none;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 1.2rem;
  border-radius: 14px;
  border: 1px dashed rgba(244, 241, 234, 0.35);
  background: transparent;
  color: var(--fg);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-tour-again:hover {
  border-color: rgba(232, 212, 170, 0.65);
  border-style: solid;
  background: rgba(244, 241, 234, 0.06);
}
.text-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.text-btn:hover { color: var(--fg); }

.load-bar {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.load-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--fg);
  transition: width 0.25s var(--ease);
}

.load-status {
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.06em;
}

/* —— Glass panels —— */
.hud-top,
.hud-metrics,
.hud-controls,
.hud-hint {
  z-index: 10;
  pointer-events: none;
}

.hud-top > *,
.hud-metrics > *,
.hud-controls > * {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  top: calc(1.1rem + var(--safe-t));
  left: 1.25rem;
  right: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

/* Clean tour chrome */
.hud-top-clean {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  pointer-events: none;
}
.hud-top-clean .brand-block h1 {
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
}
.hud-top-clean .room-verse {
  max-width: 28rem;
  margin: 0.25rem auto 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.journey-track {
  display: flex;
  gap: 0.4rem;
  pointer-events: auto;
}

.journey-dot.reachable {
  cursor: pointer;
}

/* Named room jump chips */
.room-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.28rem;
  max-width: min(44rem, calc(100vw - 1.5rem));
  pointer-events: auto;
  margin-top: 0.15rem;
}
.room-chip {
  appearance: none;
  border: 1px solid rgba(244, 241, 234, 0.18);
  background: rgba(10, 9, 8, 0.45);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.room-chip:hover {
  color: var(--fg);
  border-color: rgba(244, 241, 234, 0.4);
}
.room-chip.active {
  color: var(--fg);
  border-color: rgba(232, 212, 168, 0.75);
  background: rgba(232, 212, 168, 0.12);
}

.continue-dock {
  position: absolute;
  left: 50%;
  bottom: calc(5.2rem + var(--safe-b));
  transform: translateX(-50%);
  z-index: 18;
  text-align: center;
  pointer-events: auto;
}
.continue-dock[hidden] { display: none !important; }

.dock-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-continue,
.btn-back {
  appearance: none;
  border: 1px solid rgba(232, 212, 168, 0.5);
  background: rgba(10, 9, 8, 0.82);
  color: var(--fg);
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.2s var(--ease);
  text-decoration: none;
  display: inline-block;
}
.btn-back {
  border-color: rgba(244, 241, 234, 0.28);
  background: rgba(10, 9, 8, 0.55);
  padding: 0.75rem 1.15rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.btn-back[hidden] { display: none !important; }
.btn-continue em,
.btn-back em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05em;
}
.btn-continue:hover {
  border-color: rgba(232, 212, 168, 0.95);
  background: rgba(232, 212, 168, 0.12);
  transform: translateY(-1px);
}
.btn-back:hover {
  color: var(--fg);
  border-color: rgba(244, 241, 234, 0.5);
  transform: translateY(-1px);
}

.continue-hint {
  margin-top: 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.continue-hint kbd {
  font-family: var(--sans);
  border: 1px solid rgba(244, 241, 234, 0.25);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
}

@media (max-width: 560px) {
  .room-nav { gap: 0.25rem; }
  .room-chip {
    font-size: 0.6rem;
    padding: 0.22rem 0.5rem;
  }
  .dock-row { gap: 0.35rem; }
  .btn-continue { padding: 0.75rem 1.15rem; font-size: 0.85rem; }
  .btn-back { padding: 0.65rem 0.9rem; font-size: 0.78rem; }
}

.hud-tools {
  position: absolute;
  left: 50%;
  bottom: calc(1rem + var(--safe-b));
  transform: translateX(-50%);
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  background: rgba(10, 9, 8, 0.7);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.hud-tools[hidden] { display: none !important; }

.tool-time {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.35rem;
}
.tool-time input[type="range"] {
  width: 88px;
}
.tool-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}
.tool-btn:hover,
.tool-btn[aria-pressed="true"] {
  color: var(--fg);
  background: rgba(244, 241, 234, 0.08);
}

.brand-block h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.brand {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.status-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pill.mono,
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Metrics */
.hud-metrics {
  position: absolute;
  top: calc(11.5rem + var(--safe-t));
  left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(160px, 42vw);
}

.metric {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.metric-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.metric-value .unit {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.2rem;
}

/* Controls */
.hud-controls {
  position: absolute;
  left: 50%;
  bottom: calc(1.1rem + var(--safe-b));
  transform: translateX(-50%);
  width: min(520px, calc(100% - 1.5rem));
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.control-card {
  padding: 0.9rem 1rem 1rem;
  border-radius: var(--radius);
  background: var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.65rem;
}

.control-title {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-value {
  font-size: 0.95rem;
  font-weight: 500;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.icon-btn:hover {
  background: rgba(232, 224, 212, 0.22);
  border-color: rgba(244, 241, 234, 0.28);
}

/* Range */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(244, 241, 234, 0.15),
    rgba(244, 241, 234, 0.55)
  );
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg);
  border: 2px solid #1a1c22;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg);
  border: 2px solid #1a1c22;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.chip:hover {
  color: var(--fg);
  border-color: rgba(244, 241, 234, 0.28);
}

.chip.active {
  background: var(--fg);
  color: #12141a;
  border-color: var(--fg);
}

.control-card.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.55rem;
}

.action-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.65rem 0.4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.action-btn:hover {
  background: var(--accent-soft);
  color: var(--fg);
}

.action-btn[aria-pressed="true"] {
  background: rgba(232, 224, 212, 0.12);
  color: var(--fg);
}

.action-icon {
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.9;
}

.hud-hint {
  position: absolute;
  bottom: calc(11.5rem + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--faint);
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 640px) {
  .hud-metrics {
    top: auto;
    bottom: calc(12.5rem + var(--safe-b));
    flex-direction: row;
    flex-wrap: wrap;
    width: calc(100% - 2rem);
  }
  .metric { flex: 1 1 40%; }
  .hud-hint { display: none; }
}

/* Sound unlock gate */
.sound-gate {
  position: absolute;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  background: rgba(6, 7, 10, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1.25rem;
}
.sound-gate[hidden] { display: none !important; }
.sound-gate-inner {
  text-align: center;
  width: min(22rem, 100%);
  padding: 1.5rem 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(232, 212, 170, 0.35);
  background: rgba(10, 10, 12, 0.92);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
}
.sound-gate-brand {
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.sound-gate-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.7rem;
  margin-bottom: 0.6rem;
}
.sound-gate-copy {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1.15rem;
}
.sound-gate .btn-continue {
  width: 100%;
  margin-bottom: 0.5rem;
}
.sound-gate .text-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--faint);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.45rem;
}
.sound-gate .text-btn:hover { color: var(--fg); }

/* One song title — under room placements in the top HUD (not over Continue) */
.hud-top-clean .song-title,
.song-title {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 12;
  margin: 0.2rem auto 0;
  padding: 0.4rem 0.95rem;
  max-width: min(22rem, calc(100vw - 2rem));
  border-radius: 999px;
  background: rgba(6, 5, 4, 0.78);
  border: 1px solid rgba(232, 212, 170, 0.4);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  text-align: center;
  font-family: var(--serif, "Instrument Serif", Georgia, serif);
  font-size: clamp(0.9rem, 2.2vw, 1.05rem);
  letter-spacing: 0.03em;
  color: #f5e8c0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-title[hidden] { display: none !important; }
.song-title.is-muted { opacity: 0.7; }

@media (max-height: 700px) {
  .song-title {
    font-size: 0.85rem;
    padding: 0.35rem 0.8rem;
    margin-top: 0.1rem;
  }
}

.tool-btn[aria-pressed="true"] {
  border-color: rgba(232, 212, 170, 0.75);
  color: var(--fg);
  background: rgba(232, 212, 170, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* —— Exit back to main site (always visible, above load/sound gate/canvas) —— */
.site-back {
  position: fixed;
  top: max(0.85rem, env(safe-area-inset-top, 0px));
  left: max(0.85rem, env(safe-area-inset-left, 0px));
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem 0.45rem 0.5rem;
  text-decoration: none;
  color: var(--fg, #f4f1ea);
  border-radius: 999px;
  border: 1px solid rgba(244, 241, 234, 0.14);
  background: rgba(10, 9, 8, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: min(16rem, calc(100vw - 5.5rem));
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(232, 212, 170, 0.25);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.site-back:hover {
  border-color: rgba(232, 212, 168, 0.45);
  background: rgba(14, 12, 10, 0.88);
  transform: translateY(-1px);
}
.site-back__mark {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.5rem;
  border-radius: 0.35rem 0.35rem 0.5rem 0.5rem;
  background: linear-gradient(160deg, #c5a26f, #6b5a3e);
  box-shadow: 0 4px 12px rgba(197, 162, 111, 0.35);
}
.site-back__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  min-width: 0;
  line-height: 1.15;
}
.site-back__name {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.site-back__tag {
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 212, 168, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.site-back:hover .site-back__tag {
  color: #e8d4a8;
}
@media (max-width: 480px) {
  .site-back {
    padding: 0.4rem 0.55rem 0.4rem 0.4rem;
    gap: 0.45rem;
  }
  .site-back__name { font-size: 0.72rem; }
  .site-back__tag { font-size: 0.48rem; letter-spacing: 0.1em; }
}

