/* Layout: one phone-width column; every screen has one loud action, the cards are the hero */
:root{
  --bg:#F5F2FF; --surface:#FFFFFF; --surface-2:#EEE9FC; --ink:#1B1433; --muted:#6A6386; --line:#E2DCF4;
  --hot:#EF3A5D; --hot-deep:#C42548; --sun:#FFB637; --sun-deep:#D98E12; --on-sun:#2B1A00;
  --p1:#0A9486; --p1-on:#FFFFFF; --p1-soft:#DDF6F2;
  --p2:#7346F5; --p2-on:#FFFFFF; --p2-soft:#EAE2FF;
  --yes:#12985F; --yes-deep:#0B6F46; --no:#E0414A; --no-deep:#AE2C33; --neutral:#8580A3; --neutral-deep:#655F86;
  --on-color:#FFFFFF;
  --glow-a:rgba(239,58,93,.15); --glow-b:rgba(115,70,245,.13);
  --shadow:0 12px 32px rgba(46,28,98,.10), 0 2px 6px rgba(46,28,98,.06);
  --seg-shadow:rgba(46,28,98,.14);
  --scrim:rgba(18,12,38,.55);
  --back-pattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.4' stroke-width='1.6'%3E%3Crect x='11' y='11' width='18' height='18'/%3E%3Crect x='11' y='11' width='18' height='18' transform='rotate(45 20 20)'/%3E%3Ccircle cx='20' cy='20' r='3'/%3E%3C/g%3E%3C/svg%3E");
  --display:"Lalezar","Readex Pro",system-ui,sans-serif;
  --body:"Readex Pro","Segoe UI",Tahoma,system-ui,sans-serif;
  --emoji:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#110D20; --surface:#1C1733; --surface-2:#272044; --ink:#F4F1FF; --muted:#A69FC6; --line:#342C5C;
    --hot:#FF5C7A; --hot-deep:#B32C4B; --sun:#FFC24D; --sun-deep:#C08419; --on-sun:#2B1A00;
    --p1:#2BD3C1; --p1-on:#062421; --p1-soft:#123733;
    --p2:#A88BFF; --p2-on:#160C38; --p2-soft:#2A2154;
    --yes:#1FB57A; --yes-deep:#127550; --no:#F05A5E; --no-deep:#A3343A; --neutral:#77719A; --neutral-deep:#544E72;
    --glow-a:rgba(255,92,122,.17); --glow-b:rgba(168,139,255,.15);
    --shadow:0 12px 32px rgba(0,0,0,.40), 0 2px 6px rgba(0,0,0,.30);
    --seg-shadow:rgba(0,0,0,.45);
    --scrim:rgba(0,0,0,.6);
    color-scheme:dark;
  }
}

*{box-sizing:border-box}
html{padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px)}
body{
  margin:0; min-height:100vh;
  background-color:var(--bg);
  background-image:radial-gradient(560px 380px at 100% -6%, var(--glow-a), transparent 70%), radial-gradient(520px 420px at -12% 38%, var(--glow-b), transparent 70%);
  background-repeat:no-repeat;
  color:var(--ink); font-family:var(--body); font-size:16px; line-height:1.55;
  -webkit-tap-highlight-color:transparent;
}
[hidden]{display:none !important}
#app{
  max-width:600px; margin:0 auto;
  padding-left:max(16px, env(safe-area-inset-left, 0px));
  padding-right:max(16px, env(safe-area-inset-right, 0px));
  padding-block:14px 48px;
  display:flex; flex-direction:column; gap:16px;
}
figure,h1,h2,h3,p,ul,ol{margin:0}
.h{font-family:var(--display); font-weight:400; font-size:22px; line-height:1.25; text-wrap:balance}
.h.xl{font-size:clamp(30px, 8vw, 40px)}
.h.sm{font-size:19px}
.sub{color:var(--muted); font-size:14px}
.dim{color:var(--muted); font-weight:400}
.center{text-align:center}
.lbl{display:block; font-size:13px; font-weight:600; color:var(--muted); letter-spacing:.01em}
.hint{color:var(--muted); font-size:13.5px; text-align:center; text-wrap:balance}
.em{font-family:var(--emoji)}

/* header */
.top{display:flex; align-items:center; justify-content:space-between; gap:12px}
.logo{display:flex; align-items:center; gap:12px; font-family:var(--display); font-size:28px; line-height:1}
.logo-card{
  width:30px; height:40px; border-radius:8px; display:grid; place-items:center;
  color:var(--on-color); font-size:22px; padding-top:4px;
  background:var(--back-pattern), linear-gradient(150deg, var(--hot), var(--sun));
  background-size:20px 20px, cover; transform:rotate(-9deg); box-shadow:0 4px 0 var(--hot-deep);
}
.top-chips{display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:flex-end}
.conn{display:inline-flex; align-items:center; gap:7px; font-size:12.5px; font-weight:500; color:var(--muted); background:var(--surface); border:1px solid var(--line); padding:6px 11px; border-radius:99px; white-space:nowrap}
.conn i{width:8px; height:8px; border-radius:50%; background:var(--neutral)}
.conn.on i{background:var(--yes); box-shadow:0 0 0 3px color-mix(in srgb, var(--yes) 25%, transparent)}
.conn.off i{background:var(--no)}
.conn.wait i{background:var(--sun); animation:blink 1.2s infinite}
.conn.watch i{background:var(--p2)}

/* surfaces */
.panel{background:var(--surface); border:1px solid var(--line); border-radius:24px; padding:18px; display:flex; flex-direction:column; gap:14px; box-shadow:var(--shadow)}
.sec-head{display:flex; flex-direction:column; gap:2px}
.row-between{display:flex; flex-direction:row; align-items:center; justify-content:space-between; gap:10px}
.field{display:flex; flex-direction:column; gap:7px}
.input{width:100%; min-height:52px; padding:0 16px; border-radius:16px; border:2px solid var(--line); background:var(--surface-2); color:var(--ink); font:400 16px/1.2 var(--body); outline:none; transition:border-color .15s, background .15s}
.input:focus{border-color:var(--p2); background:var(--surface)}
.input::placeholder{color:var(--muted); opacity:.85}
.input.code{font:600 22px/1 var(--body); letter-spacing:.35em; text-align:center; direction:ltr}
.input.code::placeholder{letter-spacing:normal; font-size:16px; font-weight:400}
.join-row{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px}
.notice{padding:14px 16px; border-radius:18px; background:var(--surface); border:2px dashed var(--hot); font-size:14.5px}

/* buttons */
.btn{appearance:none; border:0; cursor:pointer; font:600 16px/1.15 var(--body); min-height:50px; padding:0 18px; border-radius:16px; display:inline-flex; align-items:center; justify-content:center; gap:8px; color:var(--ink); background:var(--surface-2); text-align:center; transition:transform .08s ease, box-shadow .08s ease, background .15s}
.btn:active:not(:disabled){transform:translateY(3px)}
.btn:disabled{cursor:not-allowed; opacity:.5}
.btn-block{width:100%}
.btn-lg{min-height:60px; font-size:18px; border-radius:20px}
.btn-sm{min-height:40px; font-size:14px; padding:0 14px; border-radius:12px}
.btn-primary{background:var(--hot); color:var(--on-color); box-shadow:0 5px 0 var(--hot-deep)}
.btn-primary:active:not(:disabled){box-shadow:0 2px 0 var(--hot-deep)}
.btn-primary:disabled{background:var(--surface-2); color:var(--muted); box-shadow:none; opacity:1}
.btn-ghost{background:var(--surface-2); color:var(--ink)}
.btn-line{background:transparent; color:var(--ink); box-shadow:inset 0 0 0 2px var(--line)}
.btn-yes,.btn-no,.btn-idk{font-family:var(--display); font-weight:400; color:var(--on-color); border-radius:20px}
.btn-yes,.btn-no{font-size:32px; min-height:82px}
.btn-yes{background:var(--yes); box-shadow:0 6px 0 var(--yes-deep)}
.btn-no{background:var(--no); box-shadow:0 6px 0 var(--no-deep)}
.btn-idk{background:var(--neutral); box-shadow:0 5px 0 var(--neutral-deep); grid-column:1 / -1; font-size:22px; min-height:56px}
.btn-yes:active:not(:disabled){box-shadow:0 2px 0 var(--yes-deep)}
.btn-no:active:not(:disabled){box-shadow:0 2px 0 var(--no-deep)}
.btn-idk:active:not(:disabled){box-shadow:0 2px 0 var(--neutral-deep)}
.btn-right{background:var(--sun); color:var(--on-sun); box-shadow:0 5px 0 var(--sun-deep); font-weight:700}
.btn-right:active:not(:disabled){box-shadow:0 2px 0 var(--sun-deep)}
.btn-danger{background:var(--no); color:var(--on-color)}
.link{appearance:none; background:none; border:0; padding:6px 4px; color:var(--muted); font:500 14px var(--body); text-decoration:underline; text-underline-offset:4px; cursor:pointer}
.center-link{align-self:center}
:focus-visible{outline:3px solid var(--p2); outline-offset:3px}
.row2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.row-wrap{display:flex; flex-wrap:wrap; gap:8px; justify-content:center}
.cta{display:flex; flex-direction:column; gap:10px; align-items:center}
.foot{display:flex; justify-content:center}
.confirm{display:flex; flex-direction:column; gap:10px; text-align:center; padding:14px; border-radius:18px; background:var(--surface); border:2px solid var(--line); width:100%}

/* chips + segmented settings */
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chip{appearance:none; display:inline-flex; align-items:center; gap:7px; padding:9px 12px 9px 14px; border-radius:99px; border:2px solid var(--line); background:var(--surface); color:var(--ink); font:500 15px/1.2 var(--body); cursor:pointer; transition:background .15s, border-color .15s, color .15s}
.chip small{font-size:11.5px; color:var(--muted)}
.chip[aria-checked="true"]{background:var(--ink); border-color:var(--ink); color:var(--bg)}
.chip[aria-checked="true"] small{color:var(--bg); opacity:.7}
.chip:disabled{cursor:default}
.chip:disabled:not([aria-checked="true"]){opacity:.6}
.seg{display:flex; gap:4px; padding:4px; background:var(--surface-2); border-radius:14px}
.seg button{flex:1 1 0; min-width:0; min-height:42px; border:0; border-radius:10px; background:transparent; color:var(--muted); font:500 14px var(--body); cursor:pointer; white-space:nowrap}
.seg button[aria-checked="true"]{background:var(--surface); color:var(--ink); font-weight:600; box-shadow:0 2px 8px var(--seg-shadow)}
.seg button:disabled{cursor:default}
.cat-pill{align-self:center; display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:99px; background:var(--surface-2); font-size:14px; font-weight:600}

/* landing */
.hero{display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; padding-block:6px 2px}
.hero-cards{position:relative; width:230px; max-width:100%; height:196px; margin-bottom:4px}
.hero-cards .card{position:absolute; top:6px; width:126px; padding:8px; gap:4px}
.hero-cards .card.back{right:8px; transform:rotate(10deg)}
.hero-cards .card.spy{left:8px; transform:rotate(-7deg); animation:float 4.5s ease-in-out infinite}
.hero-cards .card .emoji{font-size:58px}
.hero-cards .card .cname{font-size:20px}
.hero-cards .card.back .qm{font-size:68px}
.hero .sub{max-width:36ch; font-size:15px}
.steps{list-style:none; padding:0; display:flex; flex-direction:column; gap:12px}
.steps li{display:grid; grid-template-columns:34px minmax(0,1fr); gap:12px; align-items:center}
.steps b{width:34px; height:34px; border-radius:11px; display:grid; place-items:center; background:var(--surface-2); font-family:var(--display); font-weight:400; font-size:19px; padding-top:3px}

/* room bar */
.room{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-radius:22px; background:var(--back-pattern), linear-gradient(150deg, var(--hot), var(--sun)); background-size:40px 40px, cover; color:var(--on-color); box-shadow:var(--shadow)}
.room .lbl{color:var(--on-color); opacity:.92}
.room .code{display:block; font-family:var(--display); font-weight:400; font-size:32px; letter-spacing:.14em; line-height:1.1}
.room-btns{display:flex; align-items:center; gap:4px; flex-wrap:wrap; justify-content:flex-end}
.room .btn{background:var(--surface); color:var(--ink)}
.room .link{color:var(--on-color)}

/* players */
.plist{list-style:none; padding:0; display:flex; flex-direction:column; gap:8px}
.prow{display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:16px; background:var(--surface-2); min-width:0}
.prow .nm{flex:1; min-width:0; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.prow .nm.off{color:var(--muted)}
.tag{font-size:11.5px; font-weight:600; padding:2px 9px; border-radius:99px; background:var(--surface); color:var(--muted); white-space:nowrap}
.tag.host{background:var(--sun); color:var(--on-sun)}
.tag.you{background:var(--p2); color:var(--p2-on)}
.tag.score{background:var(--surface); color:var(--ink); font-family:var(--display); font-weight:400; font-size:15px}
.dot{width:9px; height:9px; border-radius:50%; background:var(--neutral); flex:none}
.dot.on{background:var(--yes)}
.av{width:34px; height:34px; border-radius:12px; display:grid; place-items:center; font-family:var(--display); font-size:18px; padding-top:2px; color:#FFFFFF; background:var(--avc, var(--p2)); flex:none}
.av.lg{width:58px; height:58px; border-radius:20px; font-size:30px; padding-top:4px}
.x{appearance:none; border:0; background:none; color:var(--muted); font-size:13px; cursor:pointer; padding:4px 6px; text-decoration:underline}
.add-row{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px}

/* play mode + game pickers */
.opts{display:flex; flex-direction:column; gap:8px}
.opt{appearance:none; display:flex; align-items:center; gap:12px; text-align:start; padding:12px 14px; border-radius:18px; border:2px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; font:inherit}
.opt .ic{font-family:var(--emoji); font-size:26px; line-height:1}
.opt .t{display:block; font-weight:700; font-size:15.5px}
.opt .d{display:block; font-size:13px; color:var(--muted)}
.opt[aria-checked="true"]{border-color:var(--hot); background:color-mix(in srgb, var(--hot) 8%, var(--surface))}
.opt:disabled{cursor:default}
.opt:disabled:not([aria-checked="true"]){opacity:.65}
.games{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.gcard{position:relative; min-width:0}
.gpick{appearance:none; width:100%; height:100%; display:flex; flex-direction:column; align-items:center; gap:6px; padding:18px 12px 14px; border-radius:20px; border:2px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; font:inherit; text-align:center}
.gpick .ic{font-family:var(--emoji); font-size:44px; line-height:1.1}
.gpick .t{font-family:var(--display); font-size:22px; line-height:1.2}
.gpick .d{font-size:12.5px; color:var(--muted)}
.gpick[aria-checked="true"]{border-color:var(--hot); background:color-mix(in srgb, var(--hot) 8%, var(--surface))}
.gpick:disabled{cursor:default}
.gpick:disabled:not([aria-checked="true"]){opacity:.6}
.info{position:absolute; top:8px; left:8px; width:30px; height:30px; border-radius:50%; border:0; background:var(--sun); color:var(--on-sun); font:800 17px/1 var(--body); cursor:pointer; display:grid; place-items:center}
.info.inline{position:static; width:26px; height:26px; font-size:15px}
.game-title{display:flex; align-items:center; gap:8px}

/* what the owner chose, for everyone else */
.summary{list-style:none; padding:0; display:flex; flex-direction:column; gap:8px}
.summary li{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border-radius:14px; background:var(--surface-2); min-width:0}
.summary .k{color:var(--muted); font-size:14px; white-space:nowrap}
.summary .v{font-weight:600; display:flex; align-items:center; gap:6px; text-align:end; min-width:0; overflow-wrap:anywhere}

/* scores strip */
.scores{display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none}
.scores::-webkit-scrollbar{display:none}
.sc{display:flex; align-items:center; gap:8px; padding:6px 12px 6px 8px; border-radius:16px; background:var(--surface); border:1px solid var(--line); white-space:nowrap; flex:none}
.sc .n{font-weight:600; font-size:14px}
.sc .v{font-family:var(--display); font-size:22px; line-height:1}
.sc .av{width:26px; height:26px; border-radius:9px; font-size:14px}
.round-meta{display:flex; align-items:center; justify-content:center; gap:8px; flex-wrap:wrap; color:var(--muted); font-size:13px}

/* turn banner */
.p1{--pc:var(--p1); --pc-on:var(--p1-on); --pc-soft:var(--p1-soft)}
.p2{--pc:var(--p2); --pc-on:var(--p2-on); --pc-soft:var(--p2-soft)}
.turn{position:relative; overflow:hidden; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px 20px; border-radius:24px; background:var(--pc, var(--p2)); color:var(--pc-on, var(--p2-on)); box-shadow:var(--shadow); animation:pop .35s ease}
.t-txt{min-width:0}
.t-title{font-family:var(--display); font-size:26px; line-height:1.15}
.t-sub{font-size:13.5px; opacity:.92}
.secs{font-family:var(--display); font-size:46px; line-height:1; min-width:2.2ch; text-align:center}
.secs.mmss{font-size:36px}
.secs.paused::before{content:""; display:inline-block; width:24px; height:32px; border-inline:8px solid currentColor; vertical-align:middle}
.turn .bar{position:absolute; inset:auto 0 0 0; height:6px; background:color-mix(in srgb, var(--pc-on, #fff) 22%, transparent)}
.turn .bar i{display:block; height:100%; background:var(--pc-on, #fff); transform-origin:right center; transition:transform .25s linear}
.turn.urgent .secs{animation:tick 1s infinite}
.turn.done{background:var(--no); color:var(--on-color)}

/* cards */
.cards{display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); gap:14px; align-items:end}
.cards.even{grid-template-columns:1fr 1fr}
.cards.one{grid-template-columns:minmax(0, 210px); justify-content:center}
.role-strip{display:flex; align-items:center; gap:12px; padding:10px 14px; border-radius:18px; background:var(--surface); border:2px solid var(--line)}
.role-strip .em{font-size:34px; line-height:1}
.role-strip div{flex:1; min-width:0; display:flex; flex-direction:column}
.role-strip b{font-family:var(--display); font-weight:400; font-size:20px; line-height:1.3}
.role-strip .s{font-size:13px; color:var(--muted)}
/* the spy's strip matches the spy's dark card in both themes */
.role-strip.spy{background:#1B1438; border-color:#3B2F70; color:#FFFFFF}
.role-strip.spy .s, .role-strip.spy .link{color:#D9D2FF}
.play-cards{max-width:440px; width:100%; margin-inline:auto}
.slot{display:flex; flex-direction:column; align-items:center; gap:8px; min-width:0}
.slot figcaption{font-size:13px; font-weight:600; color:var(--muted); text-align:center}
.slot .cap{font-size:12px; color:var(--muted); text-align:center}
.card{position:relative; width:100%; max-width:100%; aspect-ratio:3 / 4; border-radius:22px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:12px; box-shadow:var(--shadow); text-align:center}
.slot:not(.mine) > .card{transform:rotate(-2deg)}
.slot.mine > .card, .slot.mine > .flip{transform:rotate(2.5deg)}
.card.face{background:var(--surface); border:4px solid var(--pc, var(--line))}
.card .emoji{font-family:var(--emoji); font-size:clamp(54px, 18vw, 108px); line-height:1.08}
.card .cname{font-family:var(--display); font-size:clamp(20px, 5.6vw, 30px); line-height:1.2; overflow-wrap:anywhere}
.card .ccat{font-size:11.5px; font-weight:500; color:var(--muted); background:var(--surface-2); padding:3px 10px; border-radius:99px; white-space:nowrap}
.card.back{background:var(--back-pattern), linear-gradient(150deg, var(--hot), var(--sun)); background-size:40px 40px, cover; border:4px solid var(--surface); color:var(--on-color)}
.card.back .qm{font-family:var(--display); font-size:clamp(58px, 17vw, 100px); line-height:1; padding-top:.12em; text-shadow:0 4px 0 var(--hot-deep)}
/* the spy's card is deliberately dark in both themes */
.card.spy{background:radial-gradient(circle at 50% 28%, #3B2F70, #120C26 72%); border:4px solid var(--surface); color:#FFFFFF}
.card.spy .cname{color:#FFFFFF}
.card.spy .hintline{font-size:13px; color:#D9D2FF; padding:4px 12px; border-radius:99px; background:rgba(255,255,255,.12)}
.card.hidden-role{background:var(--surface-2); border:4px dashed var(--line); color:var(--muted); box-shadow:none}
.flip{width:100%; perspective:1200px}
.flip-inner{position:relative; width:100%; aspect-ratio:3 / 4; transition:transform .9s cubic-bezier(.2,.8,.2,1); transform-style:preserve-3d}
.flip-inner > .card{position:absolute; inset:0; backface-visibility:hidden; -webkit-backface-visibility:hidden}
.flip-inner > .card:last-child{transform:rotateY(180deg)}
.flip.flipped .flip-inner{transform:rotateY(180deg)}

/* asking + answering */
.bubble{background:var(--surface-2); border-radius:18px; padding:12px 14px; display:flex; flex-direction:column; gap:3px; border:2px solid transparent}
.bubble.guess{border-color:var(--sun)}
.bubble .bq{font-size:18px; font-weight:600; overflow-wrap:anywhere}
.answers{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.divider{display:flex; align-items:center; gap:10px; color:var(--muted); font-size:13px}
.divider::before,.divider::after{content:""; flex:1; height:1px; background:var(--line)}
.judge.big .btn{min-height:76px; font-size:20px; border-radius:20px}
.judge.big .btn-right{animation:glow 1.4s ease-in-out infinite}

/* logs */
.log{list-style:none; padding:0; display:flex; flex-direction:column; gap:8px}
.log li{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-radius:14px; background:var(--surface-2)}
.log .q{min-width:0; overflow-wrap:anywhere; font-size:15px}
.ans{flex:none; font-size:12.5px; font-weight:600; padding:4px 11px; border-radius:99px; color:var(--on-color); background:var(--neutral)}
.ans.yes{background:var(--yes)}
.ans.no,.ans.wrong{background:var(--no)}
.ans.right{background:var(--sun); color:var(--on-sun)}
.empty{color:var(--muted); font-size:14px}
.count{font-family:var(--display); font-size:22px; color:var(--muted); line-height:1}
.more summary{cursor:pointer; color:var(--muted); font-size:14px; padding:4px 0}
.more .log, .more .empty{margin-top:8px}
.wlogs{display:grid; grid-template-columns:repeat(auto-fit, minmax(230px, 1fr)); gap:18px}
.wlog{display:flex; flex-direction:column; gap:10px; min-width:0}
.wlog .h{color:var(--pc)}

/* chat (spy, apart) */
.chat{list-style:none; padding:4px 2px; display:flex; flex-direction:column; gap:8px; max-height:46vh; overflow-y:auto; overscroll-behavior:contain}
.msg{max-width:86%; padding:8px 12px; border-radius:16px; background:var(--surface-2); align-self:flex-start; overflow-wrap:anywhere}
.msg.mine{align-self:flex-end; background:color-mix(in srgb, var(--p2) 18%, var(--surface))}
.msg.a{border-inline-start:4px solid var(--p1)}
.msg .who{display:block; font-size:12px; color:var(--muted); font-weight:600}
.msg .txt{font-size:15.5px}
.targets{display:flex; flex-wrap:wrap; gap:6px}
.composer{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px}

/* votes */
.votes{display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:10px}
.vbtn{appearance:none; display:flex; align-items:center; gap:10px; padding:12px; border-radius:18px; border:2px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; font:600 15px var(--body); min-width:0}
.vbtn .nm{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.vbtn[aria-checked="true"]{border-color:var(--no); background:color-mix(in srgb, var(--no) 10%, var(--surface))}
.vbtn:disabled{cursor:default}
.tally{display:flex; flex-direction:column; gap:6px}
.tally .row{display:flex; justify-content:space-between; gap:10px; font-size:14px}

/* results */
.stage{display:flex; flex-direction:column; gap:18px}
.stage-head{text-align:center; display:flex; flex-direction:column; gap:6px}
.champ{display:flex; align-items:center; gap:14px; padding:16px 18px; border-radius:22px; background:var(--pc-soft, var(--surface-2)); border:2px solid var(--pc, var(--line))}
.trophy{font-family:var(--emoji); font-size:44px; line-height:1}
.spylist{display:flex; flex-wrap:wrap; gap:8px; justify-content:center}
.spylist .sc{border-color:var(--no)}

/* rules sheet */
.sheet-bg{position:fixed; inset:0; background:var(--scrim); z-index:50; display:flex; align-items:flex-end; justify-content:center; padding:16px; padding-bottom:max(16px, env(safe-area-inset-bottom, 0px))}
.sheet{width:100%; max-width:560px; max-height:85vh; overflow:auto; background:var(--surface); border-radius:24px; padding:20px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:14px; animation:rise .25s ease}
.rules{padding-inline-start:24px; display:flex; flex-direction:column; gap:10px; font-size:15px; list-style:arabic-indic}
.hero-cards .card .hintline{font-size:10px; padding:2px 8px}
.rules b{font-weight:700}

/* watching */
.watch-bar{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 14px; border-radius:16px; background:var(--surface-2); font-size:14px}
.watch-bar .link{padding:4px 0; white-space:nowrap}

/* misc */
#toast{position:fixed; left:50%; bottom:calc(18px + env(safe-area-inset-bottom, 0px)); transform:translateX(-50%); z-index:60; width:max-content; max-width:calc(100% - 32px); padding:12px 18px; border-radius:16px; background:var(--ink); color:var(--bg); font:500 14.5px/1.4 var(--body); box-shadow:var(--shadow); text-align:center}
.confetti{position:fixed; inset:0; pointer-events:none; overflow:hidden; z-index:30}
.confetti i{position:absolute; top:-16px; width:9px; height:15px; border-radius:3px; animation-name:fall; animation-timing-function:cubic-bezier(.3,.6,.6,1); animation-fill-mode:forwards}
@keyframes fall{to{transform:translate3d(var(--dx, 0px), 110vh, 0) rotate(720deg)}}
@keyframes pop{from{transform:scale(.97); opacity:.6} to{transform:none; opacity:1}}
@keyframes rise{from{transform:translateY(24px); opacity:0} to{transform:none; opacity:1}}
@keyframes tick{50%{transform:scale(1.18)}}
@keyframes blink{50%{opacity:.3}}
@keyframes float{50%{transform:rotate(-4deg) translateY(-6px)}}
@keyframes glow{50%{box-shadow:0 5px 0 var(--sun-deep), 0 0 0 6px color-mix(in srgb, var(--sun) 35%, transparent)}}
@media (max-width:360px){
  .btn-yes,.btn-no{font-size:27px; min-height:72px}
  .panel{padding:16px}
  .games{gap:8px}
}
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation:none !important; transition:none !important}
}
