.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#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;
    }

.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."
    }

.startup-loader-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    background: var(--sidebar-surface);
}

.startup-loader-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: startup-pulse 1.4s ease-in-out infinite;
}

.startup-loader-text {
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #6b7480;
    text-transform: uppercase;
}

.startup-loader-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.startup-progress {
    width: min(260px, 72vw);
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.startup-progress-bar {
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background: linear-gradient(90deg, #1f3b5b 0%, #5bd1d7 100%);
    border-radius: inherit;
    transition: width 0.12s ease-out;
}

.startup-progress-value {
    font-size: 0.85rem;
    color: #6b7480;
    font-variant-numeric: tabular-nums;
}

.startup-progress-value::after {
    content: var(--blazor-load-percentage, "0%");
}

@keyframes startup-pulse {
    0% {
        opacity: 0.35;
        transform: scale(0.94);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0.35;
        transform: scale(0.94);
    }
}

code {
    color: #c02d76;
}

.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;
}
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --sidebar-surface: linear-gradient(180deg, #dff1f4 0%, #cfe6ef 52%, #d8d7ef 100%);
    --topbar-surface: #4f8fa8;
    --border: #e2e6ea;
    --text: #1a1f24;
    --muted: #6b7480;
    --accent: #1f3b5b;
    --accent-weak: #e6edf5;
    --danger: #b21d1d;
}

:root[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #171d24;
    --sidebar-surface: linear-gradient(180deg, #13232c 0%, #183443 52%, #2a2841 100%);
    --topbar-surface: #214455;
    --border: #2a3441;
    --text: #e6edf5;
    --muted: #a7b3c2;
    --accent: #9ec4ef;
    --accent-weak: #1b2a3c;
    --danger: #ff8c8c;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.login-shell {
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.app-sidebar {
    width: 240px;
    background: var(--sidebar-surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1.25rem;
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.sidebar-brand-logo {
    display: block;
    max-width: 100%;
    height: 44px;
    width: auto;
    object-fit: contain;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav a {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
}

.nav-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.2rem 0.3rem 0.4rem;
}

.nav-group summary {
    cursor: pointer;
    padding: 0.45rem 0.5rem;
    font-weight: 600;
    color: var(--accent);
}

.nav-subgroup {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.nav a.active {
    background: var(--accent-weak);
    color: var(--accent);
    font-weight: 600;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--topbar-surface);
}

.app-title {
    font-weight: 600;
    color: #f4fbff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.user-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    color: #f4fbff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.85rem;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    cursor: pointer;
}

.user-menu-popover {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    z-index: 30;
    min-width: 240px;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.user-menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.user-menu-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.user-menu-action {
    width: 100%;
    justify-content: flex-start;
}

.app-content {
    padding: 1.5rem;
}

.app-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 35, 0.34);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.app-busy-card {
    min-width: min(360px, 92vw);
    max-width: 420px;
    padding: 1.2rem 1.35rem;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
    background: color-mix(in srgb, var(--surface) 92%, white 8%);
    box-shadow: 0 20px 48px rgba(8, 18, 30, 0.24);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    text-align: center;
}

.app-busy-spinner {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 4px solid rgba(31, 59, 91, 0.14);
    border-top-color: var(--accent);
    animation: app-busy-spin 0.9s linear infinite;
}

.app-busy-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.app-busy-text {
    color: var(--muted);
    font-size: 0.92rem;
}

@keyframes app-busy-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.page-header h1 {
    margin: 0 0 0.3rem 0;
    font-size: 1.6rem;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
    align-items: start;
}

.games-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.games-pagination-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    flex-wrap: wrap;
}

.games-pagination-actions {
    display: inline-flex;
    gap: 0.5rem;
}

.game-card {
    background: linear-gradient(180deg, var(--accent-weak) 0%, var(--surface) 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border) 82%);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(31, 59, 91, 0.08);
}

.game-card-controls {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    gap: 0.45rem;
    z-index: 1;
}

.game-card-edit {
    min-width: 0;
    width: 2rem;
    height: 2rem;
    padding: 0.35rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.game-card-favorite {
    min-width: 0;
    width: 2rem;
    height: 2rem;
    padding: 0.35rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.game-card-favorite.is-active {
    color: #c83e4d;
    border-color: rgba(200, 62, 77, 0.4);
    background: rgba(200, 62, 77, 0.08);
}

.game-card-top {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    min-width: 0;
}

.game-card-image {
    width: 148px;
    height: 148px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--background);
}

.game-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.game-card-label-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.game-card-type {
    color: var(--muted);
    font-size: 0.92rem;
}

.game-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.game-status-badge-hot {
    background: rgba(205, 79, 29, 0.14);
    color: #a0431d;
}

.game-status-badge-new {
    background: rgba(46, 139, 87, 0.14);
    color: #23694a;
}

.game-status-badge-top {
    background: rgba(33, 114, 187, 0.14);
    color: #1d5f98;
}

.game-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-height: 1.75rem;
}

.game-card-feature-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.game-card-feature-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.game-feature-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-weak) 65%, white 35%);
    border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border) 84%);
    font-size: 0.82rem;
}

.game-card-description {
    color: var(--muted);
    min-height: 3.2rem;
    overflow-wrap: anywhere;
}

.game-card-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-start;
}

@media (max-width: 1100px) {
    .games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .games-pagination-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-card-top {
        grid-template-columns: 1fr;
    }

    .game-card-image {
        width: 100%;
        height: 180px;
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.panel-title {
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-grid-modal {
    margin-bottom: 1rem;
}

.game-form-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.game-form-preview {
    min-width: 0;
}

.game-form-preview-image {
    width: 100%;
    height: 92px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--background);
    display: block;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
}

.input {
    padding: 0.55rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.input-end-value {
    width: 160px;
    max-width: 100%;
}

.input-amount {
    width: 96px;
    max-width: 100%;
}

.input-requirement-id {
    width: 180px;
    max-width: 100%;
}

.input-requirement-text {
    width: 160px;
    max-width: 100%;
}

.input-requirement-number {
    width: 96px;
    max-width: 100%;
}

.input-requirement-json {
    width: 220px;
    max-width: 100%;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn.ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-inline {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.requirements-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.login-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.login-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.login-card h1 {
    margin-top: 0;
}

.login-card-header h1 {
    margin-bottom: 0.25rem;
}

.login-divider {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--border);
}

.login-divider span {
    padding: 0 0.65rem;
}

.error {
    margin-top: 0.8rem;
    color: var(--danger);
}

.mono {
    font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 16, 24, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1.5rem;
    box-sizing: border-box;
}

.modal {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    width: min(980px, 100%);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow: auto;
}

.endpoint-switcher {
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.endpoint-switcher.compact {
    min-width: 220px;
}

.endpoint-switcher-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.endpoint-switcher-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.endpoint-switcher-select {
    min-width: 0;
    flex: 1;
    background: var(--surface);
    color: var(--text);
}

.endpoint-switcher-caption {
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-word;
}

.endpoint-pill {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.18);
    color: #f4fbff;
}

.quest-editor-requirements {
    margin-top: 0.5rem;
}

@media (max-width: 900px) {
    .game-form-layout {
        grid-template-columns: 1fr;
    }

    .game-form-preview-image {
        height: 160px;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .app-content {
        padding: 1rem;
    }

    .login-card-header {
        flex-direction: column;
    }

    .endpoint-switcher,
    .endpoint-switcher.compact {
        width: 100%;
        min-width: 0;
    }

    .user-menu-popover {
        right: auto;
        left: 0;
        min-width: min(240px, calc(100vw - 2rem));
    }

}
