:root {
  --bg: #071F2E;
  --bg-raised: #0d2c40;
  --line: #1d4660;
  --text: #FFFAF6;
  --muted: #a9bcc8;
  --coral: #FF625F;
  --yellow: #FFC55F;
  --aqua: #52D5D6;
  --font: 'Host Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px 24px;
}

.screen { display: flex; flex-direction: column; gap: 16px; animation: fade-in 240ms ease-out; }
.screen[hidden] { display: none; }
[data-screen="waiting"], [data-screen="voted"], [data-screen="loading"] {
  min-height: 60dvh;
  justify-content: center;
  align-items: center;
  text-align: center;
}

h1 { margin: 0; font-size: clamp(28px, 8vw, 38px); line-height: 1.12; font-weight: 700; letter-spacing: -0.01em; }
.waiting-title { font-size: clamp(24px, 7vw, 32px); font-weight: 500; }
.eyebrow { margin: 0; color: var(--aqua); font-size: 15px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.muted { margin: 0; color: var(--muted); }
.muted strong { color: var(--text); font-weight: 500; }

.choices { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

.choice {
  width: 100%;
  min-height: 64px;
  padding: 16px 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, transform 80ms;
  touch-action: manipulation;
}
.choice:active { transform: scale(0.98); }
.choice.selected { border-color: var(--coral); background: #2a2a3a; }
.choice:disabled { opacity: 0.6; }

.words { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.words[hidden] { display: none; }
.note { margin: 0; color: var(--yellow); font-size: 16px; }

.word {
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 20px; /* 16px+ stops iOS from zooming */
  outline: none;
}
.word:focus { border-color: var(--aqua); }
.word::placeholder { color: #6f8a9b; }

.primary, .ghost {
  min-height: 60px;
  padding: 14px 24px;
  border-radius: 16px;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.primary { border: 0; background: var(--coral); color: var(--bg); }
.primary:disabled { opacity: 0.6; }
.ghost { margin-top: 12px; border: 2px solid var(--line); background: transparent; color: var(--text); font-weight: 500; }

.error { margin: 0; color: var(--coral); font-weight: 500; }
.error[hidden] { display: none; }

.check {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--aqua);
  color: var(--bg);
  animation: pop 320ms cubic-bezier(.2, 1.4, .4, 1);
}

.pulse {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1.8s ease-in-out infinite;
}

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px max(20px, env(safe-area-inset-bottom));
}
.wordmark { color: var(--muted); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.status { color: var(--yellow); font-size: 14px; }
.status[hidden] { display: none; }
.noscript { text-align: center; padding: 20px; }

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(0.6); } to { transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.15); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
