:root {
  --bg: #0b2a1f;
  --bg-deep: #061a13;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f7f1e3;
  --muted: #b9c7bd;
  --red: #c8102e;
  --red-dark: #8e0b20;
  --green: #1f6b45;
  --green-light: #2f8a5c;
  --gold: #e8b64c;
  --gold-light: #f6d98b;
  --cream: #f7f1e3;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 0%, #174d37 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, #3a0a14 0%, transparent 55%),
    var(--bg-deep);
  background-color: var(--bg-deep);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; }

.brand-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.status {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.status.warn { color: var(--gold-light); }

.top-actions { display: flex; gap: 8px; }

.ghost {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); }
.ghost.danger:hover { border-color: var(--red); background: rgba(200, 16, 46, 0.2); }

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 0 28px 28px;
  align-items: start;
}

.wheel-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wheel-wrap {
  position: relative;
  width: min(78vh, 100%);
  aspect-ratio: 1;
  max-width: 820px;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  box-shadow: var(--shadow), 0 0 0 10px #3b2a10, 0 0 0 14px var(--gold);
}

.pointer {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 46px;
  height: 64px;
  transform: translateX(-50%);
  transform-origin: 50% 20%;
  z-index: 2;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.pointer.tick { animation: tick 0.12s ease-out; }

@keyframes tick {
  0% { transform: translateX(-50%) rotate(0deg); }
  40% { transform: translateX(-50%) rotate(-14deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e23a52, var(--red) 55%, var(--red-dark));
  border: 5px solid var(--gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: clamp(0.9rem, 2.2vh, 1.4rem);
  letter-spacing: 0.06em;
  transition: transform 0.15s;
}

.hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.hub:disabled { cursor: default; filter: saturate(0.6); }

.hint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

kbd {
  font-family: inherit;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

.side { display: flex; flex-direction: column; gap: 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(6px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
}

.pill {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(232, 182, 76, 0.18);
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.drawn {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawn li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  animation: slideIn 0.4s ease-out;
}

.drawn .num {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--gold);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.drawn .who { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
.drawn .co { color: var(--muted); font-size: 0.8rem; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.empty { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

.settings { display: flex; flex-direction: column; gap: 10px; }

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  cursor: pointer;
}

.toggle input { accent-color: var(--gold); width: 18px; height: 18px; }

/* Resultat */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 14, 10, 0.72);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-out;
}

.overlay[hidden] { display: none; }

.result {
  width: min(760px, 100%);
  text-align: center;
  padding: 36px 40px 30px;
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232, 182, 76, 0.18), transparent 60%),
    linear-gradient(180deg, #174d37, #0d3324);
  border: 2px solid var(--gold);
  box-shadow: var(--shadow), 0 0 80px rgba(232, 182, 76, 0.25);
  animation: pop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.result-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  color: var(--gold);
}

.result-number {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: clamp(5rem, 16vh, 10rem);
  line-height: 1;
  margin: 6px 0 4px;
  color: var(--cream);
  text-shadow: 0 6px 0 var(--red-dark), 0 10px 30px rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
}

.result-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 4vh, 2.4rem);
}

.result-company { color: var(--gold-light); font-size: 1.1rem; margin-top: 2px; }

.fact {
  margin: 26px 0 24px;
  padding: 18px 22px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(232, 182, 76, 0.5);
  text-align: left;
}

.fact-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 6px;
}

.fact-text { margin: 0; font-size: clamp(1.05rem, 2.4vh, 1.35rem); line-height: 1.45; }

.primary {
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--red);
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 6px 18px rgba(200, 16, 46, 0.4);
  transition: transform 0.15s, background 0.15s;
}

.primary:hover { background: #dd1736; transform: translateY(-1px); }
.kbd-hint { opacity: 0.7; font-weight: 400; font-size: 0.85rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

.confetti {
  position: fixed;
  top: -20px;
  z-index: 11;
  pointer-events: none;
  will-change: transform;
}

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; padding: 0 16px 16px; }
  .topbar { padding: 14px 16px; }
  .status { margin-left: 0; width: 100%; order: 3; }
  .wheel-wrap { width: min(92vw, 70vh); }
  .result { padding: 28px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .result, .overlay, .drawn li { animation: none; }
}
