/* Chat window. Idle: the last few lines float over the game and fade.  Enter: a proper panel with the full history. */
#chat{position:absolute;left:14px;bottom:76px;width:min(440px,46vw);border-radius:16px;transition:background .15s,box-shadow .15s}
#chat .chead{display:none;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--line);font-size:13px}
#chat .chead b{font-size:14px}
#chat .chead #chatOn{color:var(--teal);font-weight:600}
#chat .chead small{margin-left:auto;color:var(--ink-dim);font-size:11px}
#chatLog{max-height:190px;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;gap:2px;font-size:14px;text-shadow:0 1px 3px #000,0 0 6px #000;pointer-events:none;padding:0}
.cl{padding:2px 8px;border-radius:8px;background:rgba(6,20,30,.42);width:fit-content;max-width:100%;word-wrap:break-word;overflow-wrap:anywhere;transition:opacity .6s}
.cl .ts{font-style:normal;font-size:10.5px;color:var(--ink-dim);margin-right:6px;opacity:.75}
.cl.old{opacity:0;height:0;padding:0;margin:0;overflow:hidden}
.cl .who{cursor:pointer;font-weight:600}
.cl .who:hover{text-decoration:underline}
.cl.sys{color:#ffe08a}.cl.ann2{color:#e6c8ff}
.cl.whisper{color:#f0d4ff;background:rgba(90,40,130,.55);border-left:3px solid #c890ff}
.cl .wh{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#c890ff;margin-right:2px}
#chatHint{color:var(--ink-dim);font-size:12px;margin:4px 0 0 6px;text-shadow:0 1px 3px #000;opacity:.85;pointer-events:none}
#chatIn{display:none;width:calc(100% - 16px);margin:8px;padding:9px 12px;border-radius:12px;border:1px solid var(--teal);background:rgba(4,16,26,.85);color:#fff;font:500 14px var(--font);outline:none}
/* typing state = full window */
#chat.typing{background:rgba(7,24,38,.9);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border:1px solid var(--line);box-shadow:0 10px 34px rgba(0,0,0,.5)}
#chat.typing .chead{display:flex}
#chat.typing #chatHint{display:none}
#chat.typing #chatIn{display:block}
#chat.typing #chatLog{max-height:260px;overflow-y:auto;pointer-events:auto;justify-content:flex-start;padding:8px 8px 0;text-shadow:none}
#chat.typing .cl{background:transparent;padding:2px 4px}
#chat.typing .cl.whisper{background:rgba(90,40,130,.45)}
#chat.typing .cl.old{opacity:1;height:auto;padding:2px 4px;overflow:visible}
#chat.typing #chatLog::-webkit-scrollbar{width:7px}
#chat.typing #chatLog::-webkit-scrollbar-thumb{background:rgba(255,255,255,.25);border-radius:6px}
@media (max-width:820px){#chat{width:88vw;bottom:70px}}
