/* Reel Deal — warm movie-night theme, mobile first. */
:root {
  --bg: #160b12;
  --bg-2: #22101b;
  --surface: #2b1622;
  --surface-2: #3a1f30;
  --border: #54324a;
  --text: #fdf3e7;
  --dim: #d8b7a6;
  --accent: #ffc857;
  --accent-ink: #2a1608;
  --hit: #b7e33d;
  --miss: #f2708a;
  --teal: #5eead4;
  --radius: 16px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #3d1630 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .display {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(22, 11, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 26px; }
.brand-name { font-family: Georgia, serif; font-size: 24px; color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); }
.who select {
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 44vw;
}

main { max-width: 720px; margin: 0 auto; padding: 16px 14px 8px; }
.loading { text-align: center; color: var(--dim); padding: 48px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 6px; font-size: 22px; }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.sub { color: var(--dim); font-size: 14px; margin: 0 0 10px; }

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 48px;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; border-color: var(--miss); color: var(--miss); }
.btn.small { padding: 8px 12px; min-height: 40px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
}
label.field { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 6px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.chip:disabled { opacity: 0.4; cursor: default; }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* Scoreboard */
.scoreboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.score {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.score .pts { font-size: 28px; font-weight: 800; color: var(--accent); line-height: 1; }
.score .nm { font-size: 14px; font-weight: 700; margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.score .bd { font-size: 11px; color: var(--dim); margin-top: 2px; }
.score.me { outline: 2px solid var(--accent); }

/* Trope cards */
.trope-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trope {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  color: var(--text);
  min-height: 52px;
}
button.trope { cursor: pointer; }
.trope .mark {
  flex: none; font-size: 12px; font-weight: 800; letter-spacing: 0.04em;
  border-radius: 999px; padding: 5px 9px; border: 1px solid var(--border); color: var(--dim);
}
.trope.hit { border-color: var(--hit); }
.trope.hit .mark { background: var(--hit); color: #1d2a05; border-color: var(--hit); }
.trope.miss { opacity: 0.75; }
.trope.miss .mark { background: var(--miss); color: #33060f; border-color: var(--miss); }
.trope .mod-badge { flex: none; font-size: 11px; color: var(--teal); font-weight: 700; }

.pool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .pool-grid { grid-template-columns: 1fr; } }

/* Wagers */
.wager-block { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 12px; }
.wager-state { font-size: 13px; color: var(--dim); margin-top: 6px; }
.wager-state .won { color: var(--hit); font-weight: 700; }
.wager-state .lost { color: var(--miss); font-weight: 700; }

/* History + seen */
.game-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.game-head .when { color: var(--dim); font-size: 13px; }
.standing { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.standing:last-child { border-bottom: none; }
.standing .pts { margin-left: auto; font-weight: 800; color: var(--accent); font-size: 18px; }
.standing .detail { font-size: 12px; color: var(--dim); }
details.hist-detail { margin-top: 8px; }
details.hist-detail summary { cursor: pointer; color: var(--teal); font-size: 14px; padding: 6px 0; }
.seen-list { list-style: none; margin: 0; padding: 0; }
.seen-list li { padding: 10px 2px; border-bottom: 1px dashed var(--border); font-size: 16px; }
.seen-list li:last-child { border-bottom: none; }

/* Movies view: genre filter, category chips, suggestion actions */
.movie-filter { margin-bottom: 14px; }
.movie-list li { display: flex; align-items: center; gap: 10px; }
.movie-list .movie-title { flex: 1; }
.cat-chip {
  flex: none; font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 8px; color: var(--dim);
}
.cat-chip.horror { color: var(--miss); border-color: var(--miss); }
.cat-chip.christmas { color: var(--teal); border-color: var(--teal); }
.suggest-actions { display: flex; gap: 6px; flex: none; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: rgba(22, 11, 18, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.tab {
  background: none; border: none; color: var(--dim);
  font-size: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tab span { font-size: 12px; font-weight: 700; }
.tab.active { color: var(--accent); }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
  max-width: 92vw; text-align: center; z-index: 30;
}
#toast.show { opacity: 1; }

.notice {
  border: 1px dashed var(--accent); border-radius: var(--radius);
  padding: 12px 14px; font-size: 14px; color: var(--dim); margin-bottom: 14px;
  background: rgba(255, 200, 87, 0.07);
}
.notice strong { color: var(--accent); }
.error { color: var(--miss); font-size: 14px; }
