:root {
  --text: #e1e8dd;
  --map-background: #171c19;
  --focus: #adc89c;
  --border: #3b473d;
  --surface: #202721;
  --border-soft: #333e34;
  --panel: #202721f5;
  --shadow: #00000040;
  --hover: #333f34;
  --badge-background: #8d5038;
  --badge-text: #fffefa;
  --input-background: #192019;
  --muted: #aab5a6;
  --entry-background: #252d25;
  --subtle: #84917e;
  --secret-border: #50694a;
  --secret-text: #b8d5ad;
  --hint-background: #171c19dd;
  --inset: #293229;
  --selected-background: #a1bb96;
  --selected-text: #182218;
  --selected-hover: #b4cda9;
  --accent: #97b38d;
  --shadow-soft: #00000022;
  --active: #40503f;
  --launcher-border: #566c50;
  --launcher-background: #344b37;
  --launcher-text: #edf3e9;
  --shadow-strong: #00000050;
  --launcher-hover: #435f44;
  --switch-border: #56634f;
  --switch-track: #3b4936;
  --switch-thumb: #eaf0e4;
  --switch-on: #9eb792;
  --switch-on-thumb: #1a2319;
  --die-hover-border: #68805e;
  --die-hover: #394834;
  --die-active: #46583e;
  --grid-minor: #343f35;
  --grid-major: #4b5c48;
  --grid-hex: #485644;
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--map-background);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="light"] {
  --text: #3e4942;
  --map-background: #f4f2ee;
  --focus: #657f70;
  --border: #d9d8d0;
  --surface: #faf9f6;
  --border-soft: #e4e4dc;
  --panel: #faf9f6f5;
  --shadow: #29362b12;
  --hover: #e9ebe4;
  --badge-background: #8d5038;
  --badge-text: #fffefa;
  --input-background: #fffefa;
  --muted: #63685f;
  --entry-background: #f4f4ee;
  --subtle: #92958b;
  --secret-border: #cbd5c7;
  --secret-text: #486457;
  --hint-background: #f4f2eedd;
  --inset: #f1f1eb;
  --selected-background: #3e4942;
  --selected-text: #faf9f6;
  --selected-hover: #4c5d51;
  --accent: #586b5d;
  --shadow-soft: #29362b0b;
  --active: #dde2d7;
  --launcher-border: #324639;
  --launcher-background: #3e4942;
  --launcher-text: #faf9f6;
  --shadow-strong: #29362b20;
  --launcher-hover: #4c5d51;
  --switch-border: #c7ccc1;
  --switch-track: #d9ddd3;
  --switch-thumb: #fffefa;
  --switch-on: #486457;
  --switch-on-thumb: #fffefa;
  --die-hover-border: #9ba99b;
  --die-hover: #e4e9df;
  --die-active: #d6e0d3;
  --grid-minor: #d9d8d1;
  --grid-major: #c1c4b8;
  --grid-hex: #c9ccc1;
  color-scheme: light;
}

* { box-sizing: border-box; }

.career-settings-controls { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.career-settings-controls h2 { font-size: 12px; margin: 0 0 14px; }
.notes-panel { min-width: 0; color: var(--text); font-size: 13px; }
.notes-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; }
.notes-header h1 { margin: 4px 0 0; font: 600 21px/1.2 Georgia, serif; letter-spacing: -.02em; }
.notes-eyebrow { font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.notes-header button { padding: 7px 10px; font-size: 11px; }
.notes-panel input:not([type="checkbox"]), .notes-panel select, .notes-panel textarea { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: inherit; background: var(--input-background); color: var(--text); }
.notes-panel :is(button,input,select,textarea,a,summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.notes-panel button { cursor: pointer; }
.notes-library { min-width: 0; }
.notes-resize-track { display: none; }
.notes-library-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.notes-library-heading h2 { margin: 0; font-size: 12px; color: var(--muted); }
.notes-library-heading button { padding: 7px 9px; font-size: 11px; }
#notes-filter { margin: 7px 0; padding: 6px; font-size: 11px; }
#notes-pages { display: grid; gap: 4px; max-height: 170px; overflow-y: auto; margin: 5px 0 12px; }
#notes-pages button { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; justify-items: stretch; gap: 4px; width: 100%; min-width: 0; text-align: left; padding: 9px 10px; height: auto; border: 1px solid transparent; border-left-width: 3px; border-radius: 6px; background: transparent; color: var(--text); }
#notes-pages button:hover { background: var(--hover); }
#notes-pages button[aria-current="page"] { background: var(--active); border-color: var(--border); border-left: 3px solid var(--accent); }
#notes-pages strong { font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
#notes-pages span { color: var(--muted); font-size: 10px; }
.notes-group { min-width: 0; }
.notes-archive-group { border-top: 1px solid var(--border-soft); margin-top: 8px; padding-top: 8px; }
.notes-group > summary { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 7px 8px; border-radius: 5px; cursor: pointer; list-style: none; }
.notes-group > summary::-webkit-details-marker { display: none; }
.notes-group > summary::before { content: ''; flex: 0 0 5px; height: 5px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(-45deg); }
.notes-group[open] > summary::before { transform: rotate(45deg); }
.notes-group > summary:hover { background: var(--hover); }
.notes-library-group { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; overflow-wrap: anywhere; }
#notes-pages .notes-group-count { flex-shrink: 0; color: var(--subtle); font-variant-numeric: tabular-nums; }
.notes-group-pages { display: grid; gap: 4px; }
.notes-subgroup { margin-left: 8px; }
.notes-favourites-empty { margin: 0 10px 8px; color: var(--subtle); font-size: 11px; line-height: 1.5; }
#notes-favourite[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.notes-library-subgroup { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.notes-back { display: block; height: auto; max-width: 100%; padding: 5px 0; margin: 0 0 12px; background: transparent; border: 0; color: var(--muted); text-align: left; font: inherit; font-size: 11px; overflow-wrap: anywhere; }
.notes-back:hover { color: var(--text); }
.notes-library-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.notes-library-footer button { padding: 6px 9px; font-size: 11px; }
.notes-library-footer span { color: var(--subtle); font-size: 10px; }
.notes-welcome { padding: 20px 0; color: var(--muted); line-height: 1.65; }
.notes-welcome h2 { color: var(--text); font: 500 22px/1.3 Georgia, serif; }
.notes-book { display: block; color: var(--accent); font-size: 32px; }
.notes-page-heading { display: grid; gap: 9px; }
.notes-page-heading #notes-title { font: 600 19px/1.4 Georgia, serif; padding: 8px 0; border-color: transparent; background: transparent; }
.notes-page-heading #notes-category { width: fit-content; max-width: 100%; font-size: 11px; }
.notes-classification { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.notes-classification label { display: grid; gap: 5px; min-width: 120px; max-width: 100%; color: var(--muted); font-size: 11px; }
.notes-classification label select { max-width: 320px; color: var(--text); font-size: 12px; }
.notes-classification button { height: auto; padding: 8px; font-size: 11px; }
.notes-document-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 16px; }
.notes-view-controls { display: inline-flex; gap: 3px; padding: 3px; background: var(--inset); border-radius: 7px; }
.notes-view-controls button { height: auto; padding: 6px 9px; border: 0; border-radius: 5px; font: inherit; font-size: 11px; background: transparent; color: var(--muted); }
.notes-view-controls button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px var(--shadow); color: var(--text); }
#notes-save { padding: 7px 10px; font-size: 11px; }
.notes-save-status { margin: 9px 0 16px; font-size: 10px; line-height: 1.5; color: var(--muted); }
.notes-save-status.is-error { color: #e5af89; }
:root[data-theme="light"] .notes-save-status.is-error { color: #953e29; }
.notes-content-area { min-width: 0; }
.notes-content-area[data-mode="read"] .notes-write, .notes-content-area[data-mode="edit"] .notes-prose { display: none; }
.notes-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px; background: var(--inset); border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; }
.notes-toolbar button { height: auto; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 10px; }
.notes-write #notes-content { display: block; resize: vertical; min-height: 320px; border-radius: 0 0 6px 6px; font: 13px/1.75 Consolas, monospace; tab-size: 2; }
.notes-prose { padding: 4px 0 16px; min-height: 220px; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.notes-prose p { margin: 0 0 16px; }
.notes-prose a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.notes-prose a:hover { color: var(--text); }
.notes-prose h2, .notes-prose h3, .notes-prose h4 { color: var(--text); font-family: Georgia, serif; font-weight: 500; line-height: 1.35; }
.notes-prose h2 { font-size: 24px; margin: 26px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
.notes-prose h2:first-child { margin-top: 8px; }
.notes-prose h3 { font-size: 19px; margin: 24px 0 12px; }
.notes-prose h4 { font-size: 16px; margin: 20px 0 10px; }
.notes-prose :is(ul,ol) { padding-left: 22px; margin: 12px 0 20px; }
.notes-prose li { margin: 6px 0; }
.notes-prose blockquote { margin: 18px 0; border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--inset); color: var(--muted); }
.notes-prose hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.notes-prose .notes-milestone-title { color: var(--accent); font-size: 22px; font-weight: 700; }
.notes-prose .notes-milestone-title + blockquote { border-left-width: 5px; color: var(--text); }
.player-dossier-card { padding: 18px; margin: 18px 0; border: 1px solid var(--border); border-radius: 9px; background: var(--input-background); min-width: 0; }
.player-dossier-card[hidden] { display: none; }
.dossier-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.dossier-heading h2 { margin: 4px 0 0; font: 500 20px/1.3 Georgia, serif; }
.dossier-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.dossier-actions button, .dossier-advance button, .player-dossier-card > button { padding: 7px 10px; font-size: 11px; }
.player-dossier-card form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.player-dossier-card form[hidden] { display: none; }
.player-dossier-card label { display: grid; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.player-dossier-card :is(input,select,textarea) { width: 100%; min-width: 0; box-sizing: border-box; color: var(--text); font: inherit; }
.player-dossier-card textarea { resize: vertical; line-height: 1.6; padding: 9px; }
.dossier-wide { grid-column: 1 / -1; }
.dossier-sheet-open { display: flex; align-items: end; padding-bottom: 8px; font-size: 12px; }
.dossier-sheet-open a { color: var(--accent); }
.dossier-advance { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dossier-advance span, .dossier-message { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0; }
.dossier-message:empty { display: none; }
.dossier-read { min-height: 0; padding: 0; }
.dossier-read > :last-child { margin-bottom: 0; }
.dossier-casting { margin: 0 0 18px; padding: 14px 16px; background: var(--inset); border: 1px solid var(--border); border-radius: 8px; }
.dossier-casting[hidden] { display: none; }
.dossier-casting > header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.dossier-read .dossier-casting h3 { margin: 0; font-size: 17px; }
.dossier-casting > header label, .player-dossier-card .casting-show { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.player-dossier-card .dossier-casting input[type="checkbox"], .player-dossier-card .casting-show input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.casting-pools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 8px; }
.casting-pool { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; padding: 9px 11px; border: 1px solid var(--border-soft); border-radius: 6px; background: var(--input-background); }
.casting-pool > div:first-child { flex: 1; min-width: 110px; }
.casting-pool strong { display: block; font-size: 12px; line-height: 1.5; }
.casting-pool > div > span { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; }
.casting-count { font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--accent); }
.casting-pool-controls { display: flex; gap: 5px; }
.casting-pool-controls button { width: 30px; min-height: 30px; padding: 2px; font-size: 18px; }
.casting-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.casting-footer button { padding: 6px 9px; font-size: 10px; }
.casting-footer span, .dossier-read .casting-no-slots { font-size: 10px; color: var(--muted); }
.dossier-read .casting-no-slots { margin: 4px 0 10px; }
.dossier-casting-editor > div > p { font-size: 11px; color: var(--muted); }
.dossier-casting-editor .casting-show { margin: 12px 0; }
.casting-slot-config { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: 8px; }
.casting-pact-config { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.casting-pact-config > label { min-width: 130px; }
.casting-free-config { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(60px, .6fr) minmax(130px, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 10px; }
.dossier-casting-editor h4 { font-size: 13px; margin: 18px 0 10px; }
@media (max-width: 550px) { .casting-free-config { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dossier-casting { padding: 12px; } .casting-pool-controls button { width: 36px; min-height: 36px; } }
.dossier-metadata { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 26px; margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.dossier-metadata > div { min-width: 0; }
.dossier-metadata dt, .dossier-stat-strip dt, .dossier-ability-strip dt { font: 500 10px/1.4 Arial, sans-serif; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.dossier-metadata dd { margin: 4px 0 0; font-size: 12px; line-height: 1.4; }
.dossier-metadata .dossier-source-link { margin-left: auto; font-size: 12px; }
.dossier-overview { min-width: 0; }
.dossier-read .dossier-identity { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.dossier-identity > strong:first-child { display: inline-block; margin-right: 8px; color: var(--text); font: 500 24px/1.3 Georgia, serif; }
.dossier-identity > strong:first-child a { color: inherit; text-decoration-color: var(--border); }
.dossier-stat-strip, .dossier-ability-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0 0 10px; }
.dossier-stat-strip > div { padding: 11px 13px; border-radius: 7px; background: var(--inset); border: 1px solid var(--border-soft); }
.dossier-stat-strip dd { margin: 4px 0 0; color: var(--text); font: 600 24px/1.2 Georgia, serif; }
.dossier-ability-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.dossier-ability-strip > div { padding: 6px 12px; border-left: 1px solid var(--border); }
.dossier-ability-strip dd { margin: 3px 0 0; font: 500 13px/1.5 Arial, sans-serif; color: var(--text); }
.dossier-reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.dossier-section { min-width: 0; padding: 15px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-background); }
.dossier-section:first-child { border-top: 3px solid var(--accent); padding-top: 13px; }
.dossier-read .dossier-section h3 { margin: 0 0 10px; font-size: 18px; }
.dossier-read .dossier-section h4 { margin: 14px 0 8px; font-size: 14px; }
.dossier-read .dossier-section p { margin: 9px 0; font-size: 12px; line-height: 1.65; }
.dossier-read .dossier-section :is(ul,ol) { margin: 9px 0; padding-left: 17px; }
.dossier-read .dossier-section li { margin: 5px 0; font-size: 12px; line-height: 1.6; }
.dossier-read .dossier-section > :last-child { margin-bottom: 0; }
.dossier-read .dossier-section .dossier-feature-value { font-size: 21px; line-height: 1.3; color: var(--accent); margin: 0 0 12px; }
.dossier-section .notes-table-scroll { margin: 10px 0; }
.dossier-section .notes-table { min-width: 0; font-size: 11px; }
.dossier-section .notes-table :is(th,td) { padding: 7px 8px; min-width: 0; overflow-wrap: anywhere; }
.dossier-read .dossier-review-notice, .dossier-read .dossier-empty { margin: 14px 0; font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) { .dossier-reference-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 550px) { .dossier-stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dossier-stat-strip > div { padding: 9px; } .dossier-stat-strip dd { font-size: 21px; } .dossier-ability-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dossier-metadata { gap: 12px 20px; } .dossier-metadata .dossier-source-link { margin-left: 0; } .dossier-identity > strong:first-child { display: block; margin: 0 0 5px; } }
.player-dossier-card details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.player-dossier-card details summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.dossier-reference { padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
@media (max-width: 550px) { .player-dossier-card { padding: 12px; } .player-dossier-card form { grid-template-columns: minmax(0, 1fr); } }
.notes-table-scroll { max-width: 100%; overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--border); border-radius: 7px; }
.notes-table-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.notes-table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 12px; line-height: 1.6; }
.notes-table th, .notes-table td { padding: 9px 12px; vertical-align: top; overflow-wrap: normal; border-bottom: 1px solid var(--border-soft); }
.notes-table :is(a,code) { overflow-wrap: anywhere; }
.notes-table th { background: var(--inset); font-weight: 600; }
.notes-table th:first-child, .notes-table td:first-child { min-width: 120px; }
.notes-table tbody tr:nth-child(even) { background: var(--hover); }
.notes-table tbody tr:last-child td { border-bottom: 0; }
.notes-table .notes-table-left { text-align: left; }
.notes-table .notes-table-center { text-align: center; }
.notes-table .notes-table-right { text-align: right; }
.notes-prose code, .notes-format-help code { font: 11px/1.6 Consolas, monospace; background: var(--inset); border-radius: 3px; padding: 2px 4px; }
.notes-prose mark { padding: 1px 4px; border-radius: 3px; background: var(--inset); color: var(--text); box-decoration-break: clone; }
.notes-prose .note-reference { display: inline; height: auto; padding: 1px 4px; border: 0; border-bottom: 1px dotted currentColor; border-radius: 3px; font: inherit; line-height: inherit; white-space: normal; text-align: inherit; box-decoration-break: clone; vertical-align: baseline; -webkit-tap-highlight-color: transparent; }
.notes-prose .note-reference:hover { filter: brightness(1.15); border-bottom-style: solid; }
.npc-interaction-block { --npc-rule: #b29a65; --npc-heading: #e3c884; --npc-paper: #222b22; max-width: 660px; margin: 12px 0 24px; border: 1px solid var(--border); border-block: 4px solid var(--npc-rule); border-radius: 2px; background: var(--npc-paper); box-shadow: 0 2px 5px var(--shadow-soft); overflow-wrap: anywhere; }
:root[data-theme="light"] .npc-interaction-block { --npc-rule: #913a2c; --npc-heading: #70271e; --npc-paper: #f8f2e2; }
.npc-block-section { min-width: 0; position: relative; padding: 13px 18px; }
.npc-block-section + .npc-block-section::before { content: ""; display: block; height: 5px; margin: -13px 0 9px; background: var(--npc-rule); clip-path: polygon(0 0, 100% 80%, 100% 100%, 0 100%); }
.notes-prose .npc-block-section > h3 { margin: 0 0 8px; font: bold 17px/1.2 Georgia, serif; font-variant: small-caps; color: var(--npc-heading); }
.notes-prose .npc-block-section--characterization > h3, .notes-prose .npc-block-section--interaction:has(.npc-difficulty-table) > h3 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.npc-block-section p { margin: 7px 0; font-size: 13px; line-height: 1.5; }
.npc-block-section p > strong:first-child { color: var(--text); margin-right: .18em; }
.npc-block-section .npc-field--role { margin-top: 0; font-style: italic; color: var(--npc-heading); }
.npc-block-section .npc-field--appearance { font-style: italic; }
.npc-block-section :is(ul,ol) { margin: 8px 0; padding-left: 18px; }
.npc-block-section li { margin: 5px 0; font-size: 13px; line-height: 1.5; }
.npc-block-section blockquote { margin: 10px 0 0; padding: 5px 10px; border-color: var(--npc-rule); font-size: 13px; }
.npc-block-section .notes-table-scroll { margin: 9px 0; }
.notes-prose .npc-block-section .notes-table { min-width: 0; font-size: 12px; }
.notes-prose .npc-block-section .notes-table :is(th,td) { min-width: 0; overflow-wrap: anywhere; padding: 7px 9px; }
.notes-prose .npc-block-section .notes-table .notes-table-right { width: 4ch; min-width: 2.5em; white-space: nowrap; }
.notes-prose .npc-block-section .npc-difficulty-title { margin: 0 0 3px; font: bold 17px/1.2 Georgia, serif; font-variant: small-caps; color: var(--npc-heading); }
.notes-prose .npc-block-section .npc-difficulty-classes { margin: 0 0 12px; border: 0; border-radius: 0; overflow: visible; }
.notes-prose .npc-block-section .npc-difficulty-table { width: 100%; min-width: 0; table-layout: fixed; border: 0; font-size: 12px; }
.notes-prose .npc-block-section .npc-difficulty-table :is(th,td) { width: 25%; min-width: 0; padding: 4px 2px; border: 0; text-align: center; white-space: nowrap; overflow-wrap: normal; }
.notes-prose .npc-block-section .npc-difficulty-table th { background: transparent; color: var(--npc-heading); font-weight: 600; }
.notes-prose .npc-block-section .npc-difficulty-table td { background: var(--inset); font-size: 16px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.npc-block-section > :last-child, .npc-block-section > div > :last-child { margin-bottom: 0; }
.npc-block-warning { padding: 12px 16px; margin: 0; color: var(--muted); font-size: 12px; }
.npc-block-source { padding: 0 16px 12px; margin: 0; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.npc-block-invalid > div { padding: 0 16px 12px; }
.notes-preview-body .npc-interaction-block { margin: 0 0 10px; }
.notes-preview-body .npc-block-section { padding: 11px 12px; }
.notes-preview-body .npc-block-section + .npc-block-section::before { margin-top: -11px; }
.notes-preview-body .npc-block-section :is(p,li,blockquote) { font-size: 12px; line-height: 1.45; }
.notes-preview-body .npc-block-section > h3 { font-size: 15px; }
.notes-preview-body .npc-block-section .notes-table { min-width: 0; font-size: 11px; }
.notes-preview-body .npc-block-section .npc-difficulty-title { font-size: 16px; }
.notes-preview-body .npc-block-section .npc-difficulty-table th { font-size: 11px; }
@media (max-width: 550px) { .npc-block-section { padding: 12px; } .npc-block-section + .npc-block-section::before { margin-top: -12px; } .npc-interaction-block { max-width: 100%; } .notes-prose .npc-block-section .npc-difficulty-table th { font-size: 10px; } }
.notes-reference-preview { position: fixed; z-index: 1900; display: flex; flex-direction: column; width: min(440px, calc(100vw - 24px)); max-height: min(620px, calc(100dvh - 24px)); border: 1px solid var(--launcher-border); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px var(--shadow-strong); overflow: hidden; }
.notes-reference-preview[hidden] { display: none; }
.notes-reference-preview > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.notes-preview-kind { color: var(--accent); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.notes-reference-preview > header h2 { margin: 4px 0 0; font: 500 20px/1.3 Georgia, serif; overflow-wrap: anywhere; }
.notes-reference-preview .notes-preview-close { flex: 0 0 32px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: 24px/1 sans-serif; }
.notes-reference-preview .notes-preview-close:hover { color: var(--text); background: var(--hover); }
.notes-reference-preview .notes-preview-body { min-height: 0; max-height: 410px; overflow: auto; overscroll-behavior: contain; padding: 12px 16px 4px; font-size: 12px; line-height: 1.7; }
.notes-preview-body > :first-child { margin-top: 0; }
.notes-preview-body h3 { font-size: 16px; margin-top: 18px; }
.notes-preview-body h4 { font-size: 14px; }
.notes-preview-body .notes-table { min-width: 360px; font-size: 11px; }
.notes-preview-body .runeboard { padding: 10px; margin: 10px 0; }
.notes-preview-body .runeboard-plate { padding: 6px; margin: 0; }
.notes-preview-body .runeboard-grid { width: calc(var(--runeboard-columns, 6) * 42px + 28px); }
.notes-preview-body .runeboard-cell { height: 42px; }
.notes-preview-body .runeboard-rune-shape { width: 22px; height: 22px; }
.notes-preview-body .runeboard-rune-name { font-size: 8px; }
.notes-preview-body .runeboard-cell > .runeboard-token { min-width: 26px; padding: 1px; }
.notes-reference-preview > footer { padding: 10px 16px; border-top: 1px solid var(--border); }
.notes-reference-preview > footer button { padding: 7px 10px; font-size: 11px; }
@media (max-width: 550px) {
  .notes-reference-preview .notes-preview-body { max-height: min(410px, calc(100dvh - 180px)); }
  .notes-reference-preview .notes-preview-close { width: 40px; height: 40px; flex-basis: 40px; }
}
.notes-panel .note-page { color: var(--accent); background: var(--inset); }
.notes-panel .note-person { color: #cbb5ee; background: #a788db18; }
.notes-panel .note-place { color: #9bcfb9; background: #6ba78c18; }
.notes-panel .note-quest { color: #e4c18a; background: #d4a86618; }
.notes-panel .note-secret { color: #e3a6a0; background: #ce888018; }
:root[data-theme="light"] .notes-panel .note-person { color: #7651a4; }
:root[data-theme="light"] .notes-panel .note-place { color: #326a52; }
:root[data-theme="light"] .notes-panel .note-quest { color: #825a1e; }
:root[data-theme="light"] .notes-panel .note-secret { color: #963e3a; }
.note-task { list-style: none; }
.note-task input { margin: 0 8px 0 -20px; accent-color: var(--accent); }
.notes-format-help { color: var(--muted); font-size: 11px; line-height: 1.8; border-top: 1px solid var(--border-soft); padding: 12px 0; }
.notes-format-help summary { cursor: pointer; }
.notes-quick { display: grid; gap: 8px; margin-top: 15px; padding: 14px; background: var(--inset); border: 1px solid var(--border-soft); border-radius: 8px; }
.notes-quick label { font-size: 12px; font-weight: 600; }
.notes-quick textarea { resize: vertical; min-height: 65px; font-size: 12px; line-height: 1.5; }
.notes-quick button { height: auto; font-size: 11px; padding: 8px; }
.notes-quick span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.notes-page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 18px 0; }
.notes-page-footer button { font-size: 10px; padding: 6px 8px; }
.notes-notice { color: var(--muted); line-height: 1.6; font-size: 12px; }
.notes-notice:empty { display: none; }
.notes-conflict { padding: 12px; border: 1px solid #a47a54; border-radius: 6px; background: var(--inset); margin-bottom: 12px; line-height: 1.5; font-size: 12px; }
.notes-conflict button { height: auto; padding: 8px; margin: 4px 0; width: 100%; font-size: 11px; }
.notes-dialog { width: min(460px, calc(100% - 32px)); padding: 26px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; }
.notes-dialog::backdrop { background: #0008; }
.notes-dialog h2 { font: 500 24px/1.3 Georgia, serif; margin: 0 0 20px; }
.notes-dialog p { color: var(--muted); line-height: 1.7; }
.notes-dialog label { display: grid; gap: 8px; margin: 16px 0; font-size: 12px; }
.notes-dialog div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.notes-muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.notes-popout .app-shell { display: block; overflow: auto; background: var(--surface); }
.notes-popout .notes-panel { display: flex; flex-direction: column; min-height: 100%; }
.notes-popout .notes-header { padding: 24px 32px; margin: 0; flex-shrink: 0; }
.notes-popout .notes-header h1 { font-size: 27px; }
.notes-popout .notes-eyebrow { font-size: 10px; }
.notes-game-link { font-size: 12px; color: var(--muted); text-decoration: none; padding: 8px; }
.notes-popout .notes-workspace { display: grid; grid-template-columns: var(--notes-pages-width, 240px) 10px minmax(0, 1fr); flex: 1; }
.notes-popout .notes-library { padding: 26px 20px; background: var(--map-background); }
.notes-popout .notes-resize-track { display: block; background: var(--map-background); border-inline: 1px solid var(--border-soft); cursor: col-resize; touch-action: none; }
.notes-popout .notes-resize { display: flex; justify-content: center; position: sticky; top: 0; height: 190px; padding-top: 115px; outline-offset: -2px; }
.notes-popout .notes-resize::before { content: ''; width: 2px; height: 32px; background: var(--muted); border-radius: 2px; }
.notes-popout .notes-resize-track:hover, .notes-popout .notes-resize:focus-visible, .notes-is-resizing .notes-resize-track { background: var(--active); }
.notes-popout .notes-resize-track:hover .notes-resize::before, .notes-popout .notes-resize:focus-visible::before, .notes-is-resizing .notes-resize::before { background: var(--accent); }
.notes-is-resizing, .notes-is-resizing * { cursor: col-resize !important; user-select: none !important; }
.notes-popout #notes-pages { max-height: calc(100dvh - 310px); }
.notes-popout #notes-pages button { padding: 12px 10px; }
.notes-popout .notes-library-footer { border: 0; margin: 0; padding: 12px 0; }
.notes-popout .notes-document { padding: 28px 36px; min-width: 0; }
.notes-popout .notes-page-heading { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.notes-popout #notes-title { font-size: 27px; }
.notes-popout .notes-prose { font-size: 15px; }
.notes-popout .notes-welcome { max-width: 400px; margin: 80px auto; text-align: center; }
.notes-popout .notes-welcome h2 { font-size: 30px; }
.notes-popout .notes-content-area[data-mode="split"] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
.notes-popout .notes-write #notes-content { min-height: 450px; }
.notes-popout .notes-content-area[data-mode="split"] .notes-prose { max-height: 550px; overflow-y: auto; padding-right: 8px; }
.notes-popout .notes-notice { position: fixed; right: 20px; bottom: 8px; max-width: 450px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 18px var(--shadow); }
@media (max-width: 850px) {
  .notes-popout .notes-document { padding: 24px; }
  .notes-popout .notes-content-area[data-mode="split"] { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 550px) {
  .notes-popout .notes-workspace { display: block; }
  .notes-popout .notes-library { border-right: 0; border-bottom: 1px solid var(--border); }
  .notes-popout #notes-pages { max-height: 150px; }
  .notes-popout .notes-header { padding: 20px; }
}

.token-stats { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); padding: 3px 5px; white-space: nowrap; font: 600 9px/1.2 "Segoe UI", system-ui, sans-serif; }
.token-statuses { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.token-statuses > span, .encounter-status-icons > span { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 1px 3px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); font: 600 11px/1 "Segoe UI", system-ui, sans-serif; }
.combat-editor { margin-top: 18px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.combat-editor input:not([type="checkbox"]), .combat-editor select, .encounter-panel input:not([type="checkbox"]) { min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--input-background); color: var(--text); padding: 7px; font: inherit; font-size: 12px; }
.combat-editor input:focus-visible, .combat-editor select:focus-visible, .encounter-panel input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.combat-fields, .encounter-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.combat-fields label, .encounter-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.combat-actions { display: flex; align-items: center; gap: 5px; margin: 10px 0; }
.combat-actions button, .combat-editor > button, .status-add button, #encounter-end { height: auto; min-height: 30px; padding: 7px; font-size: 11px; }
.health-adjust input { flex: 1; width: 0 !important; }
.health-adjust button { white-space: nowrap; flex-shrink: 0; }
.combat-display, .combat-statuses, #encounter-add-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 12px; }
.combat-editor summary, #encounter-add-section summary { cursor: pointer; padding-bottom: 8px; font-weight: 600; }
.combat-display table { width: 100%; border-collapse: collapse; font-size: 11px; }
.combat-display th { text-align: left; font-weight: 500; color: var(--muted); }
.combat-display td, .combat-display th { padding: 5px 2px; }
.combat-display select { padding: 5px; font-size: 10px; }
.combat-display input, .status-public input, .status-row input, .encounter-panel input[type="checkbox"] { accent-color: var(--focus); }
.status-add { display: grid; gap: 8px; margin-top: 10px; }
.status-public { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status-row { display: grid; grid-template-columns: 1fr auto 25px; gap: 5px; align-items: center; margin: 6px 0; font-size: 11px; }
.status-row > span { overflow-wrap: anywhere; }
.status-row label { display: flex; align-items: center; color: var(--muted); font-size: 10px; }
.status-row button { height: 25px; padding: 3px; }
.zero-hp { flex-wrap: wrap; font-size: 11px; }
.encounter-order { list-style: none; padding: 0; margin: 18px 0; }
.encounter-row { padding: 12px 10px; margin: 8px 0; border: 1px solid var(--border); border-radius: 9px; background: var(--entry-background); }
.encounter-row-heading { display: flex; align-items: center; gap: 5px; }
.encounter-rank { min-width: 15px; color: var(--muted); font-size: 11px; }
.encounter-row-heading button { height: 25px; padding: 2px 4px; font-size: 13px; }
.encounter-row-heading .encounter-name { flex: 1; min-width: 0; height: auto; justify-content: flex-start; text-align: left; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; border-left: 3px solid; border-radius: 0; padding-left: 7px; }
.encounter-grip { cursor: grab; }
.encounter-row.is-dragging { opacity: .5; }
.encounter-row.drop-before { border-top: 3px solid var(--focus); }
.encounter-row.drop-after { border-bottom: 3px solid var(--focus); }
.encounter-fields { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 9px; }
.encounter-fields label { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.encounter-fields label:first-child { font-size: 0; }
.encounter-fields label:first-child::before { content: 'Init.'; font-size: 10px; }
.encounter-fields input { padding: 5px !important; }
.encounter-fields .encounter-initiative { width: 42px !important; }
.encounter-fields .encounter-hp { width: 46px !important; }
.encounter-fields .encounter-adjust-toggle { height: 25px; padding: 3px 5px; font-size: 10px; margin-left: auto; }
.encounter-maximum { font-size: 10px; color: var(--muted); }
.encounter-detail { margin: 8px 0 0; font-size: 10px; color: var(--muted); }
.encounter-detail:empty { display: none; }
.encounter-status-icons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.encounter-status-icons:empty { display: none; }
.encounter-candidate { display: grid; grid-template-columns: 1fr 60px; align-items: center; gap: 8px; margin: 8px 0; }
.encounter-candidate label { display: flex; gap: 7px; align-items: center; min-width: 0; font-size: 12px; }
.encounter-candidate label span { overflow-wrap: anywhere; }
#encounter-add { width: 100%; margin-top: 10px; font-size: 12px; }
.encounter-panel .form-status { font-size: 11px; line-height: 1.5; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

.app-shell { display: flex; width: 100%; height: 100%; height: 100dvh; }
.player-mobile-only, .player-panel-backdrop { display: none; }

[hidden] { display: none !important; }
.signin-screen { min-height: 100dvh; height: 100%; overflow: auto; display: grid; place-items: center; padding: 32px; background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px); background-size: 64px 64px; }
.signin-card { width: min(100%, 480px); padding: 36px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 24px 80px var(--shadow-strong); }
.signin-brand { display: flex; align-items: center; gap: 12px; color: var(--accent); font-weight: 600; letter-spacing: .04em; }
.signin-brand svg { width: 36px; height: 36px; stroke: currentColor; stroke-width: 1.3; }
.signin-card h1 { margin: 24px 0 8px; font-size: 26px; letter-spacing: -.025em; }
.signin-intro, .accounts-intro { color: var(--muted); margin: 0 0 24px; font-size: 14px; line-height: 1.6; }
.character-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.character-card { display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--input-background); color: var(--text); text-align: left; cursor: pointer; min-height: 56px; }
.character-card:hover { background: var(--hover); }
.character-card[aria-pressed="true"] { border-color: var(--focus); background: var(--active); box-shadow: 0 0 0 1px var(--focus); }
.character-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--inset); color: var(--accent); font-size: 14px; font-weight: 700; }
.account-badge, #accounts-list small { margin-left: auto; color: var(--accent); font-size: 10px; font-weight: 700; }
.signin-card label, .account-form label { display: block; font-size: 12px; font-weight: 600; margin: 0 0 8px; }
.signin-card input, .account-form input { width: 100%; background: var(--input-background); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font: inherit; margin-bottom: 16px; }
#signin-pin { font-size: 22px; letter-spacing: .3em; }
.primary-button, .secondary-button, #accounts-list button { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.primary-button { background: var(--selected-background); color: var(--selected-text); font-weight: 600; }
.primary-button:hover { background: var(--selected-hover); }
.signin-card .primary-button:disabled, .accounts-dialog .primary-button:disabled { opacity: .6; cursor: default; background: var(--selected-background); color: var(--selected-text); }
#signin-submit { width: 100%; padding: 13px; }
.secondary-button, #accounts-list button { background: var(--input-background); color: var(--text); }
.secondary-button:hover, #accounts-list button:hover { background: var(--hover); }
.form-status { font-size: 12px; color: var(--muted); line-height: 1.5; }
.account-controls { display: grid; gap: 6px; padding: 0 0 20px; border-bottom: 1px solid var(--border-soft); margin-bottom: 22px; }
#account-role { font-size: 12px; color: var(--muted); }
#signout { margin-top: 8px; justify-self: start; }
.account-controls .form-status:empty, #grid-save-status:empty { display: none; }
.account-management-controls { padding-top: 20px; }
.account-management-controls h2 { margin: 0 0 12px; font-size: 13px; }
.accounts-dialog { width: min(600px, calc(100vw - 64px)); max-height: calc(100dvh - 64px); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); padding: 28px; box-shadow: 0 20px 80px var(--shadow-strong); }
.accounts-dialog::backdrop { background: #0008; }
.accounts-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.accounts-header h2 { margin: 0; font-size: 20px; }
#accounts-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
#accounts-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; }
#accounts-list small { margin-left: 10px; }
.account-form { border-top: 1px solid var(--border-soft); padding-top: 8px; margin-top: 20px; }
.account-form h3 { font-size: 15px; margin: 16px 0; }
.accounts-notice { background: var(--entry-background); border: 1px solid var(--border); padding: 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; }
.player-name-control output { display: block; margin-top: 8px; font-size: 14px; font-weight: 600; }
.player-name-control > span { display: block; font-size: 12px; }
.map { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; }
#map-tokens { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.player-token { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; padding: 4px; border: 3px solid var(--launcher-border); border-radius: 50%; background: var(--launcher-background); color: var(--launcher-text); font: 600 10px/1.1 "Segoe UI", system-ui, sans-serif; text-align: center; overflow: visible; box-shadow: 0 2px 6px var(--shadow); pointer-events: auto; cursor: default; user-select: none; touch-action: none; }
.token-label { display: block; max-width: 100%; min-width: 0; white-space: pre; pointer-events: none; }
.player-token.is-own { box-shadow: 0 2px 6px var(--shadow), inset 0 0 0 1px var(--focus); }
.player-token.is-movable { cursor: grab; }
.player-token.is-dragging { cursor: grabbing; z-index: 1; box-shadow: 0 4px 12px var(--shadow-strong); }
.player-token.is-saving { cursor: progress; }
.player-token.is-hidden-to-players { opacity: .4; }
.player-token[data-size="small"] { padding: 1px; font-size: 8px; }
.player-token[data-size="large"] { font-size: 16px; }
.player-token:hover { background: var(--launcher-hover); }
.player-token:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.player-token.is-selected { outline: 3px solid #efc871; outline-offset: 4px; }
:root[data-theme="light"] .player-token.is-selected { outline-color: #a36d18; }
.token-inspector { position: absolute; top: 24px; right: 24px; z-index: 3; display: flex; flex-direction: column; width: 280px; max-height: calc(100dvh - 136px); overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 5px 24px var(--shadow); }
#inspector-toggle { width: 100%; flex-shrink: 0; height: auto; min-height: 54px; justify-content: space-between; padding: 14px 16px; border-radius: 11px; text-align: left; gap: 16px; }
.inspector-heading { display: grid; gap: 4px; min-width: 0; }
.inspector-heading strong { font-size: 13px; }
#inspector-selection-name { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#inspector-toggle svg { width: 16px; height: 16px; transform: rotate(180deg); }
.token-inspector.is-collapsed #inspector-toggle svg { transform: none; }
#inspector-body { min-height: 0; overflow-y: auto; padding: 2px 16px 16px; }
#inspector-empty { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 20px; }
#inspector-name-form > label, #inspector-create-options > label:not(.switch-setting), #inspector-selected > label:not(.switch-setting) { display: block; font-size: 11px; margin: 8px 0; }
.inspector-name-row, .inspector-add-row { display: flex; gap: 6px; }
#inspector-name, #inspector-create-size, #inspector-role, #inspector-create-role { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--input-background); color: var(--text); padding: 9px 10px; font: inherit; font-size: 12px; }
#inspector-name:focus-visible, #inspector-create-size:focus-visible, #inspector-role:focus-visible, #inspector-create-role:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
#inspector-save-name { flex-shrink: 0; border: 1px solid var(--border); }
#inspector-reload-name { color: var(--muted); height: 30px; font-size: 11px; }
#inspector-token-size { margin: 7px 0 18px; color: var(--muted); font-size: 11px; }
.token-role-hint { margin: 6px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#inspector-centre { width: 100%; margin-top: 18px; gap: 8px; font-size: 12px; }
#inspector-centre svg { width: 16px; height: 16px; }
.inspector-create { flex-shrink: 0; padding: 16px; border-top: 1px solid var(--border-soft); }
#inspector-add { flex: 1; gap: 8px; font-size: 12px; }
#inspector-add svg { width: 16px; height: 16px; }
#inspector-add-options { width: 38px; padding: 0; }
#inspector-add-options svg { width: 16px; height: 16px; }
#inspector-add-summary { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
#inspector-create-options { padding-top: 8px; }
#inspector-create-options .switch-setting { margin-top: 14px; font-size: 11px; }
#inspector-status { margin: 12px 0 0; }
#inspector-map-name-form > label { display: block; font-size: 11px; margin: 8px 0; }
#inspector-map-name { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--input-background); color: var(--text); padding: 9px 10px; font: inherit; font-size: 12px; }
#inspector-map-save-name { flex-shrink: 0; border: 1px solid var(--border); }
#inspector-map-centre { width: 100%; margin-top: 14px; font-size: 12px; }
.inspector-check { display: grid; grid-template-columns: 16px 1fr; gap: 5px 8px; align-items: center; margin: 16px 0; font-size: 11px; line-height: 1.4; cursor: pointer; }
.inspector-check input { accent-color: var(--focus); margin: 0; width: 14px; height: 14px; }
.inspector-check small { grid-column: 2; color: var(--muted); font-size: 10px; }
.inspector-check small:empty { display: none; }
.inspector-visibility-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.inspector-visibility-actions button { padding: 8px 4px; font-size: 10px; }
.selection-area { fill: var(--focus); fill-opacity: .12; stroke: var(--focus); stroke-width: 1.5; stroke-dasharray: 5 3; pointer-events: none; }
.map.has-token-inspector .map-hint { right: 324px; }
.token-controls { margin-top: 20px; margin-bottom: 24px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.token-controls h2 { margin: 0 0 18px; font-size: 13px; }
.token-controls .switch-setting + .switch-setting { margin-top: 16px; }
.token-controls > button { width: 100%; margin-top: 8px; }
.tokens-dialog { width: min(800px, calc(100vw - 48px)); max-width: 800px; }
.token-editor-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; }
.token-picker > button { width: 100%; }
#token-list { list-style: none; padding: 0; margin: 12px 0; max-height: 470px; overflow-y: auto; }
#token-list li { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
#token-list .token-picker-item { display: block; height: auto; flex: 1; min-width: 0; text-align: left; padding: 10px; }
#token-list .token-picker-item[aria-pressed="true"] { background: var(--selected-background); color: var(--selected-text); }
#token-list .token-visibility-action { flex: none; padding: 6px 8px; min-width: 48px; font-size: 11px; }
#token-list strong, #token-list small { display: block; overflow-wrap: anywhere; }
#token-list small { margin-top: 5px; font-size: 11px; }
#token-form h3 { margin: 0 0 18px; font-size: 16px; }
#token-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#token-fields > label:not(.switch-setting) { display: block; margin: 14px 0 8px; font-size: 12px; }
#token-fields > input, #token-size, #token-role { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--input-background); color: var(--text); font: inherit; font-size: 13px; }
.token-visibility { margin: 20px 0; }
.token-controllers { border: 1px solid var(--border-soft); border-radius: 7px; padding: 12px; }
.token-controllers legend { font-size: 12px; }
.token-controllers p { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 0 0 12px; }
#token-controllers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#token-controllers label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
#token-controllers input { accent-color: var(--accent); }
.token-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#token-delete { margin-top: 18px; color: var(--muted); }
#token-delete-confirmation p { font-size: 12px; }
.token-map-status { position: absolute; top: 20px; left: 24px; z-index: 2; max-width: min(420px, calc(100% - 48px)); padding: 10px 14px; margin: 0; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--panel); font-size: 12px; pointer-events: none; }

[hidden] { display: none !important; }
#dice-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 1; transition: opacity 180ms ease; }
#dice-overlay canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
#dice-overlay.is-fading { opacity: 0; transition: opacity 900ms ease; }
.map-hint, .view-controls { z-index: 2; }

#map {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  outline: none;
}

#map.is-dragging { cursor: grabbing; }
#map:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }

.sidebar {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 280px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#sidebar-toggle { width: 32px; height: 32px; flex-shrink: 0; }
.sidebar-content { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: 24px 20px; }
.sidebar-settings { flex-shrink: 0; }
.sidebar-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 24px; flex-shrink: 0; }
.sidebar-tabs button { flex: 1; padding: 9px 4px; height: auto; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; }
.sidebar-tabs button[aria-selected="true"], .builder-tools button[aria-pressed="true"] { background: var(--selected-background); color: var(--selected-text); }
.builder-panel { flex-shrink: 0; }
.builder-tools { display: flex; gap: 8px; }
.builder-tools button { flex: 1; }
.builder-panel h2 { font-size: 13px; margin: 0 0 16px; }
.builder-selection, .builder-boxes { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
#box-delete { width: 100%; margin-top: 18px; }
#box-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#box-list button { width: 100%; text-align: left; padding: 10px; font-size: 11px; height: auto; }
#box-list button[aria-pressed="true"] { border-color: var(--focus); background: var(--active); }
.map-box-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; outline: none; }
#map-fog { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
[data-fog-tool][aria-pressed="true"] { background: var(--selected-background); color: var(--selected-text); }
#fog-section input[type="range"] { padding: 0; }
.box-shape { fill: var(--focus); fill-opacity: .07; stroke: var(--focus); stroke-width: 2; }
.map-box.is-private { opacity: .4; }
.map-box.is-selected .box-shape, .box-handle { stroke: #efc871; }
:root[data-theme="light"] .map-box.is-selected .box-shape, :root[data-theme="light"] .box-handle { stroke: #a36d18; }
.box-handle { fill: var(--panel); stroke-width: 2; }
.box-handle[data-corner="nw"], .box-handle[data-corner="se"] { cursor: nwse-resize; }
.box-handle[data-corner="ne"], .box-handle[data-corner="sw"] { cursor: nesw-resize; }
.map.is-building .map-box { cursor: move; }
.map.is-drawing-box #map { cursor: crosshair; }
.map.is-drawing-box .player-token { pointer-events: none; }
.map-box.is-preview .box-shape { stroke-dasharray: 6 4; }
.studio-hit .box-shape { fill: transparent; fill-opacity: 1; stroke: none; }
.studio-hit { outline: none; }
.map.is-drawing-box .map-box, .map.is-drawing-box .map-box * { pointer-events: none !important; }
.studio-hit.is-selected .box-shape { fill: #b5802110; stroke: #b58021; stroke-width: 2; stroke-dasharray: 5 4; }
.studio-hit.is-preview .box-shape { fill: #b5802122; stroke: #b58021; stroke-width: 2; }
.studio-hit.is-cut .box-shape { fill: #c4433722; stroke: #c44337; }
.studio-hit[role="link"] { cursor: pointer; }
.studio-hit[role="link"]:focus .box-shape { stroke: #b58021; stroke-width: 2; }
.studio-hit.is-draft .box-shape { stroke: #59816b; stroke-width: 1; stroke-dasharray: 3 6; }
.generator-intro { margin: -10px 0 20px; }
.sidebar.generator-workbench:not(.is-collapsed) { width: 350px; }
.generator-room-editor { padding: 15px; border: 1px solid var(--border); border-radius: 8px; margin: 14px 0; }
.generator-panel .generator-presets button { min-width: 70px; }
#generator-room-list button[aria-pressed="true"] { background: var(--selected-background); color: var(--selected-text); }
#generator-variation { margin: auto; }
.generator-quick-actions { position: absolute; top: 119px; left: 22px; z-index: 3; padding: 10px 12px; max-width: 320px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 11px; }
.generator-quick-actions .builder-tools { display: flex; gap: 6px; margin-top: 8px; }
.generator-quick-actions button { height: auto; padding: 7px 9px; font-size: 11px; }
.generator-summary { white-space: pre-line; }
.generator-panel .primary-button { width: 100%; margin-bottom: 12px; }
.generator-panel .builder-tools { margin-top: 8px; }
.generator-field-row { display: flex; gap: 12px; }
.generator-field-row label { flex: 1; min-width: 0; }
.generator-panel input[type="range"] { padding: 0; }
.generator-summary { font-size: 12px; line-height: 1.6; margin: 10px 0 15px; color: var(--text); }
#generator-target { display: block; margin: 7px 0 0 14px; font-size: 10px; font-weight: 400; color: var(--muted); }
#generator-room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#generator-room-list button { width: 100%; text-align: left; padding: 8px; font-size: 11px; height: auto; }
.generator-preview-badge { position: absolute; top: 75px; left: 22px; z-index: 3; padding: 9px 12px; border: 1px dashed #59816b; border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12px; pointer-events: none; }
.map-floor-control { position: absolute; top: 22px; left: 22px; z-index: 3; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 12px; box-shadow: 0 4px 18px #0001; }
.map-floor-control select { max-width: 230px; background: var(--panel); color: var(--text); border: 0; font: inherit; }
#map-preview-badge { border-left: 1px solid var(--border); padding-left: 10px; color: var(--selected-text); }
.studio-section { border-bottom: 1px solid var(--border-soft); padding: 0 0 15px; margin-bottom: 17px; }
.studio-section summary { cursor: pointer; font-size: 12px; font-weight: 600; padding: 8px 0 14px; }
#studio-active-layer { display: block; margin: 7px 0 0 14px; font-size: 10px; font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.builder-panel label:not(.switch-setting) { font-size: 11px; }
.builder-panel select, .builder-panel input:not([type="checkbox"]), .builder-panel textarea, #token-floor { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: var(--input-background); font: inherit; font-size: 12px; margin: 6px 0 12px; }
.builder-panel textarea { min-height: 72px; resize: vertical; }
.builder-panel .switch-setting { margin: 12px 0; font-size: 11px; }
.builder-panel .builder-tools { flex-wrap: wrap; margin-bottom: 12px; }
.builder-panel .builder-tools button { min-width: 80px; padding: 8px 6px; height: auto; font-size: 11px; }
.studio-name-form { display: flex; align-items: baseline; gap: 5px; }
.studio-name-form input { min-width: 0; }
.studio-name-form button { flex-shrink: 0; height: 32px; font-size: 11px; }
.studio-layer-list { list-style: none; padding: 0; margin: 14px 0 10px; display: grid; gap: 5px; }
.studio-layer-list li { display: flex; align-items: center; gap: 8px; }
.studio-layer-list button { flex: 1; min-width: 0; text-align: left; height: auto; padding: 9px 8px; font-size: 11px; overflow-wrap: anywhere; }
.studio-layer-list button[aria-pressed="true"] { border-color: var(--focus); background: var(--active); }
.studio-layer-list label { display: flex; align-items: center; gap: 3px; font-size: 10px; }
.studio-size-row { display: flex; gap: 8px; }
.studio-size-row label { flex: 1; min-width: 0; }
.studio-danger { color: var(--muted); width: 100%; font-size: 11px; }
#map-item-save, #map-item-reload { font-size: 11px; }
.sidebar-heading { margin: 0 0 28px; font-size: 18px; font-weight: 600; }
.appearance-controls { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border-soft); }
.appearance-controls h2 { margin: 0 0 20px; font-size: 13px; font-weight: 600; }
.switch-setting { display: flex; align-items: center; justify-content: space-between; font-size: 12px; cursor: pointer; }
.dice-colour-setting { margin-top: 24px; }
.dice-colour-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; }
#dice-colour-name { color: var(--muted); font-size: 11px; }
#dice-colours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dice-colour-option { position: relative; cursor: pointer; }
.visually-hidden, .dice-colour-option input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.dice-colour-swatch { position: relative; display: flex; align-items: center; justify-content: center; height: 38px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--inset); }
.dice-colour-swatch::before { content: ''; width: 24px; height: 24px; border: 1px solid #00000033; border-radius: 50%; background: var(--dice-colour); }
.dice-colour-swatch svg { position: absolute; width: 16px; height: 16px; color: var(--dice-colour-ink); stroke-width: 2.3; visibility: hidden; }
.dice-colour-option:hover .dice-colour-swatch { background: var(--hover); }
.dice-colour-option input:checked + .dice-colour-swatch { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }
.dice-colour-option input:checked + .dice-colour-swatch svg { visibility: visible; }
.dice-colour-option input:focus-visible + .dice-colour-swatch { outline: 2px solid var(--focus); outline-offset: 3px; }
.sidebar.is-collapsed { width: 64px; }
.sidebar.is-collapsed .sidebar-header { justify-content: center; padding: 0; }
.sidebar.is-collapsed .sidebar-brand { display: none; }
.sidebar.is-collapsed #sidebar-toggle svg { transform: rotate(180deg); }

#dice-log-widget { position: absolute; right: 24px; bottom: 24px; z-index: 3; }
#dice-log-toggle { gap: 10px; height: 56px; padding: 0 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: 0 3px 14px var(--shadow); font-size: 13px; font-weight: 600; }
#dice-log-toggle:hover, #dice-log-toggle[aria-expanded="true"] { background: var(--hover); }
#dice-log-badge { display: flex; align-items: center; justify-content: center; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--badge-background); color: var(--badge-text); font-size: 11px; font-variant-numeric: tabular-nums; }
.dice-log { position: absolute; right: 0; bottom: 70px; display: flex; flex-direction: column; width: 336px; height: min(440px, calc(100dvh - 128px)); padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 5px 24px var(--shadow); }
.dice-log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dice-log h2 { margin: 0; font-size: 16px; font-weight: 600; }
#dice-log-close { width: 28px; height: 28px; }
#dice-log-close svg { width: 16px; height: 16px; }
.player-name-control { margin-bottom: 16px; }
.player-name-control label { display: block; margin-bottom: 7px; font-size: 12px; }
#player-name { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--input-background); color: inherit; font: inherit; font-size: 12px; }
#player-name:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
#dice-log-storage-status { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.dice-log-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; padding-right: 4px; margin-right: -4px; }
#dice-log-empty { margin: 0; padding: 16px 0; color: var(--muted); font-size: 12px; }
#dice-log-entries { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dice-log-entry { padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--entry-background); }
.dice-log-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dice-log-player { min-width: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.dice-log-meta time { flex-shrink: 0; color: var(--muted); font-size: 10px; }
.dice-log-roll { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.dice-log-notation { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.dice-log-arrow { color: var(--subtle); font-size: 13px; }
.dice-log-value { font-size: 18px; font-weight: 600; }
.dice-log-breakdown { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.dice-log-secret { margin-left: auto; padding: 3px 7px; border: 1px solid var(--secret-border); border-radius: 5px; color: var(--secret-text); font-size: 10px; }

svg { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.map-hint {
  position: absolute;
  top: 25px;
  right: 24px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--hint-background);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.map-hint span { margin: 0 7px; color: var(--subtle); }

.grid-controls {
  font-size: 12px;
}

.grid-controls h2 { margin: 0 0 20px; font-size: 13px; font-weight: 600; }
.setting-label { margin-bottom: 8px; }
.grid-type-controls { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--inset); }
.grid-type-button { flex: 1; gap: 8px; }
.grid-type-button svg { width: 17px; height: 17px; }
.grid-type-button[aria-pressed="true"] { background: var(--selected-background); color: var(--selected-text); }
.grid-type-button[aria-pressed="true"]:hover { background: var(--selected-hover); }
.opacity-label { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; margin-bottom: 10px; }
#grid-opacity-value { color: var(--muted); font-variant-numeric: tabular-nums; }
#grid-opacity { display: block; width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
#grid-opacity:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 2px; }

.view-controls {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 3px 14px var(--shadow-soft);
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

button:hover { background: var(--hover); }
button:active { background: var(--active); }
button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button:disabled { opacity: 0.35; cursor: default; background: transparent; }
.icon-button { width: 38px; }
#zoom-level { width: 58px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.control-divider { width: 1px; height: 20px; margin: 0 6px; background: var(--border); }
.reset-button { gap: 8px; padding: 0 12px; white-space: nowrap; }
.reset-button svg { width: 17px; height: 17px; }
.fallback { position: absolute; top: 50%; width: 100%; text-align: center; }
.log-settings-controls { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--border-soft); }
.log-settings-controls h2 { margin: 0 0 12px; font-size: 13px; }
#dice-log-sync-status { margin: 8px 0; color: var(--muted); font-size: 11px; }
.log-reset-dialog { max-width: 420px; padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--text); }
.log-reset-dialog::backdrop { background: #0009; }
.log-reset-dialog h2 { margin: 0 0 16px; font-size: 20px; }
.log-reset-dialog p { font-size: 13px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

#dice-widget { position: absolute; left: 24px; bottom: 24px; z-index: 3; }
#dice-launcher { width: 56px; height: 56px; border: 1px solid var(--launcher-border); border-radius: 14px; background: var(--launcher-background); color: var(--launcher-text); box-shadow: 0 3px 14px var(--shadow-strong); }
#dice-launcher svg { width: 34px; height: 34px; stroke-width: 1.25; }
#dice-launcher:hover, #dice-launcher[aria-expanded="true"] { background: var(--launcher-hover); }
#dice-menu { position: absolute; left: 0; bottom: 70px; width: 304px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 5px 24px var(--shadow); }
.dice-menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dice-menu-heading { font-size: 13px; font-weight: 600; }
#clear-dice { gap: 5px; height: 28px; padding: 0 8px; border: 1px solid var(--border-soft); font-size: 11px; }
#clear-dice svg { width: 14px; height: 14px; }
.dice-size-setting { margin-bottom: 18px; }
.dice-size-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; }
#dice-size-value { color: var(--muted); font-variant-numeric: tabular-nums; }
#dice-size { display: block; width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
#dice-size:disabled { opacity: 0.35; cursor: default; }
#dice-size:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 2px; }
.secret-rolls-setting { margin-bottom: 14px; }
.secret-rolls-setting label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; cursor: pointer; }
.settings-switch { position: relative; appearance: none; width: 32px; height: 18px; margin: 0; border: 1px solid var(--switch-border); border-radius: 10px; background: var(--switch-track); cursor: pointer; }
.settings-switch::before { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--switch-thumb); }
.settings-switch:checked { border-color: var(--switch-on); background: var(--switch-on); }
.settings-switch:checked::before { transform: translateX(14px); background: var(--switch-on-thumb); }
.settings-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
#secret-rolls-hint { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.dice-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.die-choice { flex-direction: column; gap: 6px; height: 70px; border: 1px solid var(--border-soft); background: var(--inset); font-size: 11px; font-weight: 600; }
.die-choice svg { width: 32px; height: 32px; stroke-width: 1.25; }
.die-choice[data-die="100"] { grid-column: span 2; }
.die-choice[data-die="100"] svg { width: 42px; }
.die-choice:hover { border-color: var(--die-hover-border); background: var(--die-hover); }
.die-choice:active { background: var(--die-active); }
.die-choice:disabled { background: var(--inset); }
.dice-menu-hint { margin: 12px 0 0; font-size: 11px; color: var(--muted); }
#dice-message { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
#dice-result { position: absolute; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 2; max-width: min(680px, calc(100% - 48px)); padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: 0 3px 14px var(--shadow-soft); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; pointer-events: none; opacity: 1; transition: opacity 180ms ease; }
#dice-result.is-fading { opacity: 0; transition: opacity 900ms ease; }
.map.is-log-open #dice-result { top: 24px; bottom: auto; }

@media (max-width: 600px) {
  :root[data-role="dm"] .sidebar { width: 240px; }
  :root[data-role="dm"] .map-hint { top: auto; right: 0; bottom: 86px; width: 100%; text-align: center; background: transparent; }
  :root[data-role="dm"] .view-controls { bottom: max(20px, env(safe-area-inset-bottom)); }
}

@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .signin-screen { height: var(--visible-height, 100dvh); min-height: 0; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); align-items: start; overscroll-behavior: contain; }
  .signin-card { padding: 22px; margin: auto 0; border-radius: 16px; }
  .signin-card h1 { font-size: 24px; margin-top: 18px; }
  .signin-intro { font-size: 13px; margin-bottom: 18px; }
  .character-list { gap: 8px; margin-bottom: 18px; }
  .character-card { min-height: 56px; height: auto; padding: 10px; gap: 6px; font-size: 14px; }
  .character-avatar { width: 26px; height: 26px; font-size: 12px; }
  .signin-card .primary-button, .signin-card .secondary-button { min-height: 44px; font-size: 16px; }
  :root[data-role="player"] .app-shell { height: var(--visible-height, 100dvh); }
  :root[data-role="player"] .map { width: 100%; touch-action: none; }
  :root[data-role="player"] button { touch-action: manipulation; }
  :root[data-role="player"] .player-token { touch-action: none; -webkit-touch-callout: none; }
  :root[data-role="player"] .player-token.is-own::after { content: ''; position: absolute; inset: calc(-1 * var(--token-hit-inset, 0px)); border-radius: 50%; }
  :root[data-role="player"] .player-token.is-mobile-selected { outline: 2px solid var(--focus); outline-offset: 4px; }
  :root[data-role="player"] #player-mobile-toolbar { position: absolute; display: flex; align-items: center; gap: 4px; top: 0; left: 0; right: 0; z-index: 4; padding: calc(6px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); border-bottom: 1px solid var(--border); background: var(--panel); }
  :root[data-role="player"] #player-mobile-toolbar button { min-width: 44px; height: 44px; padding: 0 10px; gap: 5px; font-size: 13px; }
  #mobile-player-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
  #mobile-encounter.has-encounter { background: var(--active); color: var(--text); }
  :root[data-role="player"] .sidebar { display: none; position: absolute; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: 0; width: auto; max-height: calc(var(--visible-height, 100dvh) - 68px - env(safe-area-inset-top)); height: min(78dvh, 680px); z-index: 6; border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px var(--shadow-strong); padding-bottom: env(safe-area-inset-bottom); }
  :root[data-role="player"] .sidebar.is-player-open { display: flex; }
  :root[data-role="player"] .sidebar-header { min-height: 58px; padding: 0 16px; }
  :root[data-role="player"] .sidebar-brand { font-size: 15px; }
  :root[data-role="player"] #sidebar-toggle { width: 44px; height: 44px; }
  :root[data-role="player"] #sidebar-toggle svg { transform: rotate(-90deg); }
  :root[data-role="player"] .sidebar-content { padding: 16px; overscroll-behavior: contain; touch-action: pan-y; }
  :root[data-role="player"] .sidebar-content button { min-height: 44px; font-size: 14px; }
  :root[data-role="player"] #mobile-reset-view { display: flex; }
  :root[data-role="player"] .sidebar-heading { font-size: 20px; margin: 0 0 20px; }
  :root[data-role="player"] .sidebar-tabs { margin-bottom: 20px; gap: 8px; }
  :root[data-role="player"] .switch-setting { min-height: 44px; font-size: 14px; }
  :root[data-role="player"] .settings-switch { width: 44px; height: 26px; border-radius: 14px; }
  :root[data-role="player"] .settings-switch::before { width: 18px; height: 18px; top: 3px; left: 3px; }
  :root[data-role="player"] .settings-switch:checked::before { transform: translateX(18px); }
  :root[data-role="player"] .dice-colour-swatch { height: 48px; }
  :root[data-role="player"] .sidebar-content .form-status { font-size: 13px; }
  :root[data-role="player"] .player-panel-backdrop { display: block; position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%; background: #0008; border-radius: 0; }
  :root[data-role="player"] .map-hint { display: none; }
  :root[data-role="player"] .map-floor-control { top: calc(66px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); max-width: calc(100% - 24px); padding: 4px 8px; }
  :root[data-role="player"] #map-floor { height: 36px; max-width: calc(100vw - 84px); font-size: 16px; }
  :root[data-role="player"] .view-controls { bottom: calc(12px + env(safe-area-inset-bottom)); padding: 4px; border-radius: 12px; }
  :root[data-role="player"] .view-controls .icon-button { height: 44px; width: 44px; }
  :root[data-role="player"] #zoom-level { width: 42px; font-size: 11px; }
  :root[data-role="player"] .view-controls .control-divider, :root[data-role="player"] #reset-view { display: none; }
  :root[data-role="player"] #dice-widget { left: max(12px, env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); }
  :root[data-role="player"] #dice-launcher { height: 52px; width: 52px; }
  :root[data-role="player"] #dice-log-widget { right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
  :root[data-role="player"] #dice-log-toggle { height: 52px; padding: 0 10px; gap: 5px; }
  :root[data-role="player"] #dice-log-toggle svg { width: 17px; }
  :root[data-role="player"] #dice-log-badge { position: absolute; top: -6px; right: -5px; }
  :root[data-role="player"] #dice-menu { width: min(420px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); padding: 12px; bottom: 64px; max-height: calc(var(--visible-height, 100dvh) - 136px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
  :root[data-role="player"] .dice-menu-header { margin-bottom: 8px; }
  :root[data-role="player"] .dice-menu-heading { font-size: 15px; }
  :root[data-role="player"] #clear-dice { height: 44px; font-size: 12px; }
  :root[data-role="player"] .dice-size-setting { margin-bottom: 8px; }
  :root[data-role="player"] .dice-size-label { margin-bottom: 0; }
  :root[data-role="player"] #dice-size { height: 32px; touch-action: pan-y; }
  :root[data-role="player"] .secret-rolls-setting { margin-bottom: 8px; }
  :root[data-role="player"] .secret-rolls-setting label { min-height: 40px; font-size: 13px; }
  :root[data-role="player"] #secret-rolls-hint { margin-top: 0; }
  :root[data-role="player"] .die-choice { height: 64px; font-size: 13px; gap: 4px; }
  :root[data-role="player"] .die-choice svg { width: 28px; height: 28px; }
  :root[data-role="player"] .dice-menu-hint { margin-top: 8px; }
  :root[data-role="player"] #dice-overlay { top: calc(60px + env(safe-area-inset-top)); bottom: calc(76px + env(safe-area-inset-bottom)); }
  :root[data-role="player"] .map.is-dice-open #dice-overlay { bottom: var(--mobile-dice-clearance, 76px); }
  :root[data-role="player"] #dice-log-panel { width: min(420px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))); height: min(65dvh, 520px); max-height: calc(var(--visible-height, 100dvh) - 136px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); bottom: 64px; padding: 14px; }
  :root[data-role="player"] #dice-log-close { width: 44px; height: 44px; }
  :root[data-role="player"] .dice-log-header { margin-bottom: 8px; }
  :root[data-role="player"] .dice-log-scroll { touch-action: pan-y; }
  :root[data-role="player"] .dice-log-player, :root[data-role="player"] .dice-log-notation { font-size: 14px; }
  :root[data-role="player"] .dice-log-value { font-size: 21px; }
  :root[data-role="player"] #player-name { font-size: 14px; }
  :root[data-role="player"] #dice-result, :root[data-role="player"] .map.is-log-open #dice-result { top: calc(116px + env(safe-area-inset-top)); bottom: auto; max-width: calc(100% - 24px); font-size: 13px; }
  :root[data-role="player"] .token-map-status { top: calc(116px + env(safe-area-inset-top)); left: 12px; max-width: calc(100% - 24px); }
  :root[data-role="player"] .encounter-row { padding: 10px; }
  :root[data-role="player"] .encounter-row-heading .encounter-name { min-height: 44px; font-size: 14px; }
  :root[data-role="player"] .encounter-detail { font-size: 12px; }
  :root[data-role="player"] #player-token-card { display: block; position: absolute; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 3; max-height: min(44dvh, 340px); padding: 12px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 5px 24px var(--shadow); touch-action: pan-y; overscroll-behavior: contain; }
  .player-token-card-heading { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
  #player-token-card-name { border-left: 3px solid; padding-left: 8px; font-size: 15px; overflow-wrap: anywhere; }
  #player-token-card-close { height: 44px; width: 44px; }
  #player-token-card-health, #player-token-card-ac { font-size: 14px; margin: 8px 0; }
  #player-token-card-statuses { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
  #player-token-card-statuses li { padding: 6px 0; overflow-wrap: anywhere; }
}
