:root {
  color-scheme: dark;
  --gold: #d9c08a;
  --gold-soft: #f2e2b6;
  --gold-deep: #b8923f;
  --ink: #08070c;
  --panel: rgba(18, 15, 10, 0.66);
  --line: rgba(242, 226, 182, 0.22);
  --text: #fdf6e6;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  font-family: var(--sans);
}

body { min-width: 900px; }

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(circle at 58% 40%, rgba(217, 192, 138, 0.16), transparent 30rem),
    radial-gradient(circle at 16% 82%, rgba(124, 86, 24, 0.24), transparent 34rem),
    linear-gradient(140deg, #07060a 0%, #14100b 46%, #050409 100%);
}

#assemblyScene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#assemblyScene.grabbing { cursor: grabbing; }

.hud {
  position: absolute;
  z-index: 2;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  animation: hudIn 1s ease forwards;
}

@keyframes hudIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.top-left {
  top: clamp(30px, 5.4vh, 62px);
  left: clamp(30px, 5vw, 76px);
  width: min(430px, 40vw);
}

.eyebrow {
  display: block;
  margin-bottom: 16px;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(52px, 6.6vw, 104px);
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.top-left p {
  max-width: 30rem;
  margin: 24px 0 0;
  color: rgba(253, 246, 230, 0.72);
  font-size: 16.5px;
  line-height: 1.6;
}

.bottom-left {
  left: clamp(30px, 5vw, 76px);
  bottom: clamp(30px, 5.4vh, 62px);
}

.panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(126px, auto));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(18px);
}

.panel div {
  min-height: 74px;
  padding: 15px 20px;
  background: var(--panel);
}

.panel span {
  display: block;
  color: rgba(242, 226, 182, 0.7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.replay-button {
  position: absolute;
  right: clamp(30px, 5vw, 76px);
  bottom: clamp(30px, 5.4vh, 62px);
  z-index: 3;
  height: 50px;
  padding: 0 24px;
  border: 1px solid rgba(242, 226, 182, 0.46);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(242, 226, 182, 0.17), rgba(184, 146, 63, 0.08));
  color: var(--text);
  font: 750 12.5px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  cursor: pointer;
  opacity: 0;
  animation: hudIn 1s ease 0.35s forwards;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.15s ease;
}

.replay-button:hover,
.replay-button:focus-visible {
  border-color: rgba(255, 236, 184, 0.85);
  background: linear-gradient(180deg, rgba(242, 226, 182, 0.28), rgba(184, 146, 63, 0.16));
  outline: none;
}

.replay-button:active { transform: translateY(1px); }

.loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-soft);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  background: var(--ink);
  transition: opacity 0.6s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 920px) {
  body { min-width: 0; }
  .top-left { width: min(420px, calc(100vw - 44px)); }
  h1 { font-size: 50px; }
  .top-left p { font-size: 15px; }
  .panel { grid-template-columns: 1fr 1fr; }
}
