/* PokéTable: a calm dark theme for long sessions */
:root {
  --bg: #0c0e15;
  --bg2: #10131c;
  --panel: #151925;
  --panel2: #1a1f2e;
  --panel3: #212739;
  --line: #262c3f;
  --line2: #323a52;
  --text: #d9dcea;
  --text2: #b4b9cf;
  --muted: #858ba3;
  --accent: #8b7cf6;
  --accent-2: #a99cff;
  --accent-bg: rgba(139, 124, 246, .14);
  --gold: #e8b45a;
  --good: #4ade80;
  --warn: #f5a524;
  --bad: #f87171;
  --crit: #3ddc84;
  --fumble: #ff5c5c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Pixelify Sans", "Fraunces", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, #1a1838 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; }
h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 1.1em; }
p { margin: 0 0 .8em; }
code, kbd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--panel3); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
kbd { border: 1px solid var(--line2); border-bottom-width: 2px; }
img { max-width: 100%; }
::selection { background: rgba(139, 124, 246, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3045; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.small { font-size: .85em; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; gap: 8px; }
.row.end { justify-content: flex-end; gap: 8px; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.baseline { align-items: baseline; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prewrap { white-space: pre-wrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty.big { padding: 60px 20px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
/* Spinning Poké Ball loader (pure CSS). */
.pball, .loading::before {
  --pb: 44px;
  content: ""; display: block; width: var(--pb); height: var(--pb); margin: 0 auto 10px; border-radius: 50%;
  border: calc(var(--pb) * .07) solid #1b1d24; box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 50%, #fafafa 0 11%, #1b1d24 11% 19%, transparent 19%),
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.75) 0 7%, transparent 8%),
    linear-gradient(to bottom, #e8382f 0 44%, #1b1d24 44% 56%, #f2f2f2 56% 100%);
  box-shadow: inset calc(var(--pb) * -.08) calc(var(--pb) * -.08) 0 rgba(0,0,0,.18), 0 calc(var(--pb) * .12) calc(var(--pb) * .18) rgba(0,0,0,.35);
  animation: pb-spin 1.1s cubic-bezier(.55,.1,.45,.9) infinite;
}
@keyframes pb-spin {
  0% { transform: rotate(0deg); }
  70% { transform: rotate(360deg); }
  78% { transform: rotate(350deg); }
  86% { transform: rotate(366deg); }
  100% { transform: rotate(360deg); }
}
.boot { display: grid; place-content: center; justify-items: center; gap: 14px; height: 100vh; color: var(--muted); font: 600 15px var(--display); letter-spacing: .04em; }
.boot .pball { --pb: 84px; }
.boot p { margin: 0; animation: pb-dots 1.4s steps(4) infinite; }
@keyframes pb-dots { 0% { clip-path: inset(0 1.1em 0 0); } 100% { clip-path: inset(0 -0.2em 0 0); } }
.stage-host > .loading { position: absolute; inset: 0; display: grid; place-content: center; }
@media (prefers-reduced-motion: reduce) { .pball, .loading::before { animation-duration: 3s; } }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* ------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font: 600 13.5px var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--panel3); border-color: #3c4562; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #9585f8, #7a69ef); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(124, 106, 240, .3); }
.btn.primary:hover { background: linear-gradient(180deg, #a294ff, #8676f5); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.danger { color: #ffb4b4; border-color: #5a2a33; }
.btn.danger:not(.ghost) { background: #4a1f28; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.ib {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text2); cursor: pointer; font-size: 13px; padding: 0; flex: none;
}
.ib:hover { background: var(--panel3); color: var(--text); }
.ib.sm { width: 22px; height: 22px; font-size: 11px; }
.lnk { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-align: left; }
.lnk:hover { color: var(--accent-2); }
.input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2);
  color: var(--text); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 124, 246, .18); }
.input.sm { padding: 5px 8px; font-size: 13px; border-radius: 8px; }
.input.num { width: 64px; text-align: center; }
.input.num.big { font-size: 18px; font-weight: 700; width: 70px; }
textarea.input { resize: vertical; }
select.input { cursor: pointer; }
label { font-size: 13px; color: var(--text2); display: block; }
label > .input { margin-top: 4px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chk input { accent-color: var(--accent); }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--panel3); color: var(--text2);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: middle;
}
.tag.gm { background: rgba(232, 180, 90, .16); color: var(--gold); }
.tag.warn { background: rgba(245, 165, 36, .16); color: var(--warn); }
.tag.live { background: rgba(74, 222, 128, .16); color: var(--good); }
.type {
  display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #fff; background: color-mix(in srgb, var(--t) 70%, #000); border: 1px solid color-mix(in srgb, var(--t) 80%, #fff 0%);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--text2); }
.pill[style*="--c"] { border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.pill.on { background: color-mix(in srgb, var(--c, var(--accent)) 25%, var(--panel2)); color: #fff; }
.avatar {
  position: relative; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700;
  background: color-mix(in srgb, var(--c) 30%, var(--panel2)); color: var(--c); border: 2px solid color-mix(in srgb, var(--c) 50%, transparent);
  cursor: default; font-size: 13px; padding: 0; opacity: .55;
}
button.avatar { cursor: pointer; }
.avatar.on { opacity: 1; }
.avatar.on::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--good); border: 2px solid var(--bg); }
.avatar i { position: absolute; top: -7px; font-size: 8px; font-style: normal; background: var(--gold); color: #000; padding: 0 3px; border-radius: 4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.narrow { width: min(420px, 100%); }
.card-sub { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }

/* ------------------------------------------------ toasts, modals, tooltips */
#toasts { position: fixed; z-index: 100; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel3); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: up .25s ease; max-width: min(90vw, 520px); }
.toast.error { border-color: #6b2b36; background: #2a151b; color: #ffc4cc; }
.toast.turn { border-color: var(--gold); background: #2b2312; color: var(--gold); font-weight: 700; font-size: 16px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .4s; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(4, 5, 10, .66); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); padding: 22px; animation: pop .18s ease;
}
.modal.wide { width: min(980px, 100%); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-x { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 10px; background: var(--panel2); color: var(--muted); cursor: pointer; z-index: 2; }
.modal-x:hover { color: var(--text); background: var(--panel3); }
.modal h3:first-child { padding-right: 40px; font-family: var(--display); font-size: 1.35rem; }
.tooltip { position: fixed; z-index: 120; background: #05060b; color: #e6e8f2; padding: 6px 10px; border-radius: 8px; font-size: 12px; max-width: 340px; pointer-events: none; opacity: 0; transition: opacity .12s; border: 1px solid var(--line2); font-family: ui-monospace, Consolas, monospace; }
.tooltip.on { opacity: 1; }

/* ------------------------------------------------ site shell */
.site-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: rgba(12, 14, 21, .82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none !important; }
.logo { color: var(--bad); font-size: 22px; transform: rotate(-20deg); display: inline-block; }
.site-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.site-nav a { padding: 6px 12px; border-radius: 9px; color: var(--text2); text-decoration: none; white-space: nowrap; font-weight: 500; }
.site-nav a:hover { background: var(--panel2); color: var(--text); }
.site-nav a.on { background: var(--accent-bg); color: var(--accent-2); }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 24px 60px; }
.page-title { font-size: 2rem; }
.center-page { min-height: 70vh; display: grid; place-items: center; }
.auth { display: flex; flex-direction: column; gap: 12px; }

.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 36px; align-items: center; padding: 30px 0 40px; }
.hero h1 { font-size: clamp(2.2rem, 4.5vw, 3.6rem); line-height: 1.05; }
.hero p { font-size: 1.1rem; color: var(--text2); max-width: 560px; }
.grad { background: linear-gradient(90deg, #a99cff, #f0b45b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-map { border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature p { color: var(--text2); margin: 0; }
.f-ico { font-size: 26px; display: block; margin-bottom: 8px; }

/* dashboard */
.dash-head { margin-bottom: 18px; }
.join-form .input { width: 150px; text-transform: uppercase; }
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.camp { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; color: var(--text); text-decoration: none !important; transition: transform .15s, border-color .15s, box-shadow .15s; }
.camp:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--rc) 50%, var(--line)); box-shadow: 0 14px 40px rgba(0, 0, 0, .4); }
.camp-cover { height: 150px; overflow: hidden; position: relative; pointer-events: none; }
.camp-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--panel)); }
.camp-cover svg { width: 100%; height: 100%; }
.camp-cover .node, .camp-cover .roads, .camp-cover .title-chip, .camp-cover .compass, .camp-cover .clouds, .camp-cover .drift { display: none; }
.camp-cover * { animation: none !important; }
.camp-info { padding: 4px 16px 16px; }
.camp.new { border-style: dashed; background: transparent; align-items: center; justify-content: center; min-height: 250px; color: var(--muted); font: 600 15px var(--font); cursor: pointer; gap: 6px; }
.camp.new span { font-size: 34px; color: var(--accent); }
.region-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.rp { text-align: left; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; border-left: 4px solid var(--rc); text-decoration: none !important; display: block; }
.rp small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.rp:hover { background: var(--panel3); }
.rp.on { background: color-mix(in srgb, var(--rc) 20%, var(--panel2)); border-color: var(--rc); }

/* ------------------------------------------------ maps: see map.css */
.atlas { display: grid; grid-template-columns: 1fr 320px; gap: 16px; margin-top: 14px; }
.atlas-map { height: min(72vh, 720px); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: #0a1726; }
.atlas-world { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); margin: 16px 0; }
.loc-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; overflow: auto; }
.loc-card h3 { font-family: var(--display); font-size: 1.5rem; margin: 2px 0 6px; }
.loc-type { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-weight: 700; }
.loc-biomes { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.loc-mons { display: flex; flex-wrap: wrap; gap: 4px; }
.loc-mon { width: 48px; height: 48px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); padding: 2px; cursor: pointer; }
.loc-mon:hover { border-color: var(--accent); background: var(--panel3); }
.loc-mon img { width: 100%; height: 100%; image-rendering: pixelated; object-fit: contain; }

/* ------------------------------------------------ dex */
.dex-filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 4px 0; }
.page .dex-filters { background: transparent; position: static; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.dex-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; font: inherit; transition: transform .12s, border-color .12s;
}
.dex-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.dex-card img { width: 80px; height: 80px; image-rendering: pixelated; object-fit: contain; }
.dex-card .num { font-size: 11px; color: var(--muted); align-self: flex-start; }
.dex-card .nm { font-weight: 600; }
.dex-card .types { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dex-card .meta { font-size: 11px; color: var(--muted); }
.mon-detail .mon-hero { display: flex; gap: 20px; align-items: center; padding: 16px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--t) 25%, var(--panel2)), var(--panel2)); margin-bottom: 14px; }
.mon-hero img { width: 170px; height: 170px; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .4)); }
.mon-hero h2 { font-size: 2rem; margin: 2px 0 6px; }
.statline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.statline div { background: var(--panel2); border-radius: 10px; padding: 8px; text-align: center; }
.statline b { display: block; font-size: 1.05rem; }
.statline span { font-size: 11px; color: var(--muted); }
.attrs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0; }
.attr { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.attr span, .attr > .lnk { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.attr b { font-size: 1.2rem; }
.attr small { color: var(--accent-2); font-weight: 600; }
.attr .input.num { width: 56px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 10px 0; font-size: 13.5px; }
.kv span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ability { margin-bottom: 8px; }
.evo { display: flex; flex-wrap: wrap; gap: 6px; }
.evo-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); cursor: pointer; font: inherit; }
.evo-chip img { width: 36px; height: 36px; image-rendering: pixelated; }
.mgroup { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin-bottom: 6px; }
.mgroup > span { font-size: 12px; color: var(--muted); padding-top: 4px; }
.mgroup > div { display: flex; flex-wrap: wrap; gap: 4px; }
.mchip { padding: 3px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--t, #777) 50%, transparent); background: color-mix(in srgb, var(--t, #777) 14%, var(--panel2)); color: var(--text); cursor: pointer; font: 500 12.5px var(--font); }
.mchip small { margin-left: 5px; color: var(--muted); }
.mchip:hover { background: color-mix(in srgb, var(--t, #777) 30%, var(--panel2)); }
.credit { font-size: 12px; color: var(--muted); margin-top: 16px; }
.move-list { display: flex; flex-direction: column; gap: 4px; }
.move-row { display: grid; grid-template-columns: 1.6fr 90px 80px 90px 110px 60px 70px; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); border-left: 4px solid var(--t); background: var(--panel); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.move-row:hover { background: var(--panel2); }
.mr-name { font-weight: 600; }
.mr-meta { font-size: 12px; color: var(--text2); }
.movecard { border-left: 4px solid var(--t); padding-left: 14px; }
.mc-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding-right: 36px; }
.mc-head h3 { font-family: var(--display); font-size: 1.4rem; margin: 0; }
.mc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.mc-grid div { background: var(--panel2); border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.mc-grid span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.item-list { display: flex; flex-direction: column; gap: 4px; }
.item-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.item-row:hover { background: var(--panel2); }
.item-row img, .inv-row img { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.noimg { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); flex: none; }

.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmd { width: 100%; border-collapse: collapse; }
.cmd td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13.5px; }
.cmd td:first-child { white-space: nowrap; padding-right: 14px; }

/* ------------------------------------------------ TABLE (VTT) */
.table {
  height: 100vh; height: 100dvh; display: grid; grid-template-columns: 250px 1fr 400px; grid-template-rows: auto 1fr;
  grid-template-areas: "top top top" "left stage right"; overflow: hidden;
}
.tb-top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: rgba(14, 16, 24, .92); min-width: 0; }
.tb-back { font-size: 26px; color: var(--muted); text-decoration: none !important; width: 32px; text-align: center; }
.tb-back:hover { color: var(--text); }
.tb-title { min-width: 0; }
.tb-title h1 { font-size: 1.2rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sub { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.tb-scene { margin-left: auto; font-size: 13px; color: var(--text2); white-space: nowrap; }
.tb-members { display: flex; gap: 6px; }
.tb-left { grid-area: left; border-right: 1px solid var(--line); overflow: auto; padding: 12px; background: var(--bg2); display: flex; flex-direction: column; gap: 6px; }
.tb-left h4 { margin: 4px 0 6px; }
.tb-stage { grid-area: stage; position: relative; overflow: hidden; display: flex; flex-direction: column; min-width: 0; background: #080a10; }
.stage-host { flex: 1; position: relative; min-height: 0; }
.tb-right { grid-area: right; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg2); }
.tb-mobile { display: none; }

.narration { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; background: linear-gradient(180deg, rgba(30, 26, 52, .95), rgba(22, 20, 38, .92)); border-bottom: 1px solid #36305a; font-family: var(--display); font-size: 1.05rem; color: #e9e3ff; }
.narration p { margin: 0; font-style: italic; }
.quill { color: var(--gold); }
.preview-bar { padding: 8px 14px; background: #2b2312; color: var(--gold); border-bottom: 1px solid #5a4620; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { flex: 1; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 13px var(--font); cursor: pointer; white-space: nowrap; position: relative; }
.tabs button:hover { color: var(--text); background: var(--panel); }
.tabs button.on { color: var(--text); background: var(--panel2); }
.tabs button.ping::after { content: ""; position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.panel { display: none; flex: 1; min-height: 0; overflow: auto; }
.panel.on { display: flex; flex-direction: column; }
.p-sheet, .p-journal, .p-gm { padding: 12px; }

/* chat */
.p-chat { overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.msg { padding: 3px 0; word-wrap: break-word; }
.m-head { display: flex; align-items: center; gap: 7px; margin-top: 8px; margin-bottom: 2px; }
.m-head time { margin-left: auto; font-size: 11px; color: var(--muted); }
.m-av { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--c) 25%, var(--panel2)); color: var(--c); }
.m-body { padding-left: 29px; color: var(--text); }
.msg.k-system .m-body, .msg.k-turn .m-body { padding: 6px 10px; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--panel); border-radius: 10px; margin: 6px 0; }
.msg.k-turn .m-body { color: var(--gold); background: rgba(232, 180, 90, .08); border: 1px solid rgba(232, 180, 90, .2); font-weight: 600; }
.msg.k-desc .m-body { padding: 12px 14px; margin: 8px 0; background: linear-gradient(180deg, #1f1b36, #191628); border: 1px solid #3a3363; border-radius: 12px; font-family: var(--display); font-style: italic; font-size: 1.02rem; color: #ece6ff; }
.msg.k-emote .m-body { padding: 4px 10px; color: #f3b585; font-style: italic; text-align: center; }
.msg.k-ooc .m-body { color: var(--text2); font-size: 13px; }
.msg.k-whisper .m-body { padding: 6px 10px; background: rgba(192, 132, 252, .09); border: 1px solid rgba(192, 132, 252, .25); border-radius: 10px; margin: 4px 0; }
.wh { color: #d0a7ff; font-weight: 600; }
.msg.gmonly .m-body { opacity: .85; }
.iroll { display: inline-block; min-width: 26px; text-align: center; padding: 0 7px; border-radius: 7px; background: #f3edda; color: #141414; font-weight: 800; border: 2px solid #d9cfb0; cursor: help; }
.iroll.big { font-size: 15px; padding: 2px 10px; }
.iroll.crit { border-color: var(--crit); box-shadow: 0 0 0 1px var(--crit); }
.iroll.fumble { border-color: var(--fumble); box-shadow: 0 0 0 1px var(--fumble); }
.iroll.both { border-color: #3b82f6; }
.advpair { display: inline-flex; align-items: center; gap: 5px; }
.advpair .adv-tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px; border-radius: 5px; color: #fff; }
.advpair.m-adv .adv-tag, .adv-note.m-adv { background: #2f9e5a; }
.advpair.m-dis .adv-tag, .adv-note.m-dis { background: #c2453b; }
.adv-note { display: inline-block; white-space: nowrap; color: #fff; padding: 0 6px; border-radius: 5px; font-size: 11px; }
.iroll.dropd { opacity: .45; text-decoration: line-through; cursor: default; box-shadow: none; }
.rollres { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 2px 0; }
.rr-expr { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.rr-row { display: flex; align-items: center; gap: 10px; }
.rr-bd { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text2); word-break: break-word; }
.rr-bd b { color: var(--text); font-weight: 600; }
.rr-bd b.crit { color: var(--crit); }
.rr-bd b.fumble { color: var(--fumble); }
.rr-bd b.drop, .rr-bd .drop { text-decoration: line-through 2px rgba(255, 110, 100, .9); opacity: .5; }
.rr-bd b.expl { text-decoration: underline; }
.rr-bd b.succ { color: var(--crit); }
.bd-label { color: var(--accent-2); font-style: normal; }
.rr-eq { color: var(--muted); }
.rr-total { min-width: 46px; text-align: center; font-size: 20px; font-weight: 800; padding: 3px 10px; border-radius: 10px; background: #f3edda; color: #141414; border: 2px solid #d9cfb0; }
.rollres.crit .rr-total { border-color: var(--crit); box-shadow: 0 0 12px rgba(61, 220, 132, .35); }
.rollres.fumble .rr-total { border-color: var(--fumble); box-shadow: 0 0 12px rgba(255, 92, 92, .3); }

/* roll template card */
.tcard { --tc: var(--accent); border-radius: 12px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tc) 45%, var(--line)); background: var(--panel); margin: 3px 0; }
.tc-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 40%, #12141c), color-mix(in srgb, var(--tc) 10%, #12141c)); }
.tc-head img { width: 38px; height: 38px; image-rendering: pixelated; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, .2); }
.tc-title { font-weight: 800; font-size: 15px; color: #fff; }
.tc-sub { font-size: 11.5px; color: rgba(255, 255, 255, .75); }
.tc-body { display: grid; grid-template-columns: 1fr 1fr; }
.tc-row { padding: 7px 12px; display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); }
.tc-row:nth-child(odd):last-child, .tc-row.wide, .tc-row.text { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
.tc-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.tc-row.text .tc-val { font-size: 13px; color: var(--text2); text-align: right; }
.tc-desc { padding: 6px 12px 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text2); }
.tc-desc summary { cursor: pointer; color: var(--muted); font-size: 11.5px; }
.tcard.kind-check { --tc: #4c7bd9; }
.tcard.kind-save { --tc: #36a37a; }
.tcard.kind-init { --tc: #d99a36; }
.tcard.kind-capture { --tc: #e5534b; }

/* dice bar + composer */
.dice-bar { display: flex; gap: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.die { width: 33px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text2); font: 700 11.5px var(--font); cursor: pointer; display: grid; place-items: center; }
.die:hover { background: var(--panel3); color: #fff; border-color: var(--accent); }
.die.spin span { animation: dspin .45s ease; display: inline-block; }
@keyframes dspin { 50% { transform: rotate(180deg) scale(1.3); } }
.adv { display: flex; margin-left: auto; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.adv button { border: 0; background: var(--panel2); color: var(--muted); font: 700 10px var(--font); padding: 0 6px; height: 30px; cursor: pointer; }
.adv button.on { background: var(--accent-bg); color: var(--accent-2); }
.adv button[data-adv="adv"].on { background: rgba(61, 220, 132, .15); color: var(--crit); }
.adv button[data-adv="dis"].on { background: rgba(255, 92, 92, .15); color: var(--fumble); }
.composer { display: flex; gap: 6px; padding: 6px 10px 10px; align-items: flex-end; flex-wrap: wrap; }
.composer .speak-as { width: 100%; }
.composer .chat-input { flex: 1; resize: none; min-height: 40px; max-height: 140px; }
.composer .send { height: 40px; width: 44px; padding: 0; }
.gm-only { display: none !important; }
.is-gm .gm-only { display: inline-flex !important; }
.hide-roll { height: 40px; padding: 0 4px; }

/* party rail */
.pc { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-align: left; font: inherit; margin-bottom: 6px; }
.pc:hover { border-color: var(--line2); background: var(--panel2); }
.pc.npc { opacity: .8; border-style: dashed; }
.pc-av { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 20%, var(--panel2)); overflow: hidden; }
.pc-av img { width: 100%; height: 100%; object-fit: cover; }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-main small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-hp { height: 4px; background: #2a1d22; border-radius: 4px; overflow: hidden; }
.mini-hp i { display: block; height: 100%; background: var(--good); }
.pc-mons { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 3px; }
.pc-mon { position: relative; width: 28px; height: 30px; }
.pc-mon img { width: 28px; height: 28px; image-rendering: pixelated; }
.pc-mon i { position: absolute; left: 3px; right: 3px; bottom: 0; height: 2px; background: var(--good); }
.pc-mon.out img { filter: grayscale(1) brightness(.6); }
.init { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.init-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 3px; }
.init-list li { display: flex; gap: 7px; align-items: center; padding: 5px 7px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.init-list li.cur { border-color: var(--gold); background: rgba(232, 180, 90, .1); box-shadow: inset 3px 0 0 var(--gold); }
.init-list li.gm-hidden { opacity: .55; }
.init-list img, .ini-av { width: 24px; height: 24px; image-rendering: pixelated; flex: none; border-radius: 6px; display: grid; place-items: center; background: var(--panel3); font-size: 11px; }
.ini-val { width: 42px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; text-align: center; padding: 2px; font: 600 12.5px var(--font); }

/* world stage */
.world { position: absolute; inset: 0; display: flex; flex-direction: column; }
.world-tabs { display: flex; gap: 4px; padding: 8px; overflow-x: auto; background: rgba(10, 12, 18, .85); border-bottom: 1px solid var(--line); flex: none; }
.world-tabs button { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--text2); font: 600 12px var(--font); cursor: pointer; white-space: nowrap; }
.world-tabs button:hover { color: #fff; }
.world-tabs button.on { background: color-mix(in srgb, var(--c, var(--accent)) 30%, var(--panel2)); border-color: var(--c, var(--accent)); color: #fff; }
.world-map { flex: 1; min-height: 0; }
.world .loc-card { position: absolute; right: 12px; top: 58px; bottom: 12px; width: min(330px, calc(100% - 24px)); box-shadow: var(--shadow); background: rgba(21, 25, 37, .97); }
.loc-card .close { position: absolute; right: 10px; top: 10px; }

/* battle map */
.bm { position: absolute; inset: 0; }
.bm-viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; background: radial-gradient(circle at 50% 40%, #1d6fae, #0f3f6e); }
.bm[data-tool="ruler"] .bm-viewport, .bm[data-tool="aoe"] .bm-viewport { cursor: crosshair; }
.bm[data-tool="paint"] .bm-viewport, .bm[data-tool="fog"] .bm-viewport { cursor: cell; }
.bm[data-tool="ping"] .bm-viewport { cursor: pointer; }
.bm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.bm-ground, .bm-fog, .bm-anim, .bm-top { position: absolute; left: 0; top: 0; }
.bm-ground, .bm-anim { image-rendering: pixelated; }
.bm-top { pointer-events: none; z-index: 1; }
.bm-anim { pointer-events: none; z-index: 1; }
.bm-fog { pointer-events: none; z-index: 3; }
.bm-overlay { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; overflow: visible; }
.bm-tokens { position: absolute; inset: 0; }
.bm-tokens .tok { z-index: 2; }
.bm-tokens .tok.party { z-index: 4; } /* party members stay visible above the fog */
.tok { position: absolute; transition: left .25s ease, top .25s ease; cursor: pointer; user-select: none; }
.tok.dragging { transition: none; z-index: 10; opacity: .9; }
.tok-img { position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #2b3247, #161a26); border: 3px solid var(--ring); box-shadow: 0 4px 10px rgba(0, 0, 0, .5); display: grid; place-items: center; overflow: hidden; }
.tok-img img { object-fit: contain; pointer-events: none; }
.tok-img span { font-weight: 800; font-size: 18px; color: #fff; }
.tok.k-trainer .tok-img img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.tok.sel .tok-img { box-shadow: 0 0 0 3px #fff, 0 0 18px var(--ring); }
.tok.turn .tok-img { box-shadow: 0 0 0 3px var(--gold), 0 0 22px var(--gold); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 8px var(--gold); } }
.tok.down .tok-img { filter: grayscale(1) brightness(.55); }
.tok.down .tok-img::after { content: "✕"; position: absolute; font-size: 28px; color: var(--bad); font-weight: 900; }
.tok.gm-hidden { opacity: .45; }
.tok.gm-hidden .tok-img { border-style: dashed; }
.tok-hp { position: absolute; left: 10%; right: 10%; bottom: -3px; height: 6px; background: #3a1820; border-radius: 4px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .6); }
.tok-hp i { display: block; height: 100%; background: var(--good); }
.tok-hp.mid i { background: var(--warn); }
.tok-hp.low i { background: var(--bad); }
.tok-conds { position: absolute; top: -6px; right: -6px; display: flex; gap: 1px; font-size: 13px; }
.tok-conds span { background: rgba(10, 12, 18, .85); border-radius: 50%; width: 19px; height: 19px; display: grid; place-items: center; }
.tok-name { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; white-space: nowrap; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(8, 10, 16, .82); padding: 1px 7px; border-radius: 6px; pointer-events: none; opacity: 0; transition: opacity .15s; }
.tok:hover .tok-name, .tok.sel .tok-name, .tok.turn .tok-name { opacity: 1; }
.tok-name small { color: var(--muted); }
.ruler { stroke: var(--gold); stroke-width: 3; stroke-dasharray: 8 6; }
.ruler-dot { fill: var(--gold); }
.ruler-box { fill: rgba(8, 10, 16, .9); stroke: var(--gold); }
.ruler-txt { fill: #fff; font: 700 15px var(--font); }
.aoe { fill: rgba(139, 124, 246, .22); stroke: var(--accent-2); stroke-width: 2; }
.ping { fill: none; stroke: var(--pc); stroke-width: 4; animation: ping 1.2s ease-out 2; }
.ping.p2 { animation-delay: .3s; }
@keyframes ping { from { r: 6; opacity: 1; } to { r: 60; opacity: 0; } }
.bm-tools { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 5; max-width: calc(100% - 24px); }
.tool-group { display: flex; gap: 4px; padding: 5px; background: rgba(16, 19, 28, .92); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; align-items: center; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tool { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; font-size: 16px; }
.tool:hover { background: var(--panel3); }
.tool.on { background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.palette { max-width: 420px; }
.swl { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 3px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text2); font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.swl i { width: 18px; height: 18px; border-radius: 5px; background: var(--c, transparent); display: inline-grid; place-items: center; font-style: normal; font-size: 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.swl.on { border-color: var(--accent); color: var(--text); background: var(--accent-bg); }
.status-pal > .small { flex-basis: 100%; padding: 0 3px 2px; }
.hud-conds.ro { gap: 4px; }
.cond-chip { font-size: 11.5px; padding: 2px 7px; border-radius: 999px; background: var(--panel3); border: 1px solid var(--line); }
.sw { width: 28px; height: 28px; border-radius: 7px; border: 2px solid transparent; background: var(--c); cursor: pointer; }
.sw.on { border-color: #fff; }
.sw.erase { background: var(--panel3); color: var(--text); }
.bm-hud { position: absolute; right: 12px; bottom: 12px; width: min(300px, calc(100% - 24px)); z-index: 6; display: flex; flex-direction: column; gap: 8px; max-height: calc(100% - 24px); overflow: auto; }
.hud-card, .hud-moves { background: rgba(21, 25, 37, .97); border: 1px solid var(--line2); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.hud-moves { padding: 8px; gap: 5px; }
.hud-mt { padding: 0 3px; }
.hud-mv { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); border-left: 4px solid var(--t); background: linear-gradient(90deg, color-mix(in srgb, var(--t) 22%, transparent), var(--panel2) 70%); color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
.hud-mv:hover:not(:disabled) { border-color: var(--t); }
.hud-mv:disabled { opacity: .45; cursor: not-allowed; }
.hud-mv small { margin-left: auto; color: var(--muted); }
.hud-head { display: flex; gap: 10px; align-items: center; }
.hud-head img { width: 44px; height: 44px; image-rendering: pixelated; object-fit: contain; background: var(--panel2); border-radius: 10px; }
.hud-hp { display: flex; gap: 6px; align-items: center; }
.hud-hp .hpbar { flex: 1; }
.hud-hp .input { width: 52px; }
.hud-conds { display: flex; flex-wrap: wrap; gap: 3px; }
.cond { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-size: 13px; filter: grayscale(1); opacity: .6; }
.cond.on { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-bg); }

/* hp bars */
.hpbar { position: relative; height: 18px; background: #2a1820; border-radius: 9px; overflow: hidden; border: 1px solid #3a2530; }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2fbf6a, #4ade80); transition: width .3s; }
.hpbar.mid i { background: linear-gradient(90deg, #d68b14, #f5a524); }
.hpbar.low i { background: linear-gradient(90deg, #c23b3b, #f87171); }
.hpbar span { position: relative; display: block; text-align: center; font-size: 11.5px; font-weight: 700; line-height: 16px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }

/* sheet */
.sheet-pick { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.sheet-pick select { flex: 1; min-width: 140px; }
.sheet .tabs { padding: 0 0 6px; margin-bottom: 10px; }
.sheet-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.portrait { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font: 800 26px var(--display); background: color-mix(in srgb, var(--c) 25%, var(--panel2)); color: var(--c); overflow: hidden; flex: none; border: 2px solid color-mix(in srgb, var(--c) 50%, transparent); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.sheet-top h2 { margin: 0; font-size: 1.5rem; }
.title-input { width: 100%; background: transparent; border: 0; border-bottom: 1px dashed var(--line2); color: var(--text); font: 700 1.4rem var(--display); padding: 2px 0; outline: none; }
.title-input:focus { border-color: var(--accent); }
.mini { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.mini .input.num { width: 52px; }
.vitals { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.vital { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--text); font: inherit; }
.vital > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.vital > b { font-size: 1.25rem; }
.vital.click { cursor: pointer; }
.vital.click:hover { border-color: var(--accent); }
.vital.hp { align-items: stretch; }
.hpctl { display: flex; align-items: center; gap: 4px; justify-content: center; }
.hpctl b { font-size: 1.3rem; }
.hpctl .input.num { width: 50px; }
.vital .hpbar { height: 6px; }
.attrs.big .attr { padding: 8px 2px 6px; }
.attrs.big .save { margin-top: 4px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); border-radius: 7px; font: 600 10.5px var(--font); padding: 2px 5px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.attrs.big .save.on { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.attrs.big .save input { width: 11px; height: 11px; margin: 0; accent-color: var(--accent); }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skills { display: flex; flex-direction: column; gap: 1px; }
.skill { display: flex; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 6px; font-size: 13px; }
.skill:hover { background: var(--panel3); }
.skill .lnk { flex: 1; }
.skill small { color: var(--muted); font-size: 10.5px; }
.skill input { accent-color: var(--accent); }
.pip { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); }
.pip.on { background: var(--accent); border-color: var(--accent); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.badge-chip { padding: 3px 9px; border-radius: 99px; background: rgba(232, 180, 90, .12); color: var(--gold); font-size: 12px; font-weight: 600; }
.badge-chip .x { background: none; border: 0; color: inherit; cursor: pointer; margin-left: 2px; }
.mons { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.mon { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--t) 13%, var(--panel)), var(--panel) 60%); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.mon.fainted { filter: saturate(.3); opacity: .75; }
.mon header { display: flex; gap: 10px; align-items: center; }
.mon h3 { margin: 0; font-size: 1.05rem; }
.mon-img { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); padding: 0; cursor: pointer; flex: none; }
.mon-img img { width: 100%; height: 100%; image-rendering: pixelated; object-fit: contain; }
.hpline { display: flex; gap: 5px; align-items: center; }
.hpline .hpbar { flex: 1; }
.mon-attrs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.mon-attrs button { border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 4px 0; color: var(--text); cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; }
.mon-attrs button:hover:not(:disabled) { border-color: var(--accent); }
.mon-attrs span { font-size: 9.5px; color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.mon-attrs b { font-size: 13px; }
.mon-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.mv { display: flex; gap: 3px; align-items: stretch; }
.mv-use { flex: 1; min-width: 0; text-align: left; padding: 6px 9px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--t) 55%, transparent); background: color-mix(in srgb, var(--t) 18%, var(--panel2)); color: var(--text); cursor: pointer; font: inherit; display: flex; flex-direction: column; }
.mv-use:hover:not(:disabled) { background: color-mix(in srgb, var(--t) 35%, var(--panel2)); }
.mv-use:disabled { opacity: .45; cursor: not-allowed; }
.mv-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-meta { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-pp { width: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); color: var(--text2); font: 600 11px var(--font); cursor: pointer; flex: none; }
.mv .ib.sm { height: auto; }
.mon-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mon-foot .lnk { color: var(--accent-2); font-size: 12px; }
.box summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.inv { display: flex; flex-direction: column; gap: 4px; }
.inv-row { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.qty { min-width: 26px; text-align: center; }
.edit-mon .attrs { grid-template-columns: repeat(6, 1fr); }
.evo-pick { justify-content: flex-start; }
.starter { display: flex; align-items: center; gap: 10px; }
.starter img { image-rendering: pixelated; vertical-align: middle; }

/* journal */
.jentry { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.jbody { font-size: 13.5px; color: var(--text2); margin: 6px 0 8px; max-height: 300px; overflow: auto; }

/* gm */
.gm { display: flex; flex-direction: column; gap: 10px; }
.gm-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.gm-sec h4 { margin: 0; }
.scene-list { display: flex; flex-direction: column; gap: 3px; }
.scene-row { display: flex; gap: 4px; align-items: center; padding: 5px 7px; border-radius: 9px; background: var(--panel2); font-size: 13px; }
.scene-row.view { box-shadow: inset 0 0 0 1px var(--accent); }
.player-row { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }
.dot.on { background: var(--good); }
.enc-mons { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.enc-mon { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px; background: var(--panel2); border-radius: 10px; border: 1px solid var(--line); text-align: center; }
.enc-mon img { width: 56px; height: 56px; image-rendering: pixelated; }
.enc-mon b { font-size: 12px; }
.enc-mon small { color: var(--muted); font-size: 10.5px; }
.enc-mon .ib { position: absolute; top: 4px; right: 4px; }
.invite b, .invite-big { font-family: ui-monospace, Consolas, monospace; letter-spacing: .15em; color: var(--gold); }
.invite-big { font-size: 34px; text-align: center; padding: 14px; background: var(--panel2); border-radius: 12px; margin: 10px 0; }

/* ------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .table { grid-template-columns: 220px 1fr 360px; }
}
@media (max-width: 1080px) {
  .table { grid-template-columns: 0 1fr 360px; }
  .tb-left { display: none; }
  .table[data-mobile="party"] .tb-left { display: flex; position: fixed; inset: 56px 0 56px 0; z-index: 30; width: 100%; }
  .table .tb-mobile { display: flex; }
}
@media (max-width: 900px) {
  .table { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "top" "stage" "nav"; }
  .tb-right { position: fixed; top: 56px; bottom: 56px; left: 0; right: 0; z-index: 25; display: none; border: 0; }
  .table[data-mobile="chat"] .tb-right, .table[data-mobile="sheet"] .tb-right { display: flex; }
  .tb-mobile { grid-area: nav; display: flex; border-top: 1px solid var(--line); background: var(--bg2); padding: 4px; gap: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .tb-mobile button { flex: 1; padding: 10px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text2); font: 600 12.5px var(--font); }
  .tb-scene, .tb-invite { display: none; }
  .tb-top { height: 56px; }
  .tb-sub .pill:not(:first-child) { display: none; }
  .hero { grid-template-columns: 1fr; }
  .atlas { grid-template-columns: 1fr; }
  .atlas-map { height: 60vh; }
  .rules { grid-template-columns: 1fr; }
  .dex-filters { grid-template-columns: 1fr 1fr; }
  .move-row { grid-template-columns: 1fr auto auto; }
  .move-row .mr-meta:nth-of-type(n+3) { display: none; }
  .cols2 { grid-template-columns: 1fr; }
  .vitals { grid-template-columns: repeat(3, 1fr); }
  .vital.hp { grid-column: 1 / -1; }
  .statline, .attrs, .edit-mon .attrs { grid-template-columns: repeat(3, 1fr); }
  .kv { grid-template-columns: 1fr; }
  .mon-hero { flex-direction: column; text-align: center; }
  .site-top { padding: 10px 16px; gap: 10px; }
  .page { padding: 18px 16px 50px; }
  .tb-members .avatar:nth-child(n+5) { display: none; }
}
@media (max-width: 520px) {
  .mon-moves { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .brand { font-size: 0; gap: 0; }
  .brand .logo { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------ sheet adapts to the side panel's width */
.p-sheet, .modal-body { container-type: inline-size; }
@container (max-width: 560px) {
  .vitals { grid-template-columns: repeat(4, 1fr); }
  .vital.hp { grid-column: 1 / -1; }
  .attrs.big { grid-template-columns: repeat(3, 1fr); }
  .cols2 { grid-template-columns: 1fr; }
  .mon-moves { grid-template-columns: 1fr; }
  .tc-body { grid-template-columns: 1fr 1fr; }
}
@container (max-width: 380px) {
  .vitals { grid-template-columns: repeat(2, 1fr); }
  .mon-attrs { grid-template-columns: repeat(3, 1fr); }
}
.tok-img img { width: 92%; height: 92%; image-rendering: auto; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .5)); }
.table.live .tb-title h1::after { content: "LIVE"; margin-left: 8px; font: 700 9.5px var(--font); letter-spacing: .1em; color: var(--good); border: 1px solid color-mix(in srgb, var(--good) 50%, transparent); padding: 1px 5px; border-radius: 5px; vertical-align: middle; }

/* ------------------------------------------------ roster: players and their parties */
.r-player { border-top: 1px solid var(--line); padding: 8px 0 4px; }
.r-player.gm { border-top: 0; padding-top: 0; }
.r-pname { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap; }
.r-pname .lnk { margin-left: auto; color: var(--accent-2); }
.r-empty { margin: 0 0 6px 14px; }
.r-trainer { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin-bottom: 6px; }
.r-trainer.npc { border-style: dashed; }
.r-head { display: flex; gap: 9px; align-items: center; width: 100%; background: none; border: 0; padding: 2px; color: var(--text); cursor: pointer; text-align: left; font: inherit; border-radius: 9px; }
.r-head:hover { background: var(--panel2); }
.r-mons { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.r-mon { display: flex; align-items: center; gap: 7px; padding: 3px 5px; border-radius: 8px; background: none; border: 0; color: var(--text); cursor: pointer; text-align: left; font: inherit; width: 100%; }
.r-mon:hover { background: var(--panel2); }
.r-mon img { width: 34px; height: 34px; image-rendering: pixelated; object-fit: contain; flex: none; }
.r-mon.out img { filter: grayscale(1) brightness(.55); }
.r-mon-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.r-mon-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-mon-sub { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.r-mon-sub .st { color: var(--warn); font-weight: 600; }
.tdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t); }
.mini-hp.mid i { background: var(--warn); }
.mini-hp.low i { background: var(--bad); }
.r-npcs summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 6px 0; }

.roster-strip { position: relative; flex: none; border-top: 1px solid var(--line); background: rgba(12, 14, 21, .96); }
.roster-strip.collapsed .strip-row { display: none; }
.strip-toggle { position: absolute; right: 10px; top: -28px; height: 26px; padding: 0 10px; border: 1px solid var(--line2); border-bottom: 0; border-radius: 9px 9px 0 0; background: rgba(12, 14, 21, .96); color: var(--text2); cursor: pointer; font: 600 12px var(--font); z-index: 6; }
.roster-strip.collapsed .strip-toggle { top: -28px; }
.strip-row { display: flex; gap: 10px; padding: 8px 10px; overflow-x: auto; }
.s-card { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c); flex: none; }
.s-trainer { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; text-align: left; padding: 0; }
.s-trainer .pc-av { width: 34px; height: 34px; color: var(--c); background: color-mix(in srgb, var(--c) 20%, var(--panel2)); }
.s-tmain { display: flex; flex-direction: column; width: 96px; }
.s-tmain b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-tmain small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-mons { display: flex; gap: 3px; }
.s-mon { position: relative; width: 40px; height: 42px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); padding: 0; cursor: pointer; }
.s-mon:hover { border-color: var(--accent); }
.s-mon.empty { border-style: dashed; opacity: .35; cursor: default; }
.s-mon img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; margin: 1px 1px 0; }
.s-mon.out img { filter: grayscale(1) brightness(.55); }
.s-mon .s-lv { position: absolute; top: 1px; right: 3px; font-size: 9px; font-weight: 700; color: var(--text2); }
.s-mon i { position: absolute; left: 4px; bottom: 3px; height: 3px; border-radius: 2px; background: var(--good); max-width: calc(100% - 8px); }
.s-mon i.mid { background: var(--warn); }
.s-mon i.low { background: var(--bad); }
.s-none { padding: 8px; }

/* import dialog */
.dlg-tabs { margin: -4px 0 12px; padding: 0 0 6px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.file-btn { cursor: pointer; }
.imp-ok { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.imp-mons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.imp-mon { display: flex; flex-direction: column; align-items: center; width: 92px; padding: 6px; background: var(--panel); border-radius: 10px; text-align: center; }
.imp-mon img { width: 48px; height: 48px; image-rendering: pixelated; }
.imp-mon b { font-size: 12px; }
.imp-mon small { color: var(--muted); font-size: 10.5px; }
.imp-warn { margin: 8px 0 0; padding-left: 18px; color: var(--warn); font-size: 12px; }
.imp-err { color: #ffb4b4; background: #2a151b; border: 1px solid #6b2b36; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
@media (max-width: 900px) { .roster-strip { display: none; } .table[data-mobile="party"] .tb-left { overflow: auto; } }

/* ------------------------------------------------ GM library */
.lib-list { display: flex; flex-direction: column; gap: 3px; }
.lib-row { display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 9px; background: var(--panel2); font-size: 13px; }
.lib-row img, .lib-row .noimg { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; flex: none; }
.lib-row small { font-size: 11px; }
.enc-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 4px; }
.enc-row img, .enc-row .noimg { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.enc-mon.add { justify-content: center; color: var(--accent-2); cursor: pointer; font-size: 22px; border-style: dashed; background: transparent; }
.diff { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diff-badge { padding: 3px 10px; border-radius: 99px; font-weight: 800; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; }
.d-easy { background: rgba(74, 222, 128, .15); color: var(--good); }
.d-medium { background: rgba(245, 165, 36, .15); color: var(--warn); }
.d-hard { background: rgba(248, 113, 113, .15); color: var(--bad); }
.d-deadly { background: #5a1520; color: #ffb4b4; }
.pick-row { justify-content: flex-start; }
.pick-row img { object-fit: contain; image-rendering: pixelated; }
.mchip .x { background: none; border: 0; color: inherit; cursor: pointer; margin-left: 2px; }
.gen-team { min-height: 40px; }
.out-b { color: #4ade80; font-weight: 800; letter-spacing: .04em; }
.s-mon.is-out { border-color: #4ade80; box-shadow: 0 0 0 1px #4ade80 inset; }
.out-btn { font-weight: 700; }
.out-btn.on { color: var(--warn) !important; }

/* ------------------------------------------------ pixel sprites */
.psprite {
  display: inline-block; width: calc(24px * var(--s)); height: calc(32px * var(--s));
  background-image: var(--sheet); background-repeat: no-repeat; background-size: calc(48px * var(--s)) calc(32px * var(--s));
  image-rendering: pixelated; animation: psprite-idle .9s steps(1) infinite;
}
@keyframes psprite-idle { 0% { background-position: 0 0; } 50% { background-position: calc(-24px * var(--s)) 0; } }
@media (prefers-reduced-motion: reduce) { .psprite { animation: none; } }

/* sprite tokens: characters stand on the square, Pokémon hop */
.tok-sprite { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.tok-sprite::before { content: ""; position: absolute; left: 14%; right: 14%; bottom: 4%; height: 22%; border-radius: 50%; border: 3px solid var(--ring); background: rgba(0, 0, 0, .25); }
.tok-sprite .psprite { position: relative; margin-bottom: 8%; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.tok-sprite.mon img { position: relative; width: 112%; height: 112%; flex: none; object-fit: contain; object-position: bottom; image-rendering: pixelated; margin-bottom: 4%; animation: mon-hop 1.4s steps(2) infinite; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
@keyframes mon-hop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4%; } }
.tok.sel .tok-sprite::before { border-color: #fff; box-shadow: 0 0 10px var(--ring); }
.tok.turn .tok-sprite::before { border-color: var(--gold); box-shadow: 0 0 14px var(--gold); }
.tok.down .tok-sprite { filter: grayscale(1) brightness(.6); }
@media (prefers-reduced-motion: reduce) { .tok-sprite.mon img { animation: none; } }

/* appearance editor */
.look-ed { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.look-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.look-stage { width: 190px; height: 210px; border-radius: 14px; display: grid; place-items: end center; padding-bottom: 12px;
  background: linear-gradient(180deg, #8fd3ff 0%, #c9ecff 55%, #7cc44c 55%, #5fae3e 100%); image-rendering: pixelated; box-shadow: inset 0 0 0 3px rgba(255,255,255,.4); }
.look-ctrls { display: flex; flex-direction: column; gap: 8px; }
.look-ctrls label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.look-ctrls .input.sm { width: auto; }
.sw-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.swc { width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(255,255,255,.15); background: var(--c); cursor: pointer; padding: 0; }
.swc.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.swc-custom { width: 26px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
@media (max-width: 640px) { .look-ed { grid-template-columns: 1fr; } }

/* ------------------------------------------------ trainer card (parchment) */
.tc2 {
  --ink: #3a2414; --red: #7a1414; --line: #b98a4a; --cell: #f6ead0; --head: #ead1a0;
  position: relative; display: grid; grid-template-columns: 1.15fr .85fr; border-radius: 10px; overflow: hidden; color: var(--ink);
  background: radial-gradient(ellipse at 30% 20%, #fbf1da, #ecd9b0 70%, #dcc28f); border: 3px solid var(--red);
  box-shadow: inset 0 0 0 2px #e9cf99, inset 0 0 40px rgba(120, 70, 20, .25), 0 10px 30px rgba(0, 0, 0, .35); margin-bottom: 12px;
  font-family: "IM Fell English", Georgia, serif;
}
.tc2-left { padding: 14px 14px 12px 16px; min-width: 0; }
.tc2-name { margin: 0; font: 400 30px/1.05 "IM Fell English SC", Georgia, serif; color: var(--red); letter-spacing: .01em; }
.tc2-sub { font-style: italic; font-size: 15px; border-bottom: 2px solid var(--red); padding-bottom: 4px; margin-bottom: 8px; }
.tc2-info { display: grid; grid-template-columns: 1.2fr 1fr; gap: 6px 12px; font-size: 13.5px; }
.tc2-info dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 0; }
.tc2-info dl + dl { border-left: 2px solid var(--red); padding-left: 12px; }
.tc2-info dt { color: var(--red); font-weight: 700; }
.tc2-info dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc2-h { font: 400 20px "IM Fell English SC", Georgia, serif; color: var(--red); margin: 10px 0 4px; border-bottom: 2px solid var(--red); line-height: 1.1; }
.tc2-t { width: 100%; border-collapse: collapse; font-size: 13px; text-align: center; }
.tc2-t th { background: var(--head); border: 1px solid var(--line); padding: 3px 2px; font-family: "IM Fell English SC", Georgia, serif; font-weight: 400; }
.tc2-t td { background: var(--cell); border: 1px solid var(--line); padding: 0; }
.tc2-t button, .tc2-skill, .tc2-foot button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; width: 100%; padding: 4px 2px; }
.tc2-t button:hover, .tc2-skill:hover, .tc2-foot button:hover { background: rgba(122, 20, 20, .1); }
.tc2 .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid transparent; background: none; margin-right: 5px; vertical-align: middle; }
.tc2 .prof .dot { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 35%, transparent 40%); }
.tc2 .prof b, .tc2-t .prof { font-weight: 800; }
.tc2-skills { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); font-size: 13px; }
.tc2-skills > div + div { border-left: 1px solid var(--line); }
.tc2-skill { display: grid; grid-template-columns: auto 1fr auto; align-items: center; text-align: left; padding: 2px 8px; }
.tc2-skill:nth-child(odd) { background: rgba(255, 255, 255, .25); }
.tc2-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.tc2-foot button { width: auto; padding: 0; }
.tc2-right { position: relative; min-height: 300px; border-left: 3px solid var(--red); overflow: hidden; }
.tc2-right img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tc2-scene { position: absolute; inset: 0; display: grid; place-items: end center; padding-bottom: 8%;
  background: linear-gradient(180deg, #6fc3f5 0%, #b8e5ff 45%, #fff6d6 55%, #8fd16a 56%, #5aa83f 100%); image-rendering: pixelated; }
.tc2-scene .psprite { position: relative; z-index: 1; }
.tc2-scene::before { content: ""; position: absolute; z-index: 0; left: 8%; top: 7%; width: 80px; height: 26px; border-radius: 20px; background: #fff; box-shadow: 30px -8px 0 6px #fff, 120px 30px 0 -2px #fff, 150px 22px 0 4px #fff; opacity: .9; animation: drift 22s ease-in-out infinite alternate; }
.tc2-look { position: absolute; right: 8px; bottom: 8px; }
.edit-block { margin-bottom: 10px; }
.edit-block > summary { cursor: pointer; color: var(--accent-2); font-weight: 700; padding: 6px 0; }
.tc2-extra { margin-bottom: 10px; }
@container (max-width: 560px) {
  .tc2 { grid-template-columns: 1fr; }
  .tc2-right { min-height: 220px; border-left: 0; border-top: 3px solid var(--red); order: -1; }
  .tc2-name { font-size: 26px; }
}
/* Our own pixel sprites stay crisp when shown large (Pokédex hero image). */
img[src*="assets/sprites/"] { image-rendering: pixelated; }
.bm.placing .bm-viewport { cursor: copy; }
.place-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 8; background: rgba(16, 19, 28, .95); border: 1px solid var(--accent); border-radius: 12px; padding: 8px 12px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); font-size: 13.5px; }
.sel-rect { fill: rgba(139, 124, 246, .18); stroke: var(--accent-2); stroke-width: 3; stroke-dasharray: 10 6; }
.sel-rect.hide { fill: rgba(5, 6, 12, .45); stroke: #f87171; }
.tool-group .seg { display: inline-flex; gap: 2px; margin-right: 4px; }
.r-trainer { position: relative; }
.r-summon { position: absolute; top: 8px; right: 8px; z-index: 1; }
/* dice tray + animated dice */
.dice-layer { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }
.die { position: relative; }
.die.in-pool { border-color: var(--accent); color: #fff; background: var(--accent-bg); }
.die-n { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #fff; font: 800 10px var(--font); display: grid; place-items: center; padding: 0 3px; }
.pool { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 4px; }
.pool-expr { font: 700 13px ui-monospace, Consolas, monospace; color: var(--accent-2); flex: 1; }
.pool-mod { width: 56px !important; text-align: center; }
.bld-card { position: absolute; z-index: 9; min-width: 210px; background: rgba(16, 19, 28, .97); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.bld-card small { color: var(--muted); margin-top: -4px; }
.bm .regionmap, .bm-viewport { }
.dice-result { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -10px) scale(.92); z-index: 91; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; background: rgba(12, 14, 22, .9); border: 3px solid var(--c, var(--accent)); border-radius: 18px; padding: 10px 26px 12px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.dice-result.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.dice-result b { display: block; font: 900 56px/1 Inter, system-ui, sans-serif; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.dice-result b.crit { color: #3ddc84; } .dice-result b.fumble { color: #ff7b7b; }
.dice-result span { display: block; margin-top: 4px; font: 700 13px Inter, sans-serif; color: #b9bfd6; }

/* ---- GM tools: quick bar + collapsible groups */
.gm-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; margin-bottom: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; position: sticky; top: 0; z-index: 2; }
.gm-quick kbd { font-size: 10px; padding: 0 4px; margin-left: 4px; opacity: .8; }
.gm-grp { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--panel); overflow: hidden; }
.gm-grp > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-weight: 700; font-size: 13.5px; background: var(--panel2); }
.gm-grp > summary::-webkit-details-marker { display: none; }
.gm-grp > summary::after { content: "▸"; color: var(--muted); margin-left: 8px; transition: transform .15s; }
.gm-grp[open] > summary::after { transform: rotate(90deg); }
.gm-grp > summary small { margin-left: auto; font-weight: 500; }
.gm-grp > .gm-sec { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.gm-grp .scene-list { max-height: 260px; overflow: auto; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* ---- money */
.money { color: var(--gold, #f5c451); font-weight: 700; }
.money.big { font-size: 15px; }
.tb-wallet { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid #6b5a22; background: linear-gradient(180deg, #3a3116, #2a2410); color: #ffe08a; font-weight: 700; cursor: pointer; }
.tb-wallet span { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #f5c451; color: #3a2d05; font-size: 11px; }
.wallet-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.wallet-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.r-conds i { font-style: normal; margin-left: 2px; }
/* ---- spawn palette (Shift+A) */
.spawn-pal { position: absolute; right: 12px; top: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); z-index: 30; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(16, 19, 28, .97); border: 1px solid var(--line2, var(--line)); border-radius: 14px; box-shadow: var(--shadow); }
.sp-head { display: flex; align-items: center; gap: 8px; }
.sp-head .ib { margin-left: auto; }
.sp-tabs { display: flex; gap: 4px; }
.sp-tabs button { flex: 1; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text2); cursor: pointer; font-size: 12.5px; }
.sp-tabs button.on { background: var(--accent-bg); border-color: var(--accent); color: var(--text); }
.sp-body { overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sp-body h5 { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sp-opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; }
.sp-opts .num { width: 54px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.sp-mon { position: relative; }
.sp-pick { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 3px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font-size: 11px; }
.sp-pick:hover { border-color: var(--accent); }
.sp-pick img { width: 48px; height: 48px; image-rendering: pixelated; object-fit: contain; }
.sp-pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sp-pick.row { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 7px 9px; font-size: 12.5px; }
.sp-pick.row img { width: 28px; height: 28px; }
.sp-types { display: flex; gap: 2px; }
.sp-types b { width: 14px; height: 4px; border-radius: 2px; background: var(--t); }
.sp-add { position: absolute; top: 2px; right: 2px; }
.sp-list { display: flex; flex-direction: column; gap: 4px; }
.sp-row { display: flex; gap: 4px; align-items: center; }
.sp-row .sp-pick { flex: 1; }
.sp-groups { display: flex; flex-direction: column; gap: 6px; }
.sp-group { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: var(--panel2); }
.sp-group.on { border-color: var(--accent); }
.sp-members { margin: 6px 0; padding-left: 16px; font-size: 12.5px; }
.sp-members li { margin: 2px 0; }

/* ---- measure tool */
.measure-bar { max-width: min(640px, 100%); }
.measure-bar .msz { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.measure-bar input[type=range] { width: 110px; accent-color: var(--accent); }
.measure-bar .num { width: 58px; }
.aoe-cell { fill: rgba(255, 120, 80, .18); stroke: rgba(255, 140, 90, .45); stroke-width: 1; }
.aoe.beam { fill: rgba(80, 190, 255, .22); stroke: #5fc3ff; }

.rr-alt { font-weight: 800; font-size: 15px; padding: 4px 9px; border-radius: 8px; background: var(--panel3); color: var(--muted); text-decoration: line-through; opacity: .7; margin-left: 4px; }

/* ---- manual combat */
.tc-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; width: 100%; }
.tc-row.text.wide:has(.tc-btns) { flex-wrap: wrap; }
.cr-btn.k-attack { border-color: #b8860b; }
.cr-btn.k-damage { border-color: #c2453b; }
.cr-btn.k-heal { border-color: #2f9e5a; }
.cr-btn.k-save { border-color: #3f7fd6; }
.tc-row.v-hit .tc-val { color: var(--crit); font-weight: 800; }
.tc-row.v-miss .tc-val { color: var(--fumble); font-weight: 800; }
.cr-apply { margin-left: 8px; }
.combat-mode .seg { margin-left: 4px; }
.tag.manual { background: rgba(245, 196, 81, .15); color: #f5c451; border-color: #6b5a22; }

/* ---- encounter lineup */
.lineup { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; }
.lu-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.lu-row img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; }
.lu-row small { display: block; }

.combat-mode { border-width: 2px; }
.combat-mode.auto { border-color: #3f7fd6; }
.combat-mode.manual { border-color: #f5c451; }
.combat-mode .cm-dot { width: 9px; height: 9px; border-radius: 50%; background: #3f7fd6; margin: 0 2px 0 4px; }
.combat-mode.manual .cm-dot { background: #f5c451; }
.combat-mode.live .cm-dot { animation: cm-pulse 1.2s ease-in-out infinite; }
@keyframes cm-pulse { 50% { box-shadow: 0 0 0 5px rgba(255,255,255,0); transform: scale(1.35); } }
.combat-mode.ro { font-size: 12px; font-weight: 700; padding: 6px 10px; }

.sp-types-f { display: flex; gap: 6px; }
.sp-types-f select { flex: 1; min-width: 0; }

.price-edit { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.price-edit .num { width: 84px; }
.price-custom { color: var(--gold, #f5c451); font-weight: 700; }
.item-row .grow { flex: 1; }

/* ---- GM remove buttons in the roster */
.r-mon-wrap { position: relative; }
.r-mon-wrap .r-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); opacity: 0; transition: opacity .12s; }
.r-mon-wrap:hover .r-x, .r-mon-wrap .r-x:focus { opacity: 1; }
.r-gm-btns { position: absolute; right: 5px; top: 5px; display: flex; flex-direction: column; gap: 2px; z-index: 1; }
.r-trainer { position: relative; }
.r-kick { margin-left: auto; opacity: .6; }
.r-kick:hover { opacity: 1; color: var(--fumble); }
.r-trainer:has(.r-gm-btns) .r-head { padding-right: 34px; }

/* ---- initiative roll call + turn banner */
.init-call { display: flex; flex-direction: column; gap: 6px; padding: 9px; margin-bottom: 8px; border: 1px solid #6b5a22; border-radius: 10px; background: rgba(245, 196, 81, .08); }
.init-call .ok { color: var(--crit); margin: 0; }
.init-call p { margin: 0; }
.init-roll { animation: init-glow 1.4s ease-in-out infinite; }
@keyframes init-glow { 50% { box-shadow: 0 0 0 4px rgba(245, 196, 81, .35); } }
.init-banner { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 25; display: block; text-align: center; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; background: rgba(16, 19, 28, .94); border: 2px solid var(--line); box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; }
.init-banner.call { border-color: #f5c451; color: #ffe08a; animation: init-glow 1.4s ease-in-out infinite; }
.init-banner.mine { border-color: var(--crit); color: #b8ffd6; }
.init-banner.wait, .init-banner.turn { color: var(--text2); }
.init-banner small { color: var(--muted); font-weight: 500; }
.tb-stage { position: relative; }

.ruler.over { stroke: var(--fumble) !important; }
.ruler-box.over { fill: rgba(120, 20, 20, .9) !important; }
.init-banner .btn { margin-left: 8px; vertical-align: middle; }

.tag.lethal { background: rgba(194, 69, 59, .18); color: #ff8a80; border-color: #6b2a24; }
.lethal-pick { text-align: left; white-space: normal; line-height: 1.35; padding: 10px 14px; }
.tok .tok-conds span[title="dead"] { filter: none; }

/* ---- step-by-step attack prompt */
.act-prompt { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 26; min-width: 300px; max-width: calc(100% - 24px); padding: 12px 16px; border-radius: 14px; background: rgba(16, 19, 28, .96); border: 2px solid var(--line2); box-shadow: var(--shadow); text-align: center; }
.act-prompt.me { border-color: var(--accent); }
.act-prompt.judge.me { border-color: #f5c451; }
.act-prompt .ap-head { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.act-prompt .ap-body { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.act-prompt .ap-x { position: absolute; top: 6px; right: 6px; }
.act-prompt .big-roll { font-size: 16px; padding: 10px 18px; animation: init-glow 1.4s ease-in-out infinite; }
.act-prompt .big-num { font-size: 22px; color: #ffe08a; }
.econ { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; margin-left: 4px; background: rgba(61, 220, 132, .15); color: #b8ffd6; border: 1px solid rgba(61, 220, 132, .4); }
.econ.spent { background: transparent; color: var(--muted); border-color: var(--line); text-decoration: line-through; }

.ap-fx { margin-top: 8px; text-align: left; font-size: 12.5px; color: var(--text2); max-width: 420px; }
.ap-fx summary { cursor: pointer; color: var(--muted); }
.ap-fx p { margin: 6px 0 0; line-height: 1.4; }
.tc-desc-row .tc-val { text-align: left !important; font-size: 12.5px; line-height: 1.4; color: var(--text2); }
.tc-desc-row { flex-direction: column !important; align-items: flex-start !important; }

/* ---- character from image */
.ocr-row { display: flex; gap: 12px; align-items: center; }
.ocr-thumb { width: 96px; max-height: 120px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); }
.ocr-prog { width: 100%; height: 8px; }
.ocr-form .attrs .guess { border-color: #6b5a22; }
.ocr-raw { max-height: 160px; overflow: auto; white-space: pre-wrap; font-size: 11px; background: var(--panel2); padding: 8px; border-radius: 8px; }

.tok-sprite.mon img, .tok-sprite .psprite { pointer-events: auto; }

.sheet-ro [data-roll-skill], .sheet-ro [data-roll-attr], .sheet-ro [data-roll-save], .sheet-ro [data-act-roll], .sheet-ro [data-mon-check], .sheet-ro .mv-use { pointer-events: none; opacity: .55; cursor: not-allowed; }

/* standard-size Pokémon art (cropped from the sprite frame) */
.tok-sprite.mon .mon-art { position: absolute; background-repeat: no-repeat; image-rendering: pixelated; pointer-events: auto; animation: mon-hop 1.4s steps(2) infinite; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
@media (prefers-reduced-motion: reduce) { .tok-sprite.mon .mon-art { animation: none; } }

/* ---- placed objects & treasure */
.tok.k-object { --ring: transparent; }
.tok-obj { position: absolute; left: 0; bottom: 0; width: 100%; height: 200%; pointer-events: none; }
.tok-obj img { width: 100%; height: 100%; image-rendering: pixelated; pointer-events: auto; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.tok.sel .tok-obj img { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 2px var(--accent)); }
.obj-badge, .obj-lock { position: absolute; top: -6px; font-size: 13px; filter: drop-shadow(0 1px 1px #000); pointer-events: none; }
.obj-badge { right: -4px; } .obj-lock { left: -4px; }
.obj-pal { max-width: 560px; }
.swl.obj img { width: 22px; height: 44px; object-fit: cover; object-position: bottom; image-rendering: pixelated; margin: -10px 0 -4px; }
.contents-list { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; }
.contents-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.contents-row img { width: 26px; height: 26px; image-rendering: pixelated; }

/* GM music player (left sidebar): the party list scrolls on its own, the dock keeps the bottom */
.tb-left { overflow: hidden; }
.tb-left > .party-list { flex: 1 1 0; min-height: 170px; overflow: auto; }
.tb-left > .init { flex: none; max-height: 30%; overflow: auto; }
.left-dock { flex: 0 1 auto; min-height: 0; max-height: 58%; display: flex; flex-direction: column; gap: 6px; }
.left-dock .story-btn { justify-content: flex-start; flex: none; }
.music-box { min-height: 0; display: flex; flex-direction: column; }
.music-box:empty { display: none; }
.music { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; font-size: 13px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--panel)) 0%, var(--panel) 55%); }
.mu-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; background: none; border: 0; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.mu-head b { font-size: 13px; letter-spacing: .02em; }
.mu-head small { margin-left: auto; }
.mu-chev { color: var(--muted); width: 12px; text-align: center; }
.mu-head small + .mu-chev { margin-left: 4px; }
.mu-head b + .mu-chev { margin-left: auto; }
.mu-eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 14px; height: 13px; }
.mu-eq i { flex: 1; height: 30%; background: var(--accent-2); border-radius: 1px; }
.music.is-playing .mu-eq i { animation: mu-eq .9s ease-in-out infinite; }
.music.is-playing .mu-eq i:nth-child(2) { animation-delay: -.3s; }
.music.is-playing .mu-eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes mu-eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .music.is-playing .mu-eq i { animation: none; height: 70%; } }
.mu-now { padding: 0 10px; }
.mu-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-prog { height: 5px; margin: 7px 0 4px; border-radius: 99px; background: var(--line2); overflow: hidden; }
.mu-prog.seek { cursor: pointer; height: 7px; }
.mu-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width .25s linear; }
.mu-meta { display: flex; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
.mu-ctl { display: flex; align-items: center; gap: 4px; padding: 6px 10px 8px; flex-wrap: wrap; }
.mu-b { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; font-size: 13px; padding: 0; }
.mu-b:hover { border-color: var(--accent); }
.mu-b.on { background: var(--accent-bg); border-color: var(--accent); }
.mu-b.sm { width: 26px; height: 26px; border: 0; background: none; }
.mu-play { width: 38px; height: 38px; font-size: 16px; background: var(--accent); border-color: var(--accent); color: #fff; }
.mu-play:hover { background: var(--accent-2); }
.mu-vol { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 90px; }
.mu-vol input { flex: 1; min-width: 50px; accent-color: var(--accent); }
.mu-body { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 55%, transparent); }
.music:not(.open) .mu-body, .music:not(.open) .mu-meta small:last-child { display: none; }
.mu-q { margin: 8px 8px 2px; }
.mu-list { list-style: none; margin: 0; padding: 4px; overflow: auto; min-height: 60px; flex: 1 1 auto; }
.mu-list li { display: flex; align-items: center; border-radius: 7px; }
.mu-list li:hover { background: var(--panel2); }
.mu-list li.cur { background: var(--accent-bg); }
.mu-list li.cur .mu-tt { color: var(--accent-2); font-weight: 600; }
.mu-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; color: var(--text); padding: 5px 6px; font: inherit; font-size: 12.5px; cursor: pointer; }
.mu-n { width: 20px; flex: none; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mu-list li.cur .mu-n { color: var(--accent-2); }
.mu-tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-del { flex: none; width: 22px; height: 22px; margin-right: 2px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; font-size: 11px; opacity: 0; }
.mu-list li:hover .mu-del { opacity: 1; }
.mu-del:hover { color: var(--bad); background: var(--panel3); }
.mu-empty { padding: 10px 12px 2px; }
.mu-empty p { margin: 0 0 4px; }
.mu-foot { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.mu-foot .btn { white-space: nowrap; }
.mu-foot .primary { flex: 1; }
.mu-steps { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.mu-snip { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 2px; }
.mu-snip code { flex: 1; display: block; max-height: 64px; overflow: auto; font-size: 11px; padding: 6px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; user-select: all; }
.mu-paste { width: 100%; margin: 6px 0 10px; font-family: ui-monospace, monospace; font-size: 12px; }

/* GM story map (full-screen planning board) */
.sm-ov { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr auto; outline: none; }
.sm-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.sm-top .sm-pick { max-width: 200px; }
.sm-sep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }
.sm-saved { min-width: 64px; }
.sm-x { margin-left: auto; }
.sm-stage { position: relative; overflow: hidden; cursor: grab; touch-action: none;
  background-color: var(--bg2); background-image: radial-gradient(circle, var(--line2) 1px, transparent 1.4px); background-size: 26px 26px; }
.sm-stage:active { cursor: grabbing; }
.sm-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.sm-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; color: #5b6488; }
.sm-edge { fill: none; stroke: #5b6488; stroke-width: 2.2; }
.sm-edge.done { stroke: var(--good); }
.sm-edge.dead { stroke-dasharray: 6 6; opacity: .45; }
.sm-edge.sel { stroke: var(--accent-2); stroke-width: 3; }
.sm-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.sm-temp { fill: none; stroke: var(--accent-2); stroke-width: 2; stroke-dasharray: 5 5; }
.sm-elabel { position: absolute; transform: translate(-50%, -50%); background: var(--panel2); border: 1px solid var(--line2); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
.sm-elabel.empty { opacity: 0; padding: 0 6px; }
.sm-stage:hover .sm-elabel.empty { opacity: .55; }
.sm-elabel.sel { border-color: var(--accent); opacity: 1; }
.sm-node { position: absolute; background: var(--panel); border: 1px solid var(--line2); border-left: 4px solid var(--kc, var(--accent)); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); cursor: pointer; user-select: none; z-index: 2; }
.sm-node.sel { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.sm-node.k-start { --kc: var(--good); }
.sm-node.k-event { --kc: #60a5fa; }
.sm-node.k-choice { --kc: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--panel)); }
.sm-node.k-combat { --kc: var(--bad); }
.sm-node.k-outcome { --kc: var(--accent); }
.sm-node.k-note { --kc: var(--muted); background: var(--panel2); }
.sm-node.s-now { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 60%, transparent), var(--shadow); }
.sm-node.s-done { opacity: .78; }
.sm-node.s-done .sm-st { color: var(--good); }
.sm-node.s-now .sm-st { color: var(--warn); }
.sm-node.s-skipped { opacity: .45; }
.sm-node.s-skipped b { text-decoration: line-through; }
.sm-nh { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.25; }
.sm-nh b { flex: 1; word-break: break-word; }
.sm-nb { margin-top: 4px; font-size: 12px; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.sm-kids { font-size: 11px; margin-top: 4px; }
.sm-handle { position: absolute; right: -8px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--kc, var(--accent)); border: 2px solid var(--bg); cursor: crosshair; }
.sm-node:not(:hover):not(.sel) .sm-handle { opacity: .35; }
.sm-help { position: absolute; left: 12px; bottom: 10px; pointer-events: none; }
.sm-side { width: 300px; border-left: 1px solid var(--line); background: var(--panel); padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.sm-side label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sm-side textarea { resize: vertical; min-height: 110px; }
.sm-status { display: flex; flex-wrap: wrap; gap: 4px; }
.sm-outs { display: flex; flex-direction: column; gap: 3px; }
.sm-out { text-align: left; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.sm-out i { color: var(--gold); font-style: normal; }
@media (max-width: 900px) {
  .sm-ov { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .sm-side { width: auto; max-height: 45vh; border-left: 0; border-top: 1px solid var(--line); }
  .sm-add span { display: none; }
  .sm-help { display: none; }
}
.mu-list:empty { display: none; }

/* Map toolbar: slides away behind its toggle tab */
.bm-tools { flex-direction: row; align-items: flex-start; gap: 6px; }
.bm-tools-in { display: flex; flex-direction: column; gap: 8px; min-width: 0; visibility: visible; transition: visibility 0s linear 0s; }
.bm-tools-in > * { transition: transform .38s cubic-bezier(.2, .9, .25, 1.15), opacity .28s ease; transform-origin: left center; }
.bm-tools-in > :nth-child(2) { transition-delay: .04s; }
.bm-tools-in > :nth-child(3) { transition-delay: .08s; }
.bm-tools-in > :nth-child(4) { transition-delay: .12s; }
.bm-tools.collapsed .bm-tools-in { visibility: hidden; pointer-events: none; transition: visibility 0s linear .34s; }
.bm-tools.collapsed .bm-tools-in > * { transform: translateX(-28px) scale(.94); opacity: 0; transition: transform .3s cubic-bezier(.5, 0, .75, 0), opacity .22s ease; }
.bm-tools.collapsed .bm-tools-in > :nth-child(2) { transition-delay: .03s; }
.bm-tools.collapsed .bm-tools-in > :nth-child(3) { transition-delay: .06s; }
.bm-tg { flex: none; width: 30px; height: 46px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: rgba(16, 19, 28, .92); color: var(--text2); cursor: pointer; box-shadow: var(--shadow); transition: background .2s, border-color .2s, color .2s, width .3s cubic-bezier(.2, .9, .25, 1.15); }
.bm-tg:hover { color: var(--text); border-color: var(--accent); }
.bm-tg span { display: inline-block; font-size: 22px; line-height: 1; transition: transform .38s cubic-bezier(.2, .9, .25, 1.15); }
.bm-tools.collapsed .bm-tg { width: 38px; background: var(--accent-bg); border-color: var(--accent); color: var(--accent-2); }
.bm-tools.collapsed .bm-tg span { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .bm-tools-in > *, .bm-tg, .bm-tg span { transition: none !important; } }
/* End-encounter dialog */
.enc-dest { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.enc-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); cursor: pointer; }
.enc-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.enc-opt span { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.enc-opt select { margin-top: 4px; max-width: 100%; }

/* Token facing: flip / rotate the art only (ring, HP bar and name stay put) */
.tok .tok-sprite.mon .mon-art, .tok .tok-sprite.mon img, .tok .tok-sprite .psprite, .tok .tok-img img { transform: scaleX(var(--flip, 1)) rotate(var(--rot, 0deg)); transition: transform .25s cubic-bezier(.2, .9, .25, 1.15); }
.hud-orient { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.hud-orient .ib { width: 28px; height: 28px; }
.hud-orient .ib.on { background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }

/* Token pop-up: one movable, resizable window with foldable sections */
.bm-hud { background: rgba(21, 25, 37, .97); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); gap: 0; padding: 0; resize: both; min-width: 230px; min-height: 52px; overflow: auto; }
.bm-hud.free { max-height: none; }
.bm-hud.dragging { opacity: .92; cursor: grabbing; user-select: none; }
.bm-hud.min { resize: none; height: auto !important; min-height: 0; overflow: hidden; }
.bm-hud.min .hud-body { display: none; }
.bm-hud > .hud-card { border: 0; box-shadow: none; background: transparent; }
.hud-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; cursor: grab; position: sticky; top: 0; z-index: 1; background: rgba(21, 25, 37, .98); border-bottom: 1px solid var(--line); touch-action: none; }
.bm-hud.min .hud-bar { border-bottom: 0; }
.hud-bar img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; background: var(--panel2); border-radius: 9px; flex: none; }
.hud-bar .grow { min-width: 0; }
.hud-bar b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-bar .ib.sm { width: 26px; height: 26px; flex: none; }
.hud-head { cursor: grab; }
.hud-body { display: flex; flex-direction: column; padding: 4px 8px 10px; }
.hud-sec { border-bottom: 1px solid var(--line); }
.hud-sec:last-child { border-bottom: 0; }
.hud-sh { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 4px; background: none; border: 0; color: var(--text2); font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; cursor: pointer; text-align: left; }
.hud-sh small { text-transform: none; font-weight: 400; letter-spacing: 0; }
.hud-sh span { flex: 1; }
.hud-sh i { font-style: normal; transition: transform .2s; }
.hud-sec.shut .hud-sh i { transform: rotate(-90deg); }
.hud-sb { display: flex; flex-direction: column; gap: 8px; padding: 0 2px 10px; }
.hud-sec.shut .hud-sb { display: none; }
.hud-mvs { display: flex; flex-direction: column; gap: 5px; }

/* move picker: where the move comes from */
.mv-src { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: var(--panel3); color: var(--text2); margin-left: 4px; white-space: nowrap; }
.mv-src.s-start { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.mv-src.s-level { background: var(--accent-bg); color: var(--accent-2); }
.mv-src.s-tm { background: color-mix(in srgb, #60a5fa 22%, transparent); color: #93c5fd; }
.mv-src.s-egg { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }

/* defeated (lethal, GM only sees it) and knocked-out creatures */
.tok.defeated { filter: grayscale(1) brightness(.6); opacity: .45; }
.tok.defeated .tok-sprite::before { border-style: dashed; }
.tok.ko .tok-sprite > *:not(.tok-hp) { filter: grayscale(.8) brightness(.8); }
.tok.ko .mon-art, .tok.ko .psprite { animation: none !important; rotate: 80deg; }
/* chat: GM edits damage before applying */
.cr-applybox { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
.cr-applybox .input.num { width: 58px; }
/* opportunity attack prompt */
.act-prompt.oa { border-color: var(--warn); }
.oa-moves { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }

/* GM music library: collapsible groups */
.music { position: relative; }
.mu-tools { display: flex; gap: 4px; align-items: center; padding: 8px 8px 4px; }
.mu-tools .mu-q { flex: 1; min-width: 0; margin: 0; }
.mu-groups { overflow: auto; min-height: 60px; flex: 1 1 auto; padding: 2px 4px 4px; }
.mu-grp { border-radius: 9px; margin-bottom: 3px; border: 1px solid transparent; }
.mu-grp.open { background: color-mix(in srgb, var(--panel2) 60%, transparent); border-color: var(--line); }
.mu-grp.cur > .mu-gh .mu-gt span { color: var(--accent-2); }
.mu-grp.drop-on { border-color: var(--accent); background: var(--accent-bg); }
.mu-gh { display: flex; align-items: center; gap: 2px; }
.mu-gt { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px 6px; background: none; border: 0; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; border-radius: 8px; }
.mu-gt:hover { background: var(--panel2); }
.mu-gt i { font-style: normal; color: var(--muted); width: 10px; transition: transform .18s; }
.mu-grp.open .mu-gt i { transform: rotate(90deg); }
.mu-gt span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-gt small { color: var(--muted); font-weight: 400; font-size: 11px; background: var(--panel3); border-radius: 99px; padding: 0 6px; }
.mu-gb { flex: none; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 12px; opacity: .7; }
.mu-gh:hover .mu-gb, .mu-gb:focus { opacity: 1; }
.mu-gb:hover { background: var(--panel3); color: var(--text); }
.mu-grp .mu-list { padding: 0 2px 4px 10px; min-height: 0; max-height: none; overflow: visible; }
.mu-grp .mu-list li[draggable] { cursor: grab; }
.mu-grp .mu-list li.dragging { opacity: .45; }
.mu-menu { position: absolute; z-index: 20; min-width: 200px; max-width: 260px; max-height: 260px; overflow: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); }
.mu-menu button { display: block; width: 100%; text-align: left; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.mu-menu button:hover:not(:disabled) { background: var(--accent-bg); }
.mu-menu button:disabled { opacity: .4; cursor: default; }
.mu-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

/* rests */
.tool-sep { width: 1px; height: 22px; background: var(--line2); margin: 0 3px; }
.bm-tools.dragging { opacity: .9; }
.act-prompt.rest { border-color: var(--good); }
.rest-body { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }
.rest-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.rest-row:last-of-type { border-bottom: 0; }
/* heroic inspiration */
.r-trainer { position: relative; }
.insp-tog { position: absolute; left: 34px; top: 32px; z-index: 2; width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); font-size: 12px; cursor: pointer; filter: grayscale(1); opacity: .55; padding: 0; }
.insp-tog:hover { opacity: 1; }
.insp-tog.on { filter: none; opacity: 1; border-color: var(--gold); background: color-mix(in srgb, var(--gold) 25%, var(--panel2)); box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 60%, transparent); }
.insp-tog.ro { cursor: help; }
.btn.insp { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.insp-rr { margin-top: 6px; }
.table.no-insp .insp-rr { display: none; }
/* GM move editor */
.em-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.em-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border-left: 4px solid var(--t); background: var(--panel2); }
.em-row b { flex: 1; }

/* move range preview */
.mv-range { pointer-events: none; }
.mvr-reach { fill: rgba(96, 165, 250, .16); stroke: #60a5fa; stroke-width: 2.5; stroke-dasharray: 8 6; animation: mvr-in .18s ease-out; }
.mvr-area { fill: rgba(251, 146, 60, .28); stroke: #fb923c; stroke-width: 2.5; animation: mvr-in .18s ease-out; }
.mvr-self { fill: rgba(139, 124, 246, .25); stroke: var(--accent-2); stroke-width: 2; }
@keyframes mvr-in { from { opacity: 0; } to { opacity: 1; } }
.tok.in-reach .tok-sprite::before { border-color: #fbbf24; box-shadow: 0 0 12px #fbbf24, inset 0 0 6px rgba(251, 191, 36, .6); }
.tok.in-reach .tok-img { box-shadow: 0 0 0 3px #fbbf24, 0 0 12px #fbbf24; }

.pick-row.out { opacity: .45; cursor: not-allowed; }

/* import: picture of a sheet */
.modal.drop-on, .drop-on .modal { outline: 3px dashed var(--accent); outline-offset: -6px; }
.ocr-mons { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel2); }
.ocr-mon-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ocr-mon { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); font-size: 13px; }
.ocr-mon img { width: 28px; height: 28px; image-rendering: pixelated; }
.ocr-mon .input.num { width: 48px; }

/* loot window */
.loot-note { padding: 8px 10px; border-left: 3px solid var(--gold); background: var(--panel2); border-radius: 6px; font-style: italic; }
.loot-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.loot-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.loot-row img { width: 30px; height: 30px; image-rendering: pixelated; }
.loot-coin { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: #3a2a00; font-weight: 800; }
/* trading */
.r-trade { position: absolute; right: 6px; top: 6px; z-index: 2; }
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0; }
.trade-side { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel2); display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.trade-side h4 { margin: 0; }
.trade-list { display: flex; flex-direction: column; gap: 4px; }
.trade-item { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 7px; background: var(--panel); font-size: 13px; }
.trade-item img { width: 26px; height: 26px; image-rendering: pixelated; }
.trade-item .input.num { width: 56px; }
.trade-item.out { opacity: .5; }
.act-prompt.trade { border-color: var(--gold); }
.trade-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
@media (max-width: 700px) { .trade-grid, .trade-sum { grid-template-columns: 1fr; } }

.create-trainer .attrs .input.num { width: 58px; text-align: center; }
.create-trainer .a-mod { color: var(--muted); font-size: 11px; }
.stat-hint.warn { color: var(--warn); }
.stat-modes { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* move checklist */
.mv-picked { position: sticky; top: -1px; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; flex-wrap: wrap; }
.mv-chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; align-items: center; }
.move-row .mv-tick { width: 18px; height: 18px; flex: none; vertical-align: -3px; display: inline-grid; place-items: center; border: 1.5px solid var(--line2); border-radius: 6px; margin-right: 6px; font-weight: 800; color: #fff; }
.move-row.sel { background: color-mix(in srgb, var(--t) 18%, var(--panel2)); outline: 1.5px solid var(--accent); }
.move-row.sel .mv-tick { background: var(--accent); border-color: var(--accent); }

/* physical dice */
.phys-tog { margin-left: 6px; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text2); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.phys-tog.on { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); }
.phys-entry { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.phys-entry .input.num { width: 72px; }
.phys-entry [data-pe-nat] { width: 58px; }

.ask-roll { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ask-roll .btn.primary { min-width: 200px; }
.ask-roll .phys-entry .input.num { width: 96px; }
.gm-init-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.gm-init-list .input.num { width: 80px; }
.cr-pair { display: inline-flex; gap: 2px; }

.mu-loop { flex: none; width: 22px; height: 22px; border: 0; border-radius: 5px; background: none; cursor: pointer; font-size: 11px; opacity: 0; filter: grayscale(1); }
.mu-list li:hover .mu-loop, .mu-loop:focus { opacity: .8; }
.mu-loop:hover { opacity: 1; filter: none; background: var(--panel3); }
.mu-loop.on { opacity: 1; filter: none; background: var(--accent-bg); }
