:root {
  --top-color: #4f46e5;
  --bottom-color: #e11d48;
  --bg: #0f1115;
  --panel: #171a21;
  --text: #f4f5f7;
  --muted: #9aa0ab;
  --border: #2a2e38;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
}

/* ---------- Landing / join ---------- */
.center-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
}

.center-screen h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.center-screen p.hint {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.host-footer {
  position: fixed;
  bottom: 14px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.host-footer a {
  color: var(--text);
  text-decoration: underline;
  margin-left: 4px;
}

input.code-input {
  font-size: 1.8rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  width: 220px;
  padding: 14px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--top-color);
  color: white;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.error-text {
  color: #f87171;
  min-height: 1.2em;
  font-size: 0.9rem;
}

/* ---------- Vote split screen ---------- */
.vote-screen {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
}

.zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
  touch-action: manipulation;
  transition: filter 0.15s ease, opacity 0.15s ease;
  word-break: break-word;
}

.zone.top { background: var(--top-color); }
.zone.bottom { background: var(--bottom-color); }

.vote-screen.locked .zone { opacity: 0.35; }
.vote-screen.locked .zone.picked { opacity: 1; }
.vote-screen.locked .zone.picked::after {
  content: "✓";
  position: absolute;
}

.zone.picked {
  outline: 4px solid white;
  outline-offset: -4px;
}

.timer-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  z-index: 8;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: #facc15;
}

.vote-screen.locked .timer-track { opacity: 0.35; }

.divider {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid var(--panel);
  z-index: 5;
  letter-spacing: 0.05em;
}

.status-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 6;
}

.progress-pill {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  z-index: 6;
  color: var(--muted);
}

/* ---------- Results ---------- */
.results-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  gap: 18px;
}

.result-row {
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
}

.result-row .fill {
  padding: 16px;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: fit-content;
  transition: width 0.5s ease;
}

.result-row.top .fill { background: var(--top-color); }
.result-row.bottom .fill { background: var(--bottom-color); }

.result-row.mine { box-shadow: 0 0 0 3px white; }

.you-line {
  text-align: center;
  font-size: 1.05rem;
  color: var(--text);
  margin-top: 4px;
}

.you-line strong { color: #fff; }
.you-line.match { color: #4ade80; }
.you-line.mismatch { color: #f87171; }
