﻿:root{
  --bg:#0f131a;
  --panel:#1b2230;
  --panel2:#232d40;
  --text:#f5f7fb;
  --muted:#b7c0d2;
  --gold:#f0c56e;
  --danger:#e36a82;
  --ok:#71d0aa;
  --wall:#66696f;
  --door:#efe4c6;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family:"Noto Sans TC","Microsoft JhengHei",sans-serif;
  background:
    radial-gradient(circle at top, #272d3d 0, #131924 45%, #0a0d12 100%);
}
.wrap{max-width:1920px;margin:0 auto;padding:10px 14px}
h1{margin:0 0 8px;font-size:28px}
.layout{display:grid;grid-template-columns:minmax(320px, 22vw) minmax(680px, 1fr) minmax(360px, 25vw);gap:14px;align-items:stretch}
.leftSide{padding:12px;display:flex;flex-direction:column;gap:10px;min-height:0}
.leftTopGrid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;flex:0 0 174px;min-height:0}
.card{
  background:rgba(27,34,48,.98);
  border:1px solid #333d52;
  border-radius:20px;
  box-shadow:0 18px 45px rgba(0,0,0,.34);
}
.mapCard{padding:0 4px;display:flex;flex-direction:column;min-height:0;background:transparent;border:0;box-shadow:none}
.side{padding:12px;display:flex;flex-direction:column;gap:9px;min-height:0;overflow:hidden}
.topbar{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:8px}
.pill{background:#2b3448;border-radius:999px;padding:7px 11px;font-size:13px;color:#dce3f1}
.boardWrap{display:flex;align-items:center;justify-content:center;min-height:0;flex:1}
.board{
  position:relative;
  width:min(100%, calc(100vh - 92px), 1040px);
  aspect-ratio:1/1;
  border-radius:20px;
  overflow:hidden;
  background:
    linear-gradient(145deg, #797c84 0, #585c63 100%);
  box-shadow:
    inset 0 0 0 10px #4e535a,
    inset 0 0 50px rgba(0,0,0,.18),
    0 20px 50px rgba(0,0,0,.35);
}
.board::before{
  content:"";
  position:absolute; inset:0;
  background:
    linear-gradient(rgba(255,255,255,.035), rgba(0,0,0,.04)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 8px, rgba(0,0,0,.02) 8px 16px);
  pointer-events:none; z-index:1;
}
.room{
  position:absolute;
  padding:10px;
  border-radius:16px;
  overflow:hidden;
  z-index:3;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.18),
    inset 0 -18px 30px rgba(0,0,0,.08),
    0 8px 18px rgba(0,0,0,.12);
}
.room::after{
  content:"";
  position:absolute; inset:0;
  background:radial-gradient(circle at 84% 16%, rgba(255,255,255,.16), transparent 30%);
  pointer-events:none;
}
.room h3{margin:0 0 7px;font-size:16px;display:flex;justify-content:space-between;align-items:center;position:relative;z-index:4}
.room h3 small{font-size:11px;font-weight:600;opacity:.88}
.red{left:3%; top:3%; width:39%; height:35%; background:linear-gradient(145deg, #ff4639 0, #e62e24 65%, #cb241e 100%)}
.green{left:58%; top:3%; width:39%; height:35%; background:linear-gradient(145deg, #a3d61f 0, #8bc318 65%, #79af15 100%)}
.blue{left:3%; top:62%; width:39%; height:35%; background:linear-gradient(145deg, #46b4e8 0, #2d9bd1 65%, #2486b7 100%)}
.lobby{left:30%; top:37%; width:40%; height:24%; background:linear-gradient(145deg, #efefef 0, #d6d7d8 70%, #c6c7c8 100%); color:#1b1e24; z-index:4}
.lobby .tokens{gap:5px}
.lobby .token{width:50px;height:50px;border-radius:12px}
.lobby .token .ico{font-size:20px}
.lobby .token .name{font-size:9px}
.yellow{left:58%; top:62%; width:39%; height:35%; background:linear-gradient(145deg, #ffcb42 0, #f0b62a 65%, #dd9d12 100%); color:#1b1e24}
.tokens{display:flex;flex-wrap:wrap;gap:6px;align-content:flex-start;position:relative;z-index:4}
.token{
  width:54px;height:54px;border-radius:13px;background:#f3f6fb;color:#171b22;border:2px solid rgba(0,0,0,.33);
  display:flex;flex-direction:column;align-items:center;justify-content:center;cursor:pointer;user-select:none;
  transition:.14s; box-shadow:0 5px 12px rgba(0,0,0,.18)
}
.token:hover{transform:translateY(-2px)}
.token.selected{outline:4px solid var(--gold); transform:translateY(-2px)}
.token.myIdentity{
  background:linear-gradient(145deg, #fff8d8 0, #f3d783 100%);
  border-color:#9f7524;
  box-shadow:
    0 0 0 3px rgba(240,197,110,.38),
    0 7px 16px rgba(70,42,0,.24);
}
.token.dead{opacity:.18;filter:grayscale(1);cursor:not-allowed}
.token .ico{font-size:22px;line-height:1}
.token .name{font-size:10px;margin-top:3px;white-space:nowrap}
.room.valid{outline:5px solid var(--ok);outline-offset:-5px}

/* Corridor bridges */
.door{
  position:absolute;
  background:linear-gradient(90deg, rgba(250,238,198,.35), rgba(250,238,198,.72), rgba(250,238,198,.35));
  border:1px solid rgba(250,238,198,.42);
  border-radius:999px;
  box-shadow:
    0 0 0 1px rgba(60,48,24,.12),
    0 2px 8px rgba(0,0,0,.18);
  opacity:.9;
  z-index:2;
  pointer-events:none;
}
/* outer ring corridors */
.d-rg{left:42%; top:20%; width:16%; height:2.8%;}       /* red ↔ green */
.d-rb{left:21%; top:38%; width:2.8%; height:24%; background:linear-gradient(180deg, rgba(250,238,198,.35), rgba(250,238,198,.72), rgba(250,238,198,.35));}  /* red ↔ blue */
.d-by{left:42%; top:79%; width:16%; height:2.8%;}       /* blue ↔ yellow */
.d-gy{left:76%; top:38%; width:2.8%; height:24%; background:linear-gradient(180deg, rgba(250,238,198,.35), rgba(250,238,198,.72), rgba(250,238,198,.35));}  /* green ↔ yellow */
/* central spoke corridors */
.d-rw{left:38%; top:34.5%; width:11%; height:2.6%; transform:rotate(32deg);}    /* red ↔ white */
.d-bw{left:38%; top:61%; width:11%; height:2.6%; transform:rotate(-32deg);}     /* blue ↔ white */
.d-gw{left:51%; top:34.5%; width:11%; height:2.6%; transform:rotate(-32deg);}   /* green ↔ white */
.d-yw{left:51%; top:61%; width:11%; height:2.6%; transform:rotate(32deg);}      /* yellow ↔ white */

.legend{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.legend .pill{padding:5px 9px;font-size:12px}
.section{background:var(--panel2);border-radius:14px;padding:9px}
.section h2{font-size:15px;margin:0 0 6px}
.settingHead{display:flex;align-items:center;justify-content:space-between;gap:8px}
.settingHead h2{margin:0}
.settingHead button{padding:6px 10px;font-size:12px;border-radius:9px}
.settingsBody{margin-top:8px}
.settingsBody label{display:grid;gap:5px}
.settingsBody span{font-size:12px;color:#cbd4e4}
.settingsBody select{width:100%;height:34px;border:1px solid #3a455e;border-radius:9px;background:#111722;color:var(--text);padding:5px 8px}
.identity{font-size:21px;font-weight:800;color:var(--gold)}
.help{font-size:12px;line-height:1.5;color:#d3dae8}
.diceSection{display:grid;grid-template-columns:74px 1fr;gap:10px;align-items:center}
.dice{height:68px;border-radius:16px;background:#111722;border:1px solid #3a4359;display:flex;align-items:center;justify-content:center;font-size:36px}
button{border:0;border-radius:11px;padding:10px 12px;background:#37415a;color:white;font-weight:800;cursor:pointer;transition:.15s}
button:hover:not(:disabled){transform:translateY(-1px);filter:brightness(1.08)}
button:disabled{opacity:.38;cursor:not-allowed}
.primary{background:linear-gradient(135deg,#d9993f,#efc571);color:#21190d}
.danger{background:linear-gradient(135deg,#b8435b,#e66f84)}
.actions{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px;margin-top:8px}

.aiRoster{display:grid;grid-template-columns:1fr;gap:8px;overflow:visible}
.side > .section:nth-child(3){min-height:0;overflow:hidden;flex:1}
.side > .section:last-child{width:100%}
.aiCard{display:grid;grid-template-columns:62px minmax(0,1fr);gap:10px;align-items:center;background:#151c29;border:1px solid #364058;border-radius:12px;padding:8px}
.aiCard.eliminated{opacity:.42;filter:grayscale(.85);background:#10141d;border-color:#293143}
.aiCard.eliminated .aiAvatar{opacity:.62}
.aiAvatar{width:62px;height:62px;border-radius:10px;object-fit:cover;object-position:center top;background:#0e1420;border:1px solid rgba(255,255,255,.12);display:block}
.aiInfo{min-width:0}
.aiCard b{display:block;font-size:14px;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.aiNameRow{display:flex;align-items:center;gap:6px;min-width:0}
.outBadge{display:none;padding:2px 6px;border-radius:999px;background:#553040;color:#ffb4c4;font-size:11px;font-weight:800;white-space:nowrap}
.aiCard.eliminated .outBadge{display:inline-block}
.aiCard .tag{display:inline-block;margin-top:5px;padding:3px 7px;border-radius:999px;background:#2d3548;color:#f0c878;font-size:12px}
.aiCard .archetype{font-size:12px;color:#c2cad9;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.aiCard .thought{font-size:11px;color:#98d9bc;line-height:1.38;margin-top:5px;padding-top:5px;border-top:1px dashed rgba(255,255,255,.12)}

.miniGrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.list{height:124px;overflow:auto;background:#121722;border:1px solid #31394d;border-radius:10px;padding:8px;font-size:12px;line-height:1.45}
.list .empty{color:#818ba1}
.deadItem{color:#ff9aac}
.playerOut{color:#c7a8ff}
.section.eliminated{opacity:.48;filter:grayscale(.8)}

.logSection{display:flex;flex-direction:column;min-height:0;flex:1.2}
.log{flex:1;min-height:360px;overflow:auto;background:#111620;border-radius:11px;padding:9px;font-size:12px;line-height:1.48;border:1px solid #30384b}
.log p{margin:0 0 6px}
.you{color:#f2c873} .ai{color:#a8cfff} .kill{color:#ff8fa5} .sys{color:#bcc4d5} .mind{color:#8fd6b8}
.chatSection{display:flex;flex-direction:column;min-height:0;flex:.8}
.chatLog{flex:1;min-height:160px;overflow:auto;background:#111620;border-radius:11px;padding:9px;font-size:12px;line-height:1.45;border:1px solid #30384b}
.chatLine{margin:0 0 6px;color:#dfe7f4}
.chatLine b{color:#f0c56e}
.chatLine span{color:#dfe7f4}

.overlay{position:fixed;inset:0;background:rgba(7,9,13,.86);display:flex;align-items:center;justify-content:center;padding:20px;z-index:50}
.modal{max-width:980px;width:100%;background:#1c2331;border:1px solid #4b5570;border-radius:22px;padding:24px;box-shadow:0 24px 80px rgba(0,0,0,.55);max-height:90vh;overflow:auto}
.modal h2{margin:0 0 10px;font-size:28px}
.modal p{line-height:1.65;color:#cbd1df}
.hidden{display:none}
.reveal{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.revealCard{background:#272f42;border-radius:12px;padding:12px;border:1px solid #3c4660}
.revealCard b{display:block;margin-bottom:5px}
.aliveText{color:#7bdab5} .deadText{color:#ff96aa}
.reportGrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.reportCard{background:#171d2a;border:1px solid #35405a;border-radius:12px;padding:12px}
.reportCard h4{margin:0 0 8px;font-size:16px}
.reportCard .reportMeta{font-size:12px;color:#c7cfdf;margin-bottom:8px}
.reportCard ul{margin:8px 0 0 18px;padding:0;color:#d9dfeb;font-size:12px;line-height:1.5}
.reportCard .summary{font-size:12px;color:#98d9bc;line-height:1.5;background:#101622;border-radius:8px;padding:7px 8px;border:1px solid #2a3448}

@media (min-width: 1100px){
  body{overflow:hidden}
  .wrap{height:100%}
  .layout{height:calc(100vh - 58px)}
}
@media (max-width:1400px){
  body{overflow:auto}
  .layout{grid-template-columns:1fr}
  .board{width:min(100%, 880px)}
  .side,.leftSide{max-height:none}
}
@media (max-width:1200px){
  body{overflow:auto}
  .layout{grid-template-columns:1fr}
  .board{width:min(100%, 880px)}
  .side,.leftSide{max-height:none}
}
@media (max-width:760px){
  .wrap{padding:8px}
  .token{width:48px;height:48px}
  .token .ico{font-size:20px}
  .aiCard{grid-template-columns:58px minmax(0,1fr)}
  .aiAvatar{width:58px;height:58px}
  .miniGrid{grid-template-columns:1fr}
  .leftTopGrid{grid-template-columns:1fr;flex-basis:auto}
  .reveal,.reportGrid{grid-template-columns:1fr}
  .diceSection{grid-template-columns:88px 1fr}
}

