@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --board: #14181c;
  --board-raised: #1e242b;
  --board-line: #2b323a;
  --chalk: #f3f1ea;
  --chalk-dim: #8b94a0;
  --danger: #d2607a;
  --ok: #8fb93e;
  --amber: #e3a73b;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--board);
  color: var(--chalk);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.display-font {
  font-family: 'Bebas Neue', 'Inter', sans-serif;
  letter-spacing: 0.02em;
}

.nums { font-variant-numeric: tabular-nums; }

/* ---------- control: home card ---------- */

.home {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.home-card {
  width: 100%;
  max-width: 420px;
}

.wordmark {
  font-size: clamp(3.5rem, 18vw, 5rem);
  line-height: 0.85;
  margin: 0 0 4px;
  color: var(--chalk);
}

.wordmark-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.back-link {
  color: var(--chalk-dim);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.back-link:hover { border-bottom-color: var(--chalk-dim); }

.tagline {
  color: var(--chalk-dim);
  margin: 0 0 32px;
  font-size: 0.95rem;
}

.panel {
  background: var(--board-raised);
  border: 1px solid var(--board-line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel + .panel { margin-top: 16px; }

.panel h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  color: var(--chalk);
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.hint {
  color: var(--chalk-dim);
  font-size: 0.85rem;
  margin: 10px 0 0;
}

/* ---------- inputs & buttons ---------- */

.field-row { display: flex; gap: 8px; }

input[type="text"] {
  flex: 1;
  background: var(--board);
  border: 1px solid var(--board-line);
  border-radius: var(--radius);
  color: var(--chalk);
  padding: 12px 14px;
  font-size: 1rem;
  min-width: 0;
}
input[type="text"]:focus {
  outline: 2px solid var(--chalk-dim);
  outline-offset: 1px;
}

button.btn {
  border: 1px solid var(--board-line);
  background: var(--board);
  color: var(--chalk);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  min-width: 44px;
  transition: transform 0.12s ease, background-color 0.15s ease;
}
button.btn:active { transform: scale(0.96); }
button.btn:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; }
button.btn:disabled { opacity: 0.4; cursor: not-allowed; }

button.btn-primary {
  background: var(--chalk);
  color: var(--board);
  border-color: var(--chalk);
  width: 100%;
  margin-top: 14px;
  padding: 14px 18px;
  font-size: 1.05rem;
}

button.btn-ghost {
  background: transparent;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.choice-row { display: flex; gap: 10px; }
.choice-row .btn { flex: 1; }

/* ---------- name list ---------- */

.name-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.name-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--board);
  border: 1px solid var(--board-line);
  border-radius: var(--radius);
  padding: 7px 8px 7px 12px;
  font-size: 0.9rem;
  animation: chip-in 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.name-chip button {
  all: unset;
  cursor: pointer;
  color: var(--chalk-dim);
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
}
.name-chip button:hover { background: var(--board-line); color: var(--chalk); }
.name-chip button:focus-visible { outline: 2px solid var(--chalk-dim); outline-offset: 1px; }

/* ---------- checkbox ---------- */

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--chalk-dim);
  font-size: 0.88rem;
  cursor: pointer;
}
.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--chalk);
}

/* ---------- draw stage (control, inline) ---------- */

.draw-stage {
  background: var(--board);
  border: 1px solid var(--board-line);
  border-radius: var(--radius);
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  text-align: center;
}

.draw-mystery {
  color: var(--chalk-dim);
  font-size: 1.1rem;
}

.draw-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.6rem, 8vw, 2.4rem);
  letter-spacing: 0.02em;
  color: var(--chalk);
}

.draw-stage.is-spinning .draw-name { color: var(--chalk-dim); }

.draw-stage.is-winner .draw-name {
  color: var(--ok);
  animation: pop 0.4s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes pop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .draw-stage.is-winner .draw-name { animation: none; }
  .name-chip { animation: none; }
}

/* ---------- beamer / obs full screen stage ---------- */

.full-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 5vh 6vw;
  text-align: center;
  position: relative;
}

.full-stage .draw-name {
  font-size: clamp(3rem, 13vw, 9rem);
  line-height: 1;
}

.full-stage .draw-mystery {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.full-brand {
  position: absolute;
  top: max(20px, env(safe-area-inset-top, 0px));
  left: max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--chalk-dim);
  font-size: 0.8rem;
}
.full-brand-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.full-count {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  color: var(--chalk-dim);
  font-size: 0.85rem;
}

.fullscreen-btn {
  position: absolute;
  top: max(20px, env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
}

/* OBS: transparent background, text keeps readable outline over any scene */
body.is-obs, body.is-obs .full-stage { background: transparent; }
body.is-obs .draw-name, body.is-obs .draw-mystery {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.6);
}
body.is-obs .full-brand { opacity: 0.6; }

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
