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;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid #444;
}

.app-brand {
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
}

.app-nav {
    display: flex;
    gap: 1.5rem;
}

    .app-nav a {
        text-decoration: none;
        color: inherit;
    }

        .app-nav a.active {
            font-weight: 700;
            text-decoration: underline;
        }

.app-content {
    padding: 1.5rem 2rem;
}

/* =========================================================
   CRUCIBLE WEB — APPLICATION SHELL
   ========================================================= */

:root {
    color-scheme: dark;
    --cr-bg: #111216;
    --cr-panel: #191a20;
    --cr-panel-hover: #23252d;
    --cr-border: #30323b;
    --cr-text: #e8e2d6;
    --cr-muted: #9698a3;
    --cr-accent: #b89a65;
    --cr-accent-hover: #d0b47d;
    --cr-sidebar-collapsed: 72px;
    --cr-sidebar-expanded: 248px;
    --cr-header-height: 76px;
}

/* Global foundation */

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--cr-bg);
    color: var(--cr-text);
    font-family: "Segoe UI", Arial, sans-serif;
}

body {
    min-height: 100vh;
}

* {
    box-sizing: border-box;
}

a {
    color: var(--cr-accent);
}

    a:hover {
        color: var(--cr-accent-hover);
    }

button,
input,
select,
textarea {
    font: inherit;
}

/* Main application structure */

.app-shell {
    min-height: 100vh;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--cr-sidebar-collapsed);
    display: flex;
    flex-direction: column;
    transition: margin-left 180ms ease;
}

.app-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 36px 40px;
    flex: 1;
    min-width: 0;
}

/* Left sidebar */

.app-sidebar {
    position: fixed;
    z-index: 1000;
    inset: 0 auto 0 0;
    width: var(--cr-sidebar-collapsed);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--cr-panel);
    border-right: 1px solid var(--cr-border);
    transition: width 180ms ease;
    scrollbar-width: thin;
}

    .app-sidebar:hover,
    .app-sidebar:focus-within {
        width: var(--cr-sidebar-expanded);
        box-shadow: 8px 0 28px rgb(0 0 0 / 18%);
    }

.sidebar-brand {
    height: var(--cr-header-height);
    min-height: var(--cr-header-height);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 23px;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
    color: var(--cr-text);
    border-bottom: 1px solid var(--cr-border);
}

    .sidebar-brand:hover {
        color: var(--cr-text);
    }

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    color: var(--cr-accent);
}

.brand-text {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 120ms ease;
}

.app-sidebar:hover .brand-text,
.app-sidebar:focus-within .brand-text {
    opacity: 1;
}

.sidebar-section-label {
    margin: 28px 0 12px;
    padding: 0 24px;
    color: var(--cr-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.6px;
    white-space: nowrap;
    opacity: 0;
}

.app-sidebar:hover .sidebar-section-label,
.app-sidebar:focus-within .sidebar-section-label {
    opacity: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
}

.sidebar-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--cr-muted);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

    .sidebar-link svg {
        flex: 0 0 24px;
    }

    .sidebar-link:hover {
        color: var(--cr-text);
        background: var(--cr-panel-hover);
    }

    .sidebar-link.active {
        color: var(--cr-accent-hover);
        background: rgb(184 154 101 / 10%);
        border-color: rgb(184 154 101 / 22%);
    }

.sidebar-link-text {
    opacity: 0;
    transition: opacity 120ms ease;
}

.app-sidebar:hover .sidebar-link-text,
.app-sidebar:focus-within .sidebar-link-text {
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 0 23px;
    border-top: 1px solid var(--cr-border);
    color: var(--cr-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-footer-mark {
    display: flex;
    flex: 0 0 24px;
    color: var(--cr-accent);
}

/* Top header */

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--cr-header-height);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 40px;
    background: rgb(17 18 22 / 94%);
    border-bottom: 1px solid var(--cr-border);
    backdrop-filter: blur(12px);
}

.topbar-context {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topbar-eyebrow {
    color: var(--cr-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
}

.topbar-title {
    color: var(--cr-text);
    font-size: 15px;
    font-weight: 600;
}

.topbar-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--cr-muted);
    font-size: 12px;
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cr-accent);
}

.mobile-menu-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--cr-text);
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 7px;
    cursor: pointer;
}

    .mobile-menu-button:hover {
        background: var(--cr-panel-hover);
    }

/* Footer */

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 40px;
    border-top: 1px solid var(--cr-border);
    color: var(--cr-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

/* Existing page elements */

.app-content h1,
.app-content h2,
.app-content h3 {
    color: var(--cr-text);
}

.app-content h1 {
    margin-bottom: 24px;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 700;
    letter-spacing: -0.6px;
}

.app-content h2 {
    margin-top: 30px;
    margin-bottom: 18px;
    font-size: 21px;
    font-weight: 600;
}

/* Form controls, including existing Characters form */

.app-content .form-control,
.app-content input[type="text"],
.app-content input[type="email"],
.app-content input[type="password"],
.app-content select,
.app-content textarea {
    color: var(--cr-text);
    background-color: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 6px;
}

    .app-content .form-control:focus,
    .app-content input:focus,
    .app-content select:focus,
    .app-content textarea:focus {
        color: var(--cr-text);
        background-color: var(--cr-panel);
        border-color: var(--cr-accent);
        box-shadow: 0 0 0 3px rgb(184 154 101 / 15%);
    }

.app-content .form-label {
    color: var(--cr-muted);
}

.app-content .btn-primary {
    color: #171511;
    background: var(--cr-accent);
    border-color: var(--cr-accent);
    font-weight: 600;
}

    .app-content .btn-primary:hover {
        background: var(--cr-accent-hover);
        border-color: var(--cr-accent-hover);
    }

.app-content hr {
    margin: 30px 0;
    border-color: var(--cr-border);
    opacity: 1;
}

/* Mobile navigation overlay */

.sidebar-overlay {
    display: none;
}

/* Responsive adjustments */

@media (max-width: 700px) {
    .app-main {
        margin-left: 0;
    }

    .app-sidebar {
        width: min(280px, 84vw);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 180ms ease, visibility 180ms ease;
        box-shadow: 12px 0 32px rgb(0 0 0 / 30%);
    }

        .app-sidebar:hover,
        .app-sidebar:focus-within {
            width: min(280px, 84vw);
        }

        .app-sidebar.mobile-open {
            transform: translateX(0);
            visibility: visible;
        }

    .brand-text,
    .sidebar-link-text,
    .sidebar-section-label {
        opacity: 1;
    }

    .sidebar-overlay {
        position: fixed;
        z-index: 900;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        background: rgb(0 0 0 / 60%);
        border: 0;
        cursor: pointer;
    }

    .app-topbar {
        min-height: 64px;
        gap: 12px;
        padding: 0 16px;
    }

    .mobile-menu-button {
        display: flex;
        flex: 0 0 42px;
    }

    .topbar-title {
        font-size: 13px;
    }

    .topbar-status {
        display: none;
    }

    .app-content {
        padding: 26px 18px;
    }

    .app-footer {
        padding: 18px;
        font-size: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   CHARACTERS PAGE
   ========================================================= */

.characters-page {
    width: 100%;
}

/* Page heading */

.characters-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 42px;
}

    .characters-heading h1 {
        margin: 8px 0 10px;
    }

.page-eyebrow {
    color: var(--cr-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

.page-description {
    margin: 0;
    color: var(--cr-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* Buttons */

.character-create-button,
.character-cancel-button {
    min-height: 44px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.character-create-button {
    flex-shrink: 0;
    color: #191710;
    background: var(--cr-accent);
    border-color: var(--cr-accent);
}

    .character-create-button:hover:not(:disabled) {
        background: var(--cr-accent-hover);
        border-color: var(--cr-accent-hover);
    }

    .character-create-button:active:not(:disabled) {
        transform: translateY(1px);
    }

    .character-create-button:disabled {
        cursor: wait;
        opacity: 0.65;
    }

.create-button-icon {
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
}

.character-cancel-button {
    color: var(--cr-text);
    background: transparent;
    border-color: var(--cr-border);
}

    .character-cancel-button:hover {
        background: var(--cr-panel-hover);
        border-color: #51535e;
    }

/* Notifications */

.character-notice {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    padding: 13px 16px;
    color: var(--cr-text);
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-left: 3px solid var(--cr-accent);
    border-radius: 5px;
    font-size: 13px;
}

    .character-notice button {
        padding: 0 4px;
        color: var(--cr-muted);
        background: transparent;
        border: 0;
        font-size: 20px;
        cursor: pointer;
    }

/* Collection heading */

.collection-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

    .collection-heading h2 {
        margin: 0 0 7px;
    }

    .collection-heading p {
        margin: 0;
        color: var(--cr-muted);
        font-size: 13px;
    }

.character-count {
    padding: 7px 10px;
    color: var(--cr-muted);
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Character cards */

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.character-card {
    min-width: 0;
    overflow: hidden;
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 8px;
    transition: border-color 160ms ease, transform 160ms ease;
}

    .character-card:hover {
        border-color: rgb(184 154 101 / 60%);
        transform: translateY(-2px);
    }

.character-card-top {
    min-height: 112px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px;
    background: radial-gradient( ellipse at 15% 0%, rgb(184 154 101 / 10%), transparent 75% ), #1d1e25;
    border-bottom: 1px solid var(--cr-border);
}

.character-portrait-placeholder {
    width: 54px;
    height: 54px;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    color: var(--cr-accent-hover);
    background: #292820;
    border: 1px solid rgb(184 154 101 / 40%);
    border-radius: 8px;
    font-family: Georgia, serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 1px;
}

.character-kind {
    color: var(--cr-muted);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-align: right;
}

.character-card-body {
    padding: 21px 20px;
}

    .character-card-body h3 {
        overflow-wrap: anywhere;
        margin: 0 0 6px;
        color: var(--cr-text);
        font-size: 19px;
        font-weight: 650;
    }

.character-subtitle {
    margin: 0 0 24px;
    color: var(--cr-muted);
    font-size: 12px;
}

.character-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.character-stat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 13px 12px;
    background: #14151a;
    border: 1px solid #292b33;
    border-radius: 5px;
}

.stat-label {
    color: var(--cr-muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.stat-value {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cr-text);
    font-size: 22px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.stat-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
}

.health-dot {
    background: #c66e69;
}

.armor-dot {
    background: var(--cr-accent);
}

.character-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    color: var(--cr-muted);
    background: #16171c;
    border-top: 1px solid var(--cr-border);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}

.record-indicator {
    width: 6px;
    height: 6px;
    background: var(--cr-accent);
    border-radius: 50%;
}

/* Empty collection */

.characters-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px;
    background: var(--cr-panel);
    border: 1px dashed #42434c;
    border-radius: 8px;
    text-align: center;
}

.empty-state-icon {
    width: 62px;
    height: 62px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
    color: var(--cr-accent);
    background: #25231d;
    border: 1px solid rgb(184 154 101 / 35%);
    border-radius: 50%;
    font-size: 32px;
    font-weight: 300;
}

.characters-empty-state h3 {
    margin: 0 0 10px;
    color: var(--cr-text);
    font-size: 20px;
}

.characters-empty-state p {
    max-width: 390px;
    margin: 0 0 24px;
    color: var(--cr-muted);
    font-size: 13px;
    line-height: 1.8;
}

/* Create-character modal */

.character-modal-backdrop {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 24px;
    background: rgb(0 0 0 / 72%);
    backdrop-filter: blur(5px);
}

.character-modal {
    width: 100%;
    max-width: 490px;
    margin: auto;
    padding: 30px;
    background: #1a1b21;
    border: 1px solid #3b3b43;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
}

.character-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

    .character-modal-header h2 {
        margin: 9px 0 0;
        color: var(--cr-text);
        font-size: 24px;
        font-weight: 650;
    }

.character-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    color: var(--cr-muted);
    background: transparent;
    border: 1px solid var(--cr-border);
    border-radius: 5px;
    font-size: 23px;
    cursor: pointer;
}

    .character-modal-close:hover {
        color: var(--cr-text);
        background: var(--cr-panel-hover);
    }

.character-modal-description {
    margin: 20px 0 28px;
    color: var(--cr-muted);
    font-size: 13px;
    line-height: 1.8;
}

.character-form-field {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

    .character-form-field label {
        color: var(--cr-text);
        font-size: 12px;
        font-weight: 600;
    }

    .character-form-field .form-control {
        min-height: 46px;
        padding: 11px 13px;
        background: #121318;
        border-color: #3a3c46;
    }

        .character-form-field .form-control::placeholder {
            color: #72747f;
        }

    .character-form-field .validation-message {
        color: #e19a93;
        font-size: 12px;
    }

.character-field-hint {
    color: var(--cr-muted);
    font-size: 11px;
}

.character-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--cr-border);
}

/* Tablet */

@media (max-width: 1100px) {
    .character-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .app-content {
        padding-right: 28px;
        padding-left: 28px;
    }
}

/* Mobile */

@media (max-width: 700px) {
    .characters-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 20px;
        margin-bottom: 32px;
    }

        .characters-heading .character-create-button {
            width: 100%;
        }

    .collection-heading {
        align-items: flex-start;
    }

    .character-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .character-card-top {
        min-height: 100px;
    }

    .characters-empty-state {
        padding: 48px 20px;
    }

    .character-modal-backdrop {
        align-items: flex-end;
        padding: 12px;
    }

    .character-modal {
        padding: 24px 20px;
        border-radius: 10px;
    }

    .character-modal-header h2 {
        font-size: 21px;
    }

    .character-modal-actions > button {
        flex: 1;
        padding-right: 10px;
        padding-left: 10px;
    }
}

/* CHARACTER DETAILS AND EDITING */

.character-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

    .character-card-link:focus-visible {
        outline: 2px solid var(--cr-accent);
        outline-offset: 3px;
    }

.character-details-page {
    width: 100%;
}

.character-back-link {
    display: inline-block;
    margin-bottom: 28px;
    color: var(--cr-muted);
    font-size: 13px;
    text-decoration: none;
}

    .character-back-link:hover {
        color: var(--cr-accent-hover);
    }

.character-details-heading {
    margin-bottom: 32px;
}

    .character-details-heading h1 {
        margin: 8px 0 10px;
    }

.character-edit-panel {
    padding: 26px;
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 8px;
}

.character-edit-panel-heading {
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cr-border);
}

    .character-edit-panel-heading h2 {
        margin: 0 0 8px;
    }

    .character-edit-panel-heading p {
        margin: 0;
        color: var(--cr-muted);
        font-size: 13px;
    }

.character-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

    .character-edit-grid .character-form-field .form-control {
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        background: #121318;
        border: 1px solid #3a3c46;
        border-radius: 5px;
        color: var(--cr-text);
    }

        .character-edit-grid .character-form-field .form-control:focus {
            border-color: var(--cr-accent);
            outline: 2px solid rgb(184 154 101 / 20%);
        }

.character-edit-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--cr-border);
}

    .character-edit-actions button:disabled {
        cursor: wait;
        opacity: .65;
    }

.character-details-unavailable {
    padding: 36px;
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 8px;
}

    .character-details-unavailable p {
        margin-bottom: 24px;
        color: var(--cr-muted);
        line-height: 1.7;
    }

    .character-details-unavailable .character-create-button {
        text-decoration: none;
    }

.character-page-message {
    color: var(--cr-muted);
}

.character-record-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 36px;
    margin-top: 22px;
    padding: 18px 4px;
}

    .character-record-metadata > div {
        display: flex;
        flex-direction: column;
        gap: 7px;
    }

    .character-record-metadata span {
        color: var(--cr-muted);
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 1px;
    }

    .character-record-metadata strong {
        color: var(--cr-text);
        font-size: 12px;
        font-weight: 500;
    }

@media (max-width: 700px) {
    .character-edit-panel {
        padding: 20px;
    }

    .character-edit-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .character-edit-actions {
        flex-direction: column-reverse;
    }

        .character-edit-actions button {
            width: 100%;
        }

    .character-record-metadata {
        flex-direction: column;
        gap: 18px;
    }
}

/* Attack management */

.attack-manager {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #34343c);
}

.attack-manager-heading,
.attack-card,
.attack-card-actions,
.attack-editor-actions,
.attack-catalog-add {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.attack-manager-heading {
    margin-bottom: 1.25rem;
}

.attack-manager h2,
.attack-manager h3,
.attack-manager h4 {
    margin-top: 0;
}

.attack-manager-heading h2 {
    margin-bottom: 0.25rem;
}

.attack-manager-heading p,
.attack-catalog-panel > p,
.attack-card p {
    margin: 0.25rem 0;
    color: var(--text-muted, #a4a4af);
}

.attack-catalog-panel,
.attack-editor-panel,
.attack-card,
.attack-empty-state {
    border: 1px solid var(--border-color, #34343c);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

    .attack-catalog-panel h3,
    .attack-editor-panel h3 {
        margin-bottom: 0.5rem;
    }

.attack-catalog-add {
    margin-top: 1rem;
}

    .attack-catalog-add select {
        flex: 1;
        min-width: 0;
    }

.attack-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

    .attack-editor-grid label {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        font-weight: 600;
    }

.attack-manager input,
.attack-manager select {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.45rem;
    background: var(--input-background, #202027);
    color: var(--text-color, #f3f3f5);
}

.attack-editor-actions {
    justify-content: flex-start;
    margin-top: 1rem;
}

.attack-primary-button,
.attack-secondary-button,
.attack-danger-button {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.45rem;
    cursor: pointer;
    font: inherit;
}

.attack-primary-button {
    background: var(--accent-color, #6558d3);
    color: white;
    border-color: transparent;
}

.attack-secondary-button {
    background: transparent;
    color: var(--text-color, #f3f3f5);
}

.attack-danger-button {
    background: transparent;
    color: #e57373;
    border-color: #8b4141;
}

.attack-manager button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attack-list {
    margin-top: 1.5rem;
}

    .attack-list > h3 {
        margin-bottom: 0.75rem;
    }

.attack-card {
    align-items: flex-start;
}

.attack-card-main {
    min-width: 0;
}

.attack-card h4 {
    margin-bottom: 0.35rem;
}

.attack-card-actions {
    flex-shrink: 0;
}

.attack-origin-label {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: var(--text-muted, #a4a4af);
}

.attack-empty-state {
    color: var(--text-muted, #a4a4af);
}

.attack-manager-message,
.attack-manager-status,
.attack-manager-error {
    margin: 0.75rem 0;
}

.attack-manager-status {
    color: #79c99a;
}

.attack-manager-error {
    color: #e57373;
}

@media (max-width: 700px) {
    .attack-manager-heading,
    .attack-card {
        flex-direction: column;
        align-items: stretch;
    }

    .attack-card-actions {
        justify-content: flex-start;
    }

    .attack-editor-grid {
        grid-template-columns: 1fr;
    }

    .attack-catalog-add {
        flex-direction: column;
        align-items: stretch;
    }
}

.attack-rules-editor {
    flex-basis: 100%;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #34343c);
}

    .attack-rules-editor h5,
    .attack-rules-editor h6 {
        margin: 1rem 0 0.5rem;
    }

.attack-rules-grid {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 1rem;
}

    .attack-rules-grid label {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        flex: 1;
        min-width: 180px;
    }

.attack-rules-editor input,
.attack-rules-editor select {
    box-sizing: border-box;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.45rem;
    background: var(--input-background, #202027);
    color: var(--text-color, #f3f3f5);
}

.attack-rule-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #34343c);
}

    .attack-rule-row p {
        margin: 0.25rem 0;
        color: var(--text-muted, #a4a4af);
    }

@media (max-width: 700px) {
    .attack-rules-grid {
        flex-direction: column;
        align-items: stretch;
    }

        .attack-rules-grid label {
            min-width: 0;
        }

    .attack-rule-row {
        flex-direction: column;
    }
}

.rules-section {
    margin-top: 1rem;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.5rem;
    overflow: hidden;
}

    .rules-section > summary {
        padding: 0.85rem 1rem;
        cursor: pointer;
        font-weight: 600;
        background: var(--input-background, #202027);
    }

.rules-item {
    margin: 0.5rem 0;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.4rem;
}

    .rules-item > summary {
        padding: 0.65rem 0.85rem;
        cursor: pointer;
        font-weight: 500;
    }

.rules-item-content {
    padding: 0 0.85rem 0.85rem;
}

    .rules-item-content p {
        margin: 0.5rem 0;
    }

.rules-section > :not(summary) {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
}

.rules-section > summary + * {
    margin-top: 0.75rem;
}

.attack-rules-editor {
    flex-basis: 100%;
    width: 100%;
    min-width: 0;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #34343c);
}

    .attack-rules-editor h5 {
        margin: 0 0 0.75rem;
    }

.rules-section {
    margin: 0.65rem 0;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.5rem;
    overflow: hidden;
}

    .rules-section > summary {
        padding: 0.8rem 1rem;
        cursor: pointer;
        font-weight: 600;
        background: var(--input-background, #202027);
    }

.rules-section-content {
    padding: 0.25rem 0.85rem 0.85rem;
}

.rules-item {
    margin: 0.45rem 0;
    border: 1px solid var(--border-color, #454550);
    border-radius: 0.4rem;
}

    .rules-item > summary {
        padding: 0.65rem 0.8rem;
        cursor: pointer;
        font-weight: 500;
    }

.rules-item-content {
    padding: 0 0.8rem 0.8rem;
}

    .rules-item-content p {
        margin: 0.5rem 0;
    }

.rules-item-subtitle {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted, #a4a4af);
}

.rules-section summary:hover,
.rules-item summary:hover {
    filter: brightness(1.12);
}

.rules-section summary:focus-visible,
.rules-item summary:focus-visible {
    outline: 2px solid var(--accent-color, #8888ff);
    outline-offset: -2px;
}

.trait-ability-manager {
    min-width: 0;
}

    .trait-ability-manager > label {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        margin: 0.75rem 0;
    }

    .trait-ability-manager input:not([type="checkbox"]),
    .trait-ability-manager select,
    .trait-ability-manager textarea {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding: 0.55rem 0.7rem;
        border: 1px solid var(--border-color, #454550);
        border-radius: 0.4rem;
        background: var(--input-background, #202027);
        color: var(--text-color, #f3f3f5);
    }

.definition-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin: 0.75rem 0;
}

    .definition-checkboxes label {
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

.trait-ability-manager h6 {
    margin: 1.25rem 0 0.6rem;
}

.attack-description-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 1rem;
}

    .attack-description-field textarea {
        width: 100%;
        resize: vertical;
        box-sizing: border-box;
    }

.attack-traits-editor {
    margin-top: 1.25rem;
}

.attack-trait-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.attack-trait-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border-color, #888);
    border-radius: 999px;
}

    .attack-trait-chip button {
        border: none;
        background: transparent;
        cursor: pointer;
        font: inherit;
    }

.attack-trait-input-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
}

    .attack-trait-input-wrapper input {
        width: 100%;
        box-sizing: border-box;
    }

.attack-trait-suggestions {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, #888);
    background: var(--bs-body-bg, white);
    box-shadow: 0 4px 8px rgb(0 0 0 / 12%);
}

    .attack-trait-suggestions button {
        padding: 0.5rem 0.75rem;
        border: none;
        background: transparent;
        color: inherit;
        text-align: left;
        cursor: pointer;
    }

        .attack-trait-suggestions button:hover,
        .attack-trait-suggestions button:focus {
            background: var(--bs-secondary-bg, #eee);
        }

.attack-trait-help {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

.auth-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.session-page {
    --session-surface: var(--bs-body-bg);
    --session-panel: var(--bs-tertiary-bg);
    --session-border: var(--bs-border-color);
    --session-muted: var(--bs-secondary-color);
    max-width: 1500px;
    margin: 0 auto;
    padding: .25rem 0 3rem;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--session-border);
    border-radius: 1rem;
    background: var(--cr-panel);
}

.session-title {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 750;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

.session-code {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: .35rem;
    color: var(--session-muted);
    font-size: .9rem;
}

    .session-code strong {
        color: var(--bs-body-color);
        letter-spacing: .12em;
        font-size: 1rem;
    }

.session-header-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.session-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 1rem;
    align-items: start;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

    .section-heading h2 {
        font-size: 1.1rem;
        font-weight: 750;
        margin: 0;
    }

.character-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.character-panel {
    min-width: 0;
    border: 1px solid var(--session-border);
    border-radius: .9rem;
    background: var(--cr-panel);
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .character-panel.own-character {
        border-color: var(--bs-primary);
        box-shadow: inset 0 0 0 1px var(--bs-primary);
    }

    .character-panel.expanded {
        grid-column: 1 / -1;
    }

.character-panel-heading {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem;
    border: 0;
    background: transparent;
    color: var(--bs-body-color);
    text-align: left;
}

    .character-panel-heading:hover {
        background: color-mix(in srgb, var(--bs-primary) 5%, transparent);
    }

    .character-panel-heading:focus-visible,
    .timeline-preview:focus-visible,
    .combatant-panel:focus-visible {
        outline: 2px solid var(--bs-primary);
        outline-offset: -2px;
    }

.character-name {
    font-weight: 750;
    overflow-wrap: anywhere;
}

.character-kind {
    color: var(--session-muted);
    font-size: .8rem;
}

.character-chevron {
    flex: 0 0 auto;
    color: var(--session-muted);
    transition: transform .18s ease;
}

.expanded .character-chevron {
    transform: rotate(180deg);
}

.character-summary {
    padding: 0 .9rem .9rem;
}

.character-summary-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

.mini-stat {
    min-width: 0;
    padding: .65rem;
    border: 1px solid var(--session-border);
    border-radius: .65rem;
    background: var(--session-surface);
}

.mini-stat-label {
    color: var(--session-muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.mini-stat-value {
    margin-top: .15rem;
    font-size: 1.05rem;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.character-sheet {
    padding: 0 .9rem 1rem;
    animation: sheet-enter .18s ease both;
}

    .character-sheet h4 {
        font-size: 1rem;
        font-weight: 750;
    }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.stat-editor {
    min-width: 0;
    padding: .75rem;
    border: 1px solid var(--session-border);
    border-radius: .7rem;
    background: var(--session-surface);
}

    .stat-editor .form-label {
        font-size: .82rem;
        font-weight: 650;
    }

    .stat-editor .input-group {
        flex-wrap: nowrap;
    }

    .stat-editor .form-control {
        min-width: 0;
        padding-inline: .4rem;
    }

.attacks-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.attack-card {
    min-width: 0;
    padding: .75rem;
    border: 1px solid var(--session-border);
    border-radius: .7rem;
    overflow-wrap: anywhere;
}

    .attack-card h5 {
        font-size: .95rem;
        font-weight: 750;
    }

.session-sidebar {
    min-width: 0;
    position: sticky;
    top: 1rem;
}

.timeline-widget {
    border: 1px solid var(--session-border);
    border-radius: .9rem;
    overflow: hidden;
    background: var(--cr-panel);
}

.timeline-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .85rem;
    border-bottom: 1px solid var(--session-border);
}

    .timeline-widget-header h2 {
        margin: 0;
        font-size: 1rem;
        font-weight: 750;
    }

.timeline-preview {
    display: block;
    width: 100%;
    max-height: 340px;
    overflow-y: auto;
    padding: .65rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.timeline-preview-list,
.timeline-full-list {
    display: grid;
    gap: .55rem;
}

.timeline-event {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: .65rem;
    padding: .7rem;
    border: 1px solid var(--session-border);
    border-left: 3px solid var(--bs-secondary);
    border-radius: .7rem;
    background: var(--session-surface);
    overflow-wrap: anywhere;
}

    .timeline-event.event-combat {
        border-left-color: var(--bs-danger);
    }

    .timeline-event.event-character {
        border-left-color: var(--bs-primary);
    }

    .timeline-event.event-join {
        border-left-color: var(--bs-success);
    }

    .timeline-event.event-warning {
        border-left-color: var(--bs-warning);
    }

.timeline-symbol {
    display: grid;
    place-items: center;
    align-self: start;
    width: 2rem;
    height: 2rem;
    border-radius: .6rem;
    background: var(--cr-panel);
    font-weight: 800;
    font-size: 1rem;
}

.event-combat .timeline-symbol {
    color: var(--bs-danger);
}

.event-character .timeline-symbol {
    color: var(--bs-primary);
}

.event-join .timeline-symbol {
    color: var(--bs-success);
}

.event-warning .timeline-symbol {
    color: var(--bs-warning-text-emphasis, var(--bs-warning));
}

.timeline-message {
    font-size: .86rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.timeline-time {
    display: block;
    margin-top: .3rem;
    color: var(--session-muted);
    font-size: .72rem;
}

.timeline-expand-hint {
    padding: .65rem .85rem;
    border-top: 1px solid var(--session-border);
    color: var(--session-muted);
    font-size: .78rem;
    text-align: center;
}

.empty-panel {
    padding: 1.25rem;
    border: 1px dashed var(--session-border);
    border-radius: .9rem;
    color: var(--session-muted);
    text-align: center;
}

.combat-open-button {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.combat-open-indicator {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--bs-success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-success) 15%, transparent);
}

.overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(5px);
    animation: backdrop-enter .18s ease both;
}

    .overlay-backdrop.overlay-closing {
        animation: backdrop-exit .18s ease both;
    }

.overlay-window {
    display: flex;
    flex-direction: column;
    width: min(100%, 1100px);
    height: min(92dvh, 1000px);
    overflow: hidden;
    border: 1px solid var(--session-border);
    border-radius: 1.1rem;
    background: var(--cr-panel);
    box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .3);
    animation: overlay-grow .22s cubic-bezier(.2, .8, .2, 1) both;
    transform-origin: center;
}

.overlay-closing .overlay-window {
    animation: overlay-shrink .18s ease both;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--session-border);
    background: var(--cr-panel);
}

    .overlay-header h2 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 800;
    }

.overlay-subtitle {
    margin-top: .2rem;
    color: var(--session-muted);
    font-size: .83rem;
}

.overlay-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1rem;
}

.combat-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

    .combat-toolbar h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 800;
    }

.combatant-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.combatant-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .9rem;
    border-radius: .9rem;
    border: 1px solid var(--cr-border);
    background: #23252d;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

    .combatant-panel:hover {
        background: #2b2e37;
    }

    .combatant-panel.current-turn {
        border-color: #5aa2ff;
        box-shadow: 0 0 0 2px rgba(90,162,255,.25);
    }

    .combatant-panel.target-selected {
        background: rgba(184,154,101,.22);
        border-color: var(--cr-accent);
        box-shadow: 0 0 0 2px rgba(184,154,101,.35);
    }

.combatant-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
}

.combatant-name {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.combatant-initiative {
    flex: 0 0 auto;
    min-width: 2.3rem;
    padding: .3rem .45rem;
    border-radius: .5rem;
    background: var(--session-surface);
    text-align: center;
    font-weight: 800;
}

.combatant-health {
    margin-top: .75rem;
}

.combatant-health-label {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .3rem;
    color: var(--session-muted);
    font-size: .78rem;
}

.combatant-health-track {
    height: .4rem;
    border-radius: 999px;
    background: var(--session-surface);
    overflow: hidden;
}

.combatant-health-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--bs-success);
    transition: width .2s ease;
}

    .combatant-health-fill.low {
        background: var(--bs-danger);
    }

.combatant-details {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .8rem;
    margin-top: .65rem;
    color: var(--session-muted);
    font-size: .78rem;
}

.combatant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}

.combat-section {
    margin-top: 1.25rem;
}

    .combat-section h3 {
        margin-bottom: .65rem;
        font-size: 1rem;
        font-weight: 800;
    }

.target-hint {
    margin-bottom: .75rem;
    color: var(--session-muted);
    font-size: .85rem;
}

.round-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--bs-primary) 45%, var(--session-border));
    border-radius: .9rem;
    background: color-mix(in srgb, var(--bs-primary) 7%, var(--cr-panel));
}

    .round-banner h3 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 800;
    }

    .round-banner p {
        margin: .2rem 0 0;
        color: var(--session-muted);
        font-size: .85rem;
    }

@keyframes overlay-grow {
    from {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes overlay-shrink {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }
}

@keyframes backdrop-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes backdrop-exit {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes sheet-enter {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 767.98px) {
    .session-page {
        padding-inline: .1rem;
    }

    .session-header {
        align-items: flex-start;
        padding: .85rem;
        border-radius: .85rem;
    }

    .session-header-actions {
        width: 100%;
    }

        .session-header-actions .btn {
            flex: 1;
        }

    .session-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .character-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .character-panel.expanded {
        grid-column: auto;
    }

    .session-sidebar {
        position: static;
    }

    .timeline-preview {
        max-height: 240px;
    }

    .overlay-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .overlay-window {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: 0;
    }

    .overlay-header {
        padding: .9rem;
        padding-top: max(.9rem, env(safe-area-inset-top));
    }

    .overlay-content {
        padding: .75rem;
        padding-bottom: max(.75rem, env(safe-area-inset-bottom));
    }

    .combatant-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .attacks-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .overlay-backdrop,
    .overlay-window,
    .character-sheet {
        animation: none !important;
    }

    .character-panel,
    .character-chevron,
    .combatant-panel,
    .combatant-health-fill {
        transition: none !important;
    }
}

.overlay-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    flex-shrink: 0;
}

.overlay-heading {
    min-width: 0;
}

    .overlay-heading h2 {
        margin-bottom: .25rem;
    }

@media (max-width: 576px) {
    .overlay-header {
        align-items: flex-start;
        gap: .5rem;
        padding: .75rem;
    }

    .overlay-header-actions {
        flex-wrap: wrap;
        gap: .35rem;
    }

        .overlay-header-actions .btn {
            padding: .35rem .5rem;
            font-size: .85rem;
        }
}

.initiative-list {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: .75rem;
    width: 100%;
    max-height: 48dvh;
    overflow-y: auto;
    padding-right: .35rem;
}

    .initiative-list > article.combatant-panel {
        display: flex !important;
        flex-direction: column !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

.initiative-list {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
}

    .initiative-list > .combatant-panel {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 auto !important;
    }

.attack-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.attack-panel {
    overflow: hidden;
    border: 1px solid var(--cr-border);
    border-radius: .85rem;
    background: #23252d;
}

.attack-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    min-height: 76px;
    padding: 1rem;
    border: 0;
    background: transparent;
    color: var(--cr-text);
    text-align: left;
    cursor: pointer;
}

    .attack-panel-header:hover {
        background: #2b2e37;
    }

.attack-panel-summary {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

    .attack-panel-summary span {
        color: var(--cr-muted);
        overflow-wrap: anywhere;
    }

.attack-expand-indicator {
    flex: 0 0 auto;
    font-size: 1.5rem;
    color: var(--cr-accent);
}

.attack-panel-content {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    border-top: 1px solid var(--cr-border);
}

.attack-option-label {
    margin: 0;
    font-weight: 600;
}

.attack-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: .65rem;
}

.attack-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: .4rem;
    min-height: 72px;
    padding: .85rem;
    border: 1px solid var(--cr-border);
    border-radius: .7rem;
    background: var(--cr-panel);
    color: var(--cr-text);
    text-align: left;
    cursor: pointer;
}

    .attack-option span {
        color: var(--cr-muted);
        overflow-wrap: anywhere;
    }

    .attack-option.selected {
        border-color: var(--cr-accent);
        background: rgba(184, 154, 101, .16);
        box-shadow: 0 0 0 1px var(--cr-accent);
    }

.attack-execute-button {
    width: 100%;
    min-height: 46px;
}

.mobile-section {
    margin: 1rem 0 1.5rem;
}

.mobile-search {
    min-height: 48px;
    margin: .75rem 0;
    font-size: 16px;
}

.mobile-card-list {
    display: grid;
    gap: .65rem;
    max-height: 320px;
    overflow-y: auto;
    padding: 2px;
}

.mobile-option-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
}

.mobile-option-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .25rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

    .mobile-option-info span,
    .mobile-option-info small {
        color: var(--bs-secondary-color);
    }

.mobile-add-button {
    min-width: 68px;
    min-height: 44px;
}

.mobile-action-button {
    min-height: 48px;
    margin: .5rem 0 1rem;
}

.mobile-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .4rem;
}

.mobile-choice {
    min-height: 44px;
    min-width: 52px;
    padding: .65rem .85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    touch-action: manipulation;
}

    .mobile-choice.selected {
        border-color: var(--bs-primary);
        background: var(--bs-primary);
        color: white;
    }

    .mobile-choice:disabled,
    .mobile-trait-chip:disabled {
        opacity: .55;
    }

.mobile-trait-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .5rem;
}

.mobile-trait-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    padding: .55rem .8rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    touch-action: manipulation;
}

.character-creation-form input,
.character-creation-form textarea {
    font-size: 16px;
}

@media (max-width: 576px) {
    .mobile-option-card {
        align-items: flex-start;
    }

    .mobile-choice {
        flex: 1 1 auto;
    }
}

.character-delete-button {
    background: #a52834;
    color: white;
    border: 1px solid #a52834;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    cursor: pointer;
}

    .character-delete-button:hover:not(:disabled) {
        background: #842029;
    }

    .character-delete-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.character-delete-confirmation {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #a52834;
    border-radius: 8px;
}

    .character-delete-confirmation h3 {
        margin-top: 0;
    }

.character-delete-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.65);
}

.character-delete-dialog {
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    border: 1px solid #a52834;
    border-radius: 10px;
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

    .character-delete-dialog h2 {
        margin-top: 0;
    }

    .character-delete-dialog .character-edit-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

.character-delete-section {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid #a52834;
    border-radius: 8px;
}

.character-delete-button {
    background: #a52834;
    color: white;
    border: 1px solid #a52834;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    cursor: pointer;
}

    .character-delete-button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

.join-character-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.join-character-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    text-align: left;
    color: var(--bs-body-color);
    background: var(--cr-panel);
    border: 1px solid var(--cr-border);
    border-radius: 0.75rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

    .join-character-panel:hover:not(:disabled) {
        background: var(--cr-panel-hover);
        border-color: var(--cr-accent);
    }

    .join-character-panel:focus-visible {
        outline: 2px solid var(--bs-primary);
        outline-offset: 2px;
    }

    .join-character-panel.selected {
        background: var(--bs-primary-bg-subtle);
        border-color: var(--bs-primary);
        box-shadow: 0 0 0 1px var(--bs-primary);
    }

    .join-character-panel:disabled {
        opacity: 0.65;
        cursor: not-allowed;
    }

.join-character-portrait {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 3rem;
    width: 3rem;
    height: 3rem;
    color: var(--bs-emphasis-color);
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    font-size: 1rem;
    font-weight: 700;
}

.join-character-info {
    flex: 1;
    min-width: 0;
}

    .join-character-info h4 {
        margin: 0 0 0.5rem;
        color: var(--bs-emphasis-color);
        font-size: 1rem;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

.join-character-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

.join-character-check {
    flex: 0 0 auto;
    color: var(--bs-primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.join-character-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (max-width: 576px) {
    .join-character-panel {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .join-character-stats {
        flex-direction: column;
        gap: 0.2rem;
    }
}

@media (max-width: 576px) {
    .join-character-panel {
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .join-character-portrait {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
    }

    .join-character-stats {
        gap: 0.35rem 0.75rem;
    }

    .join-character-actions > button {
        width: 100%;
    }
}

    .character-heading-text {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        overflow-wrap: anywhere;
    }

    .character-owner {
        color: var(--bs-secondary-color);
        font-size: 0.8rem;
        font-weight: 400;
    }

    .character-control-icon {
        color: var(--bs-warning);
        font-size: 1rem;
        line-height: 1;
    }

    .character-attack-list {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        max-height: 24rem;
        overflow-y: auto;
        padding: 0.15rem 0.35rem 0.15rem 0.15rem;
    }

        .character-attack-list .attack-panel {
            flex: 0 0 auto;
        }

    .host-character-roster {
        margin-bottom: 1.25rem;
        border: 1px solid var(--cr-border);
        border-radius: 10px;
        background: #1c1e25;
        overflow: hidden;
    }

    .host-character-roster-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.85rem 1rem;
        background: #23252d;
        border-bottom: 1px solid var(--cr-border);
    }

        .host-character-roster-header h3 {
            margin: 0;
            color: var(--cr-text);
            font-size: 1rem;
        }

        .host-character-roster-header span {
            color: var(--cr-muted);
            font-size: 0.85rem;
        }

    .host-character-roster-list {
        height: 220px;
        overflow-y: auto;
        padding: 0.4rem;
    }

    .host-character-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 0.3rem;
        padding: 0.75rem;
        border: 1px solid transparent;
        border-radius: 6px;
        background: #202229;
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

        .host-character-card:hover {
            background: #2a2c35;
            border-color: var(--cr-border);
        }

        .host-character-card:last-child {
            margin-bottom: 0;
        }

    .host-character-info {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 0;
    }

        .host-character-info strong {
            color: var(--cr-text);
            overflow-wrap: anywhere;
        }

        .host-character-info span {
            color: var(--cr-muted);
            font-size: 0.85rem;
        }

    .roster-button {
        flex-shrink: 0;
        padding: 0.45rem 0.7rem;
        border: 1px solid var(--cr-accent);
        border-radius: 6px;
        background: transparent;
        color: var(--cr-text);
        cursor: pointer;
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

        .roster-button:hover:not(:disabled) {
            border-color: var(--cr-accent-hover);
            background: #343039;
        }

        .roster-button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

    .roster-remove {
        border-color: var(--cr-border);
    }

        .roster-remove:hover:not(:disabled) {
            background: #2a2c35;
            border-color: #454854;
        }

    .roster-empty {
        margin: 0;
        padding: 0.75rem;
        color: var(--cr-muted);
    }

    @media (max-width: 576px) {
        .host-character-roster-header {
            align-items: flex-start;
            flex-direction: column;
            gap: 0.25rem;
        }

        .host-character-card {
            align-items: flex-start;
            gap: 0.75rem;
        }

        .host-character-info {
            flex: 1;
        }

        .roster-button {
            white-space: nowrap;
        }
    }


/* =========================================================
   COMBAT TRACKER — HIGH-CONTRAST PANEL SURFACES
   These overrides intentionally make the roster and character
   cards visibly distinct from the page background.
   ========================================================= */

.session-page .host-character-roster {
    background-color: #20232c !important;
    border-color: #454957 !important;
}

.session-page .host-character-roster-header {
    background-color: #303441 !important;
    border-bottom-color: #454957 !important;
}

.session-page .host-character-roster-list {
    background-color: #191b22 !important;
}

    .session-page .host-character-roster-list .host-character-card {
        background-color: #2a2e39 !important;
        border-color: #414654 !important;
    }

        .session-page .host-character-roster-list .host-character-card:hover {
            background-color: #373c49 !important;
            border-color: #b89a65 !important;
        }

.session-page .character-panel {
    background-color: #252832 !important;
    border-color: #454957 !important;
}

.session-page .character-panel-heading {
    background-color: #2d313c !important;
    color: var(--cr-text) !important;
}

    .session-page .character-panel-heading:hover {
        background-color: #383d49 !important;
    }

.session-page .character-summary,
.session-page .character-sheet {
    background-color: #252832 !important;
}

.session-page .mini-stat {
    background-color: #17191f !important;
    border-color: #3b3f4b !important;
}

.session-page .character-panel.own-character {
    border-color: var(--cr-accent) !important;
    box-shadow: inset 0 0 0 1px var(--cr-accent) !important;
}
