/* ═══════════════════════════════════════════════
   IMPOSTER — polished mobile-first party game
   iOS-safe: 16px inputs, safe-area, no overflow
   ═══════════════════════════════════════════════ */
:root {
  --bg: #0d0b1e;
  --bg2: #151233;
  --card: #1b1740;
  --card2: #221d4d;
  --line: #2d2758;
  --text: #f2efff;
  --muted: #9a92c9;
  --acc: #7c5cff;
  --acc2: #ff5cd0;
  --good: #38e29b;
  --bad: #ff5c7a;
  --chip-bg: #221d45;
  --glow: radial-gradient(60% 50% at 50% 0%, rgba(124,92,255,.28), transparent 70%);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body {
  height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#app { position: relative; height: 100dvh; min-height: 0; overflow: hidden; }
#app::before {
  content: ""; position: fixed; inset: 0;
  background: radial-gradient(120% 60% at 50% -10%, rgba(124,92,255,.22), transparent 60%),
              radial-gradient(90% 45% at 85% 110%, rgba(255,62,208,.14), transparent 60%);
  pointer-events: none; z-index: 0;
}
button { font-family: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }

/* ── screen shell ── */
.screen {
  position: relative; z-index: 1;
  height: 100dvh; overflow-y: auto; overscroll-behavior-y: contain;
  display: none;
  padding: 0 max(18px, env(safe-area-inset-right, 0px)) calc(26px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.screen.show { display: flex; flex-direction: column; }
.pad { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.pad.center { justify-content: center; align-items: stretch; }

/* ── top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  background: rgba(13,11,30,.92); backdrop-filter: blur(14px);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 6px 14px;
  margin: 0 -18px 10px;
  min-height: calc(54px + env(safe-area-inset-top, 0px));
}
.topbar h2 { font-size: 18px; letter-spacing: .3px; }
.tbar-title { font-size: 18px; }
.back { font-size: 30px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); line-height: 1; }

/* ── buttons ── */
.btn {
  width: 100%; min-height: 54px; padding: 14px 18px;
  font-size: 16px; font-weight: 700; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.btn.big { min-height: 62px; font-size: 17px; letter-spacing: .2px; }
.btn.primary {
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border: 0; color: #fff; box-shadow: 0 10px 30px -10px rgba(124,92,255,.7);
}
.btn.ghost { background: transparent; border-color: var(--line); }
.btn:active { transform: scale(.98); }
.btn[hidden] { display: none; }
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; margin: 2px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── mode cards (home) ── */
.brand { margin-top: max(10vh, 60px); text-align: center; }
.brand-mark { font-size: 60px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.logo {
  font-size: 46px; font-weight: 900; letter-spacing: 2px; margin-top: 6px;
  background: linear-gradient(90deg, var(--acc), var(--acc2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tag { color: var(--muted); font-size: 15px; margin-top: 10px; }
.modes { margin-top: 44px; display: flex; flex-direction: column; gap: 14px; }
.mode-card {
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 18px; border-radius: 20px; min-height: 84px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 8px 30px -16px rgba(0,0,0,.8);
}
.mode-card:active { transform: scale(.98); }
.mode-emoji { font-size: 30px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--card2); }
.mode-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mode-body b { font-size: 17px; }
.mode-body small { color: var(--muted); font-size: 13.5px; }
.mode-arrow { color: var(--muted); font-size: 24px; }
.hint { color: var(--muted); font-size: 13.5px; text-align: center; margin-top: auto; padding-top: 18px; }
.fine { color: var(--muted); font-size: 13px; text-align: center; margin-top: 4px; }

/* ── labels / rows ── */
.lbl { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 6px; }
.wordcat { text-align: center; }
.count { float: right; background: var(--card2); border-radius: 999px; padding: 2px 10px; color: var(--text); font-size: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.row-2 { display: flex; gap: 12px; margin-top: 6px; }
.row-2 .btn { flex: 1; }

/* ── stepper ── */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 46px; height: 46px; font-size: 24px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.stepper button:active { background: var(--card2); }
.step-val { font-size: 22px; font-weight: 800; min-width: 34px; text-align: center; color: var(--acc2); }
.count { }

/* ── chips (categories) ── */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  min-height: 46px; padding: 11px 15px; font-size: 15px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--chip); color: var(--text);
}
.chip.sel { background: linear-gradient(135deg, var(--acc), var(--acc2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(124,92,255,.6); }
.chip:active { transform: scale(.96); }

/* ── lobby code ── */
.code-wrap { margin-top: 4px; padding: 22px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); text-align: center; position: relative; }
.code { font-size: 40px; font-weight: 900; letter-spacing: 7px; margin: 4px 0 2px; }
.code-wrap .lbl { margin-bottom: 8px; }
.copy {
  margin-top: 8px; padding: 8px 18px; font-size: 14px; font-weight: 700;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card2); color: var(--text);
}
.copy:active { background: var(--acc); }

/* ── players list ── */
.players ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.players li {
  min-height: 42px; padding: 9px 15px; border-radius: 13px; font-size: 15px;
  background: var(--card); border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 7px;
}
.players li.me { border-color: var(--acc2); }
.empty { color: var(--muted); font-size: 14px; }

/* ── word card ── */
.flash-card { width: 84px; height: 84px; margin: 0 auto; display: grid; place-items: center; font-size: 40px; border-radius: 26px; background: var(--card2); border: 1px solid var(--line); }
.the-word {
  font-size: clamp(38px, 12vw, 56px); font-weight: 900; text-align: center; margin: 18px 0 4px;
  letter-spacing: .5px; background: linear-gradient(135deg,#fff,#c9bfff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.word-sub { color: var(--muted); font-size: 15px; text-align: center; margin-bottom: 22px; }
#roleBadge.citizen { background: var(--card2); border-color: var(--line); }
#roleBadge.imposter { background: linear-gradient(135deg,#7a0f28,#3a0a18); border-color: var(--bad); }
.pass-hint { margin-top: 14px; }

/* ── discussion ── */
.talk { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; font-size: 15.5px; line-height: 1.6; color: var(--text); }

/* ── vote list ── */
#voteList { list-style: none; display: flex; flex-direction: column; gap: 10px; }
#voteList li button {
  width: 100%; min-height: 58px; padding: 0 18px; text-align: left; font-size: 16px; font-weight: 600;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
#voteList li button .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--card2); }
#voteList li button.sel { border-color: var(--bad); background: linear-gradient(135deg,#521326,#3a0f20); }
#voteList li button.sel .av { background: var(--bad); }
#voteList li button:disabled { opacity: .4; }

/* ── reveal ── */
.imposter-name { font-size: 26px; font-weight: 900; text-align: center; color: var(--bad); margin-bottom: 16px; }
.reveal-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; text-align: center; }
.reveal-card .vs { color: var(--muted); font-size: 13px; margin-top: 6px; }
.reveal-card.faint { background: var(--card); opacity:.85; }
.r-word { font-size: 30px; font-weight: 900; }
.votes { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.votes li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 14px; }

/* ── name prompt ── */
.prompt-overlay { position: fixed; inset: 0; background: rgba(6,4,18,.85); display: none; align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(6px); }
.prompt-overlay.show { display: flex; }
.prompt-box { width: min(320px, calc(100vw - 48px)); padding: 24px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 20px 60px -20px rgba(0,0,0,.8); }
.prompt-lbl { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.prompt-input {
  width: 100%; min-height: 52px; font-size: 16px; font-weight: 600;
  border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0 16px;
}
.prompt-row { display: flex; gap: 12px; margin-top: 18px; }
.prompt-row .btn { flex: 1; }

/* desktop: center a phone column */
@media (min-width: 768px) {
  #app { max-width: 460px; margin: 0 auto; }
}