:root {
  --bg: #090b14; --bg2: #0f1322; --panel: #141a2e; --panel2: #1a2240; --line: #29335f; --text: #e6ebff; --muted: #8e99c4;
  --cyan: #3ae0ff; --pink: #ff4fd8; --gold: #ffd84a; --good: #3ddc84; --bad: #ff5470; --warn: #ffb020;
  --glow: 0 0 10px rgba(58, 224, 255, .45);
  --font: "Noto Sans Thai", "Sarabun", "Tahoma", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(1200px 600px at 10% -10%, #1a1440 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #0e2a3d 0%, transparent 55%), var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: var(--cyan); }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 18px; } h3 { font-size: 15px; letter-spacing: .02em; } h4 { font-size: 13px; color: var(--muted); }
.hide { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); } .tiny { font-size: 12px; } .center { justify-content: center; align-items: center; }
.row { display: flex; align-items: center; gap: 6px; } .row.wrap { flex-wrap: wrap; } .row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 4px; }
label.col { font-size: 12px; color: var(--muted); }
label.col > input, label.col > select, label.col > textarea { color: var(--text); }

/* controls */
button, .btn { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
button:hover, .btn:hover { border-color: var(--cyan); box-shadow: var(--glow); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.primary { background: linear-gradient(180deg, #1c6b86, #124a63); border-color: var(--cyan); }
button.bad { border-color: #7a2b3c; color: #ff9db0; } button.good { border-color: #1f6b46; color: #8dffc0; }
button.on { background: #234a63; border-color: var(--cyan); }
button.small, .btn.small { padding: 4px 9px; font-size: 13px; } button.tiny { padding: 2px 7px; font-size: 12px; border-radius: 6px; }
input, select, textarea { font: inherit; color: var(--text); background: #0b0f1d; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }
input:disabled, textarea:disabled, select:disabled { opacity: .85; background: transparent; border-color: transparent; }
textarea { width: 100%; resize: vertical; }
input.num { width: 64px; text-align: center; }
input[type=color] { padding: 0; width: 34px; height: 28px; }
input[type=checkbox] { accent-color: var(--cyan); width: 16px; height: 16px; }
label.chk { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: #1f2850; border: 1px solid var(--line); font-size: 12px; }
.pill.good { border-color: #1f6b46; color: #8dffc0; } .pill.bad { border-color: #7a2b3c; color: #ff9db0; } .pill.secret { color: var(--gold); }
.pill.healthy { color: #8dffc0; } .pill.bloodied { color: var(--warn); } .pill.down { color: #ff9db0; }
.badge { padding: 1px 8px; border-radius: 6px; background: #1f2850; font-size: 12px; border: 1px solid var(--line); }
.badge.dm { background: #3a1d52; border-color: var(--pink); color: #ffc0f0; } .badge.warn { border-color: var(--warn); color: var(--warn); }
.code { font: 700 13px ui-monospace, monospace; letter-spacing: .12em; background: #0b0f1d; border: 1px dashed var(--cyan); color: var(--cyan); padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.note { background: #2a2350; border: 1px solid #5b4bd0; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.msg { color: var(--bad); min-height: 1.2em; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; } .chip { padding: 3px 9px; font-size: 12px; border-radius: 99px; }
.chip.on { background: #4a1f3a; border-color: var(--pink); color: #ffc0f0; }
.cchips { display: flex; flex-wrap: wrap; gap: 3px; } .cchip { font-size: 13px; background: #2a1f3f; border-radius: 6px; padding: 0 4px; }
.scroll-x { overflow-x: auto; }

/* header, footer, auth, home */
.hdr { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(9, 11, 20, .8); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.logo { display: flex; align-items: baseline; gap: 8px; color: var(--text); text-decoration: none; }
.logo b { font-size: 18px; letter-spacing: .12em; text-shadow: 0 0 12px var(--cyan); } .logo-d { color: var(--cyan); font-size: 20px; } .logo-s { color: var(--muted); font-size: 12px; }
.foot { padding: 20px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.auth-card { max-width: 380px; margin: 40px auto; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 0 40px rgba(58, 224, 255, .12); }
.auth-card h1 { text-align: center; letter-spacing: .2em; text-shadow: 0 0 14px var(--cyan); margin: 0; } .auth-card p { margin: 0; text-align: center; }
.big-logo { text-align: center; font-size: 44px; color: var(--cyan); text-shadow: 0 0 20px var(--cyan); }
.cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 8px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ccard { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.ccard .btns { align-items: flex-end; }
.mini-portrait { width: 34px; height: 34px; border-radius: 50%; background: #23306a center/cover; border: 2px solid var(--cyan); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.mini-portrait.big { width: 52px; height: 52px; font-size: 22px; }
.table-root { height: 100vh; }

/* toasts, modal, neon alerts */
#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 9000; }
.toast { background: var(--panel2); border: 1px solid var(--cyan); padding: 8px 14px; border-radius: 10px; max-width: 340px; box-shadow: var(--glow); transition: opacity .3s, transform .3s; }
.toast.bad { border-color: var(--bad); } .toast.good { border-color: var(--good); } .toast.out { opacity: 0; transform: translateX(20px); }
.modal-back { position: fixed; inset: 0; background: rgba(2, 4, 12, .7); display: flex; align-items: center; justify-content: center; z-index: 8000; padding: 12px; }
.modal { background: var(--panel); border: 1px solid var(--cyan); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(58, 224, 255, .25); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 14px; overflow: auto; } .modal-f { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal .x { padding: 2px 8px; }
.neon-alert { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); z-index: 9500; min-width: min(560px, 92vw); max-width: 92vw; text-align: center; padding: 22px 30px; border-radius: 16px; background: rgba(6, 8, 18, .94); border: 2px solid var(--cyan); color: var(--text); box-shadow: 0 0 30px var(--cyan), inset 0 0 30px rgba(58, 224, 255, .15); animation: naIn .45s cubic-bezier(.2, 1.4, .4, 1); cursor: pointer; transition: opacity .35s, transform .35s; }
.neon-alert.out { opacity: 0; transform: translateX(-50%) translateY(-20px); }
.na-tag { font-weight: 800; letter-spacing: .35em; font-size: 13px; color: var(--cyan); text-shadow: 0 0 10px currentColor; margin-bottom: 6px; }
.na-text { font-size: clamp(20px, 3.4vw, 32px); font-weight: 700; text-shadow: 0 0 14px currentColor; line-height: 1.3; }
.na-by { margin-top: 8px; color: var(--muted); font-size: 12px; }
.neon-alert.danger { border-color: var(--bad); box-shadow: 0 0 40px var(--bad), inset 0 0 30px rgba(255, 84, 112, .2); animation: naIn .45s cubic-bezier(.2, 1.4, .4, 1), naPulse .6s ease-in-out 3; } .neon-alert.danger .na-tag { color: var(--bad); }
.neon-alert.loot { border-color: var(--gold); box-shadow: 0 0 30px var(--gold), inset 0 0 30px rgba(255, 216, 74, .15); } .neon-alert.loot .na-tag { color: var(--gold); }
.neon-alert.quest { border-color: var(--pink); box-shadow: 0 0 30px var(--pink), inset 0 0 30px rgba(255, 79, 216, .15); } .neon-alert.quest .na-tag { color: var(--pink); }
.neon-alert.admin { border-color: #a78bfa; box-shadow: 0 0 30px #a78bfa; } .neon-alert.admin .na-tag { color: #a78bfa; }
@keyframes naIn { from { opacity: 0; transform: translateX(-50%) scale(.7); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes naPulse { 50% { box-shadow: 0 0 70px var(--bad), inset 0 0 40px rgba(255, 84, 112, .35); } }

/* tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 8px 0; }
.tab { border-radius: 8px 8px 0 0; border-bottom: none; background: transparent; }
.tab.on { background: var(--panel2); border-color: var(--cyan); color: var(--cyan); }

/* ---------------- character sheet ---------------- */
.sheet-wrap { max-width: 1200px; margin: 0 auto; padding: 12px; }
.sheet-bar { display: flex; align-items: center; gap: 8px; padding: 6px 4px 10px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg), rgba(9, 11, 20, .9)); }
.sheet-bar b { font-size: 18px; }
.charpage .sheet-bar { top: 50px; }
.sheet-overlay .sheet-bar { top: 0; }
.modes { display: inline-flex; gap: 0; } .mode { border-radius: 0; padding: 3px 9px; font-size: 12px; } .modes .mode:first-child { border-radius: 8px 0 0 8px; } .modes .mode:last-child { border-radius: 0 8px 8px 0; }
.mode.on { background: #234a63; border-color: var(--cyan); color: var(--cyan); }
.sheet { display: flex; flex-direction: column; gap: 10px; }
.sheet .card { padding: 10px; }
.sheet.ro input, .sheet.ro textarea { color: var(--text); }
.head { display: flex; gap: 12px; align-items: flex-start; }
.portrait { width: 96px; height: 96px; flex: none; border-radius: 50%; border: 3px solid var(--cyan); box-shadow: var(--glow); background: #23306a center/cover; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; }
.portrait.edit { cursor: pointer; }
.head-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.head-fields .row { align-items: flex-end; } .head-fields > label.col { flex: none; } .head-fields .row label.col { flex: 1 1 130px; } .head-fields .row label.narrow { flex: 0 0 76px; }
input.big { font-size: 20px; font-weight: 700; } input.huge { font-size: 30px; font-weight: 800; width: 84px; text-align: center; }
.vitals { display: grid; grid-template-columns: 130px 1.6fr 1.1fr 1fr; gap: 10px; }
.lbl { font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; text-align: center; margin-bottom: 4px; }
.acbox, .hpbox, .hdbox, .deathbox { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.acbox { border-radius: 14px 14px 40px 40px; }
.hpnums { display: flex; align-items: flex-end; gap: 6px; } .slash { font-size: 24px; color: var(--muted); } label.tiny { font-size: 11px; color: var(--muted); }
.hpbar { width: 100%; height: 8px; background: #0b0f1d; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.hpbar i { display: block; height: 100%; background: var(--good); transition: width .25s; } .hpbar.bloodied i { background: var(--warn); } .hpbar.down i { background: var(--bad); }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 2px solid var(--muted); background: transparent; }
.pip.on { background: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow); }
.pips.fail .pip.on { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 8px var(--bad); } .pips.ok .pip.on { background: var(--good); border-color: var(--good); box-shadow: 0 0 8px var(--good); }
.pip.dia { border-radius: 3px; transform: rotate(45deg); width: 15px; height: 15px; margin: 2px; } .pip.dia.on { background: var(--pink); border-color: var(--pink); box-shadow: 0 0 8px var(--pink); }
.statusrow { display: flex; flex-direction: column; gap: 8px; }
.insp { font-size: 14px; } .insp.on { background: #4a3a10; border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(255, 216, 74, .5); }
.strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mini { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; }
.mini .big { font-size: 26px; font-weight: 800; } .mini input.tinyin { width: 52px; font-size: 12px; padding: 2px; }
.abilities { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 10px; align-content: start; }
.ab { display: flex; flex-direction: column; gap: 3px; padding: 8px; }
.abh { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-bottom: 4px; }
.abn { font-weight: 700; font-size: 13px; } .abs { font-size: 11px; color: var(--cyan); letter-spacing: .1em; }
.abm { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
input.score { width: 56px; font-weight: 700; text-align: center; }
.rollv { padding: 1px 8px; background: transparent; border-color: transparent; font-weight: 700; min-width: 42px; justify-content: center; }
.rollv:hover { border-color: var(--cyan); background: #163049; }
.rollv.modv { font-size: 30px; font-weight: 800; padding: 0 10px; color: var(--cyan); text-shadow: var(--glow); } .rollv.big { font-size: 26px; } .rollv.sb { font-size: 14px; }
.srow { display: flex; align-items: center; gap: 6px; } .sn { flex: 1; font-size: 13px; min-width: 0; }
.tri { padding: 0 4px; border: none; background: transparent; font-size: 15px; color: var(--muted); min-width: 22px; justify-content: center; } .tri.s1 { color: var(--cyan); } .tri.s2 { color: var(--gold); text-shadow: 0 0 6px var(--gold); }
.tri:hover { box-shadow: none; }
.page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.25fr); gap: 10px; align-items: start; }
.right-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; } .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.page.p2, .page.p3 { grid-template-columns: 1fr; } .page.p3 { grid-template-columns: 1fr 1fr; } .page.p3 .col { gap: 10px; }
table.wt { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.wt:not(.spells) th:nth-child(1) { width: 30%; } table.wt:not(.spells) th:nth-child(2) { width: 13%; } table.wt:not(.spells) th:nth-child(3) { width: 22%; }
table.spells th:nth-child(1) { width: 50px; } table.spells th:nth-child(2) { width: 31%; } table.spells th:nth-child(3) { width: 13%; } table.spells th:nth-child(4) { width: 15%; } table.spells th:nth-child(5), table.spells th:nth-child(6), table.spells th:nth-child(7) { width: 34px; }
.sheet textarea { overflow: hidden; } .wt th { font-size: 11px; color: var(--muted); font-weight: 600; text-align: left; padding: 2px 4px; white-space: nowrap; }
.wt td { padding: 1px 2px; } .wt td input { width: 100%; padding: 4px 6px; } .wt td.c { text-align: center; } .wt input.c { text-align: center; }
td.wb { white-space: nowrap; } td.wb input { width: calc(100% - 26px); } .rollmini { padding: 0 3px; font-size: 12px; background: transparent; border: none; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 14px; } .slot { display: flex; align-items: center; gap: 6px; } .sl { width: 64px; font-size: 13px; }
.pipsw { display: inline-flex; min-width: 40px; } .coin { align-items: center; }

/* ---------------- table ---------------- */
.table { display: flex; flex-direction: column; height: 100vh; }
.tbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(9, 11, 20, .9); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tname { font-size: 17px; text-shadow: 0 0 10px var(--cyan); }
.conn { position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); background: var(--warn); color: #000; padding: 4px 14px; border-radius: 99px; z-index: 9000; font-size: 13px; }
.tmain { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) 390px; }
.party { border-right: 1px solid var(--line); overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; background: var(--bg2); }
.pc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.pc.online { border-color: #2c5a7a; }
.pc-top { display: flex; align-items: center; gap: 6px; } .pc-id { flex: 1; min-width: 0; } .pc-id b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #444; } .dot.on { background: var(--good); box-shadow: 0 0 6px var(--good); }
.star { color: var(--gold); text-shadow: 0 0 8px var(--gold); } .pill.ac { flex: none; }
.hprow { display: flex; align-items: center; gap: 6px; } .hpn { font-size: 12px; white-space: nowrap; }
.mapwrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.maptools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.tool { padding: 4px 9px; font-size: 16px; } .tool.on { background: #234a63; border-color: var(--cyan); }
.canvas-box { position: relative; flex: 1; min-height: 220px; }
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.selbar { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--bg2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.dock { padding: 6px 8px; background: var(--bg2); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.dice-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; } .dice-row input[type=text] { flex: 1 1 140px; }
.die { padding: 4px 9px; font-weight: 700; font-size: 13px; }
.die.d20 { border-color: var(--gold); color: var(--gold); } .die.d100 { border-color: var(--pink); color: var(--pink); }
.rollpops { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 3; align-items: flex-end; }
.rollpop { background: rgba(6, 8, 18, .92); border: 2px solid var(--cyan); border-radius: 12px; padding: 6px 16px; text-align: center; box-shadow: var(--glow); animation: pop .3s cubic-bezier(.2, 1.5, .4, 1); transition: opacity .4s; }
.rollpop.out { opacity: 0; } .rollpop.crit { border-color: var(--gold); box-shadow: 0 0 24px var(--gold); } .rollpop.fumble { border-color: var(--bad); box-shadow: 0 0 24px var(--bad); }
.pn { font-size: 12px; color: var(--muted); } .pt { font-size: 40px; font-weight: 800; line-height: 1; text-shadow: 0 0 14px currentColor; } .pe { font-size: 11px; color: var(--muted); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg2); }
.side-tabs { margin: 0; padding: 4px 6px 0; flex: none; } .side-tabs .tab { padding: 5px 7px; font-size: 12.5px; }
.pane-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane { flex: 1; min-height: 0; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.log-pane { padding: 0; gap: 0; overflow: hidden; }
.logbox { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.chatbar { display: flex; gap: 4px; padding: 6px; border-top: 1px solid var(--line); } .chatbar input { flex: 1; } .chatbar select { max-width: 120px; }
.log { font-size: 14px; word-break: break-word; }
.log.sys { color: var(--muted); font-size: 12px; }
.log.chat.whisper { color: #d6b8ff; font-style: italic; }
.log.roll { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: 8px; padding: 5px 8px; }
.log.roll.crit { border-left-color: var(--gold); background: #2a2410; } .log.roll.fumble { border-left-color: var(--bad); background: #2a1219; } .log.roll.secret { border-left-color: var(--gold); border-style: dashed; }
.rl-h { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .rl-label { color: var(--muted); font-size: 13px; }
.rl-b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .expr { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
.dice { font-size: 12px; color: var(--muted); } .dice > span { display: inline-block; min-width: 18px; text-align: center; margin-left: 2px; padding: 0 3px; border: 1px solid var(--line); border-radius: 4px; color: var(--text); }
.dice .drop { text-decoration: line-through; opacity: .45; } .dice .n20 { color: var(--gold); border-color: var(--gold); } .dice .n1 { color: var(--bad); border-color: var(--bad); }
.total { font-size: 22px; font-weight: 800; color: var(--cyan); margin-left: auto; } .crit .total { color: var(--gold); } .fumble .total { color: var(--bad); }
.log.alert { border: 1px solid var(--cyan); border-radius: 8px; padding: 5px 8px; text-shadow: 0 0 6px currentColor; } .log.alert.danger { color: var(--bad); border-color: var(--bad); } .log.alert.loot { color: var(--gold); border-color: var(--gold); } .log.alert.quest { color: var(--pink); border-color: var(--pink); }
.log.ask { background: #1c1638; border: 1px dashed var(--pink); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.ask-res { display: flex; flex-wrap: wrap; gap: 4px; }
.init-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .tools { gap: 4px; }
.ini { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.ini.turn { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 216, 74, .4); background: #2a2410; } .ini.down { opacity: .55; }
.initn { font-size: 22px; font-weight: 800; color: var(--cyan); min-width: 34px; text-align: center; } .ini-n { flex: 1; min-width: 0; } .ini-n .hpbar { width: 70px; }
.npc { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.npc.vis { border-color: #2c5a7a; } .npc.down { opacity: .6; }
.npc-top { display: flex; align-items: center; gap: 6px; } .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.atk { display: inline-flex; gap: 2px; } .npc-edit { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.card.tool { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.pc-checks { border-left: 2px solid var(--line); padding-left: 6px; }

/* ---------------- admin ---------------- */
body.admin .wrap { max-width: 1280px; margin: 0 auto; padding: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { text-align: center; } .stat b { font-size: 30px; color: var(--cyan); display: block; text-shadow: var(--glow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; } .tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 4px 6px; border-bottom: 1px solid #1c2445; vertical-align: middle; } .tbl td input, .tbl td select { width: 100%; padding: 3px 5px; }
.tbl tr:hover td { background: #131a33; } .tbl input.w60 { width: 60px; } .tbl input.w120 { width: 120px; }
.changed { border-color: var(--pink) !important; box-shadow: 0 0 10px rgba(255, 79, 216, .35); }
.ev-login_fail, .ev-login_blocked { color: #ff9db0; } .ev-admin { color: var(--pink); }


/* ---------------- on-screen coach, voice captions, AI DM ---------------- */
#guide { position: fixed; inset: 0; z-index: 8500; pointer-events: none; }
.gd-dim { position: absolute; inset: 0; background: rgba(4, 6, 14, .62); }
.gd-ring { position: absolute; border: 3px solid var(--gold); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(4, 6, 14, .62), 0 0 22px var(--gold), inset 0 0 14px rgba(255, 216, 74, .35); animation: gdPulse 1.2s ease-in-out infinite; transition: left .25s, top .25s, width .25s, height .25s; }
@keyframes gdPulse { 50% { box-shadow: 0 0 0 9999px rgba(4, 6, 14, .62), 0 0 40px var(--gold), inset 0 0 24px rgba(255, 216, 74, .55); } }
.gd-arrow { position: absolute; width: 30px; height: 44px; fill: var(--gold); stroke: #000; stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 0 8px var(--gold)); animation: gdBob .55s ease-in-out infinite alternate; transition: left .25s, top .25s; }
@keyframes gdBob { from { translate: 0 0; } to { translate: var(--bx, 0) var(--by, 8px); } }
.gd-card { position: absolute; pointer-events: auto; background: linear-gradient(180deg, #182042, #10162b); border: 2px solid var(--gold); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .65), 0 0 26px rgba(255, 216, 74, .35); transition: left .25s, top .25s; }
.gd-step { font-size: 11px; color: var(--gold); letter-spacing: .12em; margin-bottom: 4px; font-weight: 700; }
.gd-text { font-size: 15px; line-height: 1.55; }
.gd-chip { margin-top: 8px; background: #0b1a12; border: 1px dashed var(--good); color: #bfffd8; padding: 4px 10px; border-radius: 8px; display: inline-block; }
.gd-chip b { color: #fff; font-size: 16px; }
.gd-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gd-item { display: flex; gap: 10px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; } .gd-icon { font-size: 28px; }
#subs { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 8400; background: rgba(0, 0, 0, .82); color: #fff; padding: 9px 20px; border-radius: 12px; max-width: min(780px, 92vw); font-size: 18px; line-height: 1.45; text-align: center; border: 1px solid rgba(255, 255, 255, .22); pointer-events: none; text-shadow: 0 0 6px #000; }
.voicectl { display: inline-flex; gap: 2px; align-items: center; } .voicectl select { padding: 3px 4px; font-size: 12px; }
.guide-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px auto 0; max-width: 1200px; padding: 12px 14px; background: linear-gradient(90deg, #2a2350, #123048); border: 1px solid var(--gold); border-radius: 14px; box-shadow: 0 0 22px rgba(255, 216, 74, .2); }
.turnbar { background: linear-gradient(90deg, #3a3010, #1a2440); border-top: 2px solid var(--gold); padding: 8px; display: flex; flex-direction: column; gap: 6px; animation: tbGlow 1.4s ease-in-out infinite alternate; }
@keyframes tbGlow { from { box-shadow: 0 -2px 12px rgba(255, 216, 74, .2); } to { box-shadow: 0 -4px 30px rgba(255, 216, 74, .55); } }
.tb-h { font-weight: 800; color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.aibar { border-top: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 6px; background: #12132a; } .aibar input { flex: 1; }
.aiopts { display: flex; flex-wrap: wrap; gap: 5px; } .aiopts .chip { font-size: 13px; background: #14384a; border-color: var(--cyan); text-align: left; }
.aibusy { color: var(--pink); font-size: 13px; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .35; } }
.log.aidm { background: #1c1638; border: 1px solid var(--pink); border-left: 4px solid var(--pink); border-radius: 8px; padding: 8px 10px; box-shadow: 0 0 12px rgba(255, 79, 216, .15); }
.aidm-h { font-size: 12px; color: var(--pink); font-weight: 700; letter-spacing: .06em; } .aidm-t { font-size: 15px; line-height: 1.5; }
.aidm-teach { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #5a3a70; color: #ffd9f4; font-size: 13px; }
.log.act { color: #bfe9ff; font-style: italic; }
@media (max-width: 900px) { #subs { bottom: 10px; font-size: 16px; } }

/* ---------------- responsive ---------------- */
@media (max-width: 1150px) { .tmain { grid-template-columns: 210px minmax(0, 1fr) 330px; } .vitals { grid-template-columns: 110px 1.5fr 1fr 1fr; } }
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; } .page, .page.p3, .two { grid-template-columns: 1fr; } .abilities { grid-template-columns: 1fr 1fr; } .vitals { grid-template-columns: 1fr 1fr; } .strip { grid-template-columns: repeat(3, 1fr); }
  .table, .table-root { height: auto; min-height: 100vh; } .tmain { display: flex; flex-direction: column; } .mapwrap { height: 78vh; order: 1; } .party { order: 2; border: 0; } .side { order: 3; border: 0; min-height: 70vh; } .side .pane { max-height: 60vh; }
  .head { flex-direction: column; align-items: center; } .slots { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .abilities { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; } .strip { grid-template-columns: repeat(2, 1fr); } .hdr .logo-s { display: none; } }
.sheet-overlay { position: fixed; inset: 0; z-index: 7000; background: var(--bg); overflow: auto; }
@media print {
  body { background: #fff; color: #000; } .hdr, .foot, .sheet-bar, .tabs, .toast, #toasts, .neon-alert { display: none !important; }
  .page.hide { display: grid !important; } .card { background: #fff; border-color: #888; color: #000; } input, textarea, select { color: #000 !important; background: #fff !important; border-color: #aaa !important; }
  .sheet-overlay { position: static; } .rollv, .modv { color: #000 !important; text-shadow: none !important; }
}
