/* Fengshen modern chat panel (play.html, right side). Dark, matches the site's top bar; gold accent like the promo pill. */
:root{--cbg:#121212;--cbg2:#1a1a1a;--cbg3:#222;--cline:rgba(255,255,255,.08);--ctext:#e8e6e3;--cdim:rgba(232,230,227,.55);
  --cgold:#e3b356;--cpurple:#b07ce8;--cblue:#6aa8ff;--cred:#ff6b5e;--cgreen:#7bd88f}
body.has-chat{flex-direction:column}
#main{flex:1 1 0;display:flex;min-height:0}
#main #c{flex:1 1 0;min-width:0}
#chat{flex:0 0 28.571em;display:flex;flex-direction:column;background:var(--cbg);border-left:1px solid var(--cline);color:var(--ctext);
  font:1em/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;min-height:0;position:relative}
#chat.closed{flex-basis:0;border:0;overflow:visible}
#chat.closed>*:not(#chat-open){display:none}
#chat-open{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%);writing-mode:vertical-rl;background:var(--cbg2);color:var(--cgold);
  border:1px solid var(--cline);border-right:0;border-radius:8px 0 0 8px;padding:0.857em 0.429em;cursor:pointer;font-weight:600;z-index:5}
#chat.closed #chat-open{display:block}
#chat-open .badge{writing-mode:horizontal-tb;margin-top:0.429em}
.chat-head{display:flex;align-items:center;gap:2px;padding:0.429em 0.429em 0;border-bottom:1px solid var(--cline);overflow-x:auto;scrollbar-width:none}
.chat-head::-webkit-scrollbar{display:none}
.chat-tab{flex:0 0 auto;background:none;border:0;color:var(--cdim);font:600 0.929em/1 inherit;padding:0.571em 0.714em;border-radius:8px 8px 0 0;cursor:pointer;position:relative;
  max-width:8.571em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-tab:hover{color:var(--ctext);background:var(--cbg2)}
.chat-tab.on{color:var(--ctext);background:var(--cbg2);box-shadow:inset 0 -2px 0 var(--cgold)}
.chat-tab .x{margin-left:0.429em;opacity:.5}.chat-tab .x:hover{opacity:1}
.badge{display:inline-block;min-width:1.143em;padding:1px 0.357em;border-radius:999px;background:var(--cgold);color:#000;font-size:0.786em;margin-left:0.357em;text-align:center}
.badge.mention{background:var(--cred);color:#fff}
.chat-tools{margin-left:auto;display:flex;align-items:center;gap:0.286em;padding-bottom:0.286em}
.chat-tools button{background:none;border:0;color:var(--cdim);cursor:pointer;padding:0.286em 0.429em;border-radius:6px;font:inherit}
.chat-tools button:hover{color:var(--ctext);background:var(--cbg3)}
.chat-online{font-size:0.857em;color:var(--cdim);white-space:nowrap}
.chat-online i{display:inline-block;width:0.5em;height:0.5em;border-radius:50%;background:var(--cgreen);margin-right:0.286em}
.chat-list{flex:1 1 0;overflow-y:auto;padding:0.571em 0;min-height:0;overscroll-behavior:contain}
.chat-more{display:block;margin:0.286em auto 0.571em;background:var(--cbg2);border:1px solid var(--cline);color:var(--cdim);border-radius:999px;padding:0.286em 0.857em;cursor:pointer;font:0.857em inherit}
.msg{display:flex;gap:0.643em;padding:0.286em 0.857em;position:relative}
.msg:hover{background:rgba(255,255,255,.03)}
.msg.cont{padding-top:1px}.msg.cont .av{visibility:hidden;height:0}
.msg.mentioned{background:rgba(227,179,86,.09)}
.av{flex:0 0 2.286em;height:2.286em;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:1em;color:#111}
.mbody{min-width:0;flex:1}
.mhead{display:flex;align-items:baseline;gap:0.429em}
.mname{font-weight:600;cursor:pointer}.mname:hover{text-decoration:underline}
.mtime{font-size:0.786em;color:var(--cdim)}
.mvia{font-size:0.714em;color:var(--cdim);border:1px solid var(--cline);border-radius:4px;padding:0 0.286em}
.mch{font-size:0.714em;font-weight:600;border-radius:4px;padding:1px 0.357em;color:#0d1117;background:#7fd1c7}
.mch.dm{background:#e0995f}.mch.sys{background:var(--cgold);margin-right:0.429em}
.mtext{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:anywhere}
.mtext a{color:var(--cblue)}
.mtext .at{color:var(--cgold);background:rgba(227,179,86,.12);border-radius:4px;padding:0 2px}
.mtext .at.me{color:#000;background:var(--cgold)}
.mimg{display:block;max-width:17.143em;max-height:15.714em;border-radius:8px;margin-top:0.286em;cursor:zoom-in;border:1px solid var(--cline)}
.mreply{font-size:0.857em;color:var(--cdim);margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mact{position:absolute;right:0.714em;top:-0.714em;display:none;background:var(--cbg3);border:1px solid var(--cline);border-radius:6px}
.msg:hover .mact{display:flex}
.mact button{background:none;border:0;color:var(--cdim);cursor:pointer;padding:0.214em 0.5em;font:0.857em inherit}.mact button:hover{color:var(--ctext)}
.msys{padding:0.286em 1em;color:var(--cgold);font-size:0.929em}
.msys .mtime{margin-right:0.429em}
.chat-day{text-align:center;font-size:0.786em;color:var(--cdim);margin:0.571em 0}
/* game item / legend cards */
.card{display:flex;gap:0.714em;margin-top:0.357em;background:var(--cbg2);border:1px solid var(--cline);border-radius:10px;padding:0.571em;max-width:24.286em;cursor:pointer}
.card:hover{border-color:rgba(227,179,86,.5)}
.card img{width:3.143em;height:2.857em;border-radius:6px;object-fit:cover;flex:0 0 auto;background:#000}
.card img.por{width:3.714em;height:3.714em;border-radius:8px;object-position:top}
.chat-toast.ok{background:#2e7d4f}
.card .ct{font-weight:600}.card .cs{font-size:0.857em;color:var(--cdim)}
.card .gems{display:flex;flex-wrap:wrap;gap:0.286em;margin-top:0.286em}
.card .gem{font-size:0.786em;border-radius:4px;padding:1px 0.357em;background:var(--cbg3)}
.card .gem.p{color:var(--cpurple);border:1px solid rgba(176,124,232,.5)}
.q1{color:#cdcdcd}.q2{color:#5aff52}.q3{color:#33ccff}.q4{color:#c55fff}.q5{color:#ff9d2e}
/* composer */
.chat-compose{border-top:1px solid var(--cline);padding:0.571em;position:relative}
.chat-replying{font-size:0.857em;color:var(--cdim);display:flex;justify-content:space-between;padding:0 0.286em 0.429em}
.chat-replying button{background:none;border:0;color:var(--cdim);cursor:pointer}
/* composer: full-width message box, one slim icon row underneath (emoji · GIF · image ... send) */
.chat-row{display:flex;flex-direction:column;background:var(--cbg2);border:1px solid var(--cline);border-radius:10px;padding:0.5em 0.571em 0.286em}
.chat-row:focus-within{border-color:rgba(227,179,86,.6)}
.chat-row textarea{width:100%;box-sizing:border-box;background:none;border:0;outline:0;color:var(--ctext);font:inherit;resize:none;max-height:8.571em;min-height:1.571em;padding:2px 2px 0.286em}
.chat-bar{display:flex;align-items:center;gap:2px;border-top:1px solid var(--cline);padding-top:0.214em}
.chat-bar .grow{flex:1}
.chat-bar button{display:inline-grid;place-items:center;width:2em;height:1.857em;padding:0;background:none;border:0;border-radius:6px;color:var(--cdim);cursor:pointer;flex:0 0 auto}
.chat-bar button:hover{color:var(--ctext);background:var(--cbg3)}
.chat-bar svg{width:1.286em;height:1.286em;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.chat-bar svg .f{fill:currentColor;stroke:none}
.chat-bar .gif{width:auto;height:1.286em;margin:0 0.286em;padding:0 0.357em;border:1.5px solid currentColor;font:700 0.714em/1 system-ui,sans-serif;letter-spacing:.5px}
.chat-bar .send{color:var(--cgold)}
.chat-bar .send svg{fill:currentColor;stroke:none}
.chat-bar .send:hover{color:#f5cf7b;background:rgba(227,179,86,.12)}
.chat-pop{position:absolute;left:0.571em;right:0.571em;bottom:100%;background:var(--cbg2);border:1px solid var(--cline);border-radius:10px;box-shadow:0 -8px 30px rgba(0,0,0,.5);
  max-height:23.571em;display:flex;flex-direction:column;z-index:10}
.chat-pop input{margin:0.571em;background:var(--cbg);border:1px solid var(--cline);color:var(--ctext);border-radius:8px;padding:0.5em 0.714em;font:inherit;outline:0}
.gif-grid{overflow-y:auto;columns:2;column-gap:0.429em;padding:0 0.571em 0.571em}
.gif-grid img{width:100%;border-radius:6px;margin-bottom:0.429em;cursor:pointer;display:block;background:var(--cbg3)}
.gif-attr{font-size:0.714em;color:var(--cdim);text-align:right;padding:0 0.714em 0.429em}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);padding:0.571em;gap:2px;overflow-y:auto}
.emoji-grid button{font-size:1.429em;background:none;border:0;cursor:pointer;border-radius:6px;padding:0.286em}.emoji-grid button:hover{background:var(--cbg3)}
.mention-list button{display:block;width:100%;text-align:left;background:none;border:0;color:var(--ctext);padding:0.5em 0.857em;cursor:pointer;font:inherit}
.mention-list button.on,.mention-list button:hover{background:var(--cbg3)}
.chat-status{padding:1.143em;color:var(--cdim);text-align:center;font-size:0.929em}
.chat-toast{position:absolute;left:50%;bottom:6.429em;transform:translateX(-50%);background:var(--cred);color:#fff;padding:0.429em 0.857em;border-radius:8px;font-size:0.929em;z-index:20}
.chat-drop{position:absolute;inset:0;background:rgba(227,179,86,.12);border:2px dashed var(--cgold);display:grid;place-items:center;color:var(--cgold);font-weight:600;z-index:30}
#chat-modal{position:fixed;inset:0;background:rgba(0,0,0,.75);display:grid;place-items:center;z-index:1000;cursor:zoom-out}
#chat-modal img{max-width:90vw;max-height:90vh;border-radius:8px}
#chat-modal .big{background:var(--cbg);color:var(--ctext);border:1px solid var(--cline);border-radius:14px;padding:18px 20px;min-width:300px;max-width:420px;cursor:default;
  font:14px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
#chat-modal .big h3{margin:0 0 6px}#chat-modal .big table{width:100%;border-collapse:collapse;margin-top:8px}
#chat-modal .big td{padding:3px 0;border-bottom:1px solid var(--cline)}#chat-modal .big td:last-child{text-align:right}
/* profile pictures (AB-60 legend portraits) */
.av{overflow:hidden}
.av img{width:100%;height:100%;object-fit:cover;object-position:top;display:block;background:#000}
.av.mine{cursor:pointer}.av.mine:hover{box-shadow:0 0 0 2px var(--cgold)}
.chat-tools .me-av{padding:2px;border-radius:50%}
.av.small{width:1.714em;height:1.714em;flex:0 0 1.714em;font-size:0.786em}
.pop-title{font-size:0.857em;color:var(--cdim);padding:0.714em 0.857em 2px}
.av-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:0.429em;padding:0.571em 0.714em 0.714em;overflow-y:auto}
.av-pick{display:flex;flex-direction:column;align-items:center;gap:0.214em;background:none;border:1px solid transparent;border-radius:10px;padding:0.286em 2px;cursor:pointer;color:var(--cdim)}
.av-pick:hover{background:var(--cbg3)}.av-pick.on{border-color:var(--cgold);background:rgba(227,179,86,.08)}
.av-pick img,.av-pick span{width:3.429em;height:3.429em;border-radius:50%;object-fit:cover;object-position:top;background:#000}
.av-pick span{display:grid;place-items:center;background:var(--cbg3);color:var(--ctext);font-weight:700;font-size:1.286em}
.av-pick i{font-style:normal;font-size:0.714em;line-height:1.15;text-align:center;max-width:4.714em;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
/* phase 2: shift-click link chips + legend view */
.chat-links{display:flex;flex-wrap:wrap;gap:0.286em;padding:0 2px 0.429em}.chat-links:empty{display:none}
.chat-chip{font-size:0.857em;background:var(--cbg3);border:1px solid rgba(227,179,86,.4);color:var(--cgold);border-radius:999px;padding:2px 0.571em}
.chat-chip b{cursor:pointer;margin-left:0.286em;opacity:.6}.chat-chip b:hover{opacity:1}
#chat-modal .big.lv{max-width:460px}
.lv-top{display:flex;gap:1em;align-items:center}
.lv-por{width:6em;height:6em;border-radius:12px;object-fit:cover;background:#000;border:1px solid var(--cline)}
.lv-gear{display:flex;flex-wrap:wrap;gap:0.429em;margin-top:0.714em}
.lv-g{position:relative;width:3.286em;height:3em;border-radius:6px;overflow:hidden;background:#000;border:1px solid var(--cline)}
.lv-g img{width:100%;height:100%;object-fit:cover}
.lv-g span{position:absolute;right:2px;bottom:0;font-size:0.786em;font-weight:700;color:#fff;text-shadow:0 0 3px #000}
.cs{font-size:0.857em;color:var(--cdim)}
@media (max-width:900px){#chat{position:fixed;right:0;top:34px;bottom:0;width:min(360px,100vw);z-index:50;box-shadow:-10px 0 30px rgba(0,0,0,.6)}
  #chat.closed{width:0}}
/* in-game chat (owner 2026-11-04: "move the chat ... inside the game area where the other chat used to be"): bottom-left of
   the 1000x600 stage like the old Flash chat box (x 0-326, y 453-600), sized in % of the game so it scales with it */
#game{container-type:size}
#game #chat{position:absolute;left:0.429em;bottom:0.429em;top:auto;right:auto;width:32.6%;height:24.5%;z-index:5;flex:none;
  background:rgba(9,10,12,.84);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);border:0;border-top:1px solid rgba(227,179,86,.35);
  border-right:1px solid rgba(227,179,86,.35);border-radius:0 10px 0 0;box-shadow:4px -4px 18px rgba(0,0,0,.45);font-size:min(1.2cqw,14px);
  transition:height .15s}
#game #chat.tall{height:50%}#game #chat.taller{height:78%}
#game #chat .chat-head{padding:0.214em 0.286em 0}
#game #chat .chat-tab{font-size:0.857em;padding:0.357em 0.5em}
#game #chat .chat-tools{gap:1px;padding-bottom:2px}
#game #chat .chat-tools button{padding:2px 0.357em}
#game #chat .chat-list{padding:0.286em 0}
#game #chat .msg{gap:0.5em;padding:2px 0.571em}
#game #chat .av{flex-basis:1.714em;height:1.714em;font-size:0.786em}
#game #chat .msys{padding:2px 0.643em;font-size:.92em}
#game #chat .chat-day{margin:0.286em 0}
#game #chat .card{max-width:100%;padding:0.429em;gap:0.571em}
#game #chat .mimg{max-width:100%;max-height:10.714em}
#game #chat .chat-compose{padding:0.286em 0.357em 0.357em}
#game #chat .chat-row{flex-direction:row;align-items:flex-end;gap:2px;padding:0.214em 0.286em 0.214em 0.5em;border-radius:8px}
#game #chat .chat-row textarea{min-height:1.429em;max-height:5.143em;padding:0.214em 0}
#game #chat .chat-bar{border-top:0;padding-top:0}
#game #chat .chat-bar button{width:1.714em;height:1.714em}
#game #chat .chat-bar .gif{margin:0 2px}
#game #chat .chat-pop{left:0;right:auto;width:max(100%,24.286em)}
#game #chat .chat-toast{bottom:4.286em}
#game #chat.closed{width:auto;height:auto;min-width:0;min-height:0;background:none;border:0;box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}
#game #chat-open{position:static;transform:none;writing-mode:horizontal-tb;margin:0 0 0.429em 0.429em;border:1px solid rgba(227,179,86,.4);border-radius:999px;
  padding:0.357em 0.857em;background:rgba(9,10,12,.86)}
#game #chat-open .badge{margin:0 0 0 0.429em}
/* 2026-11-04 owner pass: hidden until login, quiet scrollbar, announcement / system lines, cleaner icon row */
#chat.pre{display:none!important}
#chat .chat-list,#chat .gif-grid,#chat .av-grid,#chat .emoji-grid{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.13) transparent}
#chat ::-webkit-scrollbar{width:6px;height:6px}#chat ::-webkit-scrollbar-track{background:transparent}
#chat ::-webkit-scrollbar-thumb{background:rgba(255,255,255,.13);border-radius:3px}
#chat .msys{padding:0.214em 0.714em 0.286em;font-size:.95em}
#chat .msys .mh{display:flex;align-items:center;gap:0.429em;margin-bottom:1px}
#chat .msys .mtime{margin:0}
#chat .msys .mch{font-size:0.714em;font-weight:700;letter-spacing:.02em}
#chat .msys.ann .mx{color:#9fc98f}#chat .msys.ann .mch{background:rgba(126,196,104,.16);color:#a9d39a;box-shadow:inset 0 0 0 1px rgba(126,196,104,.3)}
#chat .msys.own .mx{color:#d6cfa4}#chat .msys.own .mch{background:rgba(226,214,150,.13);color:#ddd5a8;box-shadow:inset 0 0 0 1px rgba(226,214,150,.28)}
#game #chat .chat-row{align-items:center;padding:2px 0.214em 2px 0.571em}
#game #chat .chat-bar{gap:0;align-items:center}
#game #chat .chat-bar button{width:1.857em;height:1.857em;color:rgba(232,230,227,.5)}
#game #chat .chat-bar button:hover{color:var(--ctext)}
#game #chat .chat-bar svg{width:1.214em;height:1.214em}
#game #chat .chat-bar .gif{width:auto;height:1.071em;margin:0 0.286em;padding:0 0.214em;border:1.3px solid currentColor;border-radius:3px;font:700 0.643em/1 system-ui,sans-serif;letter-spacing:.4px}
#game #chat .chat-bar .gif:hover{background:none}
#game #chat .chat-bar .grow{display:none}
#game #chat .chat-bar .send{color:var(--cgold);margin-left:2px}
#chat.fullview{display:none!important}
/* floating like the HUD pieces (owner 2026-11-05: "they are all not attached"): gap from the edges, full frame */
#game #chat:not(.closed){border:1px solid rgba(227,179,86,.35);border-radius:10px;box-shadow:0 6px 20px rgba(0,0,0,.4)}
/* emote reactions (owner 2026-11-08) */
.mre{display:flex;flex-wrap:wrap;gap:3px;margin-top:3px}.mre.none{display:none}
.rx{display:inline-flex;align-items:center;gap:0.286em;background:var(--cbg3);border:1px solid var(--cline);border-radius:999px;padding:0 0.5em;font:0.857em/1.6 inherit;color:var(--ctext);cursor:pointer}
.rx b{font-weight:600;color:var(--cdim);font-size:.9em}
.rx:hover{border-color:rgba(255,255,255,.25)}
.rx.on{border-color:rgba(227,179,86,.6);background:rgba(227,179,86,.14)}.rx.on b{color:var(--cgold)}
.rpick{position:absolute;z-index:30;display:flex;gap:2px;padding:3px;background:var(--cbg2);border:1px solid rgba(227,179,86,.35);border-radius:999px;box-shadow:0 4px 14px rgba(0,0,0,.5)}
.rpick button{background:none;border:0;cursor:pointer;font-size:1.15em;line-height:1;padding:0.214em 0.286em;border-radius:50%;transition:transform .1s}
.rpick button:hover{background:var(--cbg3);transform:scale(1.2)}
#chat .msys{position:relative}
.msys:hover .mact{display:flex}
/* owner 2026-11-17 (small laptops): only the tabs scroll sideways - the tools (picture, private message, bigger / smaller) always stay
   in view on the right; the online count is gone */
.chat-head{overflow:visible}
.chat-head .tabs{flex:1 1 auto;min-width:0;overflow-x:auto;scrollbar-width:none}
.chat-head .tabs::-webkit-scrollbar{display:none}
.chat-tools{flex:none;margin-left:0;padding-left:0.286em;border-left:1px solid var(--cline)}
.chat-tools .size{font-size:1.15em;color:var(--cgold)}
/* the "To" chip on All (where the message goes) and its menu */
.chat-to{flex:none;align-self:center;background:var(--cbg3);border:1px solid var(--cline);color:var(--ctext);border-radius:999px;font:600 0.786em/1.2 inherit;
  padding:0.25em 0.6em;margin-right:0.357em;cursor:pointer;white-space:nowrap;max-width:9.5em;overflow:hidden;text-overflow:ellipsis}
.chat-to i{font-style:normal;opacity:.6;font-size:.85em}
.chat-to:hover{border-color:rgba(227,179,86,.5)}
.chat-to.ally{color:#7fd1c7}.chat-to.dm{color:#e8a36c;border-color:rgba(232,163,108,.35)}
.chat-compose{position:relative}
.chat-tomenu{position:absolute;left:0.357em;bottom:calc(100% - 0.143em);z-index:30;min-width:12em;max-height:16em;overflow:auto;background:var(--cbg2);
  border:1px solid var(--cline);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.55);padding:0.286em;display:flex;flex-direction:column;gap:1px}
.chat-tomenu button{background:none;border:0;color:var(--ctext);text-align:left;padding:0.429em 0.643em;border-radius:7px;cursor:pointer;font:0.929em/1.2 inherit;white-space:nowrap}
.chat-tomenu button:hover{background:var(--cbg3)}
.chat-tomenu button.on{background:var(--cbg3);color:var(--cgold)}
.chat-tomenu button.ally{color:#7fd1c7}.chat-tomenu button.dm{color:#e8a36c}
.chat-tomenu button.new{color:var(--cdim);border-top:1px solid var(--cline);border-radius:0 0 7px 7px;margin-top:2px}
/* private messages in a muted orange, like the original chat */
.msg.dmmsg{background:rgba(232,153,95,.08)}
.msg.dmmsg .mtext{color:#e8b48a}
