/* -------------------------------------------------------------------------
   The room the cabinet stands in. Everything else — wood, glass, lamps — is
   drawn by the game itself, so this file only has to build the darkness
   around it and keep the chrome controls out of the way.
   ------------------------------------------------------------------------- */

:root {
  --room: #05070c;
  --room-lit: #0d1420;
  --teal: #3ef0cd;
  --amber: #ffc23d;
  --magenta: #ff3d92;
  --ink: #dbe8f5;
  --hud: rgba(12, 18, 26, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--room);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  /* a workshop wall, lit only by the backbox */
  background:
    radial-gradient(120% 70% at 50% -10%, #16283a 0%, #0a121c 42%, #05070c 78%),
    linear-gradient(180deg, #05070c 0%, #04060a 100%);
}

#room {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1600px;
}

#stage {
  position: relative;
  height: min(100dvh, 196vw);
  aspect-ratio: 620 / 1240;
  filter: drop-shadow(0 40px 70px rgba(0, 0, 0, 0.85));
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body:not(.ready) #stage {
  transform: scale(0.965);
}

canvas#cab {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  touch-action: none;
  cursor: crosshair;
  background: #05070c;
}

/* faint glow on the floor beneath the cabinet */
#stage::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -2.5%;
  height: 6%;
  background: radial-gradient(50% 100% at 50% 0%, rgba(62, 240, 205, 0.16), rgba(0, 0, 0, 0) 70%);
  filter: blur(10px);
  pointer-events: none;
}

/* ------------------------------------------------------------------- HUD */
#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  gap: 6px;
  z-index: 4;
}

.chip {
  appearance: none;
  border: 1px solid rgba(160, 200, 225, 0.18);
  background: var(--hud);
  color: var(--ink);
  font: 600 13px/1 inherit;
  padding: 7px 9px;
  border-radius: 9px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.chip:hover {
  border-color: rgba(62, 240, 205, 0.6);
  color: #eafffb;
}

.chip:active {
  transform: translateY(1px);
}

.chip.wide {
  cursor: default;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
  min-width: 52px;
  text-align: center;
}

/* ------------------------------------------------------------------- help */
#help {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  width: min(88%, 460px);
  background: rgba(6, 11, 18, 0.9);
  border: 1px solid rgba(160, 200, 225, 0.2);
  border-radius: 14px;
  padding: 16px 20px 18px;
  backdrop-filter: blur(10px);
  z-index: 5;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

#help h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
}

#help ul {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.75;
}

#help b {
  color: #fff;
  font-weight: 700;
}

#help p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #b6cbdd;
}

#help .dim {
  color: #8ea6bb;
}

/* --------------------------------------------------------------- overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: radial-gradient(60% 40% at 50% 45%, rgba(4, 8, 14, 0.62), rgba(2, 4, 8, 0.9));
  border-radius: 22px;
  z-index: 6;
  pointer-events: none;
}

.overlay.show {
  display: flex;
  animation: fade 0.35s ease;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 46px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #eafcff;
  text-shadow: 0 0 26px rgba(62, 240, 205, 0.55);
}

.overlay p {
  margin: 0;
  font-size: clamp(11px, 1.6vw, 15px);
  letter-spacing: 0.14em;
  color: #a9c4d6;
}

.cta {
  pointer-events: auto;
  margin-top: 14px;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid rgba(62, 240, 205, 0.5);
  background: rgba(10, 24, 30, 0.8);
  color: #eafffb;
  font: 700 12px/1 inherit;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ----------------------------------------------------------------- splash */
#splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  justify-items: center;
  background: #05070c;
  z-index: 20;
  transition: opacity 0.7s ease, visibility 0.7s;
}

#splash span {
  font-size: clamp(28px, 7vw, 64px);
  font-weight: 800;
  letter-spacing: 0.42em;
  color: #eafcff;
  text-shadow: 0 0 34px rgba(62, 240, 205, 0.5);
}

#splash small {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #7f98ac;
}

body.ready #splash {
  opacity: 0;
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  #stage {
    transition: none;
  }
}
