/* Mafia — noir lounge theme.
 * Deep browns and blacks, warm lamp glow, gold trim; a big oval wooden
 * table with red velvet chairs and portrait avatars around it. */
:root{
  --bg:#120d0a;
  --card:linear-gradient(180deg,#241a12,#1a120c);
  --card-solid:#1e150e;
  --text:#f5ead6;
  --muted:#c9ab7d;
  --gold:#e8b64c;
  --gold2:#b9842e;
  --gold-dark:#4a3520;
  --accent:#e8b64c;
  --good:#3ddc84;
  --bad:#ff5d5d;
  --info:#6cc7ff;
  --blue:#57b7ff;
  --purple:#b06cff;
  --red-velvet:#6e1420;
}
*{box-sizing:border-box}
html{scrollbar-color:var(--gold-dark) var(--bg)}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  color:var(--text);
  padding:12px;
  min-height:100vh;
  background:
    radial-gradient(640px 320px at 6% -60px, rgba(255,166,66,.22), transparent 60%),
    radial-gradient(640px 320px at 94% -60px, rgba(255,166,66,.22), transparent 60%),
    radial-gradient(ellipse 120% 70% at 50% 42%, transparent 52%, rgba(0,0,0,.5) 100%),
    radial-gradient(130% 90% at 50% 0%, #2a1a0f 0%, var(--bg) 58%),
    var(--bg);
  background-color:var(--bg);
  overflow-x:hidden;
}

/* ---------- header / logo ---------- */
header{display:flex;justify-content:space-between;align-items:center;padding:6px 2px 12px;gap:10px;flex-wrap:wrap}
.logo{display:flex;align-items:center;gap:11px}
.logo-mark{width:48px;height:48px;flex:none;border:2px solid var(--gold2);border-radius:50%;display:flex;align-items:center;justify-content:center;background:radial-gradient(circle at 50% 35%,#3d2712,#180e05);box-shadow:0 0 14px rgba(232,182,76,.25)}
.logo-mark svg{width:32px;height:auto;display:block}
.logo-text{display:flex;flex-direction:column;line-height:1.05}
.logo-name{font-family:Georgia,'Times New Roman',serif;font-size:29px;font-weight:700;letter-spacing:5px;color:var(--gold);text-shadow:0 2px 10px rgba(232,182,76,.35)}
.logo-sub{font-size:11px;letter-spacing:1.6px;color:var(--muted);text-transform:uppercase}
.pill{font-size:12px;background:rgba(14,9,4,.85);border:1px solid var(--gold-dark);padding:5px 11px;border-radius:999px;color:var(--muted)}

/* ---------- generic ---------- */
.card{background:var(--card);border:1px solid var(--gold-dark);border-radius:16px;padding:16px;margin-bottom:12px;box-shadow:0 8px 22px rgba(0,0,0,.4)}
.card h3{margin:0 0 9px;font-family:Georgia,'Times New Roman',serif;font-size:15px;letter-spacing:1.2px;color:var(--gold)}
label{display:block;font-size:14px;color:var(--muted);margin:10px 0}
input{width:100%;margin-top:6px;padding:14px;border-radius:12px;border:1px solid var(--gold-dark);background:#140d07;color:var(--text);font-size:17px}
input:focus{outline:2px solid var(--gold2);outline-offset:1px}
button{background:linear-gradient(180deg,var(--gold),var(--gold2));color:#1c1503;border:1px solid #7a5a1e;border-radius:12px;padding:14px 18px;font-size:16px;font-weight:700;width:100%;margin:6px 0;cursor:pointer;min-height:52px;box-shadow:0 4px 12px rgba(0,0,0,.35)}
button.secondary{background:linear-gradient(180deg,#332416,#20150b);color:var(--text);border:1px solid var(--gold2)}
button.mini{width:auto;padding:8px 12px;min-height:38px;font-size:13px;margin:0}
button.ghost{background:rgba(14,9,4,.85);color:var(--gold);border:1px solid var(--gold-dark);box-shadow:none}
button.danger{background:#5a1620;color:#ffb9b9;border:1px solid #8c2f3a;width:auto;box-shadow:none}
button:disabled{opacity:.45;cursor:default}
button.selected{outline:3px solid var(--info)}
.row{display:flex;gap:8px}.row.between{justify-content:space-between;align-items:center}
.divider{text-align:center;color:var(--muted);margin:14px 0 4px;font-size:13px}
.tagline{color:var(--muted);line-height:1.45}
.note{font-size:13px;color:var(--muted);line-height:1.4}
.error{color:var(--bad);min-height:18px}
.hidden{display:none!important}

/* ---------- home ---------- */
#view-home{max-width:560px;margin:22px auto}

/* ---------- loader ---------- */
#loader{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px;gap:14px;
  background:
    radial-gradient(640px 320px at 10% 0%, rgba(255,166,66,.18), transparent 60%),
    radial-gradient(640px 320px at 90% 0%, rgba(255,166,66,.18), transparent 60%),
    radial-gradient(130% 90% at 50% 0%, #2a1a0f 0%, var(--bg) 60%),
    var(--bg)}
#loaderEmoji{font-size:84px;line-height:1;animation:loaderBob 1.6s ease-in-out infinite;filter:drop-shadow(0 6px 18px rgba(232,182,76,.35))}
@keyframes loaderBob{0%,100%{transform:translateY(0) rotate(-4deg)}50%{transform:translateY(-16px) rotate(4deg)}}
#loaderLine{font-size:21px;font-weight:800;line-height:1.35;min-height:58px;max-width:420px;color:var(--text)}
#loaderStatus{font-size:14px;color:var(--muted);line-height:1.5;max-width:420px}
#loaderWait{font-size:14px;color:var(--gold);font-weight:700;min-height:20px}

/* ---------- game top row ---------- */
.game-top{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.table-chip{background:rgba(14,9,4,.85);border:1px solid var(--gold-dark);border-radius:12px;padding:9px 14px;font-size:15px;box-shadow:0 4px 12px rgba(0,0,0,.35)}
.table-chip #tableCode{color:var(--gold);font-weight:800;letter-spacing:1px}
.chip-sep{margin:0 8px;color:var(--gold2)}
.top-right{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.phase-pill{display:flex;align-items:center;gap:10px;background:rgba(14,9,4,.88);border:1px solid var(--gold2);border-radius:999px;padding:6px 16px 6px 11px;box-shadow:0 4px 14px rgba(0,0,0,.4)}
#phaseIcon{font-size:22px;line-height:1}
.phase-lines{display:flex;flex-direction:column;line-height:1.18}
#phaseDay{font-weight:800;font-size:15px;color:var(--text)}
#phaseShort{font-size:11px;color:var(--muted)}

/* ---------- game grid ---------- */
.game-grid{display:grid;grid-template-columns:215px 1fr 250px;gap:12px;align-items:start;margin-top:12px}
.game-grid .card{margin-bottom:12px}
aside.right.flash .card{animation:flashGold 1.2s ease}
@keyframes flashGold{0%,100%{box-shadow:0 8px 22px rgba(0,0,0,.4)}30%{box-shadow:0 0 0 3px var(--gold),0 0 26px rgba(232,182,76,.65)}}

.info-row{display:flex;justify-content:space-between;align-items:baseline;gap:8px;padding:5px 0;font-size:14px;color:var(--muted);border-bottom:1px dashed rgba(185,132,46,.25)}
.info-row:last-child{border-bottom:0}
.info-row strong{color:var(--text)}

.legend{list-style:none;margin:0 0 8px;padding:0}
.legend li{display:flex;align-items:center;gap:9px;padding:4px 0;font-size:14px}
.dot{width:9px;height:9px;border-radius:50%;display:inline-block;flex:none}
.dot.alive{background:#37d67a;box-shadow:0 0 6px rgba(55,214,122,.8)}
.dot.dead{background:#e5484d}
.dot.speaking{background:var(--gold);box-shadow:0 0 6px rgba(232,182,76,.9)}
.dot.spectator{background:var(--purple)}

.rolecard{margin-bottom:12px;background:linear-gradient(135deg,#3d2710,#241708);border:2px solid var(--gold);border-radius:14px;padding:16px;text-align:center;box-shadow:0 8px 22px rgba(0,0,0,.4)}
.rolecard .role{font-size:26px;font-weight:900;color:var(--gold)}
.private{color:var(--info);font-size:14px;margin:0 2px 10px;line-height:1.45;white-space:pre-line}
.private:empty{margin:0}

/* ---------- the table ---------- */
.stage{min-width:0}
#tableWrap{display:flex;justify-content:center;padding:56px 30px 46px}
#table{position:relative;width:min(94vw,660px);aspect-ratio:80/61;border-radius:50%;
  background:radial-gradient(ellipse at 50% 42%,#6b4423 0%,#4a2c15 55%,#2e1a0c 100%);
  border:10px solid #1c110a;
  box-shadow:0 0 0 3px var(--gold2),0 24px 50px rgba(0,0,0,.65),inset 0 0 60px rgba(0,0,0,.45)}
#tableCenter{position:absolute;inset:13% 17%;border:2px solid rgba(232,182,76,.35);border-radius:50%;
  display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:3px;
  padding:10px 8%;pointer-events:none;background:radial-gradient(ellipse at 50% 45%,rgba(0,0,0,.14),transparent 70%)}
#tcIcon{font-size:30px;line-height:1;filter:drop-shadow(0 2px 6px rgba(0,0,0,.6))}
.phase{font-family:Georgia,'Times New Roman',serif;font-size:clamp(19px,3.4vw,29px);font-weight:700;letter-spacing:2.5px;text-transform:uppercase;color:#f7ead0;text-shadow:0 2px 8px rgba(0,0,0,.6);line-height:1.1}
.timer{font-size:clamp(30px,5.6vw,46px);font-weight:800;color:#fff;font-variant-numeric:tabular-nums;line-height:1.05;text-shadow:0 3px 10px rgba(0,0,0,.65);min-height:1.05em}
#tcTagline{font-family:Georgia,'Times New Roman',serif;font-style:italic;font-size:clamp(12px,1.8vw,15px);color:#e6c98c}
.announcement-bar{font-size:14px;line-height:1.4;color:#ffd98a;text-align:center;max-width:640px;
  margin:6px auto 0;padding:0 10px;min-height:20px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* ---------- "where are we, what do I do" strip ----------
 * The stepper above the table and the badge + one-line instruction in
 * the table centre are the whole fix for "confusing UI": one glance
 * tells you the step (Night → Dawn → Talk → Vote) and one sentence
 * tells you what YOU do now. */
#stepper{display:flex;gap:6px;justify-content:center;margin:2px 0 8px;flex-wrap:wrap}
#stepper .step{font-size:12.5px;font-weight:700;color:var(--muted);background:rgba(14,9,4,.85);
  border:1px solid var(--gold-dark);border-radius:999px;padding:5px 11px;white-space:nowrap}
#stepper .step.active{color:#1c1503;background:linear-gradient(180deg,var(--gold),var(--gold2));border-color:#7a5a1e}
#stepper .step.done{color:var(--gold);border-color:var(--gold2)}
#stepper .step.done::after{content:' ✓'}
.turnbadge{display:inline-block;font-size:12px;font-weight:800;letter-spacing:.6px;border-radius:999px;
  padding:4px 12px;background:rgba(0,0,0,.45);color:var(--muted);border:1px solid var(--gold-dark)}
.turnbadge.you{background:#1d5c33;color:#d8ffe9;border-color:#3ddc84;box-shadow:0 0 12px rgba(61,220,132,.35)}
.turnbadge.talk{background:linear-gradient(180deg,var(--gold),var(--gold2));color:#1c1503;border-color:#7a5a1e;box-shadow:0 0 14px rgba(232,182,76,.5)}
.nowline{font-size:clamp(13px,2vw,16px);font-weight:700;line-height:1.35;color:#fff;max-width:100%}
#btnEndDiscussion{margin-top:8px}

/* ---------- seats ---------- */
.seat{position:absolute;width:104px;transform:translate(-50%,-50%);text-align:center;z-index:2}
.seat::before{content:'';position:absolute;left:50%;top:32px;transform:translate(-50%,-50%);width:96px;height:96px;border-radius:50%;
  background:radial-gradient(circle,rgba(148,26,42,.9) 0%,rgba(110,20,32,.55) 52%,rgba(110,20,32,0) 72%);z-index:-1}
.seat .avatar{position:relative;width:64px;height:64px;border-radius:50%;background:#2a1c10;border:3px solid #3a2a18;margin:0 auto;
  display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:800;color:var(--gold);
  transition:box-shadow .15s,border-color .15s;box-shadow:0 4px 10px rgba(0,0,0,.5)}
.seat .avatar .letter{position:absolute;inset:0;display:flex;align-items:center;justify-content:center}
.seat .avatar img{position:relative;z-index:1;width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}
.micbadge{position:absolute;z-index:3;right:-5px;bottom:-5px;width:23px;height:23px;border-radius:50%;background:#1faa55;border:2px solid #0d2b18;
  display:flex;align-items:center;justify-content:center;font-size:12px;line-height:1;box-shadow:0 2px 6px rgba(0,0,0,.5)}
.seat.speaking .avatar{border-color:var(--gold);box-shadow:0 0 0 4px rgba(232,182,76,.4),0 0 20px rgba(232,182,76,.75)}
.seat.me .avatar{border-color:var(--blue);box-shadow:0 0 0 4px rgba(87,183,255,.35),0 0 18px rgba(87,183,255,.65)}
.seat.me.dead .avatar{border-color:var(--purple);box-shadow:0 0 0 4px rgba(176,108,255,.3),0 0 16px rgba(176,108,255,.55)}
.seat.dead .avatar img{filter:grayscale(1) brightness(.55)}
.seat.offline{opacity:.55}
.plate{margin-top:5px;background:rgba(10,6,3,.88);border:1px solid var(--gold-dark);border-radius:10px;padding:3px 6px 4px;box-shadow:0 3px 8px rgba(0,0,0,.45)}
.seat .sname{font-size:13px;font-weight:700;line-height:1.15;word-break:break-word;color:var(--text)}
.seat .smeta{font-size:10px;color:var(--muted);display:flex;align-items:center;justify-content:center;gap:4px;flex-wrap:wrap;line-height:1.3;margin-top:1px}
.seat button.mutebtn{width:auto;min-height:28px;padding:2px 8px;font-size:11px;background:#140d07;color:var(--muted);border:1px solid var(--gold-dark);box-shadow:none;margin-top:3px}
.seat.tappable{cursor:pointer}
.seat.tappable .avatar{border-color:var(--gold)}
.seat.picked .avatar{border-color:var(--info);box-shadow:0 0 0 4px rgba(108,199,255,.4)}
#table.vote-armed .seat.tappable .avatar{animation:votePulse .45s ease-in-out infinite alternate}
@keyframes votePulse{from{box-shadow:0 0 0 3px rgba(232,182,76,.35),0 0 8px rgba(232,182,76,.4)}to{box-shadow:0 0 0 6px rgba(232,182,76,.6),0 0 24px rgba(232,182,76,.95)}}

/* ---------- bottom row ---------- */
.game-bottom{display:flex;gap:12px;margin-top:2px;align-items:stretch}
.chat-card{flex:1 1 auto;min-width:0;margin-bottom:0}
.chat-head{font-weight:800;color:var(--gold);margin-bottom:8px;font-size:15px}
.talkfeed{display:flex;flex-direction:column;gap:6px;max-height:184px;overflow-y:auto;padding-right:2px}
.talkline{font-size:14px;line-height:1.4;background:rgba(0,0,0,.32);border:1px solid #3a2817;border-radius:10px;padding:7px 10px}
.talkline strong{color:var(--gold)}
.talkline.dim{color:var(--muted);font-style:italic}
.controls-wrap{display:flex;flex-direction:column;gap:6px;justify-content:center;max-width:360px}
.controls{display:flex;gap:10px}
button.ctl{width:auto;flex:1;min-width:76px;min-height:64px;padding:10px 8px;font-size:14px;line-height:1.25;
  background:linear-gradient(180deg,#322413,#1d130a);color:var(--text);border:1px solid var(--gold2);border-radius:14px}
button.ctl.active{background:linear-gradient(180deg,var(--gold),var(--gold2));color:#1c1503}
#btnVoteNow{width:auto;min-width:216px;align-self:center;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  background:linear-gradient(180deg,#c22323,#7d1010);color:#fff;border:1px solid #ff7b6b;border-radius:14px;
  font-size:19px;padding:13px 20px;margin:0;box-shadow:0 8px 20px rgba(125,16,16,.45)}
#btnVoteNow #voteTime{font-size:12px;font-weight:600;opacity:.92}
#btnVoteNow:disabled{opacity:.5;filter:saturate(.45)}
#btnVoteNow.preview{border-style:dashed}

/* ---------- action panel bits (rendered by app.js) ---------- */
#actionPanel p{margin:4px 0}
.seg{display:flex;gap:8px;margin:8px 0}
.seg button{flex:1}
.toggleRow{display:flex;justify-content:space-between;align-items:center;padding:8px 0;font-size:15px}
.summary{text-align:left;line-height:1.5;font-size:14px}

/* ---------- responsive: stack, stage first, bottom row, then asides ---------- */
@media (max-width:979px){
  #view-game{display:flex;flex-direction:column}
  .game-top{order:0}
  .game-grid{display:contents}
  .stage{order:1}
  .game-bottom{order:2;flex-direction:column;margin-top:10px}
  aside.left{order:3;margin-top:12px}
  aside.right{order:4}
  #table{width:96vw}
  #tableWrap{padding:50px 26px 42px}
  .seat{width:84px}
  .seat::before{width:78px;height:78px;top:26px}
  .seat .avatar{width:52px;height:52px;font-size:16px}
  .seat .sname{font-size:11px}
  .seat .smeta{font-size:9px}
  .micbadge{width:20px;height:20px;font-size:10px}
  .controls-wrap{max-width:none}
  .controls{justify-content:center}
  #btnVoteNow{width:100%;min-width:0}
  .chat-card{margin-bottom:0}
  #tableCenter{inset:11% 13%;padding:8px 5%}
}
@media (max-width:380px){
  .logo-name{font-size:24px}
  .table-chip{font-size:13px;padding:8px 10px}
  #phaseDay{font-size:13px}
}

/* ---------- phones in-game: ONE screen, zero page scroll ----------
 * While a game is on (body.in-game, set by app.js render()/showHome()),
 * the whole table must fit 100dvh: acting and voting never need a
 * scroll. The body becomes a fixed-height flex column — compact header,
 * then #view-game fills the rest as its own flex column:
 *   .game-top → role strip (aside.left) → stage (flexes, table centres)
 *   → #actionPanel sheet (only internal scroll) → .game-bottom.
 * Game Info + Legend hide behind the Players button (fixed overlays),
 * and the chat collapses to its newest lines until its header is tapped.
 * Home view is untouched and keeps normal page scroll. */
@media (max-width:760px){
  html,body{height:100%}
  body.in-game{
    overflow:hidden;
    height:100vh;height:100dvh;
    display:flex;flex-direction:column;
    padding:6px 8px;
  }
  /* compact chrome */
  body.in-game header{flex:none;padding:2px 2px 6px;flex-wrap:nowrap}
  body.in-game .logo-mark{width:30px;height:30px}
  body.in-game .logo-mark svg{width:20px}
  body.in-game .logo-name{font-size:17px;letter-spacing:3px}
  body.in-game .logo-sub{display:none}
  body.in-game .pill{font-size:10px;padding:3px 8px}

  /* the game view fills what the header leaves — never the page */
  body.in-game #view-game{flex:1;min-height:0;display:flex;flex-direction:column}
  .game-top{order:0;flex:none;gap:6px}
  .table-chip{font-size:12px;padding:6px 9px}
  .top-right{gap:5px}
  .phase-pill{padding:4px 10px 4px 8px;gap:6px}
  #phaseIcon{font-size:16px}
  #phaseDay{font-size:12px}
  #phaseShort{font-size:9px}
  .game-top button.mini{min-height:30px;padding:5px 8px;font-size:11px}

  /* left column becomes a compact strip under the top row */
  aside.left{order:1;flex:none;margin-top:6px}
  #gameInfo{display:none} /* its facts live in the top chip + phase pill */
  #roleCard{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;
    padding:7px 10px;margin-bottom:5px;border-width:1px;border-radius:10px;text-align:left}
  #roleCard .role{font-size:17px}
  #roleCard .note{font-size:11px;line-height:1.3}
  #privateInfo{font-size:11px;line-height:1.35;max-height:2.7em;overflow:hidden;margin:0 2px 3px}

  /* right column dissolves: legend hides, the action panel becomes
   * the action sheet directly under the table */
  aside.right{display:contents}
  #legendCard{display:none}
  #actionPanel{order:3;flex:none;width:100%;max-height:23dvh;overflow-y:auto;
    padding:9px 12px;margin:0;font-size:13.5px}
  #actionPanel button{min-height:40px;padding:8px 12px;font-size:14px;margin:3px 0}
  #actionPanel .note{font-size:12px}
  #actionPanel .toggleRow{padding:4px 0;font-size:13px}

  /* stage flexes; the table is sized off the viewport, so the sheet
   * and strips can never push it off-screen */
  .stage{order:2;flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
  #tableWrap{padding:22px 10px 26px}
  #table{width:min(98vw,86dvh)}
  #tableCenter{inset:12% 14%;padding:6px 5%;gap:1px}
  #tcIcon{font-size:20px}
  .phase{font-size:17px;letter-spacing:1.5px}
  .timer{font-size:26px}
  #tcTagline{font-size:11px}
  .announcement-bar{font-size:12.5px;line-height:1.35;min-height:0}

  /* smaller seats, still tappable */
  .seat{width:74px}
  .seat::before{width:64px;height:64px;top:22px}
  .seat .avatar{width:44px;height:44px;font-size:14px;border-width:2px}
  .plate{margin-top:3px;padding:2px 6px;border-radius:8px}
  .seat .sname{font-size:11px}
  .seat .smeta{font-size:9px}
  .micbadge{width:17px;height:17px;font-size:9px;right:-4px;bottom:-4px}
  .seat button.mutebtn{min-height:26px;font-size:10px;padding:1px 6px}

  /* bottom: chat hides behind its 💬 button (fixed overlay when open) so
   * the table owns the screen; controls and Vote sit in ONE row */
  .game-bottom{order:4;flex:none;flex-direction:row;align-items:stretch;gap:6px;margin-top:6px}
  .chat-card{display:none;padding:7px 10px}
  .chat-head{margin-bottom:4px;font-size:13px;cursor:pointer}
  .chat-head::after{content:'tap to close ▴';float:right;font-size:10px;font-weight:400;color:var(--muted)}
  .talkfeed{overflow:hidden;justify-content:flex-end;gap:4px;padding-right:0}
  .talkline{font-size:12px;padding:5px 8px}
  .chat-card.chat-open{display:flex;flex-direction:column;position:fixed;left:8px;right:8px;bottom:118px;z-index:44;max-height:38dvh;box-shadow:0 14px 34px rgba(0,0,0,.65)}
  .chat-card.chat-open .talkfeed{flex:1;min-height:0;max-height:none;overflow-y:auto;justify-content:flex-start}
  .controls #btnChat{display:block;position:relative} /* beats the desktop display:none below by specificity */
  #btnChat.has-new::after{content:'';position:absolute;top:6px;right:8px;width:9px;height:9px;border-radius:50%;background:var(--gold);box-shadow:0 0 8px var(--gold)}
  .controls-wrap{max-width:none;flex:1.35;min-width:0}
  .controls{gap:5px}
  button.ctl{flex:1;min-width:0;min-height:52px;padding:6px 2px;font-size:11.5px;line-height:1.2}
  #speakState{display:block;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  #btnVoteNow{flex:1;width:auto;min-width:0;min-height:52px;padding:8px 10px;font-size:15px;align-self:stretch}
  /* role card: one line — tap for the full hint */
  #roleCard{cursor:pointer}
  #roleCard .note{display:none}
  #roleCard.expanded .note{display:block}
  #roleCard::after{content:'details ▾';font-size:9px;color:var(--muted);margin-left:auto}
  #roleCard.expanded::after{content:'hide ▴'}

  /* Players button: Game Info + Legend as fixed overlays */
  #view-game.sides-open #gameInfo{display:block;position:fixed;top:58px;left:8px;
    width:min(58vw,215px);z-index:46;margin:0;box-shadow:0 14px 34px rgba(0,0,0,.65)}
  #view-game.sides-open #legendCard{display:block;position:fixed;top:58px;right:8px;
    width:min(58vw,215px);z-index:46;margin:0;box-shadow:0 14px 34px rgba(0,0,0,.65)}
}
/* short phones (e.g. 375×667): tighten further so the table still fits —
 * its width is driven by the height actually left after the fixed rows,
 * the chat collapses to just its header, and the speak-state line hides. */
@media (max-width:760px) and (max-height:720px){
  #table{width:min(94vw,max(150px,calc((100dvh - 385px) * 1.31)))}
  #tableWrap{padding:16px 8px 20px}
  #actionPanel{max-height:16dvh}
  .chat-card.chat-open .talkfeed{display:flex;max-height:30dvh}
  #speakState{display:none}
  button.ctl{min-height:48px}
  #btnVoteNow{min-height:48px}
}

/* ---------- portrait picker (home) ---------- */
.pick-title{font-size:14px;color:var(--muted);margin:12px 0 2px}
.avatar-picker{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0 2px}
.avatar-picker .pick{width:54px;height:54px;min-height:54px;padding:0;border-radius:50%;overflow:hidden;border:3px solid #4a3520;background:#241a12;cursor:pointer;flex:none}
.avatar-picker .pick img{width:100%;height:100%;object-fit:cover;display:block}
.avatar-picker .pick.sel{border-color:var(--gold);box-shadow:0 0 0 3px rgba(232,182,76,.35),0 0 14px rgba(232,182,76,.45)}
#btnChat{display:none} /* mobile-only: the chat lives behind this button */

/* ============ corner HUD (owner layout, 2026-11-09) ============
 * While seated at a table, on every screen size:
 *  - the top logo bar is CUT (phase lives in the table centre);
 *  - the four controls move into the free corners as big round
 *    buttons that follow on screen (fixed): mic top-left (it is the
 *    mute/unmute toggle), speaker top-right, players bottom-left,
 *    chat bottom-right — the bottom bar keeps only the status line
 *    and Vote Now, and the table gets the freed space. */
body.in-game header{display:none} /* the app <header> (logo bar) — cut during play */
body.in-game #btnMicGame,body.in-game #btnSpeaker,body.in-game #btnPlayers,body.in-game #btnChat{
  position:fixed;z-index:60;width:62px;height:62px;min-height:0;flex:none;
  border-radius:50%;display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:4px;font-size:10px;line-height:1.2;white-space:pre-line;text-align:center;
  background:rgba(24,17,11,.92);box-shadow:0 6px 18px rgba(0,0,0,.55)}
body.in-game #btnMicGame{top:calc(8px + env(safe-area-inset-top));left:8px}
body.in-game #btnSpeaker{top:calc(8px + env(safe-area-inset-top));right:8px}
body.in-game #btnPlayers{bottom:calc(8px + env(safe-area-inset-bottom));left:8px}
body.in-game #btnChat{bottom:calc(8px + env(safe-area-inset-bottom));right:8px}
body.in-game #btnSelfMute{display:none} /* merged into the corner mic toggle */
body.in-game #btnMicGame.live{border-color:var(--gold);box-shadow:0 0 0 2px rgba(232,182,76,.35),0 0 16px rgba(232,182,76,.5)}
body.in-game #btnMicGame.muted{border-color:#e5534b;color:#ffb4ae;background:rgba(70,18,14,.92)}
body.in-game #btnMicGame.off{opacity:.55}
body.in-game #btnChat.has-new::after{content:'';position:absolute;top:6px;right:8px;width:9px;height:9px;border-radius:50%;background:var(--gold);box-shadow:0 0 8px var(--gold)}
@media (max-height:720px){ /* short screens: the cut top bar frees table room */
  body.in-game #table{width:min(94vw,max(150px,calc((100dvh - 330px) * 1.31)))}
}
/* The corner buttons get their own bands: the game view pads its top
 * and bottom by a button's height, so the corners float in dead space
 * and NEVER cover the pill, the table, or the action panel (seen live:
 * mic circle over the Lobby pill, Players/Chat over the panel). The
 * phase pill + invite/leave group hugs the RIGHT of its row, clear of
 * the top-left mic. */
body.in-game #view-game{padding-top:calc(76px + env(safe-area-inset-top));padding-bottom:calc(76px + env(safe-area-inset-bottom))}
body.in-game .game-top{flex-wrap:wrap}
body.in-game .top-right{margin-left:auto;justify-content:flex-end;flex-wrap:wrap}
body.in-game #view-game.sides-open #gameInfo,body.in-game #view-game.sides-open #legendCard{top:calc(82px + env(safe-area-inset-top))}

/* ============ square table (owner, 2026-11-10) ============
 * The oval became a SQUARE table: a phone screen is a rectangle, so
 * a square uses the space fully — straight edges for the seats, a
 * square centre for the phase text, and predictable corners that
 * stay clear of the corner HUD buttons. Seats now walk the square's
 * perimeter (seatXY in app.js). Sizing is height-aware in-game: the
 * square's height equals its width, so the width is capped by the
 * vertical budget left after the corner bands and the panels. */
#table{aspect-ratio:1/1;border-radius:30px;
  background:radial-gradient(circle at 50% 42%,#6b4423 0%,#4a2c15 55%,#2e1a0c 100%)}
#tableCenter{inset:14%;border-radius:24px;
  background:radial-gradient(circle at 50% 45%,rgba(0,0,0,.14),transparent 70%)}
body.in-game #table{width:min(94vw,max(170px,calc(100dvh - 400px)))}
@media (min-width:1200px){ body.in-game #table{width:min(600px,calc(100dvh - 400px))} }

/* ============ half-moon stage (owner, 2026-11-10) ============
 * All players sit in a half-moon along the BOTTOM of the table; the
 * freed upper half carries the phase display in the centre and the
 * two voice buttons — Mic top-left, Speaker top-right INSIDE the
 * table — big and clearly labelled. Players / Chat keep the bottom
 * screen corners; the top screen corners are no longer used, so the
 * game view no longer needs its top reserved band. */
.stage-voice{position:absolute;top:12px;left:12px;right:12px;z-index:5;
  display:flex;justify-content:space-between;gap:8px}
.stage-voice .voice-ctl{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
body.in-game #btnMicGame,body.in-game #btnSpeaker,body.in-game #btnNarrator{
  position:static;width:auto;height:52px;min-height:52px;flex:none;
  border-radius:999px;padding:10px 14px;font-size:14px;line-height:1.2;white-space:nowrap;
  display:flex;flex-direction:row;align-items:center;justify-content:center;
  background:linear-gradient(180deg,#322413,#1d130a);box-shadow:0 6px 18px rgba(0,0,0,.5)}
body.in-game #btnNarrator.active{background:linear-gradient(180deg,#5a1620,#3d0f14);color:#ffb9b9;border-color:#8c2f3a}
#tableCenter{inset:21% 19% 47%} /* upper-middle: below the voice row, clear of the arc's ends */
body.in-game #view-game{padding-top:calc(8px + env(safe-area-inset-top))}
body.in-game #view-game.sides-open #gameInfo,body.in-game #view-game.sides-open #legendCard{top:calc(58px + env(safe-area-inset-top))}
body.in-game #tableWrap{padding-top:16px}
body.in-game #table{width:min(94vw,600px,max(180px,calc(100dvh - 355px)))}
@media (max-width:760px){
  .stage-voice{top:8px;left:8px;right:8px;gap:6px}
  body.in-game #btnMicGame,body.in-game #btnSpeaker,body.in-game #btnNarrator{height:44px;min-height:44px;flex:1;min-width:0;padding:7px 6px;font-size:12px}
  #tableCenter{inset:20% 15% 45%}
  #tcIcon{display:none} /* the phase name says it; the icon only stole centre height */
  .timer{font-size:24px}
  .turnbadge{font-size:10.5px;padding:3px 9px}
  #stepper .step{font-size:11px;padding:4px 9px}
  /* The stage now stacks stepper → table → announcement bar, so the
   * table must shrink to leave room for the two bars and the panels. */
  body.in-game #table{width:min(94vw,max(180px,calc(100dvh - 500px)))}
  #tableWrap{padding:6px 8px 10px}
}
