:root,
[data-bs-theme="light"] {
    --app-surface-bg: #ffffff;
    --app-surface-subtle: rgba(255, 255, 255, 0.8);
    --app-surface-muted: #f3f4f6;
    --app-surface-muted-hover: #e5e7eb;
    --app-surface-accent: #e2e8f0;
    --app-input-bg: #ffffff;
    --app-text-strong: #111827;
    --app-text-muted: #475569;
    --app-border-color: #d5dbe3;
    --app-border-muted: #cbd5e1;
    --app-shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.05);
    --app-shadow-panel: 0 18px 35px rgba(15, 23, 42, 0.05);
}

[data-bs-theme="dark"] {
    --app-surface-bg: #2b3035;
    --app-surface-subtle: rgba(43, 48, 53, 0.86);
    --app-surface-muted: #343a40;
    --app-surface-muted-hover: #3f474f;
    --app-surface-accent: #495057;
    --app-input-bg: #212529;
    --app-text-strong: #f8f9fa;
    --app-text-muted: #adb5bd;
    --app-border-color: #495057;
    --app-border-muted: #5c6770;
    --app-shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.24);
    --app-shadow-panel: 0 18px 35px rgba(0, 0, 0, 0.28);
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

body {
    transition: background-color 160ms ease, color 160ms ease;
}

a, .btn-link {
    color: var(--bs-link-color);
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

@media (min-width: 641px) and (max-width: 749.98px) {
    body .page > .sidebar {
        width: 4rem;
        flex: 0 0 4rem;
    }

    body .page > .sidebar:has(.navbar-toggler:checked) {
        width: 250px;
        flex-basis: 250px;
    }

    body .page > .sidebar:has(.navbar-toggler:checked) .navbar-brand {
        opacity: 1;
        pointer-events: auto;
    }
}

.page-heading-with-docs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-heading-with-docs h1,
.page-heading-with-docs h3 {
    margin-bottom: 0;
}

.page-docs-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--app-border-muted);
    border-radius: 50%;
    color: var(--app-text-strong);
    text-decoration: none;
}

.page-docs-link-icon {
    font-size: 1rem;
    font-weight: 700;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    line-height: 1;
}

.page-docs-link:hover,
.page-docs-link:focus {
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
}

.page-docs {
    max-width: 56rem;
}

.page-docs-back {
    display: inline-block;
    margin-bottom: 1rem;
}

.page-docs section {
    margin-top: 1.75rem;
}

.page-docs h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.page-docs li {
    margin-bottom: 0.45rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media print {
    body:has(.print-sheet) .sidebar,
    body:has(.print-sheet) .top-row,
    body:has(.print-sheet) .print-editor {
        display: none !important;
    }

    body:has(.print-sheet) .page {
        display: block !important;
    }

    body:has(.print-sheet) main,
    body:has(.print-sheet) article,
    body:has(.print-sheet) .content,
    body:has(.print-sheet) .print-workspace {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
    }
}

.defence-stage {
    display: grid;
    place-items: center;
    position: relative;
    width: 100%;
    height: calc(100dvh - 3.5rem);
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

.defence-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    position: relative;
    z-index: 1;
}

.defence-three-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
}

.defence-building-palette {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    display: grid;
    gap: 0.35rem;
    width: min(8.5rem, calc(100% - 1.5rem));
    max-height: calc(100dvh - 1.5rem);
    padding: 0.45rem;
    background: rgba(12, 35, 21, 0.76);
    border: 1px solid rgba(220, 240, 210, 0.22);
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.defence-building-button {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr);
    align-items: center;
    gap: 0.4rem;
    min-height: 2.6rem;
    width: 100%;
    padding: 0.2rem 0.45rem;
    color: #eef7e9;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    text-align: left;
}

.defence-building-button:hover,
.defence-building-button:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(218, 244, 203, 0.45);
}

.defence-building-button.is-selected {
    color: #163d24;
    background: #c9f0a8;
    border-color: #f1ffe8;
    box-shadow: inset 0 0 0 2px rgba(22, 61, 36, 0.24);
}

.defence-building-button img {
    width: 2.2rem;
    height: 2.2rem;
    object-fit: contain;
    justify-self: center;
}

.defence-building-button svg {
    width: 1.75rem;
    height: 1.75rem;
    justify-self: center;
    fill: currentColor;
}

.defence-building-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.defence-tool-button {
    margin-bottom: 0.15rem;
}

.defence-production-menu {
    position: absolute;
    z-index: 3;
    display: grid;
    gap: 0.25rem;
    min-width: 10.75rem;
    padding: 0.45rem;
    color: #eef7e9;
    background: rgba(12, 35, 21, 0.88);
    border: 1px solid rgba(220, 240, 210, 0.28);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.defence-bottom-popup {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    width: min(46rem, calc(100% - 2rem));
    padding: 0.65rem 0.8rem;
    color: #eef7e9;
    background: rgba(12, 35, 21, 0.9);
    border: 1px solid rgba(220, 240, 210, 0.3);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    transform: translateX(-50%);
}

.defence-status-separator {
    color: rgba(238, 247, 233, 0.74);
}

.defence-production-menu-title {
    padding: 0.1rem 0.25rem 0.25rem;
    color: #c9f0a8;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.defence-production-option {
    width: 100%;
    padding: 0.48rem 0.55rem;
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    text-align: left;
}

.defence-production-option:hover,
.defence-production-option:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(218, 244, 203, 0.45);
}

.defence-production-option.is-selected {
    color: #163d24;
    background: #c9f0a8;
    border-color: #f1ffe8;
}

.defence-buffer-title {
    margin-top: 0.2rem;
}

.defence-buffer-row,
.defence-buffer-empty {
    display: grid;
    align-items: center;
    min-height: 2rem;
    padding: 0.28rem 0.45rem;
    color: rgba(238, 247, 233, 0.9);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 700;
}

.defence-buffer-row {
    grid-template-columns: 1.45rem minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.defence-buffer-row img {
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
}

.defence-buffer-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.defence-buffer-row strong {
    color: #ffd33d;
    font-size: 0.78rem;
}

.defence-resource-bar {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 10.25rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.45rem;
    color: #eef7e9;
    background: rgba(12, 35, 21, 0.88);
    border: 1px solid rgba(220, 240, 210, 0.28);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    overflow-x: auto;
    scrollbar-width: thin;
}

.defence-resource-bar-title {
    flex: 0 0 auto;
    padding: 0 0.35rem;
    white-space: nowrap;
}

.defence-resource-item {
    display: grid;
    grid-template-columns: 1.9rem auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.45rem;
    row-gap: 0.05rem;
    flex: 0 0 auto;
    width: auto;
    min-width: 5.8rem;
    padding: 0.35rem 0.55rem;
}

.defence-resource-item img {
    grid-row: 1 / span 2;
    width: 1.8rem;
    height: 1.8rem;
    object-fit: contain;
}

.defence-fps-item {
    grid-template-columns: auto;
    min-width: 3.7rem;
    justify-items: center;
    padding-inline: 0.65rem;
}

.defence-resource-amount {
    color: #c9f0a8;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
}

.defence-resource-label {
    overflow: hidden;
    color: rgba(238, 247, 233, 0.82);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.defence-lod-legend-title,
.defence-lod-legend-item {
    display: inline-flex;
    align-items: center;
}

.defence-lod-legend-title {
    margin-right: 0.45rem;
    color: #ffe6a3;
    text-transform: uppercase;
}

.defence-lod-legend-item {
    gap: 0.22rem;
    margin-right: 0.5rem;
    color: rgba(238, 247, 233, 0.9);
}

.defence-lod-legend-item:last-child {
    margin-right: 0;
}

.defence-lod-legend-item.is-active {
    color: #ffffff;
}

.defence-lod-legend-item.is-active .defence-lod-legend-swatch {
    box-shadow:
        0 0 0 1px rgba(12, 35, 21, 0.5),
        0 0 0 3px rgba(255, 255, 255, 0.32);
}

.defence-lod-legend-swatch {
    width: 0.62rem;
    height: 0.62rem;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(12, 35, 21, 0.5);
}

.defence-shader-control {
    display: grid;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem 0.5rem;
    color: #eef7e9;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.defence-shader-control span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.defence-shader-control strong {
    color: #c9f0a8;
}

.defence-shader-control input {
    width: 100%;
    accent-color: #c9f0a8;
}

.defence-checkbox-control {
    display: grid;
    grid-template-columns: 1.1rem minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding: 0.28rem 0.45rem;
    color: #eef7e9;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
}

.defence-checkbox-control input {
    width: 1rem;
    height: 1rem;
    accent-color: #c9f0a8;
}

.defence-checkbox-control span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

article.content:has(.defence-stage) {
    display: flex;
    height: calc(100dvh - 3.5rem);
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
}

article.content:has(.defence-stage) > .defence-stage {
    flex: 1;
}

.battlemap-page {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #111827;
}

.battlemap-canvas-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--app-surface-muted);
}

.battlemap-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 3rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--app-border-color);
    background: var(--app-surface-bg);
}

.battlemap-toolbar-button,
.battlemap-upload-option,
.battlemap-upload-link button {
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-bg);
    color: var(--app-text-strong);
    font: inherit;
    font-weight: 650;
}

.battlemap-toolbar-button,
.battlemap-upload-option {
    padding: 0.4rem 0.7rem;
}

.battlemap-toolbar-button:hover,
.battlemap-toolbar-button:focus-visible,
.battlemap-toolbar-button.is-active,
.battlemap-upload-option:hover,
.battlemap-upload-option:focus-visible,
.battlemap-upload-link button:hover,
.battlemap-upload-link button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-toolbar-button.is-active {
    border-color: #111827;
    color: #111827;
}

[data-bs-theme="dark"] .battlemap-toolbar-button.is-active {
    border-color: #f8f9fa;
    color: #f8f9fa;
}

.battlemap-save-status {
    color: var(--app-text-muted);
    font-size: 0.85rem;
    font-weight: 650;
    white-space: nowrap;
}

.battlemap-scene-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--app-text-muted);
    font-size: 0.85rem;
    font-weight: 650;
    white-space: nowrap;
}

.battlemap-scene-picker select {
    min-width: 8rem;
    max-width: 12rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-bg);
    color: var(--app-text-strong);
    font: inherit;
}

.battlemap-upload-menu {
    position: relative;
}

.battlemap-upload-popover {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    display: grid;
    gap: 0.5rem;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.75rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
    box-shadow: var(--app-shadow-panel);
}

.battlemap-upload-option {
    display: block;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.battlemap-upload-file {
    display: none;
}

.battlemap-upload-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.battlemap-upload-link input {
    min-width: 0;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-input-bg);
    color: var(--app-text-strong);
    padding: 0.4rem 0.5rem;
}

.battlemap-upload-link button {
    padding: 0.4rem 0.65rem;
}

.battlemap-upload-error {
    margin: 0;
    color: #b42318;
    font-size: 0.85rem;
}

[data-bs-theme="dark"] .battlemap-upload-error {
    color: #ffb4ab;
}

.battlemap-canvas-frame {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f7f3ea;
}

.battlemap-canvas-frame.is-hidden {
    display: none;
}

.battlemap-avespfade {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #c6d4c4;
}

.battlemap-avespfade-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.battlemap-avespfade-search {
    position: absolute;
    z-index: 2;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.battlemap-avespfade-search form {
    display: flex;
    gap: 0.4rem;
    min-width: min(34rem, 100%);
    pointer-events: auto;
}

.battlemap-avespfade-search > button {
    pointer-events: auto;
}

.battlemap-avespfade-search input {
    min-width: 0;
    width: 12rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(17, 24, 39, 0.28);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.94);
    color: #111827;
    font: inherit;
}

.battlemap-avespfade-search button {
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(17, 24, 39, 0.28);
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-weight: 700;
}

.battlemap-avespfade-search span {
    max-width: min(32rem, 45vw);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    background: rgba(17, 24, 39, 0.82);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 650;
    pointer-events: none;
}

.battlemap-transform-controls {
    position: absolute;
    z-index: 3;
    display: grid;
    gap: 0.35rem;
    width: 10.5rem;
    padding: 0.5rem;
    border: 1px solid rgba(17, 24, 39, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
    color: #111827;
    user-select: none;
}

.battlemap-transform-controls[hidden] {
    display: none;
}

.battlemap-transform-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.battlemap-transform-row.two {
    grid-template-columns: repeat(2, 1fr);
}

.battlemap-transform-row.three {
    grid-template-columns: repeat(3, 1fr);
}

.battlemap-transform-controls button {
    min-width: 0;
    min-height: 2rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-weight: 700;
}

.battlemap-transform-controls button:hover,
.battlemap-transform-controls button:focus-visible,
.battlemap-transform-controls button.is-active {
    background: #e5e7eb;
}

.battlemap-transform-controls .battlemap-transform-danger {
    border-color: #ef4444;
    color: #b91c1c;
}

.battlemap-transform-controls .battlemap-transform-danger:hover,
.battlemap-transform-controls .battlemap-transform-danger:focus-visible {
    background: #fee2e2;
}

.battlemap-transform-controls label {
    display: grid;
    gap: 0.15rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.battlemap-transform-controls input {
    width: 100%;
}

[data-bs-theme="dark"] .battlemap-transform-controls {
    border-color: rgba(248, 249, 250, 0.24);
    background: rgba(33, 37, 41, 0.96);
    color: #f8f9fa;
}

[data-bs-theme="dark"] .battlemap-transform-controls button {
    border-color: #5c6770;
    background: #2b3035;
    color: #f8f9fa;
}

[data-bs-theme="dark"] .battlemap-transform-controls button:hover,
[data-bs-theme="dark"] .battlemap-transform-controls button:focus-visible,
[data-bs-theme="dark"] .battlemap-transform-controls button.is-active {
    background: #3f474f;
}

[data-bs-theme="dark"] .battlemap-transform-controls .battlemap-transform-danger {
    border-color: #f87171;
    color: #fecaca;
}

[data-bs-theme="dark"] .battlemap-transform-controls .battlemap-transform-danger:hover,
[data-bs-theme="dark"] .battlemap-transform-controls .battlemap-transform-danger:focus-visible {
    background: rgba(127, 29, 29, 0.8);
}

[data-bs-theme="dark"] .battlemap-canvas-frame {
    background: #10131a;
}

.battlemap-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #f7f3ea;
    touch-action: none;
}

[data-bs-theme="dark"] .battlemap-canvas {
    background: #10131a;
}

.battlemap-sidebar {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    border-left: 1px solid var(--app-border-color);
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
}

.battlemap-panel {
    border-bottom: 1px solid var(--app-border-color);
}

.battlemap-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.battlemap-panel summary::-webkit-details-marker {
    display: none;
}

.battlemap-panel-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
    font-size: 0.8rem;
}

.battlemap-date-panel {
    display: grid;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.battlemap-combat-panel {
    display: grid;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.battlemap-log-panel > p {
    margin: 0;
    padding: 0 1rem 1rem;
}

.battlemap-action-log {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0 1rem 1rem;
    list-style: none;
}

.battlemap-action-log li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.55rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-action-log time,
.battlemap-action-log small {
    color: var(--app-text-muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.battlemap-action-log strong,
.battlemap-action-log span,
.battlemap-action-log small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.battlemap-action-log span,
.battlemap-action-log small {
    grid-column: 1 / -1;
}

.battlemap-primary-button,
.battlemap-combat-actions button,
.battlemap-action-grid button {
    min-width: 0;
    min-height: 2.25rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-bg);
    color: var(--app-text-strong);
    padding: 0.4rem 0.55rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.15;
}

.battlemap-primary-button {
    width: 100%;
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
}

.battlemap-primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.battlemap-primary-button:not(:disabled):hover,
.battlemap-primary-button:not(:disabled):focus-visible,
.battlemap-combat-actions button:hover,
.battlemap-combat-actions button:focus-visible,
.battlemap-action-grid button:hover,
.battlemap-action-grid button:focus-visible {
    background: var(--app-surface-muted-hover);
    color: var(--app-text-strong);
}

.battlemap-combat-current {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-combat-current span,
.battlemap-combat-current small {
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.battlemap-combat-current strong {
    overflow: hidden;
    color: var(--app-text-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battlemap-initiative-list {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style-position: inside;
}

.battlemap-initiative-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-initiative-list li.is-active {
    border-color: var(--app-text-strong);
    box-shadow: inset 3px 0 0 var(--app-text-strong);
}

.battlemap-initiative-list span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

.battlemap-initiative-list strong {
    flex: 0 0 auto;
}

.battlemap-action-sections {
    display: grid;
    gap: 0.65rem;
}

.battlemap-action-section {
    display: grid;
    gap: 0.5rem;
    padding: 0.7rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-action-section h3 {
    margin: 0;
    color: var(--app-text-strong);
    font-size: 0.92rem;
    font-weight: 750;
}

.battlemap-action-section p {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

.battlemap-stabilize-panel {
    border-color: #f43f5e;
    background: color-mix(in srgb, var(--app-surface-bg) 92%, #fff1f2);
}

.battlemap-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.battlemap-action-grid button.is-selected {
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
}

.battlemap-cycle-panel {
    display: grid;
    gap: 0.65rem;
}

.battlemap-cycle-panel section {
    display: grid;
    gap: 0.5rem;
    padding: 0.7rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-cycle-panel h3 {
    margin: 0;
    color: var(--app-text-strong);
    font-size: 0.92rem;
    font-weight: 750;
}

.battlemap-cycle-panel p {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

.battlemap-movement-grid {
    display: grid;
    grid-template-columns: repeat(3, 2.2rem);
    gap: 0.35rem;
    justify-content: center;
}

.battlemap-movement-grid button {
    width: 2.2rem;
    height: 2.2rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
}

.battlemap-movement-grid button:hover,
.battlemap-movement-grid button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-combat-log {
    display: grid;
    gap: 0.3rem;
    margin: 0;
    padding-left: 1.1rem;
    color: var(--app-text-muted);
    font-size: 0.78rem;
}

.battlemap-target-panel {
    display: grid;
    gap: 0.45rem;
    padding-top: 0.15rem;
}

.battlemap-target-panel strong {
    color: var(--app-text-strong);
    font-size: 0.82rem;
}

.battlemap-target-panel > span {
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

.battlemap-target-grid {
    display: grid;
    gap: 0.35rem;
}

.battlemap-target-grid button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    min-height: 2.15rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
    padding: 0.35rem 0.5rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
}

.battlemap-target-grid button:hover,
.battlemap-target-grid button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-target-grid button.is-selected {
    border-color: var(--app-text-strong);
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
}

.battlemap-target-grid span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battlemap-target-grid small {
    font-size: 0.76rem;
    opacity: 0.8;
}

.battlemap-attack-cycle-submenu {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.15rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--app-border-color);
}

.battlemap-attack-cycle-submenu h4 {
    margin: 0;
    color: var(--app-text-strong);
    font-size: 0.88rem;
    font-weight: 800;
}

.battlemap-attack-cycle-submenu dl {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.battlemap-attack-cycle-submenu dl div {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 0.5rem;
    align-items: baseline;
}

.battlemap-attack-cycle-submenu dt,
.battlemap-attack-cycle-submenu dd {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
}

.battlemap-attack-cycle-submenu dt {
    color: var(--app-text-muted);
    font-weight: 750;
}

.battlemap-attack-cycle-submenu dd {
    color: var(--app-text-strong);
    font-weight: 650;
}

.battlemap-combat-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.battlemap-combat-actions .battlemap-danger-button {
    border-color: #fecdca;
    color: #b42318;
}

.battlemap-combat-error {
    padding: 0;
}

[data-bs-theme="dark"] .battlemap-combat-actions .battlemap-danger-button {
    border-color: rgba(255, 180, 171, 0.35);
    color: #ffb4ab;
}

.battlemap-field {
    display: grid;
    gap: 0.35rem;
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.battlemap-field input,
.battlemap-field select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-input-bg);
    color: var(--app-text-strong);
    padding: 0.48rem 0.55rem;
    font: inherit;
}

.battlemap-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.46);
}

.battlemap-dialog {
    display: grid;
    gap: 0.85rem;
    width: min(46rem, 100%);
    max-height: min(42rem, calc(100vh - 2rem));
    overflow: auto;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
    color: var(--app-text-strong);
    padding: 1rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.battlemap-dialog h2,
.battlemap-dialog h3,
.battlemap-dialog p {
    margin: 0;
}

.battlemap-date-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.battlemap-date-actions button {
    min-width: 0;
    min-height: 2.25rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-bg);
    color: var(--app-text-strong);
    padding: 0.35rem 0.45rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.1;
}

.battlemap-date-actions button:hover,
.battlemap-date-actions button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-date-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
}

.battlemap-date-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-date-list dt,
.battlemap-date-list dd {
    margin: 0;
}

.battlemap-date-list dt {
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.battlemap-date-list dd {
    color: var(--app-text-strong);
    font-weight: 750;
    white-space: nowrap;
}

.battlemap-date-error {
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid #fecdca;
    border-radius: 8px;
    background: #fff1f0;
    color: #b42318;
    font-size: 0.86rem;
    line-height: 1.35;
}

[data-bs-theme="dark"] .battlemap-date-error {
    border-color: rgba(255, 180, 171, 0.35);
    background: rgba(127, 29, 29, 0.32);
    color: #ffb4ab;
}

.battlemap-character-list {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0 1rem 1rem;
    list-style: none;
}

.battlemap-add-character-menu {
    display: grid;
    gap: 0.65rem;
    padding: 0 1rem 0.85rem;
}

.battlemap-bestiary-picker {
    display: grid;
    gap: 0.6rem;
    padding: 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.03);
}

.battlemap-bestiary-picker input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.battlemap-bestiary-results {
    display: grid;
    gap: 0.45rem;
    max-height: 22rem;
    overflow: auto;
}

.battlemap-bestiary-results button {
    display: grid;
    gap: 0.15rem;
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    background: var(--bs-body-bg);
    color: inherit;
    text-align: left;
}

.battlemap-bestiary-results button:hover,
.battlemap-bestiary-results button:focus-visible {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(37, 99, 235, 0.08);
}

.battlemap-bestiary-results span {
    font-weight: 700;
}

.battlemap-bestiary-results small {
    color: var(--bs-secondary-color);
}

.battlemap-bestiary-character-list {
    margin-top: -0.5rem;
}

.battlemap-character-list li {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    column-gap: 0.7rem;
    row-gap: 0.15rem;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
}

.battlemap-character-list li.has-portrait {
    cursor: grab;
}

.battlemap-character-list li.has-generated-portrait {
    cursor: grab;
}

.battlemap-character-list li.has-portrait:active {
    cursor: grabbing;
}

.battlemap-character-list li.has-generated-portrait:active {
    cursor: grabbing;
}

.battlemap-character-list img,
.battlemap-character-placeholder {
    grid-row: 1 / 4;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 6px;
}

.battlemap-character-portrait-menu {
    grid-row: 1 / 4;
    position: relative;
}

.battlemap-character-portrait-button {
    display: block;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.battlemap-character-portrait-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.battlemap-character-list img {
    object-fit: cover;
}

.battlemap-character-portrait-popover {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    z-index: 4;
    display: grid;
    gap: 0.5rem;
    min-width: 12rem;
    padding: 0.7rem;
    border: 1px solid var(--app-border-color);
    border-radius: 8px;
    background: var(--app-surface-bg);
    box-shadow: 0 16px 40px rgb(15 23 42 / 0.18);
}

.battlemap-character-portrait-option,
.battlemap-character-portrait-link button,
.battlemap-character-portrait-slots button {
    min-height: 2rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
}

.battlemap-character-portrait-option {
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.battlemap-character-portrait-option:hover,
.battlemap-character-portrait-option:focus-within,
.battlemap-character-portrait-link button:hover,
.battlemap-character-portrait-link button:focus-visible,
.battlemap-character-portrait-slots button:hover,
.battlemap-character-portrait-slots button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-character-portrait-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.battlemap-character-portrait-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
}

.battlemap-character-portrait-link input {
    min-width: 0;
    min-height: 2rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text);
    padding: 0.35rem 0.5rem;
    font: inherit;
    font-size: 0.8rem;
}

.battlemap-character-portrait-slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}

.battlemap-character-portrait-slots button.is-selected {
    border-color: var(--app-text-strong);
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
}

.battlemap-character-portrait-error {
    margin: 0;
    color: #b42318;
    font-size: 0.78rem;
}

.battlemap-character-placeholder {
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--app-border-color);
    background: var(--app-surface-muted);
    color: #667085;
    font-weight: 700;
}

.battlemap-character-list span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

.battlemap-character-list time,
.battlemap-muted,
.battlemap-error {
    color: #667085;
    font-size: 0.9rem;
}

.battlemap-character-stats {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, auto));
    gap: 0.35rem;
    margin: 0.15rem 0 0;
}

.battlemap-character-stats div {
    display: inline-grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 0.18rem;
    min-width: 0;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--app-border-color);
    border-radius: 5px;
    background: var(--app-surface-muted);
}

.battlemap-character-stats dt,
.battlemap-character-stats dd {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.1;
}

.battlemap-character-stats dt {
    color: var(--app-text-muted);
    font-weight: 800;
}

.battlemap-character-stats dd {
    color: var(--app-text-strong);
    font-weight: 800;
}

.battlemap-character-stats-placeholder {
    grid-column: 2;
    color: var(--app-text-muted);
    font-size: 0.78rem;
}

.battlemap-character-equipment-button {
    grid-column: 2;
    justify-self: start;
    min-height: 1.9rem;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
    padding: 0.25rem 0.5rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
}

.battlemap-character-equipment-button:hover,
.battlemap-character-equipment-button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-character-equipment-panel {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.5rem;
    margin-top: 0.45rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--app-border-color);
}

.battlemap-character-equipment-panel p {
    margin: 0;
    padding: 0;
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

.battlemap-character-equipment-list {
    display: grid;
    gap: 0.35rem;
}

.battlemap-character-equipment-list button {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
    border: 1px solid var(--app-border-color);
    border-radius: 6px;
    background: var(--app-surface-muted);
    color: var(--app-text-strong);
    padding: 0.45rem 0.55rem;
    text-align: left;
    font: inherit;
}

.battlemap-character-equipment-list button:hover,
.battlemap-character-equipment-list button:focus-visible {
    background: var(--app-surface-muted-hover);
}

.battlemap-character-equipment-list button.is-selected {
    border-color: var(--app-text-strong);
    background: var(--app-text-strong);
    color: var(--app-surface-bg);
}

.battlemap-character-equipment-list span,
.battlemap-character-equipment-list small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battlemap-character-equipment-list span {
    font-size: 0.84rem;
    font-weight: 750;
}

.battlemap-character-equipment-list small {
    font-size: 0.76rem;
    opacity: 0.78;
}

.battlemap-muted,
.battlemap-error {
    margin: 0;
    padding: 0 1rem 1rem;
}

.battlemap-error {
    color: #b42318;
}

[data-bs-theme="dark"] .battlemap-error {
    color: #ffb4ab;
}

article.content:has(.battlemap-page) {
    display: flex;
    height: calc(100dvh - 3.5rem);
    min-height: 0;
    overflow: hidden;
    padding: 0 !important;
}

article.content:has(.battlemap-page) > .battlemap-page {
    flex: 1;
}

html:has(.battlemap-page),
body:has(.battlemap-page),
body:has(.battlemap-page) .page,
body:has(.battlemap-page) main {
    height: 100dvh;
    overflow: hidden;
}

body:has(.battlemap-page) main {
    min-height: 0;
}

@media (min-width: 641px) {
    .battlemap-page,
    article.content:has(.battlemap-page) {
        height: 100dvh;
    }
}

html:has(.defence-stage),
body:has(.defence-stage),
body:has(.defence-stage) .page,
body:has(.defence-stage) main {
    height: 100dvh;
    overflow: hidden;
}

body:has(.defence-stage) main {
    min-height: 0;
}

@media (min-width: 641px) {
    .defence-stage,
    article.content:has(.defence-stage) {
        height: 100dvh;
    }
}

@media (max-width: 720px) {
    .defence-resource-bar {
        right: 0.75rem;
    }

    .defence-building-palette {
        top: 5.25rem;
        max-height: calc(100dvh - 6rem);
    }
}
