/* Noir detective theme. No external fonts: system Persian fonts keep the bundle tiny. */
:root {
  --bg: #101217; --surface: #1a1d24; --surface2: #242833; --line: #2b2f3a;
  --text: #f1e9d8; --muted: #8f8a7e; --accent: #d4a24c; --on-accent: #14110a; --danger: #e5383b;
  --r: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); }
body { font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif; font-size: 15px; line-height: 1.6;
  display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(circle at 50% -10%, rgba(212,162,76,.12), transparent 55%); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .4; cursor: not-allowed; }
#app { flex: 1; overflow-y: auto; padding: 14px 16px 90px; display: flex; flex-direction: column; gap: 10px; }
#tabs { position: fixed; bottom: 0; inset-inline: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; padding: 11px 0; color: var(--muted); font-size: 13px; }
#tabs button.on { color: var(--accent); }

h1 { font-size: 34px; color: var(--accent); text-align: center; letter-spacing: 1px; }
h2 { font-size: 20px; text-align: center; }
h3 { font-size: 13px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }
.center { text-align: center; }
.hero { text-align: center; padding: 10px 0; } .logo { font-size: 48px; line-height: 1; }
.panel { background: var(--surface); border-radius: var(--r); padding: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; }
.row + .row { border-top: 1px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--muted); }
.badge.active { background: #1f3a2a; color: #7fd49a; } .badge.hidden { background: #3a1f22; color: #f08a8d; }
.badge.host { background: var(--accent); color: var(--on-accent); }

.primary, .secondary, .danger { width: 100%; padding: 13px; border-radius: var(--r); font-weight: 700; }
.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px rgba(212,162,76,.25); }
.secondary { background: var(--surface2); }
.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.small { padding: 5px 10px; border-radius: 8px; background: var(--surface2); font-size: 13px; }
.two { display: flex; gap: 8px; align-items: center; } .two > * { flex: 1; }
.addrow { display: flex; gap: 8px; } .addrow input { flex: 1; } .addrow button { flex: 0 0 auto; padding: 0 18px; }
.nowrap { white-space: nowrap; }
bdi { unicode-bidi: isolate; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 99px; background: var(--surface2); font-size: 13px; }
.chip.on { background: var(--accent); color: var(--on-accent); }

.players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 4px; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; text-align: center; word-break: break-word; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; }

.card { height: 300px; perspective: 1000px; cursor: pointer; position: relative; }
.face { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; transition: transform .6s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 22px;
  box-shadow: 0 14px 34px rgba(0,0,0,.55), inset 0 0 0 1.5px rgba(212,162,76,.45); }
.front { background: repeating-linear-gradient(45deg, #1d2029 0 12px, #20242e 12px 24px); color: var(--accent); }
.back { background: linear-gradient(160deg, #f3e7cc, #d9c59a); color: #2a2015; transform: rotateY(180deg); }
.back.spy { background: radial-gradient(circle at 50% 30%, #b3151b, #4a0709); color: #fff; }
.card.flipped .front { transform: rotateY(-180deg); } .card.flipped .back { transform: rotateY(0); }
.big { font-size: 54px; line-height: 1.1; } .word { font-size: 30px; font-weight: 800; } .role { font-size: 17px; font-weight: 700; }

.timer { font-size: 40px; font-weight: 800; text-align: center; color: var(--accent); font-variant-numeric: tabular-nums; }
.opts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.opt { background: var(--surface2); border-radius: 8px; padding: 6px 2px; font-size: 12px; }
.vrow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface); border-radius: var(--r);
  border: 1.5px solid transparent; width: 100%; text-align: right; }
.vrow.on { border-color: var(--accent); }
.result { font-size: 28px; font-weight: 800; text-align: center; color: var(--accent); } .result.spywin { color: var(--danger); }

input[type=text], select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface2); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface2); transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; right: 3px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(-20px); background: var(--on-accent); }
.wordrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.wordrow + .wordrow { border-top: 1px solid var(--line); }
.wordrow .t { flex: 1; word-break: break-word; }

#toast { position: fixed; bottom: 70px; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: .25s; pointer-events: none;
  background: rgba(20,20,20,.95); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13px; max-width: 90vw; z-index: 9; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
