/* Party Pack — styles. Tokens first, dark via prefers-color-scheme. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --text: #1d1a22;
  --muted: #6b6672;
  --line: rgba(29,26,34,.1);
  --accent: #ff5c8a;
  --accent-ink: #ffffff;
  --g1: #ff5c8a; /* impostor */
  --g2: #ffb020; /* most likely */
  --g3: #2fb3a6; /* liar */
  --g4: #7c6cff; /* icebreaker */
  --shadow: 0 10px 30px rgba(29,26,34,.08);
  --radius: 20px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131a;
    --surface: #201d27;
    --surface-2: #2a2633;
    --text: #f3f0f7;
    --muted: #a39dac;
    --line: rgba(243,240,247,.1);
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; max-width: 720px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 1.15rem; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); }
.lang-wrap select {
  font: inherit; font-weight: 700; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}

/* Main */
.app { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px 32px; }
.screen { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 12px 0 20px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.hero p { color: var(--muted); margin-top: 8px; font-size: 1.05rem; }

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
.game-card {
  position: relative; display: flex; gap: 14px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; box-shadow: var(--shadow); min-height: 96px;
  transition: transform .12s ease;
}
.game-card:active { transform: scale(.985); }
.game-card .ico {
  flex: 0 0 56px; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  color: #fff; background: var(--c);
}
.game-card .ico svg { width: 30px; height: 30px; }
.game-card h2 { font-size: 1.2rem; }
.game-card p { color: var(--muted); margin-top: 3px; font-size: .95rem; }

.players-box { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.players-box h2 { font-size: 1.1rem; display: flex; justify-content: space-between; align-items: baseline; }
.players-box h2 small { color: var(--muted); font-weight: 700; font-size: .9rem; }
.hint { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 999px;
  padding: 8px 8px 8px 14px; font-weight: 700;
}
.chip button { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.chip button:hover { background: var(--line); color: var(--text); }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input {
  flex: 1; font: inherit; font-weight: 700; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); min-width: 0;
}
.add-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 14px 20px; font-weight: 900; font-size: 1.05rem;
  cursor: pointer; background: var(--surface-2); color: var(--text); text-decoration: none;
  transition: transform .12s ease, opacity .12s ease; min-height: 48px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.big { padding: 18px 24px; font-size: 1.15rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.row .btn { flex: 1; }

/* Game screens */
.g-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.g-head .back { border: 0; background: var(--surface); border-radius: 12px; width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; }
.g-head h1 { font-size: 1.35rem; flex: 1; }
.g-head .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 12px; }
.panel h2 { font-size: 1.15rem; }
.panel .lead { color: var(--muted); margin-top: 6px; }

.field { margin-top: 14px; }
.field label { display: block; font-weight: 700; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.field select, .field input[type=number] {
  width: 100%; font: inherit; font-weight: 700; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-weight: 700; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; margin-top: 8px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 11px; padding: 10px 6px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.howto { margin-top: 12px; }
.howto summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.howto ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
.howto li + li { margin-top: 4px; }

/* Pass screen / secret card */
.pass {
  text-align: center; padding: 40px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.pass .who { font-size: clamp(2rem, 9vw, 3rem); font-weight: 900; }
.pass .sub { color: var(--muted); font-size: 1.05rem; }
.secret {
  text-align: center; padding: 32px 20px; border-radius: var(--radius); background: var(--c); color: #fff;
  min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
}
.secret .label { opacity: .8; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.secret .word { font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 900; line-height: 1.1; }
.secret .note { opacity: .9; max-width: 32ch; }
.secret.impostor { background: #1d1a22; }
.secret.impostor .word { color: var(--g1); }
.secret .q { font-size: clamp(1.4rem, 5.5vw, 2rem); font-weight: 900; line-height: 1.25; max-width: 24ch; }

.center { text-align: center; }
.big-text { font-size: clamp(1.5rem, 6vw, 2.4rem); font-weight: 900; line-height: 1.2; }
.pill { display: inline-block; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: .85rem; }

.player-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.player-list button {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 16px 10px; font-weight: 900; cursor: pointer; font-size: 1.05rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-list button:active { transform: scale(.97); }
.player-list button.sel { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.result { text-align: center; padding: 32px 20px; }
.result .emoji { font-size: 3rem; }
.result h2 { font-size: 1.6rem; margin-top: 8px; }
.result .kv { margin-top: 16px; color: var(--muted); }
.result .kv b { color: var(--text); font-size: 1.3rem; display: block; }

.tally { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.tally div { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-weight: 700; }

/* Prompt cards */
.card-stage {
  position: relative; background: var(--c); color: #fff; border-radius: var(--radius);
  min-height: 52vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 36px 24px; text-align: center; cursor: pointer; user-select: none; box-shadow: var(--shadow);
}
.card-stage .kicker { opacity: .85; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; margin-bottom: 14px; }
.card-stage .text { font-size: clamp(1.6rem, 6.5vw, 2.6rem); font-weight: 900; line-height: 1.2; max-width: 22ch; }
.card-stage .counter { position: absolute; top: 14px; right: 16px; background: rgba(0,0,0,.2); border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 800; }
.card-stage .tap { position: absolute; bottom: 14px; opacity: .7; font-size: .85rem; font-weight: 700; }

/* Table mode */
body.table-mode { background: #0f0e13; }
body.table-mode .top, body.table-mode .foot { display: none; }
body.table-mode .app { max-width: none; padding: 0; }
.table-stage {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 10vh 8vw; text-align: center; color: #fff; cursor: pointer; user-select: none; background: var(--c);
}
.table-stage .text { font-size: clamp(2rem, 7.5vw, 5rem); font-weight: 900; line-height: 1.15; max-width: 20ch; }
.table-stage .kicker { opacity: .8; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 20px; }
.table-stage .exit { position: fixed; top: 14px; right: 14px; border: 0; background: rgba(0,0,0,.3); color: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 800; cursor: pointer; }
.table-stage .counter { position: fixed; top: 18px; left: 16px; opacity: .7; font-weight: 800; }

/* Footer */
.foot { max-width: 720px; width: 100%; margin: 0 auto; padding: 20px 16px 36px; color: var(--muted); font-size: .92rem; text-align: center; border-top: 1px solid var(--line); }
.foot-line + .foot-line { margin-top: 8px; }
.foot-line a { color: var(--text); font-weight: 700; }
.foot-line.small { font-size: .85rem; }
.store-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.badge {
  display: inline-flex; align-items: center; gap: 10px; background: #1d1a22; color: #fff; border-radius: 12px;
  padding: 8px 14px 8px 12px; text-decoration: none; min-width: 150px; text-align: left; border: 1px solid rgba(255,255,255,.15);
}
.badge svg { width: 26px; height: 26px; flex: 0 0 26px; }
.badge small { display: block; font-size: .65rem; opacity: .8; line-height: 1; }
.badge b { display: block; font-size: 1.05rem; line-height: 1.15; font-weight: 800; }
@media (prefers-color-scheme: dark) { .badge { background: #f3f0f7; color: #15131a; border-color: transparent; } }

.install-bar { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } .btn, .game-card { transition: none; } }
