/* Dark, mobile-first theme for living-room play. */

:root {
  --bg: #13151a;
  --surface: #1d2026;
  --surface-2: #262a32;
  --text: #e8eaed;
  --muted: #9aa0a8;
  --accent: #6c8cff;
  --accent-strong: #4a6ef5;
  --danger: #e5484d;
  --spy: #e5484d;
  --crew: #46a758;
  --radius: 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-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

.muted { color: var(--muted); }
.center { text-align: center; }
.small-text { font-size: 0.8rem; }

.stack { display: flex; flex-direction: column; gap: 14px; }

.hero { text-align: center; padding: 24px 0 18px; position: relative; }

.locale-switch {
  position: absolute;
  top: 8px;
  right: 0;
  display: flex;
  gap: 6px;
}

.locale-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--muted); font-size: 0.85rem; }

input {
  background: var(--surface-2);
  border: 1px solid #333845;
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px;
  width: 100%;
}

input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 1.3rem;
  text-align: center;
}

.btn {
  background: var(--surface-2);
  border: none;
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  min-height: 48px;
  padding: 12px 16px;
  touch-action: manipulation;
}

.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent-strong); }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn.vote { background: var(--surface); border: 1px solid #333845; }

.room-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 8px 0 16px;
}

.room-header .muted { display: block; font-size: 0.75rem; }

.room-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
}

.player-list { list-style: none; margin: 0; padding: 0; }

.player {
  align-items: center;
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  gap: 8px;
  padding: 10px 2px;
}

.player:last-child { border-bottom: none; }
.player.offline span:first-child { color: var(--muted); }

.badge {
  background: var(--accent-strong);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
}

.mode-list { display: flex; flex-direction: column; gap: 8px; }

.mode {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 12px;
  text-align: left;
}

.mode.selected { border-color: var(--accent); color: var(--text); }

.reveal-card {
  align-items: center;
  background: var(--surface);
  border: 2px dashed #3a4150;
  border-radius: var(--radius);
  display: flex;
  justify-content: center;
  min-height: 170px;
  padding: 16px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.secret h2 { font-size: 1.5rem; }
.secret.spy h2 { color: var(--spy); }

.timer {
  font-size: 2.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.location-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}

.location {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  min-height: 44px;
  padding: 10px;
}

.location.static { pointer-events: none; }

/* The Chameleon: 4-column word grid. */

.word-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, 1fr);
}

.word {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.78rem;
  min-height: 52px;
  padding: 6px 4px;
  text-align: center;
  word-break: break-word;
}

.word.static { pointer-events: none; }

/* DeathRoll: a single oversized number, no animation. */

.deathroll-number {
  font-size: 4.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 18px 0;
  text-align: center;
}
.word.secret { border-color: var(--crew); background: color-mix(in srgb, var(--crew) 22%, var(--surface)); }
.word.guessed-wrong { border-color: var(--spy); background: color-mix(in srgb, var(--spy) 22%, var(--surface)); }

.banner {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
}

.banner.spy { background: color-mix(in srgb, var(--spy) 25%, var(--surface)); }
.banner.crew { background: color-mix(in srgb, var(--crew) 25%, var(--surface)); }
.banner.tanner { background: color-mix(in srgb, #c08a3e 28%, var(--surface)); }

/* Night phase: fixed-window hold-to-view (decoy interaction pattern). */

.hold-view {
  align-items: center;
  background: var(--surface);
  border: 2px dashed #3a4150;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  min-height: 170px;
  padding: 16px;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.hold-ring {
  --p: 0%;
  background:
    radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
    conic-gradient(var(--accent) var(--p), var(--surface-2) 0);
  border-radius: 50%;
  height: 44px;
  width: 44px;
}

.hold-label { min-height: 48px; display: flex; align-items: center; }

.night-result { border-left: 3px solid var(--accent); }

/* The table: players seated in a circle, center cards in the middle. */

.table-area {
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
  width: min(100%, 400px);
}

.table-area::before {
  border: 2px solid var(--surface-2);
  border-radius: 50%;
  content: "";
  inset: 12%;
  position: absolute;
}

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
}

.card-tile {
  align-items: center;
  aspect-ratio: 5 / 7;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid #3a4150;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  padding: 4px;
  touch-action: manipulation;
  width: 62px;
}

.card-tile .tile-name {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.15;
  max-width: 100%;
  overflow-wrap: break-word;
  text-align: center;
}

.card-tile .tile-sub {
  font-size: 0.55rem;
  line-height: 1.1;
  overflow-wrap: break-word;
  max-width: 100%;
  text-align: center;
}

.card-tile.self { border-style: dashed; border-color: var(--accent); }

.card-tile.chosen {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px var(--accent-strong), 0 4px 10px rgb(0 0 0 / 0.45);
  transform: scale(1.07);
}

.card-tile:disabled { cursor: default; opacity: 0.45; }
.card-tile.chosen:disabled { opacity: 0.8; }

.table-center {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.table-center .card-tile { width: 52px; }

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

.memory-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.memory-list li {
  border-bottom: 1px solid var(--surface-2);
  padding: 8px 2px;
}

.memory-list li:last-child { border-bottom: none; }

/* Lobby deck builder. */

.deck-row { justify-content: space-between; }

.deck-controls {
  align-items: center;
  display: flex;
  gap: 10px;
}

.deck-controls .count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.btn.counter { min-width: 36px; }

.deck-warning { color: var(--danger); }

.toast {
  background: #2c3040;
  border-radius: 12px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.4);
  left: 50%;
  max-width: 90vw;
  padding: 12px 18px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 10;
}
