:root {
  --ink: #0b0818;
  --plum: rgba(22, 14, 40, 0.62);
  --hairline: rgba(255, 214, 160, 0.28);
  --parchment: #f3e6d4;
  --muted: rgba(243, 230, 212, 0.62);
  --gold: #ffcf7a;
  --teal: #6ff5dc;
  --rose: #ff8dbd;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--parchment); font-family: var(--sans); font-weight: 300; }
canvas#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(5, 2, 14, 0.55) 100%); }
[hidden] { display: none !important; }

kbd {
  font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  display: inline-block; min-width: 20px; padding: 2px 6px; margin: 0 2px; text-align: center;
  border: 1px solid var(--hairline); border-radius: 4px; color: var(--parchment); background: rgba(255, 220, 170, 0.06);
}

.screen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, rgba(30, 14, 52, 0.35), rgba(8, 4, 18, 0.82)); z-index: 10; }
.screen-inner { text-align: center; max-width: 760px; padding: 24px; }
.eyebrow { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--muted); margin: 0 0 4px; letter-spacing: 0.02em; }
h1 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 9vw, 124px); margin: 0; letter-spacing: 0.06em; line-height: 1.05; white-space: nowrap;
  background: linear-gradient(100deg, var(--gold) 10%, #ffe9c7 40%, var(--rose) 70%, var(--teal) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 190, 110, 0.35));
}
h2 { font-family: var(--serif); font-weight: 400; font-size: 44px; margin: 0 0 18px; letter-spacing: 0.04em; }
.lede { font-family: var(--serif); font-size: 21px; line-height: 1.5; color: var(--parchment); opacity: 0.85; margin: 22px 0 34px; }
.actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
button {
  font: 400 14px var(--sans); letter-spacing: 0.18em; text-transform: uppercase; color: var(--parchment); cursor: pointer;
  padding: 13px 26px; border-radius: 999px; border: 1px solid var(--hairline); background: rgba(255, 200, 140, 0.06);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
button:hover { background: rgba(255, 200, 140, 0.16); border-color: rgba(255, 214, 160, 0.6); box-shadow: 0 0 24px rgba(255, 180, 100, 0.25); }
button.quiet { opacity: 0.6; }
.seed { display: inline-flex; gap: 10px; align-items: center; margin-top: 26px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.seed input { width: 120px; font: 400 15px var(--sans); letter-spacing: 0.1em; text-align: center; color: var(--parchment); background: transparent; border: none; border-bottom: 1px solid var(--hairline); padding: 4px; outline: none; }
#loading { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--muted); margin-top: 24px; animation: breathe 1.6s ease-in-out infinite; }
.seed-readout { margin-top: 26px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
@keyframes breathe { 50% { opacity: 0.35; } }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#status { position: absolute; top: 22px; left: 26px; }
.brand { font-family: var(--serif); font-size: 22px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--parchment); opacity: 0.8; }
#lantern-row { margin-top: 10px; display: flex; gap: 6px; font-size: 18px; }
#lantern-row .lantern { color: var(--gold); text-shadow: 0 0 10px rgba(255, 190, 90, 0.8); }
#lantern-row .lantern.placed { color: rgba(255, 220, 170, 0.25); text-shadow: none; }
#tallies { margin-top: 8px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); line-height: 1.9; }
#tallies b { color: var(--parchment); font-weight: 500; }

#toast {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%); max-width: 640px; text-align: center;
  font-family: var(--serif); font-size: 22px; line-height: 1.4; color: var(--parchment); text-shadow: 0 0 18px rgba(10, 4, 24, 0.9);
  opacity: 0; transition: opacity 0.9s;
}
#toast.visible { opacity: 1; }
#toast small { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }

#prompt {
  position: absolute; bottom: 38px; left: 50%; transform: translateX(-50%); text-align: center; white-space: nowrap;
  font-size: 14px; letter-spacing: 0.08em; padding: 10px 22px; border-radius: 999px; background: var(--plum); border: 1px solid var(--hairline);
  backdrop-filter: blur(6px); transition: opacity 0.3s;
}
#prompt:empty { opacity: 0; }
#prompt .denied { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 17px; letter-spacing: 0.02em; }
#prompt .sep { opacity: 0.35; margin: 0 10px; }
#corner-keys { position: absolute; bottom: 22px; right: 26px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.pips { letter-spacing: 1px; }
.pip-gold { color: var(--gold); } .pip-teal { color: var(--teal); } .pip-rose { color: var(--rose); } .pip-any { color: #cdb8ff; }
.pip-off { opacity: 0.32; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.label {
  position: absolute; transform: translate(-50%, -100%); text-align: center; white-space: nowrap;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--parchment); text-shadow: 0 0 8px rgba(8, 4, 20, 1);
}
.label .name, .label .meta { display: block; }
.label .name { font-family: var(--serif); font-size: 17px; letter-spacing: 0.04em; text-transform: none; }
.label .meta { color: var(--muted); font-size: 10px; }
.label .pips { font-size: 13px; display: block; margin-top: 1px; }
.label.done { opacity: 0.55; }
.label.you { transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); box-shadow: 0 0 12px var(--gold); }

.panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 8; width: min(680px, calc(100vw - 32px));
  padding: 30px 36px; border-radius: 18px; background: rgba(16, 9, 30, 0.86); border: 1px solid var(--hairline); backdrop-filter: blur(10px);
}
.panel h2 { font-size: 32px; margin-bottom: 12px; }
.rules { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.65; color: var(--parchment); }
.rules li { margin-bottom: 4px; }
.rules b { font-weight: 500; color: var(--gold); }
.hue.gold { color: var(--gold); } .hue.teal { color: var(--teal); } .hue.rose { color: var(--rose); }
.controls { display: grid; grid-template-columns: repeat(3, auto); gap: 10px 18px; margin-top: 20px; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }
.hint { margin: 18px 0 0; text-align: right; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

#ending-stats { display: grid; grid-template-columns: auto auto; gap: 8px 28px; justify-content: center; margin: 8px auto 30px; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; }
#ending-stats dt { color: var(--muted); text-align: right; }
#ending-stats dd { margin: 0; text-align: left; color: var(--gold); }
#ending { place-items: end center; padding-bottom: 6vh; background: linear-gradient(to bottom, transparent 45%, rgba(8, 4, 18, 0.8)); }
#ending h2 { font-size: 52px; }
