/* Midnight Mafia: styles shared by both game pages (pass-the-phone.html and online.html).
   Page-only styles stay in each page. */
:root{
  color-scheme: dark;
  --bg:#110E20; --bg2:#1A1531; --surface:#1E1938; --surface2:#262045; --line:#352D5C;
  --ink:#EEE8DA; --muted:#A19ABF; --gold:#E4B24C; --gold-ink:#1B1403;
  --blood:#E0566A; --heal:#56C4A8; --seer:#8DAEF5; --psycho:#C88AF0;
  --display:"Limelight", "Didot", Georgia, serif;
  --body:"Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, Menlo, monospace;
}
body.day{
  color-scheme: light;
  --bg:#E9EDF3; --bg2:#F6E7D2; --surface:#FFFFFF; --surface2:#F2F3F8; --line:#D3D7E2;
  --ink:#1B1830; --muted:#5E5A77; --gold:#9A6A12; --gold-ink:#FFFFFF;
  --blood:#B3263B; --heal:#1C8A6E; --seer:#3558B0; --psycho:#8440B0;
}
*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0; font-family:var(--body); font-size:16px; line-height:1.5; color:var(--ink);
  background: radial-gradient(900px 520px at 85% -10%, var(--bg2), transparent 70%), var(--bg);
  background-attachment: fixed;
  transition: background-color .8s ease, color .8s ease;
  padding-inline:16px;
}
button{font:inherit; color:inherit}
.wrap{max-width:720px; margin:0 auto; padding-block:12px 48px}
/* header */
.bar{display:flex; align-items:center; gap:10px; padding-block:10px; max-width:720px; margin:0 auto}
.brand{font-family:var(--display); font-size:22px; letter-spacing:.02em; margin-right:auto; display:flex; align-items:center; gap:8px}
.brand svg{width:22px; height:22px; fill:var(--gold)}
a.brand{color:inherit; text-decoration:none}   /* the logo goes to the start page */
.brand svg .drop{fill:var(--blood)}
.back{align-self:flex-start; color:var(--muted); text-decoration:none; font-size:15px; padding:4px 0}
.back:hover, .back:focus-visible{color:var(--ink)}
.pill{font-size:12px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; padding:5px 10px; border-radius:999px; border:1px solid var(--line); color:var(--muted)}
.icon-btn{width:38px; height:38px; border-radius:10px; border:1px solid var(--line); background:var(--surface); display:grid; place-items:center; cursor:pointer}
.icon-btn svg{width:18px; height:18px; fill:none; stroke:var(--ink); stroke-width:2; stroke-linecap:round; stroke-linejoin:round}
.narr{max-width:720px; margin:0 auto 4px; display:flex; gap:10px; align-items:flex-start; font-size:14px; color:var(--muted); padding:10px 12px; border-radius:10px; background:color-mix(in srgb, var(--surface) 70%, transparent); border:1px solid var(--line)}
.narr b{color:var(--gold); font-weight:600; white-space:nowrap}
/* type */
.eyebrow{font-size:12px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--muted)}
h1,h2{font-family:var(--display); font-weight:400; text-wrap:balance; margin:0; line-height:1.1}
h1{font-size:clamp(34px,8vw,52px)}
h2{font-size:clamp(26px,6vw,34px)}
h3{font-size:14px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); margin:0}
p{margin:0}
.lede{color:var(--muted); max-width:60ch}
.stack{display:flex; flex-direction:column; gap:16px}
.stack-lg{display:flex; flex-direction:column; gap:28px}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.center{text-align:center; align-items:center}
/* panels */
.panel{background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:18px; display:flex; flex-direction:column; gap:14px}
.panel-head{display:flex; justify-content:space-between; align-items:baseline; gap:10px}
.count{font-family:var(--mono); font-size:13px; color:var(--muted)}
/* inputs */
.plist{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:8px}
.pitem{display:flex; align-items:center; background:var(--surface2); border:1px solid var(--line); border-radius:10px; padding-left:10px}
.pitem .num{font-family:var(--mono); font-size:12px; color:var(--muted); width:22px}
.pitem input{flex:1; min-width:0; background:transparent; border:0; color:var(--ink); font:inherit; padding:9px 4px}
.pitem button{border:0; background:transparent; color:var(--muted); cursor:pointer; padding:8px 10px; font-size:18px; line-height:1}
.pitem button:hover{color:var(--blood)}
.addrow{display:flex; gap:8px}
.addrow input, select{flex:1; min-width:0; background:var(--surface2); border:1px solid var(--line); color:var(--ink); border-radius:10px; font:inherit; padding:10px 12px}
input:focus-visible, select:focus-visible, button:focus-visible{outline:2px solid var(--gold); outline-offset:2px}
.roles{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:8px}
.role-row{display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--surface2); border:1px solid var(--line); border-radius:12px}
.role-row .glyph{width:30px; height:30px; flex:none}
.role-row .name{flex:1; font-weight:600; line-height:1.2}
.role-row .name small{display:block; font-weight:400; font-size:12px; color:var(--muted)}
.stepper{display:flex; align-items:center; gap:4px}
.stepper button{width:32px; height:32px; border-radius:8px; border:1px solid var(--line); background:var(--surface); cursor:pointer; font-size:18px; line-height:1}
.stepper button:disabled{opacity:.35; cursor:default}
.stepper output{font-family:var(--mono); width:24px; text-align:center}
.opts{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px}
.field{display:flex; flex-direction:column; gap:6px; font-size:14px; color:var(--muted)}
.field select{flex:none}   /* keep a dropdown its own height when the field beside it is taller */
.check{display:flex; gap:10px; align-items:center; font-size:15px; cursor:pointer}
.check input{width:18px; height:18px; accent-color:var(--gold)}
.error{color:var(--blood); font-size:14px; font-weight:500}
/* buttons */
.btn{appearance:none; border:1px solid transparent; border-radius:12px; padding:14px 22px; font-weight:700; font-size:16px; cursor:pointer; background:var(--gold); color:var(--gold-ink); transition:transform .1s, opacity .2s}
.btn:active{transform:scale(.98)}
.btn:disabled{opacity:.4; cursor:default}
.btn.ghost{background:transparent; color:var(--ink); border-color:var(--line)}
.btn.danger{background:var(--blood); color:#fff}
.btn.block{width:100%}
.link{background:none; border:0; color:var(--muted); text-decoration:underline; cursor:pointer; padding:8px}
/* player picks */
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px}
.pick{min-height:64px; border-radius:14px; border:1.5px solid var(--line); background:var(--surface); cursor:pointer; font-weight:600; font-size:17px; padding:10px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; text-align:center; transition:border-color .15s, background .15s}
.pick small{font-weight:500; font-size:12px; color:var(--muted)}
.pick[aria-pressed="true"]{border-color:var(--hue,var(--gold)); background:color-mix(in srgb, var(--hue,var(--gold)) 18%, var(--surface))}
.pick:disabled{cursor:default; opacity:.45}
.pick.dead{text-decoration:line-through; opacity:.5}
/* timer */
.timer{--p:1; width:92px; height:92px; border-radius:50%; flex:none; display:grid; place-items:center; background:conic-gradient(var(--hue,var(--gold)) calc(var(--p)*360deg), var(--line) 0)}
.timer span{width:78px; height:78px; border-radius:50%; background:var(--bg); display:grid; place-items:center; font-family:var(--mono); font-size:20px; font-variant-numeric:tabular-nums}
.turn-head{display:flex; gap:18px; align-items:center; justify-content:space-between}
/* role card */
.card{border-radius:20px; padding:28px 22px; text-align:center; background:linear-gradient(170deg, color-mix(in srgb, var(--hue) 22%, var(--surface)), var(--surface)); border:1.5px solid color-mix(in srgb, var(--hue) 60%, var(--line)); display:flex; flex-direction:column; gap:14px; align-items:center}
.card .glyph{width:72px; height:72px}
.card h1{color:var(--hue)}
.team{font-size:13px; font-weight:700; letter-spacing:.1em; text-transform:uppercase}
.glyph{fill:none; stroke:var(--hue,var(--ink)); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round}
.announce{padding:34px 20px; text-align:center; display:flex; flex-direction:column; gap:14px; align-items:center}
.announce .big{font-family:var(--display); font-size:clamp(30px,7vw,46px); line-height:1.1; text-wrap:balance}
.moon{width:84px; height:84px; border-radius:50%; box-shadow: inset -18px -6px 0 0 var(--gold); opacity:.9}
.sun{width:84px; height:84px; border-radius:50%; background:radial-gradient(circle, var(--gold) 45%, transparent 47%); position:relative}
.roster{width:100%; border-collapse:collapse; font-size:15px}
.roster td{padding:10px 6px; border-bottom:1px solid var(--line)}
.roster td:last-child{text-align:right; color:var(--muted); font-size:13px}
.tag{font-weight:600; color:var(--hue)}
/* end of game: the reveal card, made to be filmed (revealHTML in shared/core.js) */
.reveal{border-radius:22px; padding:28px 20px 18px; text-align:center; display:flex; flex-direction:column; gap:12px; align-items:center; background:linear-gradient(170deg, color-mix(in srgb, var(--hue) 24%, var(--surface)), var(--surface)); border:1.5px solid color-mix(in srgb, var(--hue) 60%, var(--line))}
.reveal .big{font-family:var(--display); font-size:clamp(32px,8vw,48px); line-height:1.1; text-wrap:balance}
.reveal-sub{margin:6px 0 0; font-size:13px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--muted)}
.reveal-mafia{display:flex; flex-direction:column; gap:6px}
.reveal-mafia div{display:flex; flex-direction:column; align-items:center; font-family:var(--display); font-size:clamp(28px,8vw,40px); line-height:1.15; word-break:break-word}
.reveal-mafia .tag{font-family:inherit; font-size:14px; letter-spacing:.06em; text-transform:uppercase}
.reveal-town{list-style:none; margin:6px 0 0; padding:0; width:100%; display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:6px}
.reveal-town li{display:flex; flex-direction:column; padding:8px 10px; border-radius:12px; background:color-mix(in srgb, var(--bg) 55%, transparent); font-size:17px; font-weight:600; word-break:break-word}
.reveal-town .tag{font-size:13px}
.reveal .gone{opacity:.55; text-decoration:line-through; text-decoration-thickness:1px}
.reveal-mafia .gone{opacity:.8; text-decoration:none}   /* the Mafia's names must stay easy to read on video */
.reveal-brand{margin:8px 0 0; display:flex; flex-wrap:wrap; gap:4px 8px; align-items:center; justify-content:center; font-family:var(--display); font-size:18px}
.reveal-brand img{border-radius:7px}
.reveal-brand .addr{font-family:var(--mono, monospace); font-size:14px; color:var(--gold)}
.card-glyph svg{width:64px;height:64px}
.styles{display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:8px}
.style-card{display:flex; flex-direction:column; gap:4px; padding:12px; border-radius:12px; border:1.5px solid var(--line); background:var(--surface2); cursor:pointer}
.style-card[aria-pressed="true"]{border-color:var(--gold); background:color-mix(in srgb, var(--gold) 14%, var(--surface2))}
.style-card small{color:var(--muted); font-size:13px; line-height:1.4}
.style-top{display:flex; justify-content:space-between; align-items:center; gap:8px}
.play{width:34px; height:34px; border-radius:50%; border:0; background:var(--gold); display:grid; place-items:center; cursor:pointer; flex:none}
.play svg{width:14px; height:14px; fill:var(--gold-ink)}
.hint{font-size:13px; color:var(--muted)}
.modes{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px}
.mode{display:flex; flex-direction:column; gap:2px; text-align:left; padding:12px 14px; border-radius:12px; border:1px solid var(--line); background:var(--surface2); color:var(--text); cursor:pointer}
.mode small{color:var(--muted)}
.mode[aria-pressed="true"]{background:var(--gold); color:var(--gold-ink); border-color:var(--gold)}
.mode[aria-pressed="true"] small{color:inherit; opacity:.8}
.seg{display:inline-flex; align-self:flex-start; padding:4px; gap:4px; border-radius:12px; background:var(--surface2); border:1px solid var(--line)}
.seg button{border:0; background:transparent; padding:8px 20px; border-radius:9px; font-weight:600; cursor:pointer; color:var(--muted)}
.seg button[aria-pressed="true"]{background:var(--gold); color:var(--gold-ink)}
.sfx-btn{padding:8px 14px; font-size:14px; font-weight:600}
.tally{display:flex; flex-direction:column; gap:10px}
.trow{display:grid; grid-template-columns:minmax(80px,32%) 1fr 32px; align-items:center; gap:10px}
.tname{font-weight:600; overflow-wrap:anywhere}
.tbar{height:14px; border-radius:7px; background:var(--surface2); border:1px solid var(--line); overflow:hidden}
.tbar i{display:block; height:100%; background:var(--muted); border-radius:7px}
.trow.top .tbar i{background:var(--gold)}
.tnum{font-family:var(--mono); text-align:right; font-variant-numeric:tabular-nums}
.guide{position:fixed; inset:0; z-index:20; overflow-y:auto; background:var(--bg); padding-inline:16px; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px)}
.guide .wrap{padding-block:20px 60px}
.guide-head{display:flex; justify-content:space-between; align-items:center; gap:12px; position:sticky; top:0; background:var(--bg); padding-block:10px; z-index:1}
.gsec{display:flex; flex-direction:column; gap:12px}
.gsec p, .gsec li{max-width:65ch}
.steps{margin:0; padding-left:22px; display:flex; flex-direction:column; gap:10px}
.steps li::marker{font-family:var(--mono); color:var(--gold)}
.steps b, .rules b{color:var(--ink)}
.rules{margin:0; padding-left:20px; display:flex; flex-direction:column; gap:8px; color:var(--muted)}
.rolecards{display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:10px}
.rolecard{display:flex; gap:12px; padding:14px; border-radius:14px; background:var(--surface); border:1px solid var(--line)}
.rolecard .glyph{width:34px; height:34px; flex:none}
.rolecard strong{display:block; color:var(--hue)}
.rolecard p{font-size:14px; color:var(--muted)}
.sheet{position:fixed; inset:0; background:rgba(8,6,16,.6); display:grid; place-items:center; padding:16px; z-index:10}
.sheet .panel{max-width:380px; width:100%}
.fade{animation:fade .35s ease both}
@keyframes fade{from{opacity:.2; transform:translateY(6px)}to{opacity:1; transform:none}}
@media (prefers-reduced-motion: reduce){.fade{animation:none} body{transition:none}}
@media (max-width:440px){ .grid{grid-template-columns:1fr 1fr} .timer{width:76px;height:76px} .timer span{width:64px;height:64px;font-size:17px} }
.pill{white-space:nowrap}
.brand{white-space:nowrap}
@media (max-width:440px){ .brand{font-size:18px} .bar{gap:6px} }
.confetti{position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:30}
.scores-wrap{overflow-x:auto}
.scores{width:100%; border-collapse:collapse; font-size:15px}
.scores th{font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); text-align:left; padding:0 6px 8px}
.scores th:nth-child(n+3){text-align:right}
.scores td{padding:10px 6px; border-top:1px solid var(--line); vertical-align:top}
.scores td small{display:block; font-size:12px; color:var(--muted); margin-top:2px}
.scores .num{text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; white-space:nowrap}
.scores .rk{font-family:var(--mono); color:var(--muted); width:28px}
.scores .pts{font-size:17px; color:var(--ink)}
.scores .gain{color:var(--heal)}
.scores tr.lead .rk, .scores tr.lead .pts{color:var(--gold)}
.how{font-size:14px; color:var(--muted)}
.how summary{cursor:pointer; font-weight:600}
.how ul{list-style:none; margin:10px 0 0; padding:0; display:flex; flex-direction:column; gap:6px; max-width:360px}
.how li{display:flex; justify-content:space-between; gap:12px}
.how b{font-family:var(--mono); color:var(--ink)}
.secrow{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.secnum{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted)}
.secnum input{width:84px;background:var(--surface2);border:1px solid var(--line);color:var(--ink);border-radius:10px;font:inherit;padding:10px 12px;text-align:center}
.timecol{display:flex;flex-direction:column;align-items:center;gap:8px;flex:none}
.timecol .hint{font-size:12px}
.timecol .btn{padding:8px 16px;min-width:64px}
