:root {
    /* Primary Colors - Dark Purple Theme */
    --color-bg-primary: #180f1f;
    --color-bg-secondary: #281a2e;
    --color-bg-tertiary: #3d2037fa;
    --color-bg-elevated: #41274d;

    /* Accent Colors */
    --color-accent-primary: #d44a4a;
    --color-accent-secondary: #e05c5c;
    --color-accent-tertiary: #4ac43a;
    --color-accent-glow: rgba(185, 0, 216, 0.3);

    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #ceb5d4;
    --color-text-muted: #9884a8;
    --color-text-accent: #ba66f0;

    /* Surface Colors */
    --color-surface-light: rgba(255, 255, 255, 0.05);
    --color-border: rgba(0, 0, 0, 0.4);
    --color-border-light: rgba(0, 0, 0, 0.5);

    /* Table Row Colors */
    --row-color1: #2a1a2e;
    --row-color2: #31203a;
    --row-hover: #44284d;
    --row-border: rgba(0, 0, 0, 0.3);

    /* Status Colors */
    --color-success: #4ade80;
    --color-success-bg: #1a3d2a;
    --color-error: #f87171;
    --color-error-bg: #341a3d;
    --color-warning: #fb24e9;
    --color-warning-bg: #3d1a35;
    --color-info: #bd5ae8;
    --color-info-bg: #3c1f3d;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--color-accent-glow);

    /* Sidebar */
    --sidebar-width: 260px;

    /* Mobile header (< 992px): 40px logo + 2 x 8px padding + 1px border */
    --mobile-header-height: 57px;

    /* Buttons (reduced on phones, see Media Queries) */
    --btn-padding-y: 12px;
    --btn-padding-x: 24px;
    --btn-min-width: 120px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-full: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

@font-face {
    font-family: TitleFont;
    src: url("../fonts/TitleFont.ttf");
    font-display: swap;
}

/* ==========================================================================
   Global Border Radius
   ========================================================================== */

.card,
.card-header,
.card-footer,
.btn,
.form-control,
.form-select,
.form-check-input,
.alert,
.modal-content,
.dropdown-menu,
.dropdown-item,
.nav-tabs .nav-link,
.pagination .page-link,
.badge,
.table-responsive,
.input-group > *,
.carousel-control-prev,
.carousel-control-next,
.carousel-indicators button,
main > .container {
    border-radius: var(--radius-sm) !important;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    background-color: var(--color-bg-primary);
    background-image: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.65) 100%),
                      linear-gradient(180deg, rgba(140, 0, 216, 0.25) 0%, transparent 40%, rgba(59, 26, 86, 0.55) 100%),
                      url("../img/background.png");
    background-repeat: no-repeat, no-repeat, repeat;
    background-attachment: fixed, fixed, fixed;
    background-size: cover, cover, auto;
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

main {
    flex: 1;
}

main > .container {
    background: rgb(46 32 26 / 92%);
    border: 1px solid rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px 32px 48px;
}

main > .container p {
    color: var(--color-text-secondary);
}

h1 {
    font-family: TitleFont, sans-serif;
    font-size: 2.75rem;
    color: var(--color-text-primary);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

a {
    color: var(--color-text-accent);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-secondary);
}

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

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh; /* mobile browsers: keep the user menu above the collapsing toolbar */
    background: linear-gradient(180deg, #151518 0%, #06070a 100%);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand {
    display: inline-block;
    text-decoration: none;
}

.sidebar-brand img {
    transition: transform var(--transition-base);
}

.sidebar-brand:hover img {
    transform: scale(1.05);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-elevated) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--color-bg-elevated);
    border-radius: 2px;
}

.sidebar-section-title {
    padding: 16px 20px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--color-text-muted);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: color var(--transition-fast), background var(--transition-fast), border-left-color var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-light);
    border-left-color: var(--color-accent-primary);
    text-decoration: none;
}

.sidebar-link i {
    width: 18px;
    text-align: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-link-button {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}

.sidebar-link-discord {
    color: #7289da;
}

.sidebar-link-discord:hover {
    color: #fff;
    background: rgba(114, 137, 218, 0.2);
    border-left-color: #7289da;
}

.sidebar-link-admin {
    color: var(--color-warning);
}

.sidebar-link-admin:hover {
    background: rgba(251, 191, 36, 0.1);
    border-left-color: var(--color-warning);
}

.sidebar-collapse-toggle {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus {
    background: var(--color-surface-light);
    color: var(--color-text-primary);
    border-left-color: var(--color-accent-primary);
    outline: none;
}

.sidebar-collapse-chevron {
    margin-left: auto;
    font-size: 0.7rem !important;
    transition: transform 0.2s ease;
}

.sidebar-collapse-toggle[aria-expanded="true"] .sidebar-collapse-chevron {
    transform: rotate(180deg);
}

.sidebar-link-nested {
    padding-left: 44px;
    font-size: 0.8rem;
}

.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border);
    padding: 10px 0;
}

.sidebar-logout {
    margin: 0;
}

/* Content Wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper > main {
    flex: 1;
}

/* reCAPTCHA v3: badge hidden, attribution shown in the footer instead.
   Google permits hiding the badge as long as the required notice/links are
   displayed (see footer.tpl). Use visibility, not display:none - display:none
   breaks widget execution. */
.grecaptcha-badge {
    visibility: hidden;
}

/* Sidebar Backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(180deg, #151518 0%, #06070a 100%);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 12px;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--color-text-primary);
    font-size: 1.25rem;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--color-surface-light);
}

.mobile-header-brand img {
    display: block;
    height: 40px;
    width: auto;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--row-color2) !important;
    border: 1px solid rgba(0, 0, 0, 0.5) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md);
    color: var(--color-text-secondary);
}

.card.rounded-0 {
    border-radius: 0 !important;
}

.card:hover {
    border-color: rgba(0, 0, 0, 0.6) !important;
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--color-bg-tertiary) !important;
    border-bottom: 1px solid var(--color-border) !important;
    color: var(--color-text-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
    padding: 1rem 1.25rem;
}

.rounded-0 > .card-header,
.card.rounded-0 .card-header {
    border-radius: 0 !important;
}

.card-header i {
    margin-right: 8px;
}

.card-body {
    color: var(--color-text-secondary);
}

.card-footer {
    background: transparent !important;
    border-top: 1px solid var(--color-border) !important;
}

.card .card-body.p-0 {
    overflow: hidden;
}

.card .card-body.p-0 .table-responsive {
    border-radius: 0 !important;
    overflow-x: auto;
}

/* Cards following nav-tabs */
.card.border-top-0 .table-responsive,
.card.border-top-0 .table thead,
.card.border-top-0 .table thead th,
.card.rounded-top-0 .table-responsive,
.card.rounded-top-0 .table thead,
.card.rounded-top-0 .table thead th {
    border-radius: 0 !important;
}

.card.border-top-0 .card-body.p-0,
.card.rounded-top-0 .card-body.p-0 {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
    overflow: hidden;
}

.card.border-top-0.rounded-top-0 {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    margin-top: -1px;
}

/* Cards without header */
.card:not(.border-top-0):not(.rounded-top-0) > .card-body.p-0:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card:not(.border-top-0):not(.rounded-top-0) > .card-body.p-0:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
}

.card:not(.border-top-0):not(.rounded-top-0) > .card-body.p-0:only-child {
    border-radius: var(--radius-lg) !important;
}

/* Download cards */
.card .card-body .card.h-100 {
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-primary) 100%) !important;
    border: 1px solid rgba(0, 0, 0, 0.5) !important;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card .card-body .card.h-100:hover {
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%) !important;
    border-color: var(--color-accent-primary) !important;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 0 20px var(--color-accent-glow) !important;
}

.card .card-body .card.h-100 .display-4,
.card .display-4 {
    color: var(--color-accent-primary) !important;
    transition: color var(--transition-base), transform var(--transition-base);
}

.card .card-body .card.h-100:hover .display-4 {
    color: var(--color-accent-secondary) !important;
    transform: scale(1.1);
}

.card .card-body .card.h-100 .card-title {
    color: var(--color-text-primary);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--color-text-secondary);
    --bs-table-border-color: var(--row-border);
    --bs-table-striped-color: var(--color-text-secondary);
    --bs-table-hover-color: var(--color-text-secondary);
    --bs-table-hover-bg: var(--row-hover);
    --bs-table-striped-bg: transparent;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: var(--row-border);
    padding: 0.75rem 1rem;
    vertical-align: middle;
    color: var(--color-text-secondary);
}

.table img,
.table [class^="icon-"],
.table [class^="sprite-"] {
    vertical-align: middle;
}

.table td {
    color: var(--color-text-secondary) !important;
}

.table thead th,
.table-dark th {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-accent-primary) !important;
}

.table a {
    color: var(--color-text-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.table a:hover {
    color: var(--color-accent-secondary);
}

/* Zebra striping */
.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: var(--row-color1);
}

.table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: var(--row-color2);
}

/* Hover effect */
.table-hover > tbody > tr:hover > td:not(.table-success) {
    background-color: var(--row-hover);
}

/* Row class-based striping for tables with rowspan grouping */
.table tr.row-odd > td:not(.table-success),
.table tbody tr.row-odd > td:not(.table-success) {
    --bs-table-bg-state: var(--row-color1);
    background-color: var(--row-color1) !important;
}

.table tr.row-even > td:not(.table-success),
.table tbody tr.row-even > td:not(.table-success) {
    --bs-table-bg-state: var(--row-color2);
    background-color: var(--row-color2) !important;
}

/* Hover effect for JS-based group hover */
.table tr.row-hover > td:not(.table-success),
.table tbody tr.row-hover > td:not(.table-success),
.table-hover > tbody > tr.row-hover > td:not(.table-success) {
    --bs-table-bg-state: var(--row-hover) !important;
    --bs-table-hover-bg: var(--row-hover) !important;
    background-color: var(--row-hover) !important;
}

/* Keep striping color on hover for row-odd/row-even */
.table-hover > tbody > tr.row-odd:not(.row-hover):hover > td:not(.table-success),
.table tbody tr.row-odd:not(.row-hover):hover > td:not(.table-success) {
    background-color: var(--row-color1) !important;
}

.table-hover > tbody > tr.row-even:not(.row-hover):hover > td:not(.table-success),
.table tbody tr.row-even:not(.row-hover):hover > td:not(.table-success) {
    background-color: var(--row-color2) !important;
}

/* Table status colors */
td.table-success,
td.table-success:hover,
tr:hover > td.table-success,
.table td.table-success,
.table tr:hover > td.table-success,
.table-hover tbody tr:hover > td.table-success {
    --bs-table-bg: #2d4a3e !important;
    --bs-table-bg-state: #2d4a3e !important;
    --bs-table-hover-bg: #2d4a3e !important;
    background-color: #2d4a3e !important;
    color: var(--color-success) !important;
    font-weight: 600 !important;
}

.table tbody tr.row-even > td.table-success,
.table tbody tr.row-even:hover > td.table-success,
.table-hover tbody tr.row-even:hover > td.table-success {
    --bs-table-bg: #386250 !important;
    --bs-table-bg-state: #386250 !important;
    --bs-table-hover-bg: #386250 !important;
    background-color: #386250 !important;
}

td.table-danger,
.table td.table-danger,
.table-hover tbody tr:hover td.table-danger {
    background-color: var(--color-error-bg) !important;
    color: var(--color-error) !important;
    font-weight: 600 !important;
}

td.table-warning,
.table td.table-warning,
.table-hover tbody tr:hover td.table-warning {
    background-color: var(--color-warning-bg) !important;
    color: var(--color-warning) !important;
    font-weight: 600 !important;
}

/* Text color utilities in tables */
.text-success,
.table td.text-success,
.table-hover > tbody > tr:hover > td.text-success {
    color: var(--color-success) !important;
}

.text-danger,
.table td.text-danger,
.table-hover > tbody > tr:hover > td.text-danger {
    color: var(--color-error) !important;
}

.text-warning,
.table td.text-warning,
.table-hover > tbody > tr:hover > td.text-warning {
    color: var(--color-warning) !important;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-control,
.form-select {
    background-color: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
    border-radius: var(--radius-sm);
}

.form-control::placeholder {
    color: var(--color-text-muted) !important;
}

.form-control:hover,
.form-select:hover {
    border-color: rgba(0, 0, 0, 0.55) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-accent-primary) !important;
    box-shadow: 0 0 0 3px var(--color-accent-glow) !important;
}

.form-label {
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.form-text {
    color: var(--color-text-muted) !important;
}

/* Custom select arrow */
.form-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23b8bcc8' d='m0,1 2,2 2-2'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
}

.form-select:focus {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23f0b366' d='m0,1 2,2 2-2'/%3E%3C/svg%3E") !important;
}

/* Checkboxes */
.form-check-input {
    background-color: var(--color-bg-secondary);
    border-color: rgba(0, 0, 0, 0.45);
}

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

.form-check-input:focus {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.form-check-label {
    color: var(--color-text-secondary);
}

/* Dropdown menus (Bootstrap's default is a white panel) */
.dropdown-menu {
    background-color: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid rgba(0, 0, 0, 0.5);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--color-text-secondary);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
}

.dropdown-item.disabled,
.dropdown-item:disabled {
    color: var(--color-text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn,
form button {
    background: linear-gradient(135deg, #8a6d1e 0%, #06070a 100%) !important;
    border: none !important;
    border-radius: var(--radius-sm);
    color: white !important;
    padding: var(--btn-padding-y) var(--btn-padding-x);
    min-width: var(--btn-min-width);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn:hover,
form button:hover {
    background: linear-gradient(135deg, #a88a3a 0%, #151518 100%) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px var(--color-accent-glow) !important;
    color: white !important;
}

.btn:active,
form button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn:disabled,
form button:disabled {
    background: #2a1d16 !important;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none !important;
}

/* Active state for toggle buttons (and radio/checkbox buttons: .btn-check + label.btn) */
.btn.active,
.btn-check:checked + .btn {
    background: var(--color-bg-tertiary) !important;
    border: 2px solid var(--color-accent-primary) !important;
    box-shadow: 0 0 10px var(--color-accent-glow) !important;
    color: var(--color-accent-primary) !important;
    transform: none !important;
}

.btn-secondary {
    background: var(--color-bg-tertiary) !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
    color: var(--color-text-primary) !important;
}

.btn-secondary:hover {
    background: var(--color-bg-elevated) !important;
    border-color: rgba(0, 0, 0, 0.55) !important;
    box-shadow: var(--shadow-md), 0 0 15px rgba(0, 0, 0, 0.4) !important;
    color: var(--color-text-primary) !important;
}

.btn-outline-primary {
    background: transparent !important;
    color: var(--color-accent-primary) !important;
    border: 1px solid var(--color-accent-primary) !important;
}

.btn-outline-primary:hover {
    background: var(--color-accent-primary) !important;
    color: white !important;
    box-shadow: var(--shadow-md), 0 0 20px var(--color-accent-glow) !important;
}

.btn-outline-secondary {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
}

.btn-outline-secondary:hover {
    background: var(--color-bg-elevated) !important;
    color: var(--color-text-primary) !important;
    border-color: rgba(0, 0, 0, 0.55) !important;
    box-shadow: var(--shadow-md), 0 0 15px rgba(0, 0, 0, 0.4) !important;
}

.btn-outline-success {
    background: transparent !important;
    color: var(--color-success) !important;
    border: 1px solid var(--color-success) !important;
}

.btn-outline-success:hover {
    background: var(--color-success) !important;
    color: white !important;
    box-shadow: var(--shadow-md), 0 0 20px var(--color-accent-glow) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    border: none !important;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: var(--shadow-md), 0 0 20px rgba(220, 38, 38, 0.5) !important;
}

/* Discord Button */
.btn-discord {
    background: #5865F2 !important;
    border: none !important;
    color: white !important;
    padding: 8px 16px !important;
    min-width: auto !important;
}

.btn-discord:hover {
    background: #4752C4 !important;
    color: white !important;
    box-shadow: var(--shadow-md), 0 0 20px rgba(88, 101, 242, 0.5) !important;
}

/* Small button variant */
.btn-sm {
    padding: 10px 14px !important;
    min-width: auto !important;
    font-size: 12px !important;
}

/* Button link */
.btn-link {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--color-text-primary) !important;
    padding: 0 !important;
    min-width: auto !important;
    font-weight: normal !important;
    text-decoration: none !important;
}

.btn-link:hover {
    background: transparent !important;
    color: var(--color-accent-primary) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-primary {
    background: linear-gradient(135deg, rgba(212, 74, 74, 0.15) 0%, rgba(46, 32, 26, 0.4) 100%) !important;
    color: var(--color-text-secondary) !important;
    border: 1px solid rgba(0, 0, 0, 0.4) !important;
    border-left: 3px solid var(--color-accent-primary) !important;
}

.alert-primary i {
    color: var(--color-accent-primary);
}

.alert-success {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, rgba(26, 61, 42, 0.4) 100%) !important;
    color: var(--color-text-secondary) !important;
    border: 1px solid rgba(74, 222, 128, 0.3) !important;
    border-left: 3px solid var(--color-success) !important;
}

.alert-success i {
    color: var(--color-success);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.15) 0%, rgba(61, 26, 26, 0.4) 100%) !important;
    color: var(--color-text-secondary) !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
    border-left: 3px solid var(--color-error) !important;
}

.alert-danger i {
    color: var(--color-error);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(61, 53, 26, 0.4) 100%) !important;
    color: var(--color-text-secondary) !important;
    border: 1px solid rgba(251, 191, 36, 0.3) !important;
    border-left: 3px solid var(--color-warning) !important;
}

.alert-warning i {
    color: var(--color-warning);
}

.alert-info {
    background: linear-gradient(135deg, rgba(216, 135, 0, 0.15) 0%, rgba(61, 42, 31, 0.4) 100%) !important;
    color: var(--color-text-secondary) !important;
    border: 1px solid rgba(216, 135, 0, 0.3) !important;
    border-left: 3px solid var(--color-info) !important;
}

.alert-info i {
    color: var(--color-info);
}

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

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-content {
    background: var(--color-bg-secondary) !important;
    border: 1px solid rgba(0, 0, 0, 0.5) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%) !important;
    border-bottom: 1px solid var(--color-border) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    color: var(--color-text-primary);
}

.modal-body {
    color: var(--color-text-secondary);
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    background: var(--color-bg-tertiary) !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
    color: var(--color-text-primary) !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    min-width: auto !important;
    margin: 0;
}

.pagination .page-link:hover {
    background: var(--color-bg-elevated) !important;
    border-color: rgba(0, 0, 0, 0.55) !important;
    box-shadow: var(--shadow-md), 0 0 15px rgba(0, 0, 0, 0.4) !important;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #8a6d1e 0%, #06070a 100%) !important;
    border-color: var(--color-accent-primary) !important;
}

.pagination .page-item.disabled .page-link {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-muted) !important;
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.nav-tabs {
    border-bottom: none;
}

.nav-tabs .nav-link {
    background: var(--color-bg-secondary) !important;
    border: 1px solid rgba(0, 0, 0, 0.5) !important;
    border-bottom: none !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    color: var(--color-text-secondary) !important;
    margin-right: 2px;
}

.nav-tabs .nav-link:hover {
    background: var(--color-surface-light) !important;
    color: var(--color-text-primary) !important;
}

.nav-tabs .nav-link.active {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
    border-color: rgba(0, 0, 0, 0.5) !important;
}

/* ==========================================================================
   Badges
   ========================================================================== */

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

.badge.bg-success {
    background: var(--color-success-bg) !important;
    color: var(--color-success) !important;
}

.badge.bg-warning {
    background: var(--color-warning-bg) !important;
    color: var(--color-warning) !important;
}

.badge.bg-danger {
    background: var(--color-error-bg) !important;
    color: var(--color-error) !important;
}

.badge.bg-info {
    background: rgba(216, 135, 0, 0.2) !important;
    color: var(--color-info) !important;
}

.badge.bg-secondary {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-secondary) !important;
}

/* ==========================================================================
   List Groups
   ========================================================================== */

.list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-border-color: var(--color-border);
}

.list-group-item {
    background: var(--color-bg-secondary) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text-secondary) !important;
}

.list-group-flush > .list-group-item {
    border-left: 0;
    border-right: 0;
}

.list-group-flush > .list-group-item:first-child {
    border-top: 0;
}

.list-group-flush > .list-group-item:last-child {
    border-bottom: 0;
}

/* ==========================================================================
   Accordion
   ========================================================================== */

.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: var(--color-border);
}

.accordion-item {
    background: transparent !important;
    border-color: var(--color-border) !important;
}

.accordion-button {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.accordion-button:not(.collapsed) {
    background: var(--color-bg-elevated) !important;
    color: var(--color-text-primary) !important;
}

.accordion-button::after {
    filter: invert(1) brightness(0.8);
}

.accordion-button:focus {
    box-shadow: none !important;
    border-color: var(--color-border) !important;
}

.accordion-collapse {
    background: transparent;
}

.accordion-body {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-secondary) !important;
    padding: 1rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer.bg-dark {
    background: linear-gradient(180deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%) !important;
    border-top: 1px solid var(--color-border);
}

.locale-link:hover {
    color: var(--color-text-primary) !important;
}

/* ==========================================================================
   Carousel
   ========================================================================== */

.carousel-control-prev,
.carousel-control-next {
    width: 48px;
    height: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-bg-secondary) !important;
    border: 1px solid rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-full);
    opacity: 1;
}

.carousel-control-prev {
    left: 1rem;
}

.carousel-control-next {
    right: 1rem;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background: var(--color-accent-primary) !important;
    border-color: var(--color-accent-primary);
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--color-bg-elevated) !important;
    border: 2px solid rgba(0, 0, 0, 0.4) !important;
}

.carousel-indicators button.active {
    background: var(--color-accent-primary) !important;
    border-color: var(--color-accent-primary) !important;
}

.carousel-caption {
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px);
    padding: 12px 20px !important;
    border-radius: var(--radius-sm);
    bottom: 60px !important;
}

.carousel-caption p {
    color: var(--color-text-primary) !important;
    margin: 0;
}

/* ==========================================================================
   Collapse & Filters
   ========================================================================== */

.collapse .card-body {
    border-top: 1px solid var(--color-border);
}

.filter-toggle {
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    transition: color var(--transition-fast);
    display: inline-flex;
    align-items: center;
}

.filter-toggle:hover {
    color: var(--color-text-primary);
    text-decoration: none;
}

.filter-toggle i {
    margin-right: 8px;
}

.filter-toggle::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
    margin-left: 10px;
    transition: transform var(--transition-fast);
}

.filter-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* ==========================================================================
   Stats Summary (Matchup page)
   ========================================================================== */

.stats-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
    padding: 15px 30px;
    background: var(--row-color1);
    border: 1px solid rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-sm);
    margin: 5px;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: white;
}

.stat-number.stat-winner {
    color: var(--color-success);
}

.stat-number.stat-loser {
    color: var(--color-error);
}

.stat-number.stat-tie {
    color: var(--color-warning);
}

.stat-label {
    font-size: 0.9em;
    color: var(--color-text-secondary);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

/* Wrapper of a Chart.js canvas (maintainAspectRatio: false): the chart takes this height */
.chart-container {
    position: relative;
    height: 400px;
}

.column-hidden {
    display: none;
}

/* Sticky bar inside a page (bulk-action toolbars), used with .sticky-top: opaque so the
   rows scroll under it; on phones it stops below the mobile header (see Media Queries) */
.sticky-below-header {
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
}


/* ==========================================================================
   Media Queries
   ========================================================================== */

@media (min-width: 992px) and (max-width: 1200px) {
    .container {
        max-width: 1100px;
    }
}

/*
 * Breakpoints follow Bootstrap (lg 992, md 768, sm 576), written as max-width .98 so they
 * never overlap its min-width utilities. Phone-only rules go here so desktop is untouched.
 */
@media (max-width: 991.98px) {
    .container {
        max-width: 95%;
    }

    main > .container {
        padding: 20px 20px 32px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content-wrapper {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
    }

    /* Sticky bars (bulk-action toolbars) stay below the sticky mobile header */
    .sticky-below-header {
        top: var(--mobile-header-height);
    }
}

@media (min-width: 992px) {
    .sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    h1 {
        font-size: 2rem;
    }

    .container {
        max-width: 100%;
    }

    .table {
        font-size: 0.875rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.4rem 0.5rem;
    }

    .table thead th,
    .table-dark th {
        font-size: 11px;
        letter-spacing: 0;
        white-space: nowrap;
    }

    /*
     * Wide tables keep every column and scroll sideways inside .table-responsive; the cell
     * that identifies the row (player, track) stays pinned on the left. Striped and
     * row-odd/even rows already paint an opaque background on their cells (those rules are
     * more specific than this one); other tables get this fallback so scrolled cells do not
     * show through.
     */
    .table > :not(caption) > * > .table-sticky-col {
        position: sticky;
        left: 0;
        z-index: 2;
        background-color: var(--row-color2);
        box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.45);
    }

    /* 16px: iOS Safari zooms the page in when a smaller field gets the focus */
    .form-control,
    .form-select {
        font-size: 16px;
    }

    /* Admin settings: the columns stack, one separated block per setting */
    .settings-row {
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--color-border);
    }

    .settings-row:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .settings-row > [class*="col-"] + [class*="col-"] {
        margin-top: 0.5rem;
    }

    .stats-summary {
        justify-content: center;
    }

    .stat-box {
        flex: 1 1 calc(50% - 10px);
        min-width: 120px;
        padding: 10px 15px;
    }

    .stat-number {
        font-size: 1.5em;
    }
}

@media (max-width: 575.98px) {
    :root {
        --btn-padding-y: 10px;
        --btn-padding-x: 16px;
        --btn-min-width: 0;
    }

    main > .container {
        padding: 16px 12px 24px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .breadcrumb {
        font-size: 0.85rem;
    }

    .card {
        --bs-card-spacer-x: 0.75rem;
    }

    .card-header {
        padding: 0.75rem;
    }

    .alert {
        --bs-alert-padding-x: 0.75rem;
        --bs-alert-padding-y: 0.75rem;
    }

    /* Tabs scroll sideways instead of wrapping under the card they are attached to */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs > .nav-item,
    .nav-tabs > .nav-link {
        flex-shrink: 0;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .pagination {
        gap: 6px;
    }

    .pagination .page-link {
        padding: 6px 10px !important;
    }

    .chart-container {
        height: 280px;
    }

    .admin-card-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 0.75rem;
    }

    .admin-card-icon i {
        font-size: 1.1rem;
    }

    .admin-card .card-footer {
        padding: 0.75rem;
    }

    /*
     * Profile statistics (partials/data/user-statistics-table.tpl): two label/value pairs
     * per row on desktop; on phones each pair takes its own line. Cells: label, value,
     * spacer, label, value; empty cells (spacer, pairs that are not shown) are hidden.
     */
    .user-stats-table thead {
        display: none;
    }

    .user-stats-table tbody tr {
        display: flex;
        flex-wrap: wrap;
    }

    .user-stats-table tbody td {
        flex: 0 0 62%;
    }

    .user-stats-table tbody td:nth-child(2),
    .user-stats-table tbody td:nth-child(5) {
        flex-basis: 38%;
        text-align: right;
    }

    .user-stats-table tbody td:nth-child(3),
    .user-stats-table tbody td:empty {
        display: none;
    }
}

/* Touch screens have no hover: the art download button shows as a small corner button */
@media (hover: none) {
    .art-gallery-overlay {
        opacity: 1;
        top: 0.5rem;
        right: 0.5rem;
        bottom: auto;
        left: auto;
        background: none;
    }

    .art-gallery-overlay .btn {
        --btn-padding-y: 6px;
        --btn-padding-x: 10px;
        --btn-min-width: 0;
        font-size: 12px;
    }
}

/* ==========================================================================
   Landing Page
   ========================================================================== */

/* Hero */
.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 100%; /* wider than a phone: would add horizontal page scroll */
    height: 400px;
    background: radial-gradient(ellipse, rgb(80 120 220 / 18%) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-logo {
    width: 420px;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 32px rgba(255, 204, 51, 0.45));
    animation: heroFloat 4s ease-in-out infinite;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero-title {
    font-family: TitleFont, sans-serif;
    font-size: 3rem;
    border: none;
    padding: 0;
}

.text-gradient {
    background: linear-gradient(135deg, var(--color-accent-primary) 0%, #f0b366 50%, var(--color-accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* News (homepage column and detail page) */
.news-item + .news-item {
    padding-top: 1rem;
    border-top: 1px solid var(--color-surface-light);
}

/* Images keep their proportions in storage; the homepage frames them at 16:9. */
.news-item-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 170px;
    object-fit: cover;
    border-radius: 6px;
}

.news-item-title {
    color: var(--color-text-primary);
    text-decoration: none;
}

.news-item-title:hover,
.news-item-title:focus-visible {
    color: var(--color-text-accent);
}

/* The homepage shows a 3-line excerpt; the full text is on the detail page. */
.news-item-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    color: var(--color-text-secondary);
}

.news-detail-img {
    display: block;
    max-width: 100%;
    max-height: 480px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 6px;
}

.news-detail-text p:last-child {
    margin-bottom: 0;
}

.news-thumb {
    width: 96px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
}

/* Feature Cards */
.feature-card {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.feature-card:hover,
.feature-card:focus-visible {
    color: var(--color-text-secondary);
    transform: translateY(-4px);
    border-color: var(--color-accent-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px var(--color-accent-glow);
}

.feature-card:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 3px;
}

.feature-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5b800 0%, #ffd84d 100%);
    border-radius: 12px;
    font-size: 1.5rem;
    color: #1a1a1a;
}

/* Activity Items */
.activity-player a {
    text-decoration: none;
}

tr.activity-wr {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.15) 0%, transparent 100%) !important;
    border-left: 3px solid var(--color-warning);
}

.activity-track {
    color: var(--color-text-accent);
    text-decoration: none;
}

.activity-track:hover {
    color: var(--color-accent-secondary);
}

.wr-badge {
    background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
    color: #1a1a1a;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Discord */
.online-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.member-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--row-color1);
}

.status-online { background: var(--color-success); }
.status-idle { background: var(--color-warning); }
.status-dnd { background: var(--color-error); }

.min-width-0 {
    min-width: 0;
}

/* Responsive */
@media (max-width: 767.98px) {
    .hero-title {
        font-size: 2.25rem;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 1.875rem;
    }
}

/* ============================================
   Art Gallery
   ============================================ */
.art-gallery-item {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.art-gallery-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg) !important;
}

.art-gallery-img {
    max-height: 200px;
    object-fit: contain;
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.art-gallery-img-lg {
    max-height: 300px;
}

.art-gallery-img-sm {
    max-height: 120px;
}

.art-gallery-img-xs {
    max-height: 100px;
}

.art-gallery-section {
    margin-bottom: 3rem;
}

.art-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.art-gallery-item:hover .art-gallery-overlay {
    opacity: 1;
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: var(--color-text-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--color-accent-secondary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--color-text-secondary);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--color-text-muted);
    content: "/";
    padding-right: 0.5rem;
}

/* ============================================
   Admin Dashboard
   ============================================ */
.admin-card {
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    height: 100%;
}

.admin-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-accent-primary) !important;
    box-shadow: var(--shadow-lg), 0 0 20px var(--color-accent-glow);
}

.admin-card .card-body {
    display: flex;
    flex-direction: column;
}

.admin-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.admin-card-icon i {
    color: #fff;
    font-size: 1.5rem;
}

.admin-card .card-title {
    color: var(--color-text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.admin-card .card-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    flex: 1;
}

.admin-card .card-footer {
    background: transparent !important;
    border-top: 1px solid var(--color-border) !important;
    padding: 1rem;
}

.admin-card .card-footer .btn {
    width: 100%;
}

/* ============================================
   Footer
   ============================================ */
.footer-link {
    transition: color 0.2s ease-in-out;
}

.footer-link:hover {
    color: var(--color-text-primary) !important;
}

/* ============================================
   Profile Avatar
   ============================================ */
.profile-avatar {
    object-fit: cover;
    vertical-align: middle;
    border: 1px solid #fff;
    outline: 1px solid #000;
}

/* Avatar of the crash-community-auth account: frame and effects copied from
   crash-community-auth apps/api/src/avatars/avatar-styles.ts (keep them in step) */
.profile-account-avatar { width: 96px; vertical-align: middle; }
.card-body .profile-account-avatar { width: 80px; }
@property --cca-angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.cca-avatar { position: relative; display: inline-block; flex: none; aspect-ratio: 1; border-radius: 22%; isolation: isolate; }
.cca-avatar > img, .cca-avatar > .cca-layers { display: block; width: 100%; height: 100%; border-radius: inherit; }
.cca-layers { position: relative; overflow: hidden; background: #22252d; }
.cca-layers > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.cca-layers > img.cca-accessory { inset: auto; left: 50%; top: 50%; width: auto; height: auto; max-width: none; transform-origin: center; }
.cca-layers > img[hidden] { display: none; }

/* Glow: a warm halo that breathes. */
.cca-fx-glow { animation: cca-glow 2.4s ease-in-out infinite; }
@keyframes cca-glow {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(255, 168, 64, .55), 0 0 0 2px rgba(255, 168, 64, .7); }
  50% { box-shadow: 0 0 22px 6px rgba(255, 168, 64, .9), 0 0 0 2px rgba(255, 214, 120, .95); }
}

/* Holographic: spinning rainbow ring plus a sheen sweeping across the picture. */
.cca-fx-holo::before { content: ''; position: absolute; inset: -4px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--cca-angle), #ff4d6d, #ffbe0b, #3ae374, #17c0eb, #7d5fff, #ff4d6d);
  animation: cca-spin 3s linear infinite; }
.cca-fx-holo::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .45) 45%, rgba(160, 220, 255, .25) 52%, transparent 65%);
  background-size: 250% 100%; mix-blend-mode: overlay; animation: cca-sheen 3.5s ease-in-out infinite; }
@keyframes cca-spin { to { --cca-angle: 360deg; } }
@keyframes cca-sheen { 0% { background-position: 120% 0; } 60%, 100% { background-position: -120% 0; } }

/* Retro: faded CRT photo with scanlines and a vignette. */
.cca-fx-retro > img, .cca-fx-retro > .cca-layers { filter: sepia(.55) saturate(1.35) contrast(1.08) brightness(.97); }
.cca-fx-retro::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px),
              radial-gradient(circle, transparent 55%, rgba(30, 10, 0, .45) 100%); }

/* Wumpa: orange and red stripes spinning round the frame. */
.cca-fx-wumpa { box-shadow: 0 0 10px 2px rgba(255, 128, 32, .55); }
.cca-fx-wumpa::before { content: ''; position: absolute; inset: -4px; z-index: -1; border-radius: inherit;
  background: repeating-conic-gradient(from var(--cca-angle), #ff8a1c 0 14deg, #ffd23f 14deg 20deg, #d9480f 20deg 34deg, #ffb347 34deg 40deg);
  animation: cca-spin 6s linear infinite; }

/* Evolvo-Ray: a green energy ring that pulses while a scan sweeps the picture. */
.cca-fx-evolvo::before { content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  background: #39ff88; animation: cca-evolvo 1.6s ease-in-out infinite; }
.cca-fx-evolvo::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, transparent 0 40%, rgba(80, 255, 150, .45) 48%, rgba(200, 255, 220, .6) 50%, transparent 58%);
  background-size: 100% 300%; mix-blend-mode: screen; animation: cca-scan 2.6s linear infinite; }
@keyframes cca-evolvo {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(57, 255, 136, .5); }
  50% { box-shadow: 0 0 18px 5px rgba(57, 255, 136, .9); }
}
@keyframes cca-scan { 0% { background-position: 0 100%; } 100% { background-position: 0 0; } }

/* Flamethrower: fire flickering up from under the picture. */
.cca-fx-flame::before { content: ''; position: absolute; inset: -10px -5px -5px; z-index: -1; border-radius: inherit;
  background: linear-gradient(0deg, #ffe066 0%, #ff8c1a 35%, #e8370c 70%, rgba(232, 55, 12, .4) 100%);
  filter: blur(4px); transform-origin: 50% 100%; animation: cca-flame .45s ease-in-out infinite alternate; }
.cca-fx-flame::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(0deg, rgba(255, 120, 20, .5), rgba(255, 120, 20, 0) 45%); mix-blend-mode: screen;
  animation: cca-flicker .3s steps(2) infinite alternate; }
@keyframes cca-flame { from { transform: scale(1, .96); opacity: .85; } to { transform: scale(1.03, 1.06); opacity: 1; } }
@keyframes cca-flicker { from { opacity: .6; } to { opacity: 1; } }

/* Stomp: a heavy landing that shakes the frame and kicks up dust. */
.cca-fx-stomp { animation: cca-stomp 2.2s ease-out infinite; }
.cca-fx-stomp::before { content: ''; position: absolute; left: -12%; right: -12%; bottom: -10%; height: 30%; z-index: -1;
  border-radius: 50%; background: radial-gradient(ellipse at center, rgba(176, 137, 90, .85), rgba(176, 137, 90, 0) 70%);
  opacity: 0; animation: cca-dust 2.2s ease-out infinite; }
@keyframes cca-stomp {
  0%, 30% { transform: translateY(0); }
  36% { transform: translateY(-8%); }
  42% { transform: translateY(2%) scale(1.02, .97); }
  46% { transform: translate(-2%, 0); }
  50% { transform: translate(2%, 0); }
  54% { transform: translate(-1%, 0); }
  58%, 100% { transform: none; }
}
@keyframes cca-dust { 0%, 40% { opacity: 0; transform: scale(.6); } 46% { opacity: 1; } 75%, 100% { opacity: 0; transform: scale(1.3); } }

/* Circuit: a cyan trace running round the frame over a faint grid. */
.cca-fx-circuit { box-shadow: 0 0 8px 1px rgba(0, 229, 255, .5); }
.cca-fx-circuit::before { content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--cca-angle), #00e5ff 0 40deg, #0b3a4a 40deg 360deg); animation: cca-spin 2.4s linear infinite; }
.cca-fx-circuit::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 229, 255, .14) 0 1px, transparent 1px 12.5%),
              repeating-linear-gradient(90deg, rgba(0, 229, 255, .14) 0 1px, transparent 1px 12.5%); }

/* Frost: an icy rim with frosted corners that twinkle. */
.cca-fx-frost { box-shadow: 0 0 0 2px #dff4ff, 0 0 12px 3px rgba(150, 215, 255, .8); }
.cca-fx-frost::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 18% 22%, #fff 0 1.5%, transparent 2.5%), radial-gradient(circle at 80% 30%, #fff 0 1%, transparent 2%),
              radial-gradient(circle at 70% 82%, #fff 0 1.5%, transparent 2.5%), radial-gradient(circle, transparent 50%, rgba(200, 235, 255, .65) 100%);
  animation: cca-twinkle 2.8s ease-in-out infinite; }
@keyframes cca-twinkle { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* Quantum: the frame shifts through the four Quantum Masks while the picture glitches. */
.cca-fx-quantum::before { content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  animation: cca-masks 4s steps(1) infinite; }
.cca-fx-quantum > img, .cca-fx-quantum > .cca-layers { animation: cca-glitch 4s linear infinite; }
@keyframes cca-masks {
  0% { background: #9b5cff; box-shadow: 0 0 12px 2px #9b5cff; }
  25% { background: #e0342f; box-shadow: 0 0 12px 2px #e0342f; }
  50% { background: #2d9cdb; box-shadow: 0 0 12px 2px #2d9cdb; }
  75% { background: #f2c94c; box-shadow: 0 0 12px 2px #f2c94c; }
}
@keyframes cca-glitch {
  0%, 22%, 26%, 47%, 51%, 72%, 76%, 97%, 100% { filter: none; }
  24%, 49%, 74%, 99% { filter: drop-shadow(2px 0 0 rgba(255, 0, 90, .7)) drop-shadow(-2px 0 0 rgba(0, 210, 255, .7)); }
}

/* Mojo: blue orbs rising through the picture. */
.cca-fx-mojo { box-shadow: 0 0 10px 2px rgba(64, 170, 255, .6); }
.cca-fx-mojo::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 30% 40%, rgba(150, 220, 255, .95) 0 4%, rgba(60, 160, 255, .5) 6%, transparent 9%),
              radial-gradient(circle at 75% 75%, rgba(150, 220, 255, .9) 0 3%, rgba(60, 160, 255, .45) 5%, transparent 8%);
  background-size: 50% 50%; mix-blend-mode: screen; animation: cca-rise 3s linear infinite; }
@keyframes cca-rise { from { background-position: 0 0; } to { background-position: 0 -100%; } }

/* Turbo Boost: exhaust flames behind the frame and speed lines across it. */
.cca-fx-boost { animation: cca-boost .5s ease-in-out infinite alternate; }
.cca-fx-boost::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, transparent 0 20%, rgba(255, 255, 255, .55) 35%, transparent 50%) 0 20% / 50% 6% repeat-x,
              linear-gradient(90deg, transparent 0 40%, rgba(255, 255, 255, .45) 60%, transparent 75%) 0 70% / 50% 4% repeat-x;
  animation: cca-streak .6s linear infinite; }
@keyframes cca-boost {
  from { box-shadow: -4px 0 8px 1px rgba(255, 140, 0, .7), 0 0 0 2px rgba(255, 140, 0, .8); }
  to { box-shadow: -10px 0 18px 4px rgba(255, 90, 0, .9), 0 0 0 2px rgba(80, 170, 255, .9); }
}
@keyframes cca-streak { from { background-position-x: 0; } to { background-position-x: -100%; } }

/* Nitro Neon: a magenta and cyan neon tube that flickers like a sign. */
.cca-fx-neon::before { content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  background: linear-gradient(135deg, #ff2bd6, #7a3cff 50%, #00e5ff);
  box-shadow: 0 0 10px 2px rgba(255, 43, 214, .7), 0 0 14px 3px rgba(0, 229, 255, .5); animation: cca-neon 3s linear infinite; }
@keyframes cca-neon { 0%, 18%, 22%, 24%, 60%, 100% { opacity: 1; } 20%, 23%, 62% { opacity: .35; } }

/* On Air: a TV broadcast frame with a blinking REC light. */
.cca-fx-onair { box-shadow: 0 0 0 2px #222, 0 0 0 3px #e03131; }
.cca-fx-onair::before { content: ''; position: absolute; inset: 7%; z-index: 1; pointer-events: none;
  background: linear-gradient(#fff, #fff) 0 0 / 18% 2px, linear-gradient(#fff, #fff) 0 0 / 2px 18%,
              linear-gradient(#fff, #fff) 100% 0 / 18% 2px, linear-gradient(#fff, #fff) 100% 0 / 2px 18%,
              linear-gradient(#fff, #fff) 0 100% / 18% 2px, linear-gradient(#fff, #fff) 0 100% / 2px 18%,
              linear-gradient(#fff, #fff) 100% 100% / 18% 2px, linear-gradient(#fff, #fff) 100% 100% / 2px 18%;
  background-repeat: no-repeat; opacity: .85; }
.cca-fx-onair::after { content: ''; position: absolute; top: 12%; right: 12%; width: 11%; height: 11%; z-index: 1; border-radius: 50%;
  background: #ff2d2d; box-shadow: 0 0 6px 1px rgba(255, 45, 45, .9); pointer-events: none; animation: cca-rec 1.2s steps(1) infinite; }
@keyframes cca-rec { 0% { opacity: 1; } 50% { opacity: 0; } }

/* Ghost: a translucent racer that trails behind, like a Time Trial ghost. */
.cca-fx-ghost > img, .cca-fx-ghost > .cca-layers { filter: saturate(.75) brightness(1.08); }
.cca-fx-ghost { animation: cca-ghost 2.4s ease-in-out infinite; }
@keyframes cca-ghost {
  0%, 100% { box-shadow: -4px 3px 0 0 rgba(140, 200, 255, .55), -8px 6px 0 0 rgba(140, 200, 255, .3); }
  50% { box-shadow: -9px 5px 0 0 rgba(140, 200, 255, .6), -18px 10px 0 0 rgba(140, 200, 255, .32); }
}

/* Platinum Relic: a polished platinum ring with a sheen. */
.cca-fx-relic::before { content: ''; position: absolute; inset: -4px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--cca-angle), #e9eef5, #9aa6b8, #ffffff, #b8c4d6, #eef3fa, #8d99ab, #e9eef5);
  box-shadow: 0 0 10px 1px rgba(200, 220, 255, .6); animation: cca-spin 5s linear infinite; }
.cca-fx-relic::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .55) 48%, transparent 60%);
  background-size: 250% 100%; mix-blend-mode: soft-light; animation: cca-sheen 4s ease-in-out infinite; }

/* Gem: a ring of the six gem colours with sparkles. */
.cca-fx-gem::before { content: ''; position: absolute; inset: -4px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--cca-angle), #e8f6ff 0 60deg, #ff3b5c 60deg 120deg, #2ee66b 120deg 180deg,
              #b14dff 180deg 240deg, #3b82ff 240deg 300deg, #ffd23f 300deg 360deg);
  animation: cca-spin 8s linear infinite; }
.cca-fx-gem::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 20% 18%, #fff 0 2%, transparent 3.5%), radial-gradient(circle at 84% 64%, #fff 0 1.5%, transparent 3%),
              radial-gradient(circle at 35% 85%, #fff 0 1.5%, transparent 3%);
  animation: cca-sparkle 1.8s ease-in-out infinite; }
@keyframes cca-sparkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* Power Crystal: a pink glow that pulses, with a glint passing over. */
.cca-fx-crystal { animation: cca-crystal 2s ease-in-out infinite; }
.cca-fx-crystal::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 170, 230, .7) 50%, transparent 60%);
  background-size: 300% 300%; mix-blend-mode: screen; animation: cca-glint 3s ease-in-out infinite; }
@keyframes cca-crystal {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(255, 64, 190, .6), 0 0 0 2px rgba(255, 110, 210, .8); }
  50% { box-shadow: 0 0 18px 5px rgba(255, 64, 190, .9), 0 0 0 2px rgba(255, 190, 240, 1); }
}
@keyframes cca-glint { 0% { background-position: 100% 100%; } 50%, 100% { background-position: 0 0; } }

/* Time Twister: a warp spiral turning behind the frame. */
.cca-fx-warp::before { content: ''; position: absolute; inset: -6px; z-index: -1; border-radius: 50%;
  background: repeating-conic-gradient(from var(--cca-angle), #2b1a6b 0 15deg, #6c4cff 15deg 30deg, #19c3d6 30deg 45deg);
  box-shadow: 0 0 12px 2px rgba(108, 76, 255, .6); animation: cca-spin 2.5s linear infinite; }

/* Elemental: the frame cycles through fire, water, wind and earth. */
.cca-fx-elemental::before { content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  animation: cca-elements 6s ease-in-out infinite; }
@keyframes cca-elements {
  0%, 100% { background: #ff5a1f; box-shadow: 0 0 14px 3px rgba(255, 90, 31, .8); }
  25% { background: #1f8bff; box-shadow: 0 0 14px 3px rgba(31, 139, 255, .8); }
  50% { background: #d8e6ef; box-shadow: 0 0 14px 3px rgba(216, 230, 239, .8); }
  75% { background: #8a5a2b; box-shadow: 0 0 14px 3px rgba(122, 170, 60, .8); }
}

/* Invincibility: Aku Aku's flashing rainbow aura with golden sparks. */
.cca-fx-invincible::before { content: ''; position: absolute; inset: -5px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--cca-angle), #ff4d6d, #ffbe0b, #3ae374, #17c0eb, #7d5fff, #ff4d6d);
  box-shadow: 0 0 16px 4px rgba(255, 214, 80, .8); animation: cca-spin .8s linear infinite; }
.cca-fx-invincible > img, .cca-fx-invincible > .cca-layers { animation: cca-flash .3s steps(1) infinite; }
.cca-fx-invincible::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 15% 20%, #ffe066 0 2%, transparent 3.5%), radial-gradient(circle at 85% 30%, #fff3b0 0 1.5%, transparent 3%),
              radial-gradient(circle at 78% 85%, #ffe066 0 2%, transparent 3.5%), radial-gradient(circle at 25% 78%, #fff3b0 0 1.5%, transparent 3%);
  animation: cca-sparkle .6s ease-in-out infinite; }
@keyframes cca-flash { 0% { filter: none; } 50% { filter: brightness(1.3) saturate(1.4); } }

@media (prefers-reduced-motion: reduce) {
  .cca-fx-glow, .cca-fx-holo::before, .cca-fx-holo::after,
  .cca-fx-wumpa::before, .cca-fx-evolvo::before, .cca-fx-evolvo::after, .cca-fx-flame::before, .cca-fx-flame::after,
  .cca-fx-stomp, .cca-fx-stomp::before, .cca-fx-circuit::before, .cca-fx-frost::after,
  .cca-fx-quantum::before, .cca-fx-quantum > img, .cca-fx-quantum > .cca-layers, .cca-fx-mojo::after,
  .cca-fx-boost, .cca-fx-boost::after, .cca-fx-neon::before, .cca-fx-onair::after, .cca-fx-ghost,
  .cca-fx-relic::before, .cca-fx-relic::after, .cca-fx-gem::before, .cca-fx-gem::after, .cca-fx-crystal, .cca-fx-crystal::after,
  .cca-fx-warp::before, .cca-fx-elemental::before, .cca-fx-invincible::before, .cca-fx-invincible::after,
  .cca-fx-invincible > img, .cca-fx-invincible > .cca-layers { animation: none; }
  .cca-fx-quantum::before { background: #9b5cff; }
  .cca-fx-elemental::before { background: #ff5a1f; }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .hero-logo {
        animation: none;
    }

    .online-dot {
        animation: none;
    }

    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}

/* Clickable submission rows: navigate to the submission detail page on click */
tr.submission-row {
    cursor: pointer;
}

/* Popovers: match site dark-purple palette */
.popover {
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
}

.popover .popover-header {
    background-color: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
}

.popover .popover-body {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-secondary);
}

.popover .popover-body a {
    color: var(--color-text-accent);
}

.popover .popover-body a:hover {
    color: var(--color-text-primary);
}

.popover .popover-arrow::before {
    border-top-color: var(--color-border);
    border-bottom-color: var(--color-border);
}

.popover .popover-arrow::after {
    border-top-color: var(--color-bg-secondary);
    border-bottom-color: var(--color-bg-elevated);
}

.tied-holders-toggle {
    color: var(--color-text-muted);
    text-decoration: none;
}

.tied-holders-toggle:hover,
.tied-holders-toggle:focus {
    color: var(--color-text-accent);
}

.tied-holders-list {
    min-width: 240px;
}

.tied-holder-row {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.tied-holder-row:last-child {
    border-bottom: none;
}

.tied-holder-player {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.tied-holder-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85em;
    color: var(--color-text-muted);
}

.tied-holder-view {
    margin-left: auto;
    color: var(--color-text-accent);
}

.tied-holder-view:hover {
    color: var(--color-text-primary);
}

/* Multi-select filter (partials/filters/multi-select.tpl) and searchable select (initSearchableSelects) */
.multi-select-menu .multi-select-options,
.searchable-select-menu .searchable-select-options {
    max-height: 18rem;
    overflow-y: auto;
    scrollbar-color: var(--color-text-muted) transparent;
}

/* Long names wrap instead of overflowing the menu (dropdown items are nowrap by default) */
.searchable-select-menu .dropdown-item {
    white-space: normal;
}

.multi-select-menu .form-check {
    margin-bottom: 0.15rem;
    border-radius: var(--radius-sm);
}

.multi-select-menu .form-check:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.multi-select-menu .form-check:hover .form-check-label,
.multi-select-menu .form-check-input:checked + .form-check-label {
    color: var(--color-text-primary);
}

.multi-select-menu a {
    color: var(--color-text-accent);
}

/*
 * The widgets above are <button>s inside a form, so the global "form button" rules would
 * turn them into gold call-to-action buttons (and on :hover, with !important, override
 * the select arrow). These selectors outrank "form button:hover" and put back the look
 * of a select, a menu item and a close icon.
 */
form button.form-select,
form button.form-select:hover,
form button.form-select:active {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    text-align: left;
    transform: none;
    box-shadow: none !important;
    background-color: var(--color-bg-secondary) !important;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23b8bcc8' d='m0,1 2,2 2-2'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    color: var(--color-text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.45) !important;
}

form button.form-select:hover {
    border-color: rgba(0, 0, 0, 0.55) !important;
}

form button.form-select:focus,
form button.form-select[aria-expanded="true"] {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23f0b366' d='m0,1 2,2 2-2'/%3E%3C/svg%3E") !important;
    border-color: var(--color-accent-primary) !important;
    box-shadow: 0 0 0 3px var(--color-accent-glow) !important;
}

form button.dropdown-item,
form button.dropdown-item:hover,
form button.dropdown-item:focus,
form button.dropdown-item:active {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 400;
    text-align: left;
    transform: none;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--color-text-secondary) !important;
}

form button.dropdown-item:hover,
form button.dropdown-item:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--color-text-primary) !important;
}

form button.dropdown-item.disabled {
    color: var(--color-text-muted) !important;
}

form .searchable-select-menu button.dropdown-item.active {
    color: var(--color-text-accent) !important;
    font-weight: 600;
}

form button.form-select.is-invalid {
    border-color: var(--bs-form-invalid-border-color, #dc3545) !important;
}

form button.btn-close,
form button.btn-close:hover,
form button.btn-close:active {
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    min-width: 0;
    padding: 0.2em;
    box-sizing: content-box;
    transform: none;
    box-shadow: none !important;
    background: transparent var(--bs-btn-close-bg) center / 0.6em auto no-repeat !important;
    opacity: 0.7;
}

form button.btn-close:hover {
    opacity: 1;
}

/* Native date inputs: light calendar icon and a dark picker on the dark theme */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
    color-scheme: dark;
}

/* Typeable dates (initTypeableDateInputs in main.js): a text box and a calendar button; the native
   input stays below the button, invisible, so its calendar opens there and it still holds the value */
.date-typeable {
    position: relative;
}

.date-typeable > .input-group > .form-control {
    min-width: 0;
}

.date-typeable-native {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Category Rules page
   ========================================================================== */

.category-rules-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: transparent;
    border: 0;
    color: var(--color-text-primary);
    text-align: left;
}

.category-rules-toggle:hover .category-rules-track-name {
    color: var(--color-text-accent);
}

.category-rules-toggle:focus-visible {
    outline: 2px solid var(--color-text-accent);
    outline-offset: -2px;
}

.category-rules-track-name {
    font-weight: 700;
    transition: color var(--transition-fast);
}

.category-rules-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: auto;
}

.card-header .category-rules-toggle i.category-rules-chevron {
    margin-right: 0;
    transition: transform var(--transition-base);
}

.category-rules-toggle:not(.collapsed) .category-rules-chevron {
    transform: rotate(180deg);
}

.category-rules-heading {
    font-size: 1rem;
    margin: 0.5rem 0 0.75rem;
    color: var(--color-text-primary);
}

.category-badge-all {
    background-color: #7a3b9c;
}

.category-badge-classic {
    background-color: #b8860b;
}

.category-badge-skipless {
    background-color: #2f7d4f;
}

/* Rendered Markdown (admin-authored content) */
.markdown-content > :last-child {
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: var(--color-text-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.markdown-content h1 { font-size: 1.4rem; }
.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.1rem; }
.markdown-content h4 { font-size: 1rem; }

.markdown-content > :first-child {
    margin-top: 0;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
}

.markdown-content code {
    color: var(--color-text-accent);
    background: var(--color-surface-light);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.markdown-content blockquote {
    border-left: 3px solid var(--color-text-accent);
    padding-left: 1rem;
    color: var(--color-text-muted);
}

.markdown-content img {
    max-width: 100%;
    height: auto;
}

.markdown-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}
