/* Layout idea: the world fills the screen; controls float at the edges, thumb-reachable on a phone.
   Every color and face comes from the theme tokens below, which themes.js overrides per skin. */
:root {
  --bg: #1d2622; --panel: #26322dee; --panel-2: #31403a; --ink: #efe9d8; --muted: #a9b3a6;
  --accent: #d7a84a; --accent-ink: #1d2622; --line: #4a5a52; --good: #7fc48a; --bad: #e0685a;
  --display: 'Vollkorn SC', Georgia, serif; --body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif; --radius: 6px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.35 var(--body); -webkit-tap-highlight-color: transparent; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
/* The 3D view is loading (a library of about 458 KB, once) or could not load: never an empty table (docs/specs/renderer.md, R14 step 1). */
#gl-status { position: fixed; left: 50%; top: 44%; transform: translate(-50%, -50%); z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 14px 18px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
#gl-status p { margin: 0; }
#gl-status:not(.failed) p::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: gl-spin .9s linear infinite; }
#gl-status.failed { border-color: var(--bad); }
@keyframes gl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #gl-status:not(.failed) p::before { animation: none; } }
h1, h2, h3, strong#mode, #c-name { font-family: var(--display); font-weight: 600; letter-spacing: .02em; }
h2 { margin: 0 0 12px; font-size: 20px; } h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }
/* The page may be pinch-zoomed (accessibility), so a text field must not make iOS zoom in on focus: 16px or more on touch screens. */
@media (pointer: coarse) { input, select, textarea { font-size: max(16px, 1em); } }
button { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; min-height: 40px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled, button.off { opacity: .45; }
input { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; min-height: 40px; min-width: 0; flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.note { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.check input { flex: none; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }

/* world labels */
.label { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; will-change: transform; }
.label .marks { order: -1; display: flex; gap: 3px; font-style: normal; } .label .marks:empty { display: none; }
.label .marks b { font: 700 10px/1 var(--body); padding: 2px 5px; border-radius: 8px; border: 1px solid #0007; text-shadow: none; color: #1d2622; background: #e9c46a; }
.label .marks b.dodging { background: #8fd0e8; } .label .marks b.dying { background: #e0685a; color: #fff; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .6; } } @media (prefers-reduced-motion: reduce) { .label .marks b.dying { animation: none; } }
.label .bar { width: 44px; } .label.dead { opacity: .35; } .label.dead .bar { display: none; }
.label.down span::after { content: ' (down)'; font-weight: 400; }
.bar { height: 6px; background: #0008; border-radius: 3px; overflow: hidden; border: 1px solid #0006; }
.bar i { display: block; height: 100%; background: var(--good); transition: width .3s; }
.label[data-side="foe"] .bar i { background: var(--bad); }
.floater { position: absolute; left: 0; top: 0; font: 700 20px var(--display); color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px #000; white-space: nowrap; }
.floater.dmg { color: #ff8474; font-size: 26px; } .floater.heal { color: #9df0a6; font-size: 24px; } .floater.crit { color: #ffd23f; font-size: 28px; }
.floater.miss { color: #d5d5d5; }

/* top bar */
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none; }
#top > * { pointer-events: auto; }
#status { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; display: flex; flex-direction: column; }
#status strong { font-size: 17px; } #clock { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
body.fight #status { border-color: var(--accent); }
#tools { display: flex; gap: 6px; } #tools button { background: var(--panel); position: relative; }

#order { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 62px); left: 12px; right: 12px; margin: 0; padding: 0; list-style: none; display: flex; gap: 6px; overflow-x: auto; pointer-events: none; scrollbar-width: none; }
#order li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 9px; font-size: 13px; white-space: nowrap; border-left: 4px solid var(--good); }
#order li[data-side="foe"] { border-left-color: var(--bad); } #order li.out { opacity: .4; text-decoration: line-through; }
#order li[data-side="unseen"] { border-left-color: var(--muted, #888); font-style: italic; }
#order li.now { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

#hint { position: fixed; left: 50%; transform: translateX(-50%); width: max-content; top: calc(max(10px, env(safe-area-inset-top)) + 104px); max-width: calc(100% - 24px); background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 6px 6px 6px 12px; display: flex; gap: 8px; align-items: center; font-weight: 600; }
#hint button { min-height: 32px; padding: 4px 10px; background: #0003; border-color: #0004; color: inherit; }
#hint select { min-height: 32px; max-width: 40vw; padding: 2px 6px; background: #0003; border: 1px solid #0004; border-radius: 6px; color: inherit; font: inherit; }

#cam { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; }
#cam button { width: 40px; padding: 0; background: var(--panel); font-size: 18px; }

/* dock */
#dock { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 6px; padding: 0 12px max(10px, env(safe-area-inset-bottom)); pointer-events: none; max-width: 760px; margin: 0 auto; }
#dock > * { pointer-events: auto; }
#party { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
#party button { background: var(--panel); display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 10px; min-height: 36px; }
#party button i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
#party button.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
#party button.now::after { content: 'turn'; font-size: 11px; background: var(--accent); color: var(--accent-ink); border-radius: 3px; padding: 0 4px; }
#card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; }
#card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#c-name { font-size: 18px; margin-right: 8px; } #c-sub { color: var(--muted); font-size: 13px; }
#card-head .row { margin: 0; flex-wrap: nowrap; } #btn-sheet, #btn-end { min-height: 34px; padding: 4px 12px; white-space: nowrap; }
#btn-end { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#c-hp { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; } #c-hp .bar { flex: 1; height: 10px; }
#c-res { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
#c-res span { border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; } #c-res span.spent { opacity: .4; text-decoration: line-through; }
#c-res span.have { border-color: var(--accent); }

/* panels */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel); border-left: 1px solid var(--line); padding: max(14px, env(safe-area-inset-top)) 16px 24px; overflow-y: auto; z-index: 5; backdrop-filter: blur(6px); }
.panel .close { float: right; } .panel section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
#log-list, #chron-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
#log-list li:where(.lg-line) { padding: 3px 0 3px 10px; border-left: 3px solid var(--line); } #log-list li.head { border-left-color: var(--accent); font-weight: 700; margin-top: 6px; }
#log-list li.bad { border-left-color: var(--bad); } #log-list li.good { border-left-color: var(--good); }
/* the log by combat (logview.js): chips, then fights and exploring runs as <details> */
.lg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.lg-chip { border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; min-height: 36px; font-size: 13px; }
.lg-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--bg, #fff); }
.lg-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; }
.lg-group > details > summary { cursor: pointer; padding: 8px 10px; min-height: 40px; display: grid; gap: 2px; list-style: none; }
.lg-group > details > summary::-webkit-details-marker { display: none; }
.lg-title { font-weight: 700; } .lg-title::before { content: "\25B8  "; } details[open] > summary > .lg-title::before { content: "\25BE  "; }
.lg-sub { color: var(--muted); font-size: 13px; }
.lg-fight { border-left: 4px solid var(--accent); }
.lg-rounds, .lg-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.lg-rounds { padding: 0 8px 8px; gap: 8px; }
.lg-h { margin: 4px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lg-note { margin: 0; color: var(--muted); font-size: 13px; }
#chron-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); } #chron-list time { color: var(--muted); font-size: 12px; display: block; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; text-align: center; margin: 10px 0; }
.stats div { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; } .stats b { display: block; font-size: 18px; } .stats small { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.facts { display: flex; gap: 6px; flex-wrap: wrap; } .facts span { border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; } td, th { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); } th { color: var(--muted); font-weight: 400; font-size: 12px; }
#dm-table .req { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; }
#dm-table code { font-size: 22px; letter-spacing: .15em; color: var(--accent); }

#lobby { position: fixed; inset: 0; display: grid; place-items: center; background: #000a; z-index: 10; padding: 16px; }
#lobby-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(380px, 100%); display: grid; gap: 8px; }
#lobby-card h1 { margin: 0; font-size: 30px; color: var(--accent); } #lobby-card p { margin: 0 0 6px; color: var(--muted); }
#lobby-card label { font-size: 13px; color: var(--muted); } #lobby-card .row { margin: 0; } #lobby-card .row > button { flex: 1; }
#lobby-map { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; min-height: 44px; width: 100%; font: inherit; }
#lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } #lobby-grid[hidden] { display: none; }
#lobby-grid label { position: relative; display: block; margin: 0; }
#lobby-grid input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
#lobby-grid span { display: grid; place-items: center; min-height: 44px; padding: 6px 8px; text-align: center; font-size: 14px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
#lobby-grid input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#lobby-grid input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#lobby-host, #lobby-join { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#lobby-code { text-transform: uppercase; letter-spacing: .15em; } #lobby-msg:empty { display: none; } #lobby-msg { color: var(--ink); }
button.quiet { background: transparent; }
#toast { position: fixed; left: 50%; bottom: 46%; transform: translateX(-50%); background: var(--bad); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-weight: 600; max-width: calc(100% - 32px); text-align: center; z-index: 20; box-shadow: 0 4px 20px #0006; }
@media (max-width: 480px) { #cam { top: 38%; } #order { top: calc(max(10px, env(safe-area-inset-top)) + 58px); } }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }
#toast.info { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); bottom: auto; top: 30%; }

/* who plays whom, leaving */
.assign { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.assign select { min-height: 40px; min-width: 9em; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel, #222); color: inherit; font: inherit; }
/* The square rules have long choices: the question above, the list under it, the full width. */
#dm-square-rules .assign { flex-direction: column; align-items: stretch; gap: 4px; }
#dm-square-rules .assign select { width: 100%; }
#dm-square-rules .note { margin-top: 0; }
button.leave.sure { outline: 2px solid currentColor; }

/* a creature the players can't see yet (only the DM is ever sent one) */
.label.unseen { opacity: .6; } .label.unseen span::after { content: ' (hidden)'; font-weight: 400; }

/* DM: conditions */
.cond-row select { min-height: 40px; flex: 1; min-width: 8em; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel, #222); color: inherit; font: inherit; }

/* lasting effects on the creature card */
#c-res .fx { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 12px; color: inherit; background: transparent; }
#c-res button.fx { min-height: 32px; cursor: pointer; }

/* skills on the sheet: tap to roll */
.facts .skill { font: inherit; text-transform: capitalize; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line, #3a4a44); background: transparent; color: inherit; cursor: pointer; min-height: 32px; }
.facts .skill.prof { font-weight: 700; border-color: currentColor; }

/* DM: the map editor. It takes the place of the dock while it is open. */
body.editing #dock, body.editing #hint { display: none !important; }
#editor { position: fixed; left: 0; right: 0; bottom: 0; max-width: 760px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; padding: 8px 10px max(8px, env(safe-area-inset-bottom)); display: grid; gap: 6px; z-index: 4; max-height: 55vh; overflow-y: auto; }
#editor .ed-head { display: flex; gap: 8px; align-items: center; } #editor .ed-head strong { font-family: var(--display); white-space: nowrap; }
#editor .ed-head select { flex: 1; min-width: 0; }
#editor select { min-height: 44px; padding: 4px 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-2); color: inherit; font: inherit; max-width: 100%; }
#ed-done { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#editor .ed-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; align-items: center; }
#editor .ed-row button { min-height: 44px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; }
#editor .ed-row input { min-height: 44px; } #editor .ed-row input.feet { flex: 0 0 5.5em; } #editor .ed-row select { flex: 1; }
#ed-tools button { flex: 1 1 auto; } #ed-tools button.sel, #ed-opts button.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#ed-opts { display: grid; gap: 6px; } #ed-opts .check { margin: 0; min-height: 44px; }
#ed-hint { margin: 0; color: var(--muted); font-size: 13px; }
#editor .ed-sub { margin: 0; color: var(--muted); font-size: 13px; }
#editor button.sure { outline: 2px solid currentColor; }
#editor .ed-form { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
#editor .ed-form:empty { display: none; }
#editor .ed-form label { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 0; }
#editor .ed-form input, #editor .ed-form select { flex: 1 1 8em; min-width: 0; min-height: 44px; font-size: 16px; }
#editor .ed-form .ed-dcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(10em, 1fr)); gap: 6px; }
#editor .ed-form .ed-dcs input { flex: 0 0 4.5em; }
#editor .ed-form .ed-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#editor .ed-form .ed-line > span { flex: 1 1 8em; }
#editor .ed-form button { min-height: 44px; padding: 6px 10px; }
#editor .ed-form button.sel, #editor .ed-form button.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#editor .ed-form ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
#editor .ed-form li { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
#editor .ed-form li.none { color: var(--muted); font-size: 13px; }
#editor .ed-notes { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; max-height: 32vh; overflow-y: auto; }
#editor .ed-notes ul { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; } #editor .ed-notes .bad { margin: 0; color: #e88; }
#editor .ed-notes button.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; } #editor .ed-notes[hidden] { display: none; }
#ed-grid { line-height: 1; }
#ed-alignask { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; } #ed-alignask[hidden] { display: none; }
#ed-alignhint { color: var(--muted); font-size: 13px; flex: 1 1 10em; }
#ed-bgpix label { gap: 6px; }
#ed-bgstate, #ed-scalehint { color: var(--muted); font-size: 13px; flex: 1 1 10em; }
#ed-bg select { flex: 1 1 9em; min-width: 0; } #ed-nudgestep { flex: 0 0 5.5em !important; }
#ed-scaleask { display: inline-flex; gap: 6px; align-items: center; } #ed-scaleask[hidden] { display: none; }
#ed-rstate, #ed-hread { color: var(--muted); font-size: 13px; flex: 1 1 10em; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid #0006; }
.sw-grass { background: #6f8f55; } .sw-forest { background: #4f7446; } .sw-stone { background: #9a978c; } .sw-water { background: #3f6f8c; } .sw-rock { background: #77736a; }
/* the combat tracker lives in the drawer: see drawer.css and the tracker block at the end of this file */
@media (max-width: 480px) { #tools { gap: 4px; } #tools button { padding: 8px 8px; } }

/* Undo: the DM's top-bar button and the pair in the DM panel */
#btn-undo:disabled, button.undo:disabled { opacity: .45; }
button.undo { display: inline-flex; flex-direction: column; align-items: flex-start; flex: 1 1 10em; min-width: 0; }
button.undo small { font-size: .78em; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (max-width: 480px) { #btn-undo { font-size: 0; min-width: 40px; } #btn-undo::before { content: "\21B6"; font-size: 18px; line-height: 1; } }

/* the DM's marching order */
#dm-march { list-style: none; margin: 0; padding: 0; }
#dm-march li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
#dm-march li span { flex: 1; }
#dm-march li small { opacity: .7; }
#dm-march button { min-width: 44px; min-height: 40px; }
.label .marks b.following { background: #b8d8a0; }

/* dice (docs/specs/dice.md): the overlay is there only while dice are moving; a tap on it skips */
#dice { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 8; touch-action: none; cursor: pointer; }
#dice[hidden] { display: none; }
#dice-tray { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h, 190px) + 24px); z-index: 7; width: max-content; max-width: calc(100% - 24px);
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; justify-items: center; box-shadow: 0 6px 24px #0007; backdrop-filter: blur(6px); }
#dice-tray .dt-words { display: grid; text-align: center; gap: 2px; }
#dice-tray .dt-words small { color: var(--muted); }
#dice-tray .dt-dice { touch-action: none; cursor: grab; min-height: 64px; }
#dice-tray .dt-buttons { display: flex; gap: 8px; }
#dice-tray .dt-throw { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; min-height: 44px; padding: 6px 18px; }
#dice-tray .dt-cancel { min-height: 44px; }
.dice-prefs { display: grid; gap: 4px; margin: 0 0 8px; }
.dgs { white-space: nowrap; }
.dg { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; margin-left: 2px; padding: 0 2px; font-size: 0.75em; font-weight: 700; border: 1px solid var(--line); border-radius: 3px; background: var(--panel-2); vertical-align: middle; }
.dg[data-s="20"] { clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); border: 0; background: var(--accent); color: var(--accent-ink); min-width: 1.8em; height: 1.8em; }
.dg[data-s="4"] { clip-path: polygon(50% 0, 100% 100%, 0 100%); border: 0; background: var(--accent); color: var(--accent-ink); padding-top: 0.4em; }
.dg.drop { opacity: 0.4; text-decoration: line-through; }
.dg.neg::before { content: '−'; }

/* Height tool: a small number on each tile (editor.js) */
#ed-hnums { position: absolute; left: 0; top: 0; pointer-events: none; }
#ed-hnums i { position: absolute; left: 0; top: 0; font: 700 11px/1 var(--body); font-style: normal; color: #fff; background: #0008; border-radius: 6px; padding: 1px 4px; will-change: transform; }
#ed-hnums i.up { background: #2f7d4fcc; } #ed-hnums i.down { background: #8a3b2fcc; }
#ed-hnums i:not(.up):not(.down) { opacity: .5; }

/* the Reactions section of the sheet */
#sheet-reactions .rx { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
#sheet-reactions .rx label { display: grid; gap: 2px; min-width: 0; } #sheet-reactions .rx small { color: var(--muted); font-size: 12px; }
#sheet-reactions .rx select { min-height: 44px; flex: 0 1 13em; min-width: 8em; max-width: 55%; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2, #222); color: inherit; font: inherit; }

/* The timeline (docs/specs/renderer.md, decision 3): while beats play in `wait`, a quiet "…" and the controls dimmed. A tap skips. */
#pace-wait { position: absolute; right: 12px; top: -38px; min-width: 44px; min-height: 32px; padding: 0 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 1.1rem; letter-spacing: 0.15em; cursor: pointer; }
#pace-wait[hidden] { display: none; }
body.playing #btn-end { opacity: 0.5; }

/* The tracker, a tab of the drawer (tracker.js). Rows run top to bottom in initiative order. */
.tr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tr-head strong { font-size: 17px; margin-right: 10px; } #tr-turn { color: var(--muted); }
.tr-head button { min-height: 44px; padding: 4px 14px; } #tr-edit { display: none; } #tr-edit[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tr-dm { display: flex; gap: 6px; margin-bottom: 8px; } .tr-dm input { width: 6.5em; flex: none; min-height: 44px; } .tr-dm button { flex: 1; min-height: 44px; padding: 4px 6px; }
#tr-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; align-content: start; }
#tr-list li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; border: 1px solid var(--line); border-left: 4px solid var(--good); border-radius: var(--radius); padding: 2px; }
#tr-list li[data-side="foe"] { border-left-color: var(--bad); } #tr-list li[data-side="unseen"] { border-left-color: var(--muted); border-style: dashed; border-left-style: solid; color: var(--muted); font-style: italic; }
#tr-list li.out { opacity: .55; } #tr-list li.out .tr-name { text-decoration: line-through; }
#tr-list li.now { background: var(--accent); color: var(--accent-ink); } #tr-list li.now .tr-tags span { border-color: currentColor; } #tr-list li.now button { color: inherit; }
.tr-tick { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin: 0 2px; } .tr-nobox { width: 2px; }
.tr-init { flex: none; min-width: 1.6em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-main { flex: 1 1 12em; min-width: 0; display: grid; gap: 2px; text-align: left; background: transparent; border: 0; padding: 4px 6px; min-height: 44px; color: inherit; }
li.tr-ghost .tr-main { min-height: 44px; align-content: center; }
.tr-name { font-weight: 700; overflow-wrap: anywhere; } .tr-turn { font-size: 12px; margin-right: 6px; }
.tr-hp { white-space: nowrap; display: flex; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; } .tr-hp .bar { width: 70px; flex: none; }
.tr-tags { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11px; } .tr-tags span { border: 1px solid var(--line); border-radius: 20px; padding: 0 7px; }
.tr-ctl { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; padding-right: 2px; } .tr-ctl button { min-height: 44px; min-width: 44px; padding: 4px 8px; font-size: 13px; }
.tr-empty { border: 0 !important; color: var(--muted); }
@media (max-width: 600px) {
  #tr-edit { display: inline-flex; align-items: center; }
  #tracker:not(.edit) .tr-dm, #tracker:not(.edit) .tr-tick, #tracker:not(.edit) .tr-ctl button:not([data-do="sheet"]) { display: none; }
}

#lobby-remember { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; } #lobby-remember[hidden] { display: none; }
#lobby-remember p { margin: 0; color: var(--ink); } #lobby-rejoin { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
#lobby-new[hidden] { display: none; } #lobby-card button.leave.sure { outline-offset: 2px; }
/* The keys list in Settings (docs/specs/keyboard.md) */
.keys-list { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 8px; font-size: 14px; }
.keys-list dt { margin: 0; }
.keys-list dd { margin: 0; text-align: right; white-space: nowrap; }
.keys-list kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font: 12px/1.4 ui-monospace, monospace; text-align: center; }
