:root {
  --bg: #14071f;
  --bg-2: #24103a;
  --card: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.14);
  --text: #fff7fb;
  --muted: #c9b8d9;
  --da: #22d17a;
  --da-dark: #0f9a55;
  --no-da: #ff3d6e;
  --no-da-dark: #c41845;
  --accent: #ffd23f;
  --radius: 20px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Height comes from html's box (not 100dvh), so any padding a host page adds to html
   (e.g. safe areas in an embedded viewer) is subtracted instead of added. */
html { height: 100%; }
body { margin: 0; min-height: 100%; display: flex; flex-direction: column; }

body {
  background:
    radial-gradient(circle at 10% 0%, #5b1a7a 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, #7a1a3f 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.screen { display: flex; flex-direction: column; gap: 18px; flex: 1; animation: pop 0.25s ease-out; }

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

h1, h2, p { margin: 0; }

.logo { text-align: center; padding-top: 24px; }
.logo .flag { font-size: 44px; }
.logo h1 {
  font-size: clamp(40px, 13vw, 60px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -1px;
  background: linear-gradient(90deg, var(--da), var(--accent), var(--no-da));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo p { color: var(--muted); margin-top: 8px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }

.title { font-size: 26px; font-weight: 800; }
.subtitle { color: var(--muted); line-height: 1.4; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 16px 20px;
  font: inherit;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, #ff3d6e, #a632ff); border: 0; box-shadow: 0 8px 24px rgba(166, 50, 255, 0.35); }
.btn-ghost { background: transparent; }
.btn-small { padding: 10px 14px; font-size: 15px; width: auto; }

.spacer { flex: 1; }

/* Keep the main action visible even when the page is taller than the visible area
   (for example inside an embedded viewer with its own toolbar). */
.screen > .btn-primary:last-child,
.screen > .actions:last-child {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2;
}

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode {
  padding: 20px 12px;
  text-align: center;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  font-size: 16px;
}
.mode .emoji { font-size: 38px; }
.mode[aria-pressed="true"] { border: 2px solid var(--accent); background: rgba(255, 210, 63, 0.12); }

.rules { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.6; }

.stepper { display: flex; align-items: center; justify-content: center; gap: 20px; }
.stepper .btn { width: 64px; height: 64px; font-size: 30px; padding: 0; border-radius: 50%; }
.stepper output { font-size: 56px; font-weight: 900; min-width: 80px; text-align: center; }

.names { display: flex; flex-direction: column; gap: 10px; }
.names label { display: flex; align-items: center; gap: 10px; }
.names span { width: 28px; color: var(--muted); font-weight: 700; text-align: right; }
.names input {
  flex: 1;
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}
.names input:focus { outline: 2px solid var(--accent); }

.categories { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.category {
  --hue: 300;
  text-align: left;
  padding: 16px 14px;
  min-height: 96px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  background: linear-gradient(145deg, hsl(var(--hue) 70% 45% / 0.55), hsl(calc(var(--hue) + 40) 70% 30% / 0.55));
  border: 1px solid hsl(var(--hue) 80% 70% / 0.4);
  font-size: 16px;
  line-height: 1.2;
}
.category small { color: rgba(255, 255, 255, 0.75); font-weight: 600; font-size: 13px; }
.category:disabled { opacity: 0.35; cursor: not-allowed; }
.category.random { grid-column: 1 / -1; min-height: 72px; background: linear-gradient(135deg, #ffd23f, #ff7a3d); color: #2a0b1d; border: 0; }
.category.random small { color: rgba(42, 11, 29, 0.75); }
.category.special { grid-column: 1 / -1; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge {
  --hue: 300;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: hsl(var(--hue) 70% 45% / 0.5);
  border: 1px solid hsl(var(--hue) 80% 70% / 0.5);
}

.question-number { color: var(--muted); font-weight: 700; }
.question { font-size: clamp(26px, 7.5vw, 34px); font-weight: 800; line-height: 1.2; }

.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vote {
  min-height: 150px;
  font-size: 30px;
  font-weight: 900;
  border: 0;
  border-radius: 24px;
}
.vote-da { background: linear-gradient(160deg, var(--da), var(--da-dark)); box-shadow: 0 10px 28px rgba(34, 209, 122, 0.35); }
.vote-no-da { background: linear-gradient(160deg, var(--no-da), var(--no-da-dark)); box-shadow: 0 10px 28px rgba(255, 61, 110, 0.35); }
.hint { text-align: center; color: var(--muted); font-size: 14px; }

.turn { text-align: center; justify-content: center; }
.turn .emoji { font-size: 64px; }
.turn .who { font-size: clamp(34px, 10vw, 48px); font-weight: 900; color: var(--accent); word-break: break-word; }
.progress { color: var(--muted); font-weight: 700; text-align: center; }

.result-row { display: flex; flex-direction: column; gap: 8px; }
.result-head { display: flex; justify-content: space-between; font-weight: 900; font-size: 22px; }
.bar { height: 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; transition: width 0.6s ease; }
.bar-da > div { background: var(--da); }
.bar-no-da > div { background: var(--no-da); }
.voters { color: var(--muted); font-size: 15px; line-height: 1.4; }

.drink { border: 2px dashed var(--accent); background: rgba(255, 210, 63, 0.1); text-align: center; }
.drink strong { display: block; font-size: 20px; color: var(--accent); margin-bottom: 4px; }

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

.intro { font-size: 22px; font-weight: 800; line-height: 1.3; color: var(--accent); }

.games { display: flex; flex-direction: column; gap: 14px; }
.game-card { display: flex; align-items: center; gap: 16px; text-align: left; padding: 18px; min-height: 92px; }
.game-icon { font-size: 44px; line-height: 1; }
.game-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.game-text strong { font-size: 22px; font-weight: 900; }
.game-text small { color: var(--muted); font-weight: 600; font-size: 14px; }
