html {
    font-size: 14px;
    scrollbar-gutter: stable;
    background-color: #ffffff;
}

:root {
    --sidebar-width: 260px;
    --header-height: calc(70px + env(safe-area-inset-top, 0px));
    --bg-color: #f4f6f9;
    --hover-bg: #f8f9fa;
    --font-color: color-mix(in oklab, var(--accent-color), black 90%);

    --accent-color: #0d6efd;
    --accent-light: #e7f1ff;
}

.theme-default {
    --accent-color: #0d6efd;
    --accent-light: #e7f1ff;
}

.theme-smaragd {
    --accent-color: #198754;
    --accent-light: #d1e7dd;
}

.theme-kupfer {
    --accent-color: #b05c00;
    --accent-light: #f9e2cc;
}

.theme-rot {
    --accent-color: #d02e44;
    --accent-light: #f9dde1;
}

.theme-violett {
    --accent-color: #7346c9;
    --accent-light: #e9e1f7;
}

.theme-petrol {
    --accent-color: #0d818e;
    --accent-light: #d0eced;
}

.theme-magenta {
    --accent-color: #bd2f6e;
    --accent-light: #f7dbe7;
}

.theme-gold {
    --accent-color: #8a6209;
    --accent-light: #f4e7c5;
}

.theme-schiefer {
    --accent-color: #566274;
    --accent-light: #e7eaef;
}

.theme-gras {
    --accent-color: #1f6b3b;
    --accent-light: #d5e8dc;
}

.theme-navy {
    --accent-color: #2b4c9b;
    --accent-light: #dde3f4;
}

.theme-terrakotta {
    --accent-color: #bf5327;
    --accent-light: #f7e0d4;
}

.theme-default, .theme-smaragd, .theme-kupfer, .theme-rot, .theme-violett,
.theme-petrol, .theme-magenta, .theme-gold, .theme-schiefer, .theme-gras,
.theme-navy, .theme-terrakotta {
    --promo-bg: color-mix(in oklab, #d9efe1, var(--accent-light) 22%);
    --promo-border: color-mix(in oklab, #1f9d61, var(--accent-color) 18%);
    --releg-bg: color-mix(in oklab, #f7dde0, var(--accent-light) 22%);
    --releg-border: color-mix(in oklab, #d24857, var(--accent-color) 18%);
    --result-win-bg: color-mix(in oklab, #d1f7d6, var(--accent-light) 15%);
    --result-draw-bg: color-mix(in oklab, #f8edab, var(--accent-light) 15%);
    --result-loss-bg: color-mix(in oklab, #ffc2bf, var(--accent-light) 15%);
}

body {
    font-family: 'Encode Sans Semi Condensed', system-ui, sans-serif;
    color: var(--font-color);
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    background-image: linear-gradient(135deg, #eef1f5 0%, var(--accent-light) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.form-check-input:focus {
    border-color: var(--accent-color);
}

.btn-primary {
    --bs-btn-bg: var(--accent-color);
    --bs-btn-border-color: var(--accent-color);
    --bs-btn-hover-bg: color-mix(in oklab, var(--accent-color), black 10%);
    --bs-btn-hover-border-color: color-mix(in oklab, var(--accent-color), black 10%);
    --bs-btn-active-bg: color-mix(in oklab, var(--accent-color), black 15%);
    --bs-btn-active-border-color: color-mix(in oklab, var(--accent-color), black 15%);
    --bs-btn-disabled-bg: var(--accent-color);
    --bs-btn-disabled-border-color: var(--accent-color);
    --bs-btn-focus-shadow-rgb: 67, 97, 238;
}

.bg-primary {
    background-color: var(--accent-color) !important;
}

.text-primary {
    color: var(--accent-color) !important;
}

.rating-link {
    color: inherit;
    text-decoration: underline dotted;
    text-decoration-color: color-mix(in oklab, currentColor, transparent 55%);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
}

.rating-link:hover,
.rating-link:focus-visible {
    text-decoration-color: currentColor;
}

.tabular-nums,
.rating-cell,
.dwz-elo-val,
.lpv-rating {
    font-variant-numeric: tabular-nums;
}

.not-implemented-content,
.error-narrow-content {
    max-width: 600px;
}

.error-wide-content,
.maintenance-content {
    max-width: 60rem;
}

.error-404-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent-color);
    opacity: 0.15;
    line-height: 1;
}

.error-stacktrace {
    max-height: 32rem;
    overflow: auto;
    white-space: pre-wrap;
}

.page-wrapper {
    max-width: 1200px;
    margin: 2.5rem auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 5rem);
    position: relative;
}

.main-header {
    height: var(--header-height);
    background-color: transparent;
    border-bottom: 1px solid #eaeaea;
    border-radius: 12px 12px 0 0;
    box-sizing: border-box;
    padding-block-start: env(safe-area-inset-top, 0px);
    padding-inline-start: env(safe-area-inset-left, 0px);
    padding-inline-end: env(safe-area-inset-right, 0px);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.main-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-color: #ffffff;
    border-radius: inherit;
    pointer-events: none;
}

.main-header > .container-fluid {
    position: relative;
    z-index: 1;
}

.safari-top-tint {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    @media (max-width: 991.98px) {
        .safari-top-tint {
            display: block;
            position: sticky;
            top: 0;
            z-index: 1041;
            width: 100%;
            height: 1px;
            margin-bottom: -1px;
            background-color: #ffffff;
            pointer-events: none;
        }
    }
}

.brand-text {
    font-family: 'Barlow Condensed', system-ui, sans-serif;
    font-weight: 800;
    color: var(--font-color);
    font-size: 2.5rem;
    letter-spacing: 0.5px;
}

.sidebar {
    background-color: #ffffff;
    border-right: 1px solid #eaeaea;
    width: var(--sidebar-width) !important;
    z-index: 1050 !important;
}

.sidebar-context {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    background-color: color-mix(in oklab, var(--accent-color), white 93%);
    border-bottom: 1px solid color-mix(in oklab, var(--accent-color), white 72%);
}

.sidebar-context-icon {
    flex: 0 0 auto;
    color: color-mix(in oklab, var(--accent-color), black 35%);
    font-size: 1rem;
}

.sidebar-context-name {
    display: -webkit-box;
    flex: 1 1 auto;
    overflow: hidden;
    min-width: 0;
    max-height: 2.6em;
    color: var(--font-color);
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.sidebar-season-switch {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f0f1f3;
}

.sidebar-season-label {
    display: block;
    margin-bottom: 0.35rem;
    color: #8a94a6;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.sidebar-season-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--font-color);
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: left;
}

.sidebar-season-toggle:hover,
.sidebar-season-toggle:focus-visible,
.sidebar-season-toggle[aria-expanded="true"] {
    color: var(--accent-color);
    background-color: color-mix(in oklab, var(--accent-color), white 96%);
    border-color: color-mix(in oklab, var(--accent-color), white 72%);
}

.sidebar-season-toggle::after {
    margin-left: 0.75rem;
}

.sidebar-season-menu {
    width: 100%;
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid #eaeaea;
    border-radius: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.sidebar-season-menu .dropdown-item {
    padding: 0.55rem 0.75rem;
    border-radius: 0.35rem;
    font-weight: 600;
}

.sidebar-season-menu .dropdown-item:hover,
.sidebar-season-menu .dropdown-item:focus,
.sidebar-season-menu .dropdown-item.active {
    color: var(--accent-color);
    background-color: color-mix(in oklab, var(--accent-color), white 93%);
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        flex-shrink: 0;
        overflow-y: auto;
        border-radius: 0 0 0 12px;
    }

    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }
}

.sidebar .nav-link,
.sidebar .accordion-button {
    border-radius: 0 !important;
    width: 100%;
    margin: 0;
    color: var(--font-color);;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .accordion-button:hover {
    background-color: var(--hover-bg);
    color: var(--accent-color);
}

.sidebar .nav-link.active {
    background-color: var(--accent-light);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.sidebar .accordion-button {
    padding: 1rem 1.25rem;
    background-color: transparent;
    box-shadow: none;
}

.sidebar .accordion-button:not(.collapsed) {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.sidebar .accordion-header {
    display: flex;
    align-items: stretch;
}

.sidebar .accordion-header .menu-link {
    flex-grow: 1;
    display: flex;
    align-items: center;
    padding: 1rem 0.5rem 1rem 1.25rem;
    color: var(--font-color);;
    font-weight: 600;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.sidebar .accordion-header .menu-link:hover {
    background-color: var(--hover-bg);
    color: var(--accent-color);
}

.sidebar .accordion-header .menu-link.active {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.sidebar .accordion-header .accordion-button {
    width: auto !important;
    padding-left: 0.5rem;
    padding-right: 1.25rem;
    border-left: none !important;
    background-color: transparent !important;
}

.sidebar .accordion-header:hover .accordion-button {
    background-color: var(--hover-bg) !important;
}

.sub-menu, .sub-menu-level-3 {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-menu {
    background: #fff;
}

.sub-menu-level-3 {
    background-color: #fcfcfc;
}

.sub-menu .nav-link {
    padding: 0.75rem 1rem 0.75rem 3rem;
    font-size: 0.95rem;
}

.sub-menu-level-3 .nav-link {
    padding: 0.6rem 1rem 0.6rem 4.5rem;
    font-size: 0.9rem;
    color: var(--font-color);;
}

.sub-menu-level-3 .nav-link:hover {
    color: var(--accent-color);
}

.sidebar i.bi-chevron-down {
    transition: transform 0.3s;
}

.nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}


.main-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 0 0 12px 0;
}

.liga-page-heading {
    width: 100%;
    max-width: 64rem;
    min-width: 0;
}

.secondary-toolbar {
    background: white;
    border-bottom: 1px solid #eaeaea;
    padding: 0;
}

.secondary-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1.5rem;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: transparent;
    border: none;
    color: var(--font-color);;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-btn:hover,
.toolbar-btn[aria-expanded="true"] {
    background-color: var(--hover-bg);
    color: var(--accent-color);
}

@media (pointer: coarse) {
    .toolbar-btn {
        min-height: 3.15rem;
    }
}

.toolbar-dropdown-menu {
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    margin-top: 0.5rem !important;
}

.content-card {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.table-responsive {
    position: relative;
}

.table-responsive::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1.5rem;
    pointer-events: none;
    background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
    opacity: 0;
    transition: opacity 0.15s ease;
}

.table-responsive.has-hidden-content::after {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .table-responsive::after {
        transition: none;
    }
}

.main-footer {
    margin-top: auto;
    background-color: #f8f9fa;
    border-top: 1px solid #eaeaea;
    padding: 1.5rem 0;
    border-radius: 0 0 12px 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.main-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.main-footer a:hover {
    text-decoration: underline;
}

@media print {
    body {
        background: white !important;
    }

    .page-wrapper {
        margin: 0 !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        min-height: auto !important;
    }

    .sidebar,
    .main-header,
    .secondary-toolbar,
    .main-footer {
        display: none !important;
    }

    .content-card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

body.no-sidebar .sidebar {
    display: none !important;
}

body.no-sidebar .main-content-wrapper {
    border-radius: 0 0 12px 12px;
}

.icon-theme {
    color: var(--accent-color);
    opacity: 0.85;
}

.collapse-chevron {
    transition: transform 0.2s ease;
}

[data-bs-toggle="collapse"][aria-expanded="false"] .collapse-chevron {
    transform: rotate(-90deg);
}

.verlegt-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.05rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: color-mix(in oklab, var(--bs-danger), black 18%);
    background-color: color-mix(in oklab, var(--bs-danger), white 92%);
    border: 1px solid color-mix(in oklab, var(--bs-danger), white 78%);
}

.verlegt-chip .bi {
    font-size: 1rem;
    margin-left: -0.15rem;
}

.brand-accent {
    color: var(--accent-color);
}

.user-avatar {
    width: 35px;
    height: 35px;
    font-weight: 700;
}

.toolbar-divider {
    height: 20px;
    opacity: 0.3;
}

.other-league-menu {
    max-height: 60vh;
    overflow-y: auto;
    min-width: 250px;
}

.other-league-icon {
    opacity: 0.5;
}

.viewport-debug-badge {
    position: fixed;
    bottom: 0.75rem;
    right: 0.75rem;
    z-index: 2000;
    background: #000;
    color: #fff;
    font-family: monospace;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    opacity: 0.85;
    pointer-events: none;
}

.successMessage {
    background-color: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}

.errorMessage {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}

.successProgressbar {
    background-color: var(--bs-success-border-subtle);
}

.successProgressbar div {
    background-color: var(--bs-success);
}

.errorProgressbar {
    background-color: var(--bs-danger-border-subtle);
}

.errorProgressbar div {
    background-color: var(--bs-danger);
}

.system-toast-container {
    z-index: 1080;
}

.system-toast {
    width: 550px;
    min-width: 400px;
    border-radius: 12px;
    overflow: hidden;
}

.toast-icon {
    width: 40px;
    height: 40px;
}

.toast-progress {
    height: 4px;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transition: width linear;
}

#eroeffnungenTable th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem !important;
}

#eroeffnungenTable th.sortable::after {
    content: '↕';
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    font-size: 0.8rem;
}

#eroeffnungenTable th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

#eroeffnungenTable th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.eroeffnungen-rang-header {
    width: 3rem;
}

.eroeffnungen-eco-header {
    width: 4rem;
}

.eroeffnungen-count-header {
    width: 6rem;
}

.eroeffnungen-share-header {
    width: 12rem;
}

.eroeffnungen-share-bar {
    flex: 1;
    background: #e9ecef;
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.eroeffnungen-share-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 4px;
}

.eroeffnungen-share-value {
    min-width: 3.5rem;
    text-align: right;
}
