/*
 * Base tabletop layout, controls, dialogs, and board rendering.
 * Keep dimensions in map coordinates in JavaScript; these rules style screen elements.
 */

@font-face {
    font-family: Satoshi;
    src: url('../webfonts/satoshi/Satoshi-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: Satoshi;
    src: url('../webfonts/satoshi/Satoshi-Medium.woff2') format('woff2');
    font-weight: 500 800;
    font-display: swap;
}
:root {
    color-scheme: dark;
    --bg: #151917;
    --panel: #1b201d;
    --line: #333b34;
    --muted: #9aa79e;
    --text: #eceee4;
    --accent: #d9bc82;
    --green: #88ad92;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font:
        14px/1.5 Satoshi,
        system-ui,
        sans-serif;
}
button,
input,
select {
    font: inherit;
}
button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}
button {
    cursor: pointer;
    color: inherit;
    background: #262d28;
    border: 1px solid #424d43;
    border-radius: 7px;
    padding: 8px 12px;
    white-space: nowrap;
}
button:hover {
    background: #354036;
    border-color: #7b8e7e;
}
button:disabled {
    opacity: 0.45;
    cursor: wait;
}
button.primary {
    background: var(--accent);
    color: #22281f;
    border-color: var(--accent);
    font-weight: 700;
}
button.primary:hover {
    background: #eed2a0;
}
button[aria-pressed='true'] {
    background: #384a3d;
    border-color: #90b497;
}
button.danger {
    color: #e6a393;
}
a {
    color: inherit;
    text-decoration: none;
}
a:hover {
    color: var(--accent);
}
input,
select {
    background: #121713;
    border: 1px solid #3b473e;
    border-radius: 6px;
    color: var(--text);
    padding: 9px 11px;
    min-width: 0;
}
input:focus,
select:focus {
    outline: 2px solid #a3b999;
    outline-offset: 1px;
}
input[type='checkbox'] {
    accent-color: var(--green);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
input[type='number'] {
    width: 75px;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
h1,
h2,
h3,
p {
    margin: 0;
}
h2 {
    font-size: 16px;
    font-weight: 600;
}
.muted {
    color: var(--muted);
}
.eyebrow {
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 700;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
[hidden] {
    display: none !important;
}
#startup {
    padding: 60px;
    text-align: center;
    color: var(--muted);
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    line-height: 1;
}
.brand-mark {
    display: block;
    width: 54px;
    height: 43px;
    object-fit: contain;
    mix-blend-mode: screen;
}
.brand > span {
    font-size: 29px;
    letter-spacing: -0.04em;
}
.brand-descriptor {
    display: block;
    font-size: 8px;
    letter-spacing: 0.35em;
    margin-top: 6px;
    margin-left: 2px;
}
.brand.compact {
    width: 46px;
    min-height: 44px;
    justify-content: center;
}
.brand.compact .brand-mark {
    width: 46px;
    height: 36px;
}
#lobby {
    max-width: 1080px;
    margin: auto;
    padding: 32px 52px 80px;
}
.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--line);
}
.lobby-header > a:last-child {
    color: var(--muted);
    font-size: 13px;
}
.lobby-intro {
    padding: 65px 0 32px;
    max-width: 620px;
}
.lobby-intro h1 {
    font-size: 58px;
    line-height: 1.15;
    font-weight: 500;
    letter-spacing: -2px;
    margin: 12px 0 22px;
}
.lobby-intro > p:last-child {
    font-size: 18px;
    color: #b6c0b7;
    max-width: 520px;
    line-height: 1.7;
}
.create-room {
    background: var(--panel);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    max-width: 620px;
}
.create-room > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}
.create-room > div {
    display: flex;
    gap: 10px;
}
.create-room input {
    flex: 1;
}
.create-room button {
    padding: 12px 20px;
}
.create-room button span {
    margin-left: 20px;
}
.create-room .gm-contact-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gm-contact-fields label { display: grid; gap: 8px; font-weight: 600; }
.gm-contact-fields input { width: 100%; min-width: 0; }
.create-room .gm-contact-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 14px 0 20px; }
@media (max-width: 600px) { .create-room .gm-contact-fields { grid-template-columns: 1fr; } }
.saved-rooms {
    margin-top: 42px;
}
.saved-rooms > p {
    font-size: 12px;
    margin-top: 7px;
}
#rooms {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}
.room-card {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 9px;
    overflow: hidden;
}
.room-card:hover {
    border-color: var(--green);
}
.room-card img {
    display: block;
    width: 100%;
    height: 135px;
    object-fit: cover;
}
.room-card div {
    padding: 15px;
}
.room-card strong {
    display: block;
    font-size: 16px;
}
.room-card small {
    color: var(--muted);
}
#gm {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    min-height: 600px;
}
.gm-header {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 17px;
    border-bottom: 1px solid var(--line);
    padding: 0 22px;
    flex-shrink: 0;
    background: #191e1a;
}
.room-heading {
    display: flex;
    flex-direction: column;
    min-width: 90px;
    max-width: 350px;
}
.room-heading > button {
    padding: 0;
    background: none;
    border: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 17px;
    font-weight: 600;
}
.room-heading > span {
    font-size: 11px;
    color: var(--green);
    margin-top: 1px;
}
.header-label {
    margin-left: auto;
    font-size: 10px;
    color: #87958b;
    letter-spacing: 2px;
    margin-right: 18px;
}
#screen-settings {
    display: none;
}
.workspace {
    display: grid;
    grid-template-columns: 238px minmax(0, 1fr) 240px;
    min-height: 0;
    flex: 1;
}
.library-panel,
.units-panel {
    background: var(--panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.library-panel {
    border-right: 1px solid var(--line);
}
.units-panel {
    border-left: 1px solid var(--line);
}
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px 14px;
    gap: 5px;
}
.panel-heading h1 {
    font-size: 18px;
    font-weight: 600;
}
.panel-heading h2 {
    font-size: 14px;
}
.panel-heading > span {
    font-size: 11px;
    color: var(--muted);
}
.panel-heading > button {
    font-size: 11px;
    padding: 5px 7px;
}
input[type='search'] {
    width: 100%;
}
.search {
    margin: 0 14px 14px;
}
.search input {
    font-size: 12px;
    padding: 9px 10px;
}
.library-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 14px 16px;
    border-bottom: 1px solid var(--line);
}
.library-tabs button {
    font-size: 11px;
    padding: 5px 9px;
    border-radius: 20px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.library-tabs button[aria-pressed='true'] {
    background: #364239;
    border-color: #566d59;
    color: #e6eede;
}
#unit-library {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 8px;
    padding: 16px 14px;
    overflow-y: auto;
    flex: 1;
}
.library-token {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 7px;
    background: #232b25;
    border-color: #343e36;
    padding: 12px 4px 9px;
    font-size: 11px;
    min-height: 104px;
    white-space: normal;
}
.library-token svg {
    width: 55px;
    height: 55px;
}
.library-tip {
    font-size: 11px;
    color: #85928a;
    line-height: 1.8;
    padding: 15px;
    border-top: 1px solid var(--line);
}
.board-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #111512;
    min-height: 0;
}
.board-toolbar {
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: #1b211d;
    flex-shrink: 0;
}
.map-button {
    background: none;
    border: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: start;
    min-width: 0;
    white-space: normal;
    text-align: left;
}
.map-button:hover {
    background: none;
    border-color: transparent;
}
.map-button > .map-title {
    font-weight: 600;
    font-size: 14px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.map-button > .muted {
    font-size: 10px;
}
.map-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.notes-button {
    font-size: 11px;
    padding: 6px 9px;
    flex-shrink: 0;
}
.notes-button.has-notes::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: middle;
}
#unit-notes { width: 100%; margin: 2px 0 14px; }
#notes-dialog { width: min(680px, calc(100vw - 24px)); }
#notes-dialog.has-note-sections { width: min(960px, calc(100vw - 24px)); }
#notes-subject { color: var(--muted); overflow-wrap: anywhere; margin-top: 4px; }
.notes-layout { display: flex; gap: 20px; margin-top: 16px; }
.notes-editor { flex: 1; min-width: 0; }
#notes-sections {
    flex: 0 0 180px;
    max-height: clamp(220px, 45vh, 420px);
    overflow-y: auto;
    padding-right: 12px;
    border-right: 1px solid var(--line);
}
#notes-sections button {
    display: block;
    width: 100%;
    margin: 0 0 6px;
    padding: 10px;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
    font-size: 12px;
}
#notes-sections button.is-dirty { font-style: italic; }
#notes-section { margin: 0 0 8px; font-size: 14px; overflow-wrap: anywhere; }
#notes-text {
    display: block;
    width: 100%;
    height: clamp(160px, 38vh, 360px);
    margin-top: 0;
    padding: 14px;
    resize: vertical;
    font: inherit;
    line-height: 1.7;
    color: var(--text);
    background: var(--light-field, #121713);
    border: 1px solid var(--light-border, #3b473e);
    border-radius: 7px;
}
#notes-text:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.notes-meta, .notes-actions { display: flex; align-items: center; gap: 10px; }
.notes-meta { justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 8px; }
.notes-actions { flex-wrap: wrap; margin-top: 20px; }
.notes-actions > .muted { flex: 1; font-size: 11px; }
#notes-error { color: var(--light-danger, #e6a393); margin-top: 12px; }
@media (max-width: 680px) {
    #notes-dialog { padding: 20px; }
    .notes-layout { flex-direction: column; gap: 12px; }
    #notes-sections {
        flex-basis: auto;
        max-height: 120px;
        padding: 0 0 6px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    #notes-sections button { margin-bottom: 4px; padding: 7px 10px; }
    #notes-dialog.has-note-sections #notes-text { height: clamp(160px, 28vh, 260px); }
    .map-heading { width: 100%; justify-content: space-between; gap: 8px; }
    .map-heading .map-button { overflow: hidden; }
    .map-heading .map-button > .map-title { flex-shrink: 0; max-width: 130px; }
    .map-heading .map-button > .muted { display: none; }
    .notes-actions > .muted { flex-basis: calc(100% - 100px); }
}
.board-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    color: #adb9ae;
    font-size: 11px;
}
.board-options label {
    display: flex;
    align-items: center;
    gap: 4px;
}
.board-options .cell-label {
    font-size: 10px;
    gap: 3px;
}
.cell-label input {
    padding: 5px 3px 5px 6px;
    width: 51px;
    font-size: 11px;
}
.board-host {
    position: relative;
    overflow: hidden;
    min-height: 0;
    flex: 1;
    background-color: #101511;
    background-image: radial-gradient(#2c362e 1px, transparent 1px);
    background-size: 18px 18px;
}
.board-host > svg {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    user-select: none;
}
.board-host > svg.panning {
    cursor: grab;
}
.board-host > svg.dragging {
    cursor: grabbing;
}
#board-loading {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 16px;
    background: #151b16e8;
    border: 1px solid var(--line);
    border-radius: 20px;
    color: #d3d9cb;
    font-size: 12px;
    pointer-events: none;
}
.board-navigation {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    background: #202820ec;
    border: 1px solid #55664d;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 5px 25px #0006;
}
.board-navigation button {
    background: none;
    border: 0;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 13px;
}
.board-navigation button:hover {
    background: #3b493d;
}
.board-navigation button[aria-pressed='true'] {
    background: #445b46;
}
.board-navigation > span {
    border-left: 1px solid #4c594c;
    margin: 5px;
}
.scene-bar {
    height: 51px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: #191f1a;
    border-top: 1px solid var(--line);
    font-size: 10px;
    color: var(--muted);
    min-width: 0;
}
.scene-bar > span:first-child {
    margin-right: 4px;
}
.scene-bar > button {
    padding: 4px 9px;
    font-size: 17px;
    border-color: transparent;
    background: transparent;
}
.scene-bar #unit-count {
    margin-left: auto;
    white-space: nowrap;
}
#scene-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
}
#scene-tabs button {
    font-size: 10px;
    padding: 5px 10px;
    background: transparent;
    border-color: #343f35;
}
#scene-tabs button[aria-pressed='true'] {
    background: #344238;
    color: #d5e5ce;
    border-color: #5e7761;
}
.token {
    cursor: grab;
}
.token:active {
    cursor: grabbing;
}
.token.hidden-unit {
    opacity: 0.4;
}
.token .selection-ring {
    fill: none;
    stroke: #fff2ca;
    stroke-width: 3;
    stroke-dasharray: 6 4;
    vector-effect: non-scaling-stroke;
}
.token text {
    font-family: Satoshi, system-ui, sans-serif;
    pointer-events: none;
}
.token [data-glyph] {
    pointer-events: none;
}
#placement-hint {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #293b2a;
    border: 1px solid #8fa77e;
    padding: 9px 15px;
    border-radius: 7px;
    pointer-events: none;
}
#unit-list {
    overflow-y: auto;
    min-height: 100px;
    flex: 1;
    padding: 0 12px 14px;
}
.roster-group {
    color: #8e9d91;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    margin: 16px 4px 8px;
}
.unit-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 7px 8px;
    background: transparent;
    margin-bottom: 3px;
}
.unit-row:hover {
    background: #2c372f;
}
.unit-row[aria-pressed='true'] {
    background: #354339;
    border-color: #617962;
}
.unit-row svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.unit-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}
.unit-row > small {
    margin-left: auto;
    color: #bcc3b9;
    font-size: 9px;
}
.empty-units {
    padding: 25px 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8;
}
.empty-units strong {
    display: block;
    color: #c7d1c6;
    margin-bottom: 8px;
    font-weight: 500;
}
#inspector {
    border-top: 1px solid var(--line);
    padding: 18px 16px;
    background: #202820;
}
#inspector h2 {
    color: var(--accent);
    font-size: 12px;
    margin-bottom: 14px;
}
#inspector label:not(.check) {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 10px;
    color: #a8b6aa;
}
#inspector input:not([type='checkbox']) {
    font-size: 12px;
    padding: 7px 8px;
    width: 100%;
}
.inspector-row {
    display: flex;
    gap: 18px;
    margin: 13px 0;
    align-items: end;
}
.inspector-row > label {
    flex: 1;
}
.inspector-row > div > span {
    font-size: 10px;
    color: #a8b6aa;
}
.rotate-buttons {
    display: flex;
    gap: 4px;
    margin-top: 5px;
}
.rotate-buttons button {
    font-size: 17px;
    padding: 1px 12px;
}
.check {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #bdc9bc;
    margin: 10px 0;
}
.check input {
    margin: 0;
}
.inspector-actions {
    display: flex;
    gap: 7px;
    margin-top: 16px;
}
.inspector-actions button {
    font-size: 11px;
    flex: 1;
    padding: 7px 6px;
}
.control-tip {
    font-size: 10px;
    padding: 14px 16px;
    color: #7d8c80;
    border-top: 1px solid var(--line);
    line-height: 1.8;
}
.saving-error {
    color: #ecad8c !important;
}
dialog {
    color: var(--text);
    background: #1c231e;
    border: 1px solid #4b5b4d;
    border-radius: 14px;
    box-shadow: 0 25px 120px #0009;
    padding: 28px;
    width: min(530px, calc(100vw - 30px));
    max-height: 90dvh;
}
dialog::backdrop {
    background: #050905bb;
    backdrop-filter: blur(5px);
}
.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
}
.dialog-header h2 {
    font-size: 23px;
    font-weight: 500;
}
.dialog-header .eyebrow {
    margin-bottom: 5px;
}
.dialog-header button {
    background: transparent;
    border-color: transparent;
    font-size: 18px;
    padding: 4px 8px;
}
dialog > p {
    color: #a8b6aa;
    line-height: 1.8;
    margin: 15px 0;
}
dialog label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
    color: #a8b6aa;
    font-size: 12px;
}
dialog label input {
    width: 100%;
    font-size: 14px;
}
#map-picker {
    width: min(1040px, calc(100vw - 40px));
    padding: 25px 30px;
}
#map-picker .dialog-copy {
    font-size: 12px;
    margin: 8px 0 20px;
}
.map-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
#map-group-intro { margin: 18px 0; font-size: 13px; }
.map-group-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; white-space: normal; border-radius: 10px; }
.map-group-card:hover, .map-group-card:focus-visible { border-color: var(--accent); }
.map-group-art { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: #101713; overflow: hidden; }
.map-group-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-group-copy { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding: 15px 16px; width: 100%; }
.map-group-copy strong { font-size: 14px; font-weight: 500; }
.map-group-copy > span { color: var(--muted); font-size: 11px; align-self: center; }
.map-group-copy small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.world-formats .map-group-art { aspect-ratio: 4 / 3; padding: 20px; background: radial-gradient(ellipse, #334538, #121a16); }
.world-formats .map-group-art img { object-fit: contain; filter: drop-shadow(0 4px 8px #0007); }
.world-formats .map-group-copy { padding: 20px 16px; }
.world-formats .map-group-copy strong { font-size: 18px; }
.map-format-ratio { position: absolute; bottom: 10px; right: 10px; padding: 4px 9px; border-radius: 5px; color: var(--accent); background: #101713ed; font-size: 12px; }
.map-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0; }
.map-breadcrumb > span { color: var(--muted); font-size: 12px; }
#map-cards.world-map-cards .map-card img { height: 180px; object-fit: contain; padding: 8px; background: #101713; }
@media (max-width: 760px) { .map-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } .map-groups.world-formats { grid-template-columns: 1fr; } .world-formats .map-group-card { flex-direction: row; align-items: center; } .world-formats .map-group-art { width: 42%; flex-shrink: 0; padding: 12px; } }
@media (max-width: 480px) { .map-groups { grid-template-columns: 1fr; } .world-formats .map-group-copy { grid-template-columns: 1fr; } .world-formats .map-group-copy strong { font-size: 16px; } }
.map-filters {
    display: flex;
    gap: 10px;
}
.map-filters input {
    flex: 1;
}
.map-filters select {
    max-width: 220px;
}
#map-count {
    font-size: 11px;
    margin: 14px 0;
}
#map-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}
.map-card {
    overflow: hidden;
    text-align: left;
    white-space: normal;
    background: #28312a;
    border: 1px solid #3d493d;
    border-radius: 8px;
    padding: 0;
}
.map-card img {
    width: 100%;
    height: 125px;
    object-fit: cover;
    display: block;
}
.map-card > div {
    padding: 10px 12px;
}
.map-card strong {
    display: block;
    font-size: 12px;
    font-weight: 500;
}
.map-card small {
    display: block;
    color: #a3b19f;
    font-size: 10px;
    margin-top: 3px;
}
#map-scroll-sentinel, #map-shown { text-align: center; font-size: 12px; color: var(--muted); padding: 14px 0; }
#map-scroll-sentinel { min-height: 40px; }
#map-shown { margin: 0; padding-top: 0; }
@media (prefers-reduced-motion: no-preference) {
    #map-cards .map-card { animation: map-card-appear .22s ease-out both; }
    #map-cards .map-thumb { transition: opacity .2s ease-out; }
    @keyframes map-card-appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
#map-cards .map-thumb { opacity: 0; }
#map-cards .map-thumb.is-loaded { opacity: 1; }
#map-picker .map-import-options .check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
#map-picker .map-import-options input { width: auto; }
.screen-link input {
    font-size: 11px;
}
#rename-form > button {
    width: 100%;
    margin-top: 5px;
}
#notice {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 30px);
    padding: 12px 15px;
    background: #364138;
    border: 1px solid #84957a;
    border-radius: 10px;
    box-shadow: 0 8px 35px #0008;
    font-size: 13px;
}
#notice > button {
    font-size: 12px;
    padding: 5px 9px;
}
#dismiss-notice {
    border: 0;
    background: none;
}
#display {
    height: 100dvh;
    width: 100vw;
    background: #060906;
    display: flex;
}
#display .board-host {
    background: #060906;
}
#display-board {
    cursor: default;
}
#display-board .token {
    cursor: default;
}
#display-cover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #060906;
    color: #718373;
    font-size: 16px;
    letter-spacing: 0.05em;
}
.display-controls {
    position: fixed;
    bottom: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}
#display:hover .display-controls,
.display-controls:focus-within,
.display-controls.visible {
    opacity: 1;
}
.display-controls button {
    background: #202b22e0;
    border-color: #4e654c;
    font-size: 11px;
}
.display-controls span {
    font-size: 11px;
    background: #151c16df;
    padding: 3px 8px;
    border-radius: 5px;
}
.display-controls span:empty {
    display: none;
}
@media (min-width: 1600px) {
    .workspace {
        grid-template-columns: 260px minmax(0, 1fr) 270px;
    }
    #unit-library {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .library-token {
        font-size: 10px;
    }
    .library-token svg {
        width: 48px;
        height: 48px;
    }
}
@media (max-width: 1150px) {
    .workspace {
        grid-template-columns: 194px minmax(0, 1fr) 210px;
    }
    .panel-heading {
        padding-left: 12px;
        padding-right: 12px;
    }
    .panel-heading > span {
        display: none;
    }
    .board-toolbar {
        padding: 0 12px;
    }
    .board-options {
        gap: 5px;
    }
    .library-token {
        font-size: 10px;
    }
    #unit-library {
        gap: 6px;
        padding: 12px 10px;
    }
    .scene-bar > span:first-child,
    .scene-bar #unit-count {
        display: none;
    }
    .map-button > .map-title {
        max-width: 175px;
    }
    .header-label {
        margin-right: 0;
    }
}
@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 156px minmax(0, 1fr) 186px;
    }
    .gm-header {
        padding: 0 15px;
    }
    .header-label {
        display: none;
    }
    .gm-header > #open-screen {
        margin-left: auto;
    }
    .library-tabs {
        padding: 0 9px 10px;
        gap: 2px;
    }
    .library-tabs button {
        font-size: 10px;
        padding: 5px 6px;
    }
    #unit-library {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 10px 7px;
        gap: 5px;
    }
    .library-token {
        min-height: 89px;
        padding-top: 9px;
    }
    .library-token svg {
        width: 42px;
        height: 42px;
    }
    .board-toolbar {
        height: 85px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 7px;
    }
    .map-button {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    .map-button > .map-title {
        font-size: 12px;
    }
    .map-button > .muted {
        font-size: 9px;
    }
    .board-options {
        gap: 10px;
    }
    .panel-heading {
        padding: 15px 10px 10px;
        flex-wrap: wrap;
    }
    .panel-heading h2 {
        font-size: 13px;
    }
    #inspector {
        padding: 14px 11px;
    }
    .inspector-row {
        gap: 10px;
    }
    .rotate-buttons button {
        padding: 1px 9px;
    }
    .search {
        margin: 0 9px 10px;
    }
    .search input {
        font-size: 10px;
    }
    .control-tip {
        padding: 12px 10px;
        font-size: 9px;
    }
    #map-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 680px) {
    #lobby {
        padding: 20px 22px 60px;
    }
    .lobby-intro {
        padding-top: 40px;
    }
    .lobby-intro h1 {
        font-size: 44px;
    }
    .create-room {
        padding: 18px;
    }
    .create-room > div {
        flex-direction: column;
    }
    #rooms {
        grid-template-columns: repeat(2, 1fr);
    }
    .workspace {
        grid-template-columns: 115px minmax(0, 1fr);
        grid-template-rows: minmax(350px, 1fr) auto;
    }
    #gm {
        height: auto;
        min-height: 100dvh;
    }
    .gm-header {
        height: 61px;
        gap: 10px;
    }
    .room-heading {
        max-width: 170px;
    }
    .room-heading > button {
        font-size: 14px;
    }
    #open-screen {
        display: none;
    }
    #screen-settings {
        display: block;
        margin-left: auto;
        font-size: 11px;
    }
    .library-panel {
        grid-row: 1/3;
        max-height: calc(100dvh - 61px);
    }
    .library-tabs {
        gap: 3px;
    }
    .library-tabs button {
        padding: 3px 5px;
        font-size: 9px;
    }
    .library-tip {
        font-size: 9px;
        padding: 10px;
    }
    .library-panel .panel-heading {
        padding: 12px 9px;
    }
    .panel-heading h1 {
        font-size: 15px;
    }
    .search {
        margin: 0 6px 10px;
    }
    .search input {
        padding: 7px;
        font-size: 9px;
    }
    #unit-library {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    .library-token {
        min-height: 80px;
        font-size: 10px;
        padding: 7px;
    }
    .library-token svg {
        width: 40px;
        height: 40px;
    }
    .board-panel {
        height: 57dvh;
        min-height: 350px;
    }
    .board-toolbar {
        height: 75px;
    }
    .board-options {
        font-size: 10px;
        gap: 5px;
    }
    .map-button {
        gap: 5px;
    }
    .map-button > .muted {
        display: none;
    }
    .board-navigation {
        bottom: 10px;
    }
    .board-navigation button {
        padding: 4px 8px;
    }
    .board-navigation button > span {
        display: none;
    }
    .scene-bar {
        height: 42px;
        padding: 0 8px;
    }
    .units-panel {
        grid-column: 2;
        grid-row: 2;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .units-panel > .panel-heading {
        padding: 10px 12px;
    }
    #unit-list {
        min-height: 0;
        max-height: 140px;
        padding-bottom: 5px;
    }
    #inspector {
        padding: 12px;
    }
    .control-tip {
        display: none;
    }
    #map-picker {
        padding: 18px;
        width: calc(100vw - 18px);
    }
    #map-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 9px;
    }
    .map-card img {
        height: 100px;
    }
    .map-filters {
        flex-direction: column;
    }
    .map-filters select {
        max-width: none;
        width: 100%;
    }
    .dialog-header h2 {
        font-size: 21px;
    }
    .map-button > .map-title {
        max-width: 190px;
    }
    #notice {
        width: calc(100vw - 25px);
        font-size: 11px;
        gap: 7px;
        flex-wrap: wrap;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
.screen-link-button {
    margin-left: -12px;
    padding: 8px 9px;
}
#board:focus {
    outline: none;
}
@media (max-width: 680px) {
    .screen-link-button {
        display: none;
    }
}

/* Character creation, reusable parties, and player-screen framing. */
#character-dialog .health-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
button:disabled {
    cursor: not-allowed;
}
.board-panel > .board-navigation {
    position: static;
    transform: none;
    flex-shrink: 0;
    margin: 8px auto;
    max-width: calc(100% - 20px);
}
.screen-info {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    max-width: 620px;
    margin: 0 0 18px;
    padding: 5px 0;
    color: #97a69a;
    font-size: 12px;
    line-height: 1.6;
}
.screen-info > span {
    font-size: 14px;
    line-height: 1.2;
    flex-shrink: 0;
    margin-top: 2px;
}
.screen-info p {
    margin: 0;
}
#grid-settings {
    font-size: 12px;
    padding: 3px 7px;
    margin-left: -8px;
    background: transparent;
    border-color: transparent;
}
#grid-settings[aria-expanded='true'] {
    background: #344238;
    border-color: #5e7761;
}
.grid-options-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    padding: 12px 18px;
    background: #202820;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.grid-options-panel > label {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.grid-options-panel select {
    width: 100%;
    font-size: 12px;
    padding: 5px 8px;
    min-width: 0;
}
.grid-options-panel > .grid-opacity {
    grid-column: 1/-1;
    flex-wrap: nowrap;
    gap: 12px;
}
.grid-opacity output {
    color: var(--cream);
    min-width: 32px;
}
.grid-opacity input {
    min-width: 50px;
    flex: 1;
    padding: 0;
    height: 20px;
}
.board-navigation > .view-target {
    width: auto;
    flex-wrap: wrap;
    padding: 2px 6px;
}
.board-navigation > .frame-shape {
    border-left: 1px solid #4c594c;
}
.board-navigation > .frame-shape select {
    max-width: 138px;
}
.combat-participant > label {
    flex-direction: row !important;
    align-items: center;
}
.map-import-options {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.map-import-options .check {
    margin: 0;
    font-size: 12px;
}
.presentation-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 35px;
    padding: 5px 12px;
    background: #1e2b22;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.presentation-bar > span {
    color: #b9c8b0;
    font-size: 10px;
    min-width: 0;
}
.presentation-bar > button {
    font-size: 11px;
    padding: 5px 10px;
}
.presentation-bar:has(#publish-view:not([hidden])) {
    background: #3a3222;
}
.presentation-bar:has(#publish-view:not([hidden])) > span {
    color: #e8cd96;
}
#bring-party-here {
    font-size: 11px;
    white-space: normal;
}
@media (max-width: 680px) {
    .presentation-bar {
        padding: 5px 8px;
        gap: 5px;
    }
    .presentation-bar > span {
        font-size: 9px;
    }
    .presentation-bar > button {
        font-size: 9px;
        padding: 5px;
    }
    .map-import-options {
        gap: 10px;
        flex-direction: column;
    }
}
#combat-dialog {
    width: min(540px, calc(100vw - 28px));
}
#combat-dialog > form > p {
    font-size: 12px;
    line-height: 1.6;
}
#combat-participants {
    max-height: 45dvh;
    overflow-y: auto;
    margin: 20px 0;
}
.combat-participant {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}
.combat-participant > label {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 10px;
    margin: 0;
    font-size: 13px;
}
.combat-participant input[type='checkbox'] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--accent);
}
.combat-participant > input {
    width: 74px;
    flex-shrink: 0;
    padding: 9px;
    font-size: 13px;
}
.view-resize-handle[data-view-edge='left'],
.view-resize-handle[data-view-edge='right'] {
    cursor: ew-resize;
}
.view-resize-handle[data-view-edge='top'],
.view-resize-handle[data-view-edge='bottom'] {
    cursor: ns-resize;
}
.view-resize-handle[data-view-edge='left-top'],
.view-resize-handle[data-view-edge='right-bottom'] {
    cursor: nwse-resize;
}
.view-resize-handle[data-view-edge='right-top'],
.view-resize-handle[data-view-edge='left-bottom'] {
    cursor: nesw-resize;
}
.view-resize-handle:focus {
    outline: none;
}
.view-resize-handle:hover rect:last-child,
.view-resize-handle:focus rect:last-child {
    fill: #fff4d9;
}
#display-turns {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 154px;
    padding: 10px;
    background: #0d1813bd;
    backdrop-filter: blur(5px);
    border: 1px solid #afc3a529;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0.82;
    color: #dce6d7;
}
.turn-sidebar-heading {
    font-size: 10px;
    margin: 0 0 7px;
    color: #bbc6b4;
}
.display-turn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
}
.display-turn.current {
    background: #d6bd7221;
    border-radius: 6px;
    color: #f4dfac;
}
.display-turn > div {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.display-turn small {
    font-size: 8px;
    color: #afbfaa;
}
.display-turn span {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.embedded #display-turns {
    width: 125px;
    right: 10px;
    top: 10px;
    padding: 8px;
}
.embedded .display-turn span {
    font-size: 10px;
}
.embedded .display-turn img,
.embedded .display-turn svg {
    width: 23px;
    height: 23px;
}
.character-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.character-fields select {
    min-width: 0;
    width: 100%;
    padding: 7px;
    font-size: 11px;
}
#character-dialog,
#group-dialog,
#room-dialog,
#remove-location-dialog {
    width: min(540px, calc(100vw - 28px));
}
#character-preview {
    display: flex;
    justify-content: center;
    margin: 0 0 20px;
}
#character-preview img {
    border-radius: 50%;
}
.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 22px;
    flex-wrap: wrap;
}
.dialog-actions button {
    font-size: 12px;
}
#character-role-hint,
#group-dialog p,
#room-dialog p,
#remove-location-dialog p {
    font-size: 12px;
    line-height: 1.65;
}
#saved-group,
#new-room-group {
    width: 100%;
    padding: 10px;
    font-size: 13px;
}
#save-group-form {
    border-top: 1px solid var(--line);
    padding-top: 22px;
    margin-top: 22px;
}
#save-group-form > button {
    margin-top: 14px;
}
#gm-resume-link {
    font-size: 11px;
}
#room-dialog hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 24px 0;
}
.room-group-label {
    margin-top: 18px !important;
}
.saved-rooms > .check {
    margin: 18px 0;
}
#manage-group {
    margin-top: 8px;
    background: transparent;
    border-color: #465a46;
}
.board-navigation {
    flex-wrap: wrap;
    max-width: calc(100% - 20px);
    width: max-content;
    justify-content: center;
}
.view-target {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 2px 6px 7px;
    color: #d4c8a9;
    font-size: 10px;
}
.view-target select {
    font-size: 11px;
    padding: 4px 8px;
    max-width: 150px;
}
.portrait-image {
    position: relative;
    display: block;
    margin-bottom: 9px;
    border-radius: 50%;
    background: radial-gradient(circle, #465445, #2a352b 70%);
}
.portrait-card .portrait-image img {
    display: block;
    margin-bottom: 0;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.portrait-card .portrait-image img.loaded {
    opacity: 1;
}
.portrait-retry {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #dfc584;
}
.portrait-retry[hidden] {
    display: none;
}
.portrait-failed .portrait-image {
    box-shadow: inset 0 0 0 1px #8f7950;
}
@media (prefers-reduced-motion: reduce) {
    .portrait-image img {
        transition: none;
    }
}
#use-character-icon {
    display: block;
    margin: 15px auto 0;
    font-size: 11px;
    background: transparent;
    border-color: #52604d;
}
.character-fields label {
    min-width: 0;
}
#room-settings {
    font-size: 11px;
    padding: 7px 12px;
}
@media (max-width: 680px) {
    .gm-header #room-settings {
        font-size: 9px;
        padding: 5px 7px;
    }
    .room-heading {
        max-width: 100px;
    }
    .view-target {
        font-size: 9px;
        gap: 5px;
        padding: 0 0 5px;
    }
    .view-target select {
        font-size: 10px;
    }
    .board-navigation {
        gap: 2px;
    }
    .character-fields {
        gap: 6px;
    }
    .character-fields select {
        font-size: 10px;
        padding: 6px;
    }
    #group-new-room {
        font-size: 10px;
    }
    .dialog-actions {
        gap: 7px;
    }
}
/* Tabletop tools: compact GM controls, private combat data and shared visuals. */
#unit-character {
    margin-top: 10px;
}
#unit-class {
    width: 100%;
    padding: 7px 9px;
    font-size: 12px;
}
.portrait-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.portrait-control > span {
    display: flex;
}
.portrait-control > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.portrait-control button {
    font-size: 10px;
    padding: 6px 10px;
}
.portrait-control .text-button {
    background: none;
    border: 0;
    padding: 2px 0;
    color: #afc2aa;
    font-size: 9px;
}
.roster-label > .roster-class {
    color: #b5b9cf;
}
.portrait-options {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-top: 12px;
}
.portrait-options > label {
    margin: 0;
    min-width: 145px;
    font-size: 10px;
    gap: 4px;
}
.portrait-options select {
    padding: 8px;
    font-size: 12px;
}
.portrait-options > p {
    font-size: 11px;
    line-height: 1.5;
    margin: 0 0 6px;
    max-width: 340px;
}
@media (max-width: 680px) {
    .portrait-options {
        flex-wrap: wrap;
        gap: 10px;
    }
    .portrait-options > label {
        min-width: 0;
        flex: 1;
    }
    .portrait-options > p {
        flex-basis: 100%;
        font-size: 10px;
    }
    .portrait-control {
        gap: 6px;
    }
    .portrait-control button {
        font-size: 9px;
        padding: 5px 8px;
    }
}
.workspace {
    grid-template-columns: 238px minmax(0, 1fr) 270px;
}
.units-panel .control-tip {
    display: none;
}
#inspector {
    max-height: 56%;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 14px 15px;
}
#inspector h2 {
    margin-bottom: 9px;
}
.unit-portrait {
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
    background: #111a14;
}
.unit-row .roster-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 11px;
}
.roster-label > small {
    display: block;
    font-size: 9px;
    color: #91b99b;
}
.roster-label .health-zero {
    color: #e59d8b;
}
.initiative-number {
    color: #dac18f;
    font-size: 12px;
    margin-left: auto;
    background: #1c291f;
    min-width: 25px;
    text-align: center;
    border-radius: 4px;
    padding: 2px;
}
.unit-row.current-turn {
    box-shadow: inset 3px 0 #c0e5a5;
    background: #2a382b;
}
.status-number {
    font-size: 9px;
    color: #d0bc8b !important;
}
.combat-panel {
    padding: 0 14px 13px;
    border-bottom: 1px solid var(--line);
}
.combat-panel > div {
    display: flex;
    gap: 6px;
    align-items: center;
}
.combat-panel > div:first-child {
    justify-content: space-between;
    font-size: 11px;
    color: #c9d6c6;
}
#combat-round {
    font-size: 10px;
    color: var(--accent);
}
#combat-current {
    font-size: 10px;
    color: #9daf9b;
    margin: 5px 0 8px;
}
.combat-panel button {
    font-size: 10px;
    padding: 5px 8px;
}
#combat-start {
    width: 100%;
}
#combat-next {
    flex: 1;
}
.health-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 13px;
}
.health-adjust {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}
.health-adjust input {
    max-width: 58px;
}
.health-adjust button {
    font-size: 10px;
    flex: 1;
    padding: 6px;
}
.status-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #acbba8;
    margin: 13px 0 7px;
}
.status-heading button {
    font-size: 10px;
    padding: 4px 8px;
}
#active-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.status-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    padding: 2px 5px 2px 2px;
    background: #18221b;
    border-color: var(--status-color);
    color: var(--status-color);
    white-space: normal;
}
.status-chip svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.status-chip > span:last-child {
    margin-left: 3px;
}
#unit-appearance {
    border-top: 1px solid #3a483b;
    margin-top: 13px;
    padding-top: 10px;
}
#unit-appearance summary {
    cursor: pointer;
    color: #b5c4b0;
    font-size: 10px;
    list-style-position: inside;
}
#effect-controls {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 12px;
}
#effect-controls select {
    padding: 7px 9px;
    font-size: 12px;
    width: 100%;
}
#effect-controls .check {
    margin: 0;
}
#effect-controls input[type='range'] {
    padding: 0;
    background: transparent;
    accent-color: var(--accent);
}
#effect-opacity-value {
    color: var(--accent);
    float: right;
}
.inspector-hint {
    font-size: 9px;
    line-height: 1.6;
    color: #94a48f;
}
.portrait-library-button {
    margin: 12px 14px 0;
    text-align: left;
    background: #304034;
    border-color: #5a7357;
    font-size: 12px;
    padding: 10px;
}
.portrait-library-button span {
    display: block;
    color: #afc2aa;
    font-size: 9px;
    margin-top: 2px;
}
#status-dialog {
    width: min(700px, calc(100vw - 28px));
}
#status-options h3 {
    font-size: 11px;
    letter-spacing: 0.06em;
    color: #a3b59e;
    margin: 21px 0 10px;
}
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.status-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 13px 4px 11px;
    font-size: 11px;
    background: #202a22;
    white-space: normal;
    color: #bcc7b7;
    position: relative;
}
.status-option[aria-pressed='true'] {
    border-color: var(--status-color);
    background: #344237;
    color: var(--status-color);
}
.status-option[aria-pressed='true']:after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 12px;
}
.status-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 19px;
    margin-top: 20px;
    border-top: 1px solid var(--line);
}
.status-footer > span {
    font-size: 12px;
    color: #a4b49d;
    flex: 1;
}
.status-footer > button {
    font-size: 11px;
}
#display-legend {
    position: absolute;
    bottom: 18px;
    left: 18px;
    max-width: calc(100vw - 210px);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    pointer-events: none;
}
.legend-status {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #122019dc;
    border: 1px solid #6c7a594a;
    border-radius: 20px;
    padding: 3px 9px 3px 4px;
    color: #dce7d4;
    font-size: 11px;
}
.embedded #display-legend {
    max-width: calc(100% - 20px);
    left: 10px;
    bottom: 10px;
}
.embedded .legend-status {
    font-size: 9px;
}
.embedded .display-controls:has(#display-status:empty) {
    display: none;
}
.effect-handle {
    cursor: nwse-resize;
}
.effect-handle[data-handle='rotate'] {
    cursor: grab;
}
.effect-art .effect-swirl,
.effect-art .effect-drift,
.effect-art .flame {
    transform-origin: 0 0;
}
.effect-art.is-animated .effect-flow {
    animation: effect-flow var(--fx-duration, 16s) linear var(--fx-delay, 0s) infinite;
}
.effect-art.is-animated .effect-swirl {
    animation: effect-spin var(--fx-duration, 42s) linear var(--fx-delay, 0s) infinite;
}
.effect-art.is-animated .effect-drift {
    animation: effect-spin var(--fx-duration, 78s) linear var(--fx-delay, 0s) infinite reverse;
}
.effect-art.is-animated .effect-particle {
    animation: effect-rise var(--fx-duration, 5s) ease-in-out var(--fx-delay, 0s) infinite;
}
.effect-art.is-animated .flame {
    animation: flame-flicker var(--fx-duration, 2.1s) ease-in-out var(--fx-delay, 0s) infinite;
}
.effect-art.is-animated .effect-shimmer {
    animation: effect-shimmer var(--fx-duration, 3.5s) ease-in-out var(--fx-delay, 0s) infinite;
}
.effect-art.is-animated .effect-mist {
    animation: mist-pulse var(--fx-duration, 5s) ease-in-out var(--fx-delay, 0s) infinite;
}
@keyframes effect-spin {
    to {
        transform: rotate(360deg);
    }
}
@keyframes effect-rise {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.15;
    }
    50% {
        transform: translateY(calc(-1 * var(--fx-rise, 40px)));
        opacity: 0.9;
    }
}
@keyframes effect-flow {
    to {
        stroke-dashoffset: -132;
    }
}
@keyframes flame-flicker {
    0%,
    100% {
        transform: scale(0.97);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.015);
        opacity: 1;
    }
}
@keyframes effect-shimmer {
    0%,
    100% {
        opacity: 0.45;
    }
    50% {
        opacity: 1;
    }
}
@keyframes mist-pulse {
    0%,
    100% {
        opacity: 0.08;
    }
    50% {
        opacity: 0.3;
    }
}
@media (prefers-reduced-motion: reduce) {
    .effect-art:not(.motion-allowed) * {
        animation: none !important;
    }
}
.library-section,
.library-explanation {
    grid-column: 1/-1;
}
.library-section {
    font-size: 10px;
    font-weight: 500;
    color: #bec9b8;
    margin: 9px 0 0;
}
.library-explanation {
    font-size: 10px;
    color: #94a48f;
    line-height: 1.6;
    margin: 0 0 2px;
}
#portrait-dialog {
    width: min(1050px, calc(100vw - 28px));
}
.portrait-filters {
    display: flex;
    gap: 10px;
    align-items: end;
}
.portrait-filters > input {
    flex: 1;
}
.portrait-filters > select {
    max-width: 250px;
}
.portrait-filters > label {
    margin: 0;
    min-width: 125px;
    font-size: 10px;
    gap: 4px;
}
.portrait-filters > label select {
    padding: 9px;
}
#portrait-count {
    font-size: 11px;
    margin: 15px 0;
}
#portrait-cards {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}
.portrait-card {
    white-space: normal;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px 10px;
    background: #232e25;
    border-color: #3d4d3e;
    min-height: 150px;
}
.portrait-card img {
    width: 86px;
    height: 86px;
    object-fit: contain;
    border-radius: 50%;
    margin-bottom: 9px;
}
.portrait-card strong {
    font-weight: 500;
    font-size: 11px;
    line-height: 1.3;
}
.portrait-card small {
    font-size: 9px;
    color: #94a68e;
    margin-top: 4px;
}
#more-portraits {
    display: block;
    margin: 22px auto 0;
}
#split-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid #52654c;
    background: #0a100d;
}
#split-panel > header {
    height: 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    font-size: 11px;
    color: #aac19f;
    border-bottom: 1px solid #35432f;
}
#split-panel i {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #9ac58d;
    border-radius: 50%;
    margin-right: 7px;
}
#split-panel button {
    border: 0;
    background: none;
    padding: 3px 8px;
}
#split-frame {
    border: 0;
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #07100a;
}
#gm.split-view {
    display: grid;
    grid-template-columns: minmax(630px, 1.5fr) minmax(300px, 1fr);
    grid-template-rows: 70px minmax(0, 1fr);
}
.split-view > .gm-header {
    grid-column: 1/-1;
}
.split-view > .workspace {
    grid-template-columns: 130px minmax(200px, 1fr) 240px;
    grid-column: 1;
    grid-row: 2;
}
.split-view > #split-panel {
    grid-column: 2;
    grid-row: 2;
}
.split-view .library-token svg {
    width: 40px;
    height: 40px;
}
.split-view #unit-library {
    grid-template-columns: 1fr;
    gap: 6px;
}
.split-view .library-token {
    min-height: 82px;
}
.split-view .panel-heading > span {
    display: none;
}
.split-view .portrait-library-button {
    font-size: 10px;
    margin: 10px 7px 0;
    padding: 7px;
    white-space: normal;
}
.split-view .portrait-library-button span {
    font-size: 8px;
}
.split-view .library-tabs {
    padding: 0 7px 12px;
    gap: 2px;
}
.split-view .library-tabs button {
    font-size: 9px;
    padding: 4px 6px;
}
.split-view .board-toolbar {
    height: 88px;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    gap: 7px;
    padding: 0 10px;
}
.split-view .board-options {
    gap: 8px;
}
.split-view .scene-bar > span {
    display: none;
}
.split-view .map-button > .map-title {
    max-width: 190px;
    font-size: 12px;
}
.split-view .scene-bar {
    padding: 0 7px;
}
.split-view .library-tip {
    font-size: 9px;
    padding: 10px;
}
@media (max-width: 1150px) {
    .workspace {
        grid-template-columns: 190px minmax(0, 1fr) 245px;
    }
    .gm-header {
        gap: 12px;
    }
    .header-label {
        margin-right: 0;
    }
    .portrait-library-button {
        margin: 10px 9px 0;
        font-size: 10px;
    }
    .portrait-library-button span {
        font-size: 8px;
    }
    #portrait-cards {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}
@media (max-width: 980px) {
    .workspace {
        grid-template-columns: 145px minmax(0, 1fr) 230px;
    }
    #gm.split-view {
        display: flex;
        min-height: 1100px;
        height: auto;
    }
    .split-view > .workspace {
        height: 650px;
        flex: none;
        grid-template-columns: 145px minmax(0, 1fr) 230px;
    }
    .split-view > #split-panel {
        height: 50dvh;
        min-height: 360px;
        flex: none;
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .header-label {
        display: none;
    }
    .gm-header > #split-view {
        margin-left: auto;
    }
    .gm-header > #open-screen {
        margin-left: 0;
    }
    .portrait-library-button {
        white-space: normal;
    }
}
@media (max-width: 680px) {
    .workspace {
        grid-template-columns: 115px minmax(0, 1fr);
    }
    .split-view > .workspace {
        grid-template-columns: 115px minmax(0, 1fr);
        height: auto;
    }
    .split-view .units-panel {
        grid-row: 2;
        grid-column: 2;
    }
    #inspector {
        max-height: none;
        overflow: visible;
    }
    .units-panel > .combat-panel {
        padding: 0 12px 12px;
    }
    .combat-panel {
        font-size: 10px;
    }
    .health-fields {
        gap: 5px;
    }
    #inspector .health-fields input {
        padding: 7px 5px;
    }
    #split-view {
        font-size: 10px;
        padding: 6px 8px;
    }
    #screen-settings {
        font-size: 10px;
        padding: 6px 8px;
        margin-left: 0;
    }
    .gm-header {
        gap: 8px;
    }
    .room-heading {
        max-width: 130px;
    }
    .room-heading > button {
        font-size: 12px;
    }
    .brand.compact {
        width: 36px;
    }
    .brand.compact .brand-mark {
        width: 36px;
        height: 29px;
    }
    .portrait-library-button {
        font-size: 9px;
        margin: 8px 6px 0;
    }
    .portrait-library-button span {
        display: none;
    }
    .status-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }
    .status-option {
        font-size: 10px;
    }
    .portrait-filters {
        flex-wrap: wrap;
    }
    .portrait-filters > input {
        flex-basis: 100%;
    }
    .portrait-filters > select {
        flex: 1;
        max-width: 55%;
        font-size: 11px;
    }
    .portrait-filters > label {
        min-width: 100px;
    }
    .portrait-filters > label select {
        font-size: 11px;
    }
    #portrait-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }
    .portrait-card {
        padding: 9px 4px;
        min-height: 125px;
    }
    .portrait-card img {
        width: 65px;
        height: 65px;
    }
    .portrait-card strong {
        font-size: 10px;
    }
    .portrait-card small {
        font-size: 8px;
    }
    #portrait-dialog {
        padding: 19px 14px;
    }
    #display-legend {
        max-width: calc(100vw - 30px);
        bottom: 60px;
        left: 10px;
    }
    .legend-status {
        font-size: 9px;
        padding-right: 6px;
    }
    .legend-status svg {
        width: 18px;
        height: 18px;
    }
}

/* Grid alignment is independent from unit positions and cell size. */
.grid-alignment {
    grid-column: 1/-1;
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px 16px;
}
.grid-alignment label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    color: var(--muted);
}
.grid-alignment label:first-child {
    min-width: 140px;
    flex: 1;
}
.grid-alignment input[type='number'] {
    width: 130px;
    padding: 5px 8px;
    font-size: 12px;
}
.grid-alignment button {
    font-size: 11px;
    padding: 6px 10px;
}
.grid-alignment p {
    flex-basis: 100%;
    font-size: 11px;
    color: var(--muted);
}
@media (max-width: 680px) {
    .grid-alignment {
        gap: 8px;
    }
    .grid-alignment label {
        flex: 1;
        min-width: 100px;
    }
    .grid-alignment input[type='number'] {
        width: 100%;
    }
    .grid-alignment label:first-child {
        flex-basis: 100%;
    }
    .grid-alignment button {
        align-self: end;
    }
}

/* Movement information stays with the selected unit. */
.movement-controls {
    padding: 0 0 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border, #37483b);
}
.movement-controls input[type='number'] {
    width: 100px;
}
.movement-controls .check {
    margin: 10px 0;
}
.movement-controls p {
    margin: 8px 0;
}
.movement-key {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    font-size: 13px;
}
.movement-key .normal {
    color: #83e5a0;
}
.movement-key .dash {
    color: #f4d06c;
}
.movement-key .over {
    color: #ff7974;
}
#movement-hint {
    position: absolute;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    padding: 9px 15px;
    border-radius: 8px;
    color: #83e5a0;
    background: #0b1715ee;
    border: 1px solid currentColor;
    pointer-events: none;
    font-size: 13px;
    max-width: 90%;
    text-align: center;
    z-index: 4;
}
#movement-hint[data-band='dash'] {
    color: #f4d06c;
}
#movement-hint[data-band='over'] {
    color: #ff7974;
}
#game-settings-dialog {
    max-width: 570px;
}
#step-distance {
    max-width: 140px;
}

/* Counts calibrate a fixed grid; they do not change the artwork or follow zoom. */
.grid-sizing {
    grid-column: 1/-1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: start;
}
.grid-sizing label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    color: var(--muted);
}
.grid-sizing > label {
    min-width: 160px;
}
.character-screen-options { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.character-screen-options summary { cursor: pointer; font-weight: 500; padding-block: 8px; }
.character-screen-options p { margin: 14px 0; line-height: 1.65; }
.character-screen-options .dialog-actions { align-items: center; flex-wrap: wrap; gap: 12px; }
.character-screen-options .dialog-actions a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.character-screen-options .dialog-actions a[hidden] { display: none; }
.character-location-controls { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.character-location-controls h3 { margin: 0; font-size: 16px; font-weight: 500; }
.character-location-controls p:last-child { margin-bottom: 0; }
.grid-count-fields {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}
.grid-count-fields[hidden],
.cell-label[hidden],
#grid-counts-summary[hidden] {
    display: none;
}
.grid-count-fields input {
    width: 75px;
    padding: 5px 8px;
    font-size: 12px;
}
.grid-count-fields button,
#grid-counts-summary {
    font-size: 11px;
    padding: 6px 10px;
}
.grid-count-fields p {
    flex-basis: 100%;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.5;
}
.grid-options-panel {
    max-height: min(55vh, 440px);
    overflow-y: auto;
}
@media (max-width: 680px) {
    .grid-count-fields {
        flex-basis: 100%;
    }
    .grid-count-fields label {
        flex: 1;
    }
    .grid-count-fields input {
        width: 100%;
        min-width: 60px;
    }
    .grid-sizing {
        gap: 8px;
    }
    .grid-count-fields {
        gap: 8px;
    }
}
/* Room uploads live in the picker, leaving the board's workspace unchanged. */
.map-upload-details { margin: 18px 0 24px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; }
.map-upload-details summary { cursor: pointer; font-weight: 600; }
.map-upload-details fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.map-upload-details p { line-height: 1.6; font-size: 13px; margin: 12px 0; }
.map-upload-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.map-upload-fields label { display: grid; gap: 8px; min-width: 0; margin: 0; }
.map-upload-fields input { width: 100%; min-width: 0; margin: 0; box-sizing: border-box; }
#map-picker .map-upload-consent { display: flex; flex-direction: row; align-items: start; gap: 9px; margin: 18px 0; line-height: 1.6; font-size: 13px; }
#map-picker .map-upload-consent input { flex: 0 0 auto; width: auto; margin: 4px 0 0; }
.map-upload-consent a { text-decoration: underline; }
#map-upload-status:empty { display: none; }
.map-replace-note { padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--panel); line-height: 1.6; }
@media (max-width: 600px) { .map-upload-fields { grid-template-columns: 1fr; } }

/* Editable scene labels share the existing title row and do not add toolbar height. */
.map-button > button { background: none; border: 0; border-radius: 3px; padding: 0; min-height: 0; color: inherit; line-height: 1.4; text-align: left; }
.map-button > .map-title { display: flex; align-items: center; gap: 5px; }
.map-button > .map-choice { color: var(--muted); }
.map-button > button:hover { background: none; text-decoration: underline; text-underline-offset: 3px; }
.map-title > #active-map-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.map-rename-icon { font-size: 11px; opacity: .65; flex-shrink: 0; margin-left: 4px; }
.rename-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
