/* Spyfall Online — mobile-first styling. */

:root {
  --bg: #0f1226;
  --bg-card: #1a1f3d;
  --bg-elev: #242a52;
  --text: #eef0ff;
  --muted: #9aa0c7;
  --primary: #6c7bff;
  --primary-press: #5563e6;
  --danger: #ff6b6b;
  --spy: #ff5470;
  --ok: #4ade80;
  --radius: 14px;
  --gap: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px 32px;
  min-height: 100vh;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* ---- Branding ---- */
.brand {
  text-align: center;
  margin: 24px 0 8px;
}
.brand h1 {
  font-size: 2.6rem;
  margin: 0;
  letter-spacing: 0.04em;
}
.tagline {
  color: var(--muted);
  margin: 6px 0 0;
}

/* ---- Fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-size: 0.85rem;
  color: var(--muted);
}
input,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--bg-elev);
  border-radius: var(--radius);
  padding: 13px 14px;
  width: 100%;
}
input:focus,
select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}
#home-code {
  text-transform: lowercase;
  letter-spacing: 0.4em;
  text-align: center;
  font-size: 1.5rem;
}

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elev);
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
}
.btn-primary:active {
  background: var(--primary-press);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--bg-elev);
  color: var(--muted);
}
.btn-small {
  padding: 9px 12px;
  font-size: 0.85rem;
  align-self: center;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  gap: 10px;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bg-elev);
}

/* ---- Lobby ---- */
.lobby-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.code-pill {
  display: inline-block;
  background: var(--bg-elev);
  padding: 2px 12px;
  border-radius: 999px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-list li {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.player-list li.offline {
  opacity: 0.4;
}
.badge {
  font-size: 0.7rem;
  color: var(--bg);
  background: var(--primary);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
}
.badge.you {
  background: var(--ok);
}

/* ---- Game / reveal ---- */
.timer {
  text-align: center;
  font-size: 3.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin: 8px 0;
}
.timer.low {
  color: var(--danger);
}
.reveal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
}
.reveal-card.spy {
  background: linear-gradient(160deg, #2a1030, #3a1020);
  border: 1px solid var(--spy);
}
.reveal-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 14px 0 4px;
}
.reveal-location {
  font-size: 2rem;
  margin: 0;
}
.reveal-role {
  font-size: 1.4rem;
  margin: 0;
  color: var(--primary);
}
.spy-warning {
  color: var(--spy);
  font-size: 1.8rem;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}
.location-grid {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.location-grid li {
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
}
.location-grid li.struck {
  opacity: 0.35;
  text-decoration: line-through;
}

/* ---- Misc ---- */
.muted {
  color: var(--muted);
  text-align: center;
}
.error {
  color: var(--danger);
  text-align: center;
  margin: 4px 0 0;
}
