:root {
  color-scheme: dark;
  --bg: #17120d; --panel: #211a13; --panel2: #2b2219; --line: #43362a; --text: #efe5d2; --muted: #a8987f;
  --gold: #c9a24b; --gold2: #e6c477; --red: #b5433a; --green: #6b8f3a; --radius: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); }
#app { height: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.02rem; color: var(--gold2); margin-top: 1em; }
p { margin: 0 0 .7em; }
a { color: var(--gold2); }
code { font: 12.5px ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.3); padding: 1px 4px; border-radius: 4px; }
mark { background: rgba(201,162,75,.4); color: inherit; border-radius: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .error { color: #ee8a80; min-height: 0; } .center { text-align: center; } .grow { flex: 1; min-width: 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 11px; cursor: pointer; transition: border-color .12s, background .12s; }
button:hover { border-color: var(--gold); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--gold2); outline-offset: 1px; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--gold); border-color: var(--gold); color: #21180c; font-weight: 600; }
button.primary:hover { background: var(--gold2); border-color: var(--gold2); }
button.danger { color: #f0a097; }
button.danger:hover { border-color: var(--red); background: rgba(181,67,58,.2); }
button.icon { background: none; border: 0; padding: 2px 6px; color: var(--muted); }
button.icon:hover { color: var(--text); }
button.link { background: none; border: 0; padding: 0; color: var(--gold2); text-align: left; text-decoration: underline; text-underline-offset: 2px; }
button.wide { width: 100%; padding: 8px; }
input, select, textarea { background: #15100b; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--gold); }
input[type=color] { padding: 2px; height: 32px; }
input[type=range] { accent-color: var(--gold); padding: 0; }
input[type=file] { padding: 5px; }
textarea { resize: vertical; }
.field { display: block; margin-bottom: 10px; flex: 1; min-width: 0; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.field small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.row.end { justify-content: flex-end; margin: 10px 0 0; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; background: rgba(255,255,255,.08); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.badge.gm { background: rgba(201,162,75,.2); color: var(--gold2); }
.badge.player { background: rgba(91,143,185,.2); color: #9cc5e6; }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100000; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--gold); padding: 8px 14px; border-radius: 8px; box-shadow: 0 6px 22px rgba(0,0,0,.5); max-width: 560px; }
.toast.error { border-color: var(--red); background: #3a1a15; }

/* login */
.center-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 20%, #33271b 0%, var(--bg) 62%); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 18px 60px rgba(0,0,0,.5); }
.login-card h1 { margin: 8px 0 2px; text-align: center; }
.login-card > .muted { text-align: center; margin-bottom: 18px; }
.login-logo { display: block; width: 62px; height: 62px; margin: 0 auto; }
.email-chip { display: flex; justify-content: space-between; gap: 8px; background: rgba(0,0,0,.25); padding: 6px 10px; border-radius: 6px; overflow-wrap: anywhere; }
.invite-note { background: rgba(201,162,75,.14); border: 1px solid rgba(201,162,75,.4); border-radius: 6px; padding: 8px 10px; text-align: center; }

/* pages */
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topnav nav { display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 600 1.1rem var(--serif); color: var(--text); text-decoration: none; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.who { color: var(--muted); }
.page { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.card:hover { border-color: var(--gold); transform: translateY(-2px); }
.card .badge { float: right; }
.empty { grid-column: 1/-1; text-align: center; padding: 50px 20px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.empty h2 { color: var(--text); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 7px 13px; text-decoration: none; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--gold); }
.tabs.small { margin-bottom: 10px; }
.tabs.small button { padding: 5px 10px; }
.narrow { max-width: 500px; }
table.list { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; }
table.list th, table.list td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.off { opacity: .6; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 4px; }
.shelf { margin-top: 22px; }
.progress { margin: 8px 0; }
.progress span { display: block; font-size: 13px; color: var(--muted); }
.progress b { display: block; height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
.search-results { max-height: 45vh; overflow: auto; margin-top: 6px; }
.search-hit { display: block; width: 100%; text-align: left; margin-bottom: 5px; background: rgba(0,0,0,.2); }
.search-hit strong { display: block; color: var(--gold2); font-size: 13px; }
.search-hit span { font-size: 13px; color: var(--muted); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(8,6,4,.65); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50000; overflow: auto; }
.modal { width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.modal.wide { max-width: 800px; }
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal > header h2 { margin: 0; }
.modal-body { padding: 14px 16px 16px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.template { text-align: left; padding: 10px; }
.template strong { display: block; }
.template small { color: var(--muted); }
.test-result { min-height: 1.2em; margin: 6px 0; font-size: 13.5px; overflow-wrap: anywhere; }
.test-result.ok { color: #a9d37a; } .test-result.bad { color: #ee8a80; }
.member-list { list-style: none; padding: 0; margin: 0; }
.member-list li { padding: 3px 0; display: flex; gap: 6px; align-items: center; }
.member-list .link { margin-left: auto; font-size: 13px; }

/* map maker */
.maker > input { margin-bottom: 10px; }
.maker-preview { margin: 10px 0; }
.maker-preview canvas, .maker-preview img { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto; border-radius: 6px; border: 1px solid var(--line); }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.asset { position: relative; }
.asset .icon { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); border-radius: 4px; }
.asset-pick { display: block; width: 100%; padding: 4px; text-align: left; overflow: hidden; }
.asset-pick img { display: block; width: 100%; height: 100px; object-fit: cover; border-radius: 4px; }
.asset-pick span { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* table */
.table { position: relative; height: 100%; overflow: hidden; }
.board-wrap { position: absolute; inset: 0; }
.board { display: block; touch-action: none; cursor: grab; outline: none; }
.board[data-tool=ruler], .board[data-tool=draw], .board[data-tool^=fog] { cursor: crosshair; }
.board[data-tool=ping] { cursor: pointer; }
.board-empty { position: absolute; inset: 0 340px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); }
.board-empty h2 { color: var(--text); font-size: 1.6rem; }
.table-top { position: absolute; left: 0; right: 340px; top: 0; display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: linear-gradient(rgba(23,18,13,.95), rgba(23,18,13,.7)); z-index: 10; }
.table-top .brand { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.scene-tabs { display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: thin; }
.scene-tab { display: inline-flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; flex: none; }
.scene-tab > button:first-child { background: none; border: 0; padding: 3px 9px; white-space: nowrap; }
.scene-tab.active { border-color: var(--gold); }
.scene-tab .bring { font-size: 12px; padding: 1px 7px; margin-right: 2px; border-color: var(--gold); color: var(--gold2); background: none; white-space: nowrap; }
.live { color: #7fd06f; margin-right: 4px; font-size: 10px; }
.scene-add { flex: none; background: none; border-style: dashed; padding: 3px 9px; }
.scene-name { font-family: var(--serif); color: var(--muted); white-space: nowrap; }
.people { display: flex; align-items: center; gap: 4px; flex: none; }
.person { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid; font-size: 11px; font-weight: 700; opacity: .4; background: var(--panel); }
.person.online { opacity: 1; }
.voice { text-decoration: none; font-size: 17px; }
.conn { width: 9px; height: 9px; border-radius: 50%; background: #777; flex: none; }
.conn.on { background: #7fd06f; } .conn.off { background: var(--red); }
.rail { position: absolute; left: 8px; top: 56px; display: flex; flex-direction: column; gap: 4px; padding: 5px; background: rgba(33,26,19,.94); border: 1px solid var(--line); border-radius: 10px; z-index: 10; }
.rail button { width: 36px; height: 36px; padding: 0; font-size: 17px; background: none; border-color: transparent; }
.rail button:hover { border-color: var(--line); }
.rail button.active { background: var(--gold); color: #21180c; }
.rail-gap { height: 8px; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.swatches button { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); margin: auto; }
.swatches button.active { outline: 2px solid var(--gold2); }
.side { position: absolute; right: 0; top: 0; bottom: 0; width: 340px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 11; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.side-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 4px; color: var(--muted); position: relative; }
.side-tabs button.active { color: var(--text); border-bottom-color: var(--gold); }
.side-tabs button.unread::after { content: ""; position: absolute; top: 6px; right: 18%; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel { flex: 1; min-height: 0; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.empty-note { text-align: center; padding: 20px 8px; }

.playing { flex: none; }
.playing-chip { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.1; padding: 2px 10px; font: 600 .95rem var(--serif); border-color: var(--gold); }
.playing-chip small { font: 400 10.5px var(--sans); color: var(--muted); }
.playing-chip.empty { font: 13px var(--sans); color: var(--gold2); padding: 5px 10px; }
.welcome { position: absolute; top: 64px; left: calc((100% - 340px) / 2); transform: translateX(-50%); width: min(430px, 70%); background: var(--panel); border: 1px solid var(--gold); border-radius: 12px; padding: 16px 18px; box-shadow: 0 16px 50px rgba(0,0,0,.6); z-index: 12; text-align: center; }
.welcome h2 { font-size: 1.5rem; color: var(--gold2); margin: 2px 0 6px; }
.welcome-close { position: absolute; top: 6px; right: 6px; }
.welcome-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.list-totals { display: flex; gap: 14px; justify-content: flex-end; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.list-totals b { color: var(--gold2); }
.die-btn.book { font-size: 13px; }
.repeat input[type=checkbox] { display: block; margin: auto; }
.passkey-btn { margin-top: 8px; }
.account { display: grid; gap: 18px; max-width: 620px; }
.account section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.account section > h2 { margin-bottom: 6px; }
.qr { display: block; background: #fff; padding: 8px; border-radius: 6px; margin: 8px 0; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; font: 14px ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.3); padding: 10px; border-radius: 6px; margin: 8px 0; }
.pk-list { list-style: none; padding: 0; margin: 0 0 8px; }
.pk-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
a.who { text-decoration: none; }

/* chat */
.chat { overflow: hidden; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 3px; overflow-wrap: anywhere; }
.chat-log > :first-child { margin-top: auto; }
.chat textarea { flex: none; }
.quick-rolls { display: flex; flex-wrap: wrap; gap: 3px; flex: none; }
.quick-rolls button { padding: 1px 7px; font-size: 12.5px; }
.msg { background: rgba(0,0,0,.18); border-radius: 6px; padding: 5px 8px; flex: none; }
.msg p { margin: 2px 0 0; white-space: pre-wrap; }
.msg > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13px; }
.whisper { font-size: 11px; color: #c9a8e6; }
.msg.fresh { animation: pop .28s ease-out; }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
.msg.roll { border-left: 3px solid var(--gold); }
.msg.roll.crit { border-left-color: #7fd06f; background: rgba(127,208,111,.09); }
.msg.roll.fumble, .msg.roll.glitch { border-left-color: var(--red); background: rgba(181,67,58,.13); }
.roll-line { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; }
.dice-row { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.die { min-width: 24px; height: 24px; padding: 0 3px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #e9dcc0; color: #2a1e10; font-weight: 700; font-size: 12.5px; }
.die.max { background: var(--gold2); }
.die.one { background: #d98a80; }
.die.hit { background: #a9d37a; }
.die.dropped { opacity: .35; text-decoration: line-through; }
.fresh .die { animation: tumble .38s ease-out; }
@keyframes tumble { from { transform: rotate(-200deg) scale(.5); } }
.total { font: 700 1.5rem var(--serif); color: var(--gold2); }
.msg footer { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.note { color: var(--text); }
.handout { padding: 3px; display: block; width: 100%; margin-top: 4px; }
.handout img { display: block; max-width: 100%; max-height: 200px; margin: auto; }
.handout-view { height: 100%; overflow: auto; text-align: center; background: #000; }
.handout-view img { max-width: 100%; }
.book-link { display: block; margin-top: 4px; text-align: left; width: 100%; }

/* characters, fight, books */
.char-list, .book-list, .init-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.char-list li { display: flex; align-items: center; gap: 8px; padding: 5px; background: rgba(0,0,0,.18); border-radius: 6px; }
.char-list small { display: block; }
.char-pic { width: 34px; height: 34px; border-radius: 50%; background: var(--panel2); display: flex; align-items: center; justify-content: center; overflow: hidden; flex: none; font-weight: 700; }
.char-pic img { width: 100%; height: 100%; object-fit: cover; }
.book-list li { padding: 4px 2px; }
.fight-head { display: flex; align-items: center; gap: 5px; }
.init-list li { display: flex; align-items: center; gap: 7px; padding: 5px 7px; background: rgba(0,0,0,.18); border-radius: 6px; border: 1px solid transparent; }
.init-list li.current { border-color: var(--gold); background: rgba(201,162,75,.14); }
.init-value { min-width: 28px; text-align: center; font-weight: 700; color: var(--gold2); }
.action-card { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; flex: none; width: 36px; height: 50px; background: #f8f4e8; color: #1b1b1b; border: 1px solid #b9ae94; border-radius: 5px; line-height: 1.05; box-shadow: 0 1px 3px rgba(0,0,0,.45); }
.action-card b { font: 700 15px var(--serif); }
.action-card i { font-style: normal; font-size: 15px; }
.action-card.red { color: #b52a20; }
.action-card.joker { background: linear-gradient(160deg, #f8f4e8, #efd98f); color: #6a3d9a; }
.action-card.joker i { font-size: 9px; font-weight: 700; }
.deck { display: flex; gap: 12px; align-items: center; padding: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.deck p { margin: 0 0 4px; font-size: 13px; }
.deck .row { margin: 0; }
.deck-stack { position: relative; width: 48px; height: 64px; flex: none; }
.deck-stack span { position: absolute; width: 42px; height: 58px; border-radius: 5px; border: 2px solid #f4efe2; background: repeating-linear-gradient(45deg, #7a1f1a 0 4px, #94322b 4px 8px); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.deck-stack span:nth-child(1) { left: 0; top: 0; }
.deck-stack span:nth-child(2) { left: 3px; top: 3px; }
.deck-stack span:nth-child(3) { left: 6px; top: 6px; }
.joker-note { color: var(--gold2); }
.card-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.free-add { flex-wrap: nowrap; margin: 0; }
.free-add input { min-width: 0; }
.center-row { justify-content: center; }
.checks { display: flex; flex-wrap: wrap; gap: 3px; margin: 2px 0; }
.die-check { min-width: 26px; padding: 0 5px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; font-weight: 700; font-size: 12.5px; background: rgba(255,255,255,.1); }
.die-check.hit { background: #a9d37a; color: #1c2a10; }
.die-check.miss { color: var(--muted); }
.die-check sup { font-size: 10px; margin-left: 2px; color: #1c5a10; line-height: 1; }
.roll-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 3px 0; font-size: 13px; }
.roll-result strong { font: 700 1.1rem var(--serif); }
.roll-result .won { color: #a9d37a; }
.roll-result .lost { color: #f0a097; }
.tn-secret { border-color: #7a5fc0; color: #c9b8f0; }
.mini-cards { display: inline-flex; gap: 3px; flex: none; }
.mini-cards:empty { display: none; }
.mini-cards .action-card { width: 25px; height: 35px; }
.mini-cards .action-card b { font-size: 11px; line-height: 1.1; }
.mini-cards .action-card i { font-size: 11px; line-height: 1; }
.mini-cards .action-card.joker i { font-size: 6px; }
.playing { display: flex; align-items: center; gap: 6px; }
.combat-fields { border: 1px solid var(--line, rgba(255,255,255,.15)); border-radius: 6px; padding: 6px 10px; margin: 8px 0; }
.combat-fields legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.dmg-tag { display: inline-block; font-size: 11px; color: #f0a097; }
.tn-chip { border-color: var(--gold); color: var(--gold2); }
.cast-btn { padding: 1px 7px; font-size: 12.5px; border-color: #5c78b0; color: #a8c2f0; }
.quick-cast { padding: 8px; background: rgba(0,0,0,.2); border: 1px solid #5c78b0; border-radius: 8px; flex: none; }
.quick-cast .row { margin: 4px 0 0; }
.status-card { background: rgba(0,0,0,.18); border-radius: 8px; padding: 7px 8px; flex: none; }
.status-card > header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.char-pic.small { width: 24px; height: 24px; font-size: 12px; }
.status-row { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 12.5px; }
.status-label { width: 76px; flex: none; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-bar { position: relative; height: 18px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.status-bar i { position: absolute; inset: 0 auto 0 0; opacity: .8; }
.status-bar b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; }
.step { width: 20px; height: 20px; padding: 0; line-height: 1; flex: none; }
.coins { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; min-height: 18px; }
.coins i { width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f6e2a4, #c9a24b 60%, #8c6d27); border: 1px solid #6b5420; }
.status-conditions { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.status-conditions .badge { margin: 0; background: rgba(181,67,58,.3); color: #f0c0b8; }
.owner-pick { display: inline-flex; flex-direction: column; }
.owner-pick select { padding: 2px 4px; max-width: 120px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.portrait { width: 56px; height: 56px; border-radius: 8px; background: var(--panel2); overflow: hidden; flex: none; border: 1px solid var(--line); }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* windows */
.win { position: absolute; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 50px rgba(0,0,0,.6); resize: both; overflow: hidden; min-width: 300px; min-height: 200px; max-width: 96vw; max-height: 96vh; }
.win-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--panel2); border-bottom: 1px solid var(--line); cursor: move; user-select: none; touch-action: none; flex: none; }
.win-title { font: 600 .98rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-body { flex: 1; min-height: 0; overflow: auto; }

/* sheet */
.sheet { padding: 10px 12px 16px; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.char-name { font: 600 1.2rem var(--serif); background: none; border-color: transparent; padding: 2px 4px; }
.char-name:hover, .char-name:focus { border-color: var(--line); }
.save-status { font-size: 11.5px; padding-left: 5px; display: block; min-height: 1.2em; }
.sheet-sec { margin-bottom: 8px; }
.sheet-sec h3 { margin: 6px 0; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.sheet-grid { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 6px 8px; }
.sheet-field > span, .roll-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roll-label { background: none; border: 0; padding: 0; color: var(--gold2); text-decoration: underline dotted; text-underline-offset: 2px; width: 100%; text-align: left; }
.calc { display: block; padding: 6px 8px; background: rgba(201,162,75,.08); border: 1px solid transparent; border-radius: 6px; font-weight: 600; min-height: 34px; }
.repeat table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.repeat th { font-weight: 500; font-size: 12px; color: var(--muted); text-align: left; padding: 0 3px; }
.repeat td { padding: 2px 3px; }
.repeat input[type=number] { min-width: 46px; padding: 5px; }
.repeat select { padding: 5px 2px; min-width: 56px; }
.row-actions { white-space: nowrap; width: 1%; }
.die-btn { padding: 1px 7px; font-size: 16px; color: var(--gold2); }
.die-btn.alt { color: #e59a8f; }

/* pdf */
.pdf-reader { height: 100%; display: flex; flex-direction: column; outline: none; }
.pdf-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--line); flex: none; }
.pdf-bar input { width: 62px; padding: 3px 5px; }
.pdf-bar button { padding: 2px 8px; }
.pdf-bar button.on { background: var(--gold); color: #21180c; }
.pdf-main { flex: 1; min-height: 0; display: flex; position: relative; }
.pdf-outline { width: 230px; flex: none; overflow: auto; border-right: 1px solid var(--line); padding: 6px; font-size: 13px; }
.pdf-outline ul { list-style: none; margin: 0; padding-left: 10px; }
.pdf-outline > ul { padding: 0; }
.pdf-outline li { margin: 2px 0; }
.pdf-scroll { flex: 1; min-width: 0; overflow: auto; background: #0e0b08; padding: 6px; }
.pdf-page { position: relative; margin: 0 auto 8px; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.5); }
.pdf-page canvas { display: block; }
.pdf-page.cropping { cursor: crosshair; touch-action: none; }
.pdf-page.cropping .textLayer { pointer-events: none; }
.crop-rect { position: absolute; border: 2px solid var(--gold2); background: rgba(230,196,119,.2); pointer-events: none; }
.crop-menu { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; background: var(--panel2); border: 1px solid var(--gold); border-radius: 8px; z-index: 3; white-space: nowrap; }
/* text layer as pdf.js expects it: invisible glyphs on top of the page for selecting */
.textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; caret-color: CanvasText;
  -webkit-text-size-adjust: none; text-size-adjust: none; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0 0; }
.textLayer ::selection { background: rgba(0,90,200,.35); color: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.pdf-sheet-wrap { padding-top: 2px; }
.pdf-sheet { overflow-x: auto; }
.form-layer { position: absolute; inset: 0; }
.form-input { position: absolute; background: rgba(120,160,255,.12); border: 0; border-radius: 0; padding: 0 2px; color: #101030; line-height: 1.1; color-scheme: light; }
.form-input:hover, .form-input:focus { background: rgba(120,160,255,.28); outline: 1px solid #5070c0; outline-offset: 0; }
textarea.form-input { resize: none; }
.form-check { position: absolute; margin: 0; accent-color: #24408a; color-scheme: light; }

@media (max-width: 900px) {
  .side { width: 290px; } .table-top { right: 290px; } .board-empty { right: 290px; }
}
