:root {
  --brass: #c4a574;
  --brass-2: #8a6a3e;
  --ink: #efe6d8;
  --dim: #9a9184;
  --cyan: #3ecfff;
  --dusk: #152238;
  --wood: #2a1c14;
  --teal: #1a3a40;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 520px at 50% -8%, #3d3348 0%, transparent 52%),
    linear-gradient(180deg, #152238 0%, #3d3348 26%, #c4784a 58%, #2a1c14 100%);
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, #0000 0 17px, #00000012 17px 18px),
    radial-gradient(ellipse at 50% 120%, #0008, transparent 55%);
  z-index: 0;
}
.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}
#hub, #play { grid-row: 3; }
#hub[hidden], #play[hidden] { display: none !important; }
.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  background: linear-gradient(#3a2c20, #1c1612);
  border-bottom: 2px solid var(--brass);
  box-shadow: inset 0 1px 0 #6a5438, 0 10px 28px #0008;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Cinzel, Palatino, serif;
  letter-spacing: 0.12em;
  color: var(--brass);
}
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.title { font-family: Cinzel, Palatino, serif; letter-spacing: 0.06em; }
.title small {
  display: block;
  color: var(--dim);
  font-family: "Source Sans 3", sans-serif;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}
.grow { flex: 1; }
.stat { color: var(--dim); letter-spacing: 0.05em; font-size: 0.85rem; }
.stat b { color: var(--brass); font-variant-numeric: tabular-nums; }
a { color: var(--brass); text-decoration: none; letter-spacing: 0.08em; }
a.hall-exit {
  background: var(--brass);
  color: #1c1612;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
button {
  font: inherit;
  background: #3a2c20;
  color: var(--ink);
  border: 1px solid var(--brass-2);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover { border-color: var(--brass); }
button:disabled { opacity: 0.45; cursor: default; }

#hint {
  margin: 0;
  padding: 8px 18px 0;
  color: var(--dim);
  letter-spacing: 0.04em;
}

#hub { padding: 0 18px 32px; }

.bunting {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  height: 40px;
  margin: 0 -18px 4px;
  padding: 0 6px;
  background: linear-gradient(#6a5438, #4a3a24) 0 0 / 100% 4px no-repeat;
}
.bunting i {
  width: 22px;
  height: 36px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  box-shadow: 0 4px 8px #0004;
}
.bunting i:nth-child(5n+1) { background: #c4a574; }
.bunting i:nth-child(5n+2) { background: #3ecfff; }
.bunting i:nth-child(5n+3) { background: #7dcea0; }
.bunting i:nth-child(5n+4) { background: #d07090; }
.bunting i:nth-child(5n+5) { background: #e8c868; }

.lights {
  height: 14px;
  margin: 0 -18px 8px;
  background-image: radial-gradient(circle, #ffbe46 0 3px, #ffbe4628 4px, transparent 9px);
  background-size: 48px 14px;
  background-repeat: repeat-x;
  filter: drop-shadow(0 0 6px #ffbe4688);
  animation: glow 2.4s ease-in-out infinite;
}
@keyframes glow {
  50% { filter: drop-shadow(0 0 10px #ffbe46cc) brightness(1.15); }
}

.hero {
  text-align: center;
  padding: 6px 12px 14px;
}
.hero .kicker {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  font-size: 0.72rem;
}
.hero h1 {
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 4px 0 6px;
  text-shadow: 0 2px 0 #1c1612, 0 0 28px #c4784a88;
}
.hero p {
  margin: 0 auto;
  max-width: 38rem;
  color: var(--dim);
}

.rail-title {
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  letter-spacing: 0.12em;
  font-size: 1.05rem;
  margin: 18px 0 8px;
  border-bottom: 1px solid #8a6a3e66;
  padding-bottom: 4px;
}
#booths {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.booth-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
  text-align: left;
  color: inherit;
  background:
    radial-gradient(circle at 11px calc(100% - 11px), #efe6d8 0 1.2px, #c4a574 1.8px, #8a6a3e 2.6px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 11px) calc(100% - 11px), #efe6d8 0 1.2px, #c4a574 1.8px, #8a6a3e 2.6px, transparent 3.4px),
    linear-gradient(180deg, #3a2c20, #1c1612);
  border: 2px solid var(--brass);
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 1px #8a6a3e,
    inset 0 1px 0 #efe6d833,
    0 10px 22px #0007;
}
.booth-card:hover { border-color: #e8c868; transform: translateY(-2px); }
.booth-card .art {
  display: block;
  width: 100%;
  height: 148px;
  object-fit: cover;
  border-bottom: 2px solid var(--brass);
  background: #1a1612;
  box-shadow: inset 0 0 0 1px #c4a57466;
}
.booth-card .copy { padding: 10px 12px 12px; }
.booth-card h2 {
  font-family: Cinzel, Palatino, serif;
  margin: 0 0 4px;
  color: var(--brass);
  font-size: 1.15rem;
}
.booth-card .blurb { margin: 0; color: var(--ink); font-size: 0.9rem; }
.booth-card .ctrl { margin: 6px 0 0; color: var(--dim); font-size: 0.78rem; }
.booth-card .best {
  margin: 6px 0 0;
  color: var(--cyan);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.booth-card .key {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: #1c1612cc;
  border: 1px solid var(--brass);
  border-radius: 50%;
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  font-size: 0.85rem;
}

.ad-slot { margin-top: 22px; min-height: 40px; }

.dock.off,
.dock[hidden] { display: none !important; }
.dock {
  padding: 8px 12px 12px;
  background: linear-gradient(#3a2c20, #1c1612);
  border-top: 2px solid var(--brass);
}
.dock .pad {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 44px);
  gap: 6px;
  justify-content: center;
}
.dock .pad.stack-pad {
  grid-template-columns: repeat(5, 52px);
  grid-template-rows: 44px;
}
.dock .pad i { visibility: hidden; }
.dock .pad button {
  min-width: 0;
  height: 100%;
  font-size: 1.05rem;
  touch-action: none;
}

body.playing #hub { display: none; }
#play {
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
}
#view-wrap {
  height: min(72vh, 540px);
  border: 3px solid var(--brass-2);
  border-radius: 12px;
  overflow: hidden;
  background: #0c0a08;
  box-shadow: 0 0 0 4px #1c1612, inset 0 0 40px #0008, 0 12px 32px #0008;
}
#view { width: 100%; height: 100%; display: block; background: #0c0a08; }

#result {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0c0a08d8;
  z-index: 30;
}
#result[hidden] { display: none !important; }
#result .panel {
  background: linear-gradient(180deg, #3a2c20, #1c1612);
  border: 2px solid var(--brass);
  padding: 20px 22px;
  border-radius: 14px;
  min-width: min(92vw, 360px);
  box-shadow: 0 16px 40px #000a, inset 0 1px 0 #efe6d833;
}
#result h2 {
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  margin: 0 0 8px;
}
#result ul { margin: 8px 0 16px; padding-left: 1.2rem; color: var(--dim); }

.file-hint {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0c0a08f0;
  z-index: 50;
  padding: 24px;
}
.file-hint[hidden] { display: none !important; }
.file-hint div {
  max-width: 28rem;
  background: #2a2218;
  border: 1px solid var(--brass);
  border-radius: 12px;
  padding: 20px;
}
.file-hint h1 {
  font-family: Cinzel, Palatino, serif;
  color: var(--brass);
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.file-hint code { color: var(--cyan); }

@media (max-width: 640px) {
  .booth-card .art { height: 120px; }
  #view-wrap { height: 62vh; }
  .hero h1 { font-size: 1.7rem; }
}
