/* Oche Aye The Noo - Custom Styles */

:root {
    --primary-green: #198754;
    --primary-red: #dc3545;
    --dark-bg: #212529;
    --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, sans-serif;
    --shadow-card: 0 2px 8px rgba(0,0,0,.07);
    --shadow-card-raised: 0 4px 20px rgba(0,0,0,.13);
    --radius-card: 0.5rem;
    --surface-feature: rgba(25, 135, 84, 0.05);
}

body {
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Navbar active state */
.navbar-nav .nav-link.active {
    font-weight: 700;
    border-bottom: 2px solid var(--primary-green);
    padding-bottom: calc(0.5rem - 2px);
}

/* Cards */
.card {
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-card);
}

.card-header {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Stats cards */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* League table */
.league-table th {
    white-space: nowrap;
}

.league-table .rank-col {
    width: 50px;
    text-align: center;
}

.league-table .points-col {
    font-weight: 700;
}

.league-table tr.highlight {
    background-color: rgba(25, 135, 84, 0.1);
}

/* Match score display — display font for score numbers */
.score-display .display-3,
.score-display .display-4,
.score-display .display-5 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

/* Match score display */
.score-display {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-display .vs {
    font-size: 0.875rem;
    font-weight: 400;
    color: #6c757d;
    margin: 0 0.5rem;
}

/* Winner highlight */
.winner {
    color: var(--primary-green);
}

.loser {
    color: #6c757d;
}

/* Form validation */
.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Badges */
.badge-active {
    background-color: var(--primary-green);
}

.badge-inactive {
    background-color: #6c757d;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Action buttons */
.btn-actions {
    white-space: nowrap;
}

.btn-actions .btn {
    padding: 0.25rem 0.5rem;
}

/* Player avatar placeholder */
.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--dark-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Player profile photos */
.player-profile-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}

.player-profile-photo-placeholder {
    width: 120px;
    height: 120px;
    background: var(--dark-bg);
    color: white;
    font-size: 3rem;
    flex-shrink: 0;
}

.player-profile-photo-sm {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.player-profile-photo-placeholder-sm {
    width: 80px;
    height: 80px;
    background: var(--dark-bg);
    color: white;
    font-size: 2rem;
}

.player-profile-photo-xs {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
}

@media (max-width: 575.98px) {
    .player-profile-photo,
    .player-profile-photo-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* Responsive table wrapper */
.table-responsive {
    border-radius: 0.375rem;
}

/* Match leg indicator */
.leg-indicator {
    display: inline-flex;
    gap: 0.25rem;
}

.leg-indicator .leg {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #e9ecef;
}

.leg-indicator .leg.won {
    background-color: var(--primary-green);
}

.leg-indicator .leg.lost {
    background-color: var(--primary-red);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Button loading state */
.btn.is-loading {
    position: relative;
    pointer-events: none;
}

.btn.is-loading .btn-text {
    visibility: hidden;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spinner 0.75s linear infinite;
}

@keyframes btn-spinner {
    to { transform: rotate(360deg); }
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary-green);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top:hover {
    transform: translateY(-3px);
    background-color: #157347;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* Breadcrumb styling */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
}

.breadcrumb-item a {
    color: var(--primary-green);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Head-to-Head comparison */
.h2h-stat-row .stat-better {
    color: var(--primary-green);
    font-weight: 700;
}

.h2h-form-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.form-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
}

/* Achievement badges */
.achievement-badge {
    width: 80px;
    transition: transform 0.2s;
}

.achievement-badge:hover {
    transform: translateY(-3px);
}

.achievement-badge .badge-icon {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.achievement-badge .badge-name {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Search dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15);
    margin-top: 2px;
}

.search-dropdown .search-group-label {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
}

.search-dropdown .search-group-label:first-child {
    border-top: none;
}

.search-dropdown .search-result-item {
    display: block;
    padding: 0.4rem 0.75rem;
    color: #212529;
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown .search-result-item:hover {
    background-color: #e9ecef;
}

.search-dropdown .search-no-results {
    padding: 0.75rem;
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
}

.search-dropdown .search-view-all {
    display: block;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--primary-green);
    text-decoration: none;
    border-top: 1px solid #e9ecef;
}

.search-dropdown .search-view-all:hover {
    background-color: #f8f9fa;
}

/* Notifications */
.notification-item {
    white-space: normal !important;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease;
}
.notification-item:hover {
    background-color: #f0f0f0 !important;
}
.notification-item.notification-unread {
    border-left-color: #0d6efd;
}
#notifDropdownMenu .dropdown-item {
    white-space: normal;
}

/* Notification badge pulse */
@keyframes notifPulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); }
}
.notif-pulse {
    animation: notifPulse 0.6s ease-in-out 2;
}

/* Full page notifications */
.notification-page-item {
    transition: background-color 0.15s ease;
}
.notification-page-item.unread {
    border-left: 3px solid #0d6efd;
    background-color: #f8f9fa;
}
.notification-page-item.unread .notification-title {
    font-weight: 600;
}

/* Division system */
.division-standings .promotion-row { background-color: rgba(25, 135, 84, 0.1); }
.division-standings .relegation-row { background-color: rgba(220, 53, 69, 0.1); }
.division-standings .playoff-row { background-color: rgba(255, 193, 7, 0.1); }

.tier-badge { font-size: 0.75rem; }
.deadline-ok { color: var(--primary-green); }
.deadline-soon { color: #ffc107; }
.deadline-overdue { color: var(--primary-red); font-weight: 700; }

.season-progress .progress { height: 8px; }

/* ==========================================
   Notification Dropdown (moved from inline styles)
   ========================================== */
.notif-dropdown {
    min-width: 340px;
    max-height: 440px;
    overflow-y: auto;
}

/* ==========================================
   Navbar Search Input (moved from inline styles)
   ========================================== */
#navSearchInput {
    min-width: 160px;
}

/* ==========================================
   Swipe Back Indicator
   ========================================== */
.swipe-back-indicator {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateX(-30px);
    width: 30px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-green);
    color: #fff;
    border-radius: 0 8px 8px 0;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1090;
    pointer-events: none;
}

/* ==========================================
   Mobile Responsive Styles
   ========================================== */
@media (max-width: 575.98px) {
    /* --- Navbar: notification dropdown full-width --- */
    .notif-dropdown {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        min-width: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 0;
        transform: none !important;
    }

    /* --- Navbar: search input --- */
    #navSearchInput {
        min-width: 0;
        width: 100%;
    }

    /* --- Navbar: search dropdown within viewport --- */
    .search-dropdown {
        width: calc(100vw - 2rem);
        min-width: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    /* --- Tables: tighter padding & smaller font --- */
    .table th,
    .table td {
        padding: 0.4rem 0.3rem;
        font-size: 0.8125rem;
    }

    .league-table .rank-col {
        width: 35px;
    }

    /* --- Stat cards: smaller values --- */
    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    /* --- Touch-friendly score entry --- */
    #legForm .btn-group .btn {
        padding: 0.75rem 1rem;
        font-size: 1.125rem;
        min-height: 48px;
    }

    #legForm .form-control-sm {
        min-height: 44px;
        font-size: 1rem;
    }

    #legForm .form-check-input {
        width: 1.25em;
        height: 1.25em;
    }

    #legForm button[type="submit"] {
        width: 100%;
        min-height: 48px;
        font-size: 1.125rem;
    }

    /* --- Hide keyboard shortcuts on mobile --- */
    .keyboard-shortcuts-hint {
        display: none;
    }

    /* --- Touch targets: action buttons --- */
    .btn-actions {
        display: flex;
        gap: 0.25rem;
    }

    .btn-actions .btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* --- Touch targets: pagination --- */
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* --- Touch targets: form controls --- */
    .form-control,
    .form-select {
        min-height: 44px;
    }

    /* --- Match scoreboard: compact display --- */
    .score-display .display-4 {
        font-size: 2rem;
    }

    .score-display .display-5 {
        font-size: 1.75rem;
    }

    .score-display h3 {
        font-size: 1.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --- Page headers: stack vertically --- */
    .page-header-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .page-header-flex .btn,
    .page-header-flex > div:last-child {
        width: 100%;
    }

    .page-header-flex > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header-flex > div:last-child .btn {
        flex: 1;
        min-width: 0;
    }

    /* --- Notification filter pills: horizontal scroll --- */
    .notif-filter-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .notif-filter-pills::-webkit-scrollbar {
        display: none;
    }

    .notif-filter-pills .nav-item {
        flex-shrink: 0;
    }
}

/* Tablet breakpoint */
@media (max-width: 767.98px) {
    /* --- Hide keyboard shortcuts on tablets too --- */
    .keyboard-shortcuts-hint {
        display: none;
    }

    /* --- Match scoreboard compact --- */
    .score-display .display-4 {
        font-size: 2rem;
    }

    .score-display h3 {
        font-size: 1.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ==========================================
   Safe Area Insets (notched devices)
   ========================================== */
@supports (padding: env(safe-area-inset-top)) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .back-to-top {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .swipe-back-indicator {
        left: env(safe-area-inset-left);
    }
}

/* ==========================================
   Page & Interactive Polish
   ========================================== */
/* Smooth hover on list-group-item-action */
.list-group-item-action {
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

/* Consistent link colour in card headers */
.card-header a {
    color: inherit;
}
.card-header a:hover {
    opacity: 0.8;
}

/* ==========================================
   Typography
   ========================================== */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.3rem !important;
    letter-spacing: 0.05em;
}

/* ==========================================
   Card Tiers
   ========================================== */
/* Tier 1: Primary content â€” raised shadow + green left accent */
.card-feature {
    box-shadow: var(--shadow-card-raised);
    border-left: 3px solid var(--primary-green) !important;
}

.card-feature > .card-header {
    background-color: var(--surface-feature);
}
/* ==========================================
   Dark Mode Adjustments
   ========================================== */
[data-bs-theme="dark"] {
    --primary-green: #20c075;
    --primary-red: #e85d6c;
    --dark-bg: #1a1d21;
    --surface-feature: rgba(32, 192, 117, 0.08);
}

[data-bs-theme="dark"] .card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .loading-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

[data-bs-theme="dark"] .search-dropdown {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .search-dropdown .search-result-item {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .search-dropdown .search-result-item:hover {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .search-dropdown .search-group-label {
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .search-dropdown .search-view-all {
    border-top-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .stat-card .stat-label {
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .player-avatar {
    background-color: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .player-profile-photo-placeholder,
[data-bs-theme="dark"] .player-profile-photo-placeholder-sm {
    background: var(--bs-secondary-bg);
}

[data-bs-theme="dark"] .notification-item:hover {
    background-color: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .back-to-top {
    background-color: var(--primary-green);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .back-to-top:hover {
    background-color: #1aa862;
}

[data-bs-theme="dark"] .notif-dropdown {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .notification-item.notification-unread {
    background-color: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .swipe-back-indicator {
    background-color: var(--primary-green);
}

/* Dark mode toggle button */
#darkModeToggle {
    font-size: 1rem;
    padding: 0.5rem;
    line-height: 1;
}

/* ==========================================
   Inline 3DA Editing & Multi-select Player Add
   ========================================== */
.player-avg-display {
    cursor: pointer;
    transition: outline 0.15s ease, background-color 0.3s ease;
}

.player-avg-display:hover {
    outline: 2px solid var(--bs-primary);
    outline-offset: 1px;
}

.player-avg-edit {
    width: 75px;
}

.player-avg-flash {
    animation: avgFlash 0.6s ease;
}

@keyframes avgFlash {
    0% { background-color: rgba(25, 135, 84, 0.4); }
    100% { background-color: transparent; }
}

.player-add-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
}

.player-add-results .form-check {
    padding: 0.35rem 0.75rem 0.35rem 2rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.player-add-results .form-check:last-child {
    border-bottom: none;
}

.player-add-results .form-check:hover {
    background-color: var(--bs-tertiary-bg);
}

.player-add-selected .badge {
    cursor: pointer;
    transition: opacity 0.15s;
}

.player-add-selected .badge:hover {
    opacity: 0.7;
}

[data-bs-theme="dark"] .player-avg-flash {
    animation: avgFlashDark 0.6s ease;
}

@keyframes avgFlashDark {
    0% { background-color: rgba(32, 192, 117, 0.3); }
    100% { background-color: transparent; }
}

/* ==========================================
   What's New Indicator Dot
   ========================================== */
.whats-new-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -6px;
}

/* ==========================================
   Print Styles for Standings & Tables
   ========================================== */
@media print {
    /* Hide non-essential elements */
    .navbar,
    footer,
    .back-to-top,
    .btn,
    .breadcrumb,
    .alert,
    #cookieModal,
    #confirmModal,
    .no-print {
        display: none !important;
    }

    /* Reset page layout */
    body {
        min-height: auto;
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    main {
        padding: 0 !important;
        margin: 0 !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Cards - remove shadows and borders */
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    .card-header {
        background-color: #f5f5f5 !important;
        color: black !important;
        border-bottom: 1px solid #ccc !important;
    }

    /* Tables */
    .table {
        border-collapse: collapse !important;
    }

    .table th,
    .table td {
        border: 1px solid #ccc !important;
        padding: 8px !important;
        background: white !important;
        color: black !important;
    }

    .table th {
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
    }

    .table-striped tbody tr:nth-of-type(odd) {
        background-color: #f9f9f9 !important;
    }

    /* League standings specific */
    .league-table tr.highlight {
        background-color: #e8f5e9 !important;
    }

    /* Links - show URL */
    a[href]:after {
        content: none !important;
    }

    /* Page title for print */
    .print-title {
        display: block !important;
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 10pt;
        text-align: center;
    }

    /* Badges */
    .badge {
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
    }

    /* Profile photos in print */
    .player-profile-photo,
    .player-profile-photo-sm {
        width: 60px !important;
        height: 60px !important;
    }

    .player-profile-photo-placeholder,
    .player-profile-photo-placeholder-sm {
        display: none !important;
    }

    /* Page breaks */
    h1, h2, h3 {
        page-break-after: avoid;
    }

    .table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ── Ad Zones ────────────────────────────────────────────────────────────── */
.ad-zone { margin: 0.5rem auto; text-align: center; }
.ad-zone-header,
.ad-zone-footer  { max-width: 728px; }
.ad-zone-sidebar_medium,
.ad-zone-sidebar_large { max-width: 300px; margin-left: auto; margin-right: auto; }
.ad-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em;
            color: #aaa; margin-bottom: 2px; display: block; }

.ad-sidebar { position: sticky; top: 1rem; }
.ad-sidebar .ad-zone { margin-bottom: 1rem; }

.site-sponsor-bar { background: transparent; }
[data-bs-theme="dark"] .site-sponsor-bar { border-color: rgba(255,255,255,0.15) !important; }

/* ── Celebration Animations (Phase 10.5) ─────────────────────────────────── */

/* Confetti particles */
@keyframes confetti-fall {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}
.confetti-piece {
    position: absolute;
    top: -14px;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Toast notification (180 / high checkout) */
.celebrate-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(140%);
    background: #fff;
    border-left: 5px solid #ffc107;
    border-radius: 0.5rem;
    box-shadow: 0 6px 24px rgba(0,0,0,.22);
    padding: 0.8rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 9995;
    cursor: pointer;
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1), opacity 0.45s;
    white-space: nowrap;
    max-width: 92vw;
}
.celebrate-toast--in  { transform: translateX(-50%) translateY(0); opacity: 1; }
.celebrate-toast--out { transform: translateX(-50%) translateY(150%); opacity: 0; transition-timing-function: ease-in; transition-duration: 0.4s; }
.celebrate-toast-icon { font-size: 1.5rem; flex-shrink: 0; }
[data-bs-theme="dark"] .celebrate-toast { background: #2d3035; color: #f8f9fa; }

/* Match win overlay */
.celebrate-match-win {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.35s;
}
.celebrate-match-win--in { opacity: 1; }
.celebrate-match-win-box {
    background: linear-gradient(135deg, #1a472a 0%, #198754 100%);
    color: #fff;
    border-radius: 1rem;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0,0,0,.5);
    transform: scale(0.75);
    transition: transform 0.45s cubic-bezier(0.34,1.56,0.64,1) 0.1s;
    max-width: 90vw;
}
.celebrate-match-win--in .celebrate-match-win-box { transform: scale(1); }
.celebrate-mw-trophy { font-size: 4rem; line-height: 1.1; }
.celebrate-mw-title  { font-size: 1.8rem; font-weight: 800; margin-top: 0.25rem; }
.celebrate-mw-name   { font-size: 1.2rem; opacity: 0.9; margin-top: 0.2rem; }

/* 9-darter full-screen overlay */
.celebrate-nine-darter {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.3s;
}
.celebrate-nine-darter--in { opacity: 1; }
.celebrate-nd-content { text-align: center; color: #fff; padding: 2rem; }
.celebrate-nd-dart {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
    display: inline-block;
    animation: nd-pulse 0.9s ease-in-out infinite alternate;
}
.celebrate-nd-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: #FFD700;
    text-shadow: 0 0 40px rgba(255,215,0,.7);
    line-height: 1;
}
.celebrate-nd-sub { font-size: 1.3rem; opacity: 0.85; margin-top: 0.5rem; }
@keyframes nd-pulse {
    0%   { transform: scale(1) rotate(-5deg); }
    100% { transform: scale(1.18) rotate(5deg); }
}

/* Preference toggle — fixed bottom-right */
#animPrefBar {
    position: fixed;
    bottom: 0.75rem;
    right: 1rem;
    z-index: 9996;
    background: rgba(0,0,0,.45);
    color: #ddd;
    border-radius: 2rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.4s;
}
#animPrefBar a { color: #ddd; text-decoration: none; }
#animPrefBar a:hover { color: #fff; }

/* ── Live Scoring Overlay ─────────────────────────────────────────────────── */
.live-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.live-overlay-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.live-overlay-badge {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #22c55e;
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.3);
    border-radius: 2rem;
    padding: 0.2rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.live-overlay-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    animation: livePulse 1.4s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}

.live-score-zone {
    padding: 1rem 1rem 0.5rem;
    text-align: center;
    flex-shrink: 0;
}

.live-score-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.live-player-col {
    flex: 1;
    max-width: 120px;
}

.live-player-name {
    font-family: var(--font-display);
    font-size: clamp(0.85rem, 4vw, 1rem);
    font-weight: 700;
    color: rgba(255,255,255,.8);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-pips {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.live-pip {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.2);
    transition: background .25s, border-color .25s, transform .2s;
}

.live-pip.won-p1 {
    background: #22c55e;
    border-color: #22c55e;
    transform: scale(1.1);
}

.live-pip.won-p2 {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1);
}

.live-score-center {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.live-score-num {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 18vw, 5.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    color: #fff;
    display: inline-block;
}

.live-score-sep {
    font-family: var(--font-display);
    font-size: clamp(2rem, 10vw, 3rem);
    font-weight: 300;
    color: rgba(255,255,255,.2);
    margin: 0 0.1rem;
    line-height: 1;
}

.live-leg-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
    text-align: center;
    margin-top: 0.4rem;
}

.live-entry-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    gap: 0.75rem;
}

.live-prompt {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    text-align: center;
}

.live-winner-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.live-winner-btn {
    background: rgba(255,255,255,.05);
    border: 2px solid rgba(255,255,255,.1);
    border-radius: 1rem;
    color: rgba(255,255,255,.85);
    font-family: var(--font-display);
    font-size: clamp(1rem, 5vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1.25rem 0.5rem 1rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
    text-align: center;
    line-height: 1.25;
    min-height: 90px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.live-winner-btn:active {
    transform: scale(0.97);
}

.live-winner-btn .winner-dart {
    display: block;
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
    filter: grayscale(1) opacity(0.4);
    transition: filter .15s;
}

.live-winner-btn.selected-p1 {
    background: rgba(34,197,94,.18);
    border-color: #22c55e;
    color: #22c55e;
}

.live-winner-btn.selected-p1 .winner-dart {
    filter: none;
}

.live-winner-btn.selected-p2 {
    background: rgba(239,68,68,.18);
    border-color: #ef4444;
    color: #ef4444;
}

.live-winner-btn.selected-p2 .winner-dart {
    filter: none;
}

.live-winner-btn .partner-sub {
    display: block;
    font-size: 0.7em;
    opacity: 0.7;
    font-weight: 600;
    margin-top: 0.2rem;
}

.live-stats-panel {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
}

.live-stats-heading {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    margin-bottom: 0.75rem;
}

.live-stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
}

.live-stat-player-label {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255,255,255,.5);
    min-width: 52px;
}

.live-stat-field-label {
    font-size: 0.72rem;
    color: rgba(255,255,255,.35);
    font-family: var(--font-body);
}

.live-stepper {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 0.4rem;
    overflow: hidden;
}

.live-stepper-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: 1rem;
    padding: 0.2rem 0.55rem;
    cursor: pointer;
    line-height: 1;
    transition: background .1s, color .1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.live-stepper-btn:hover, .live-stepper-btn:active {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.live-stepper-val {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    min-width: 1.8rem;
    text-align: center;
    color: #fff;
}

.live-num-input {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 0.4rem;
    color: #fff;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    width: 68px;
    font-family: var(--font-body);
    transition: border-color .15s, background .15s;
    -webkit-appearance: none;
}

.live-num-input::placeholder {
    color: rgba(255,255,255,.2);
}

.live-num-input:focus {
    outline: none;
    border-color: rgba(255,255,255,.35);
    background: rgba(255,255,255,.1);
}

.live-nine-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.live-nine-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #f59e0b;
    cursor: pointer;
    flex-shrink: 0;
}

.live-nine-label span {
    font-size: 0.72rem;
    color: rgba(255,255,255,.45);
    font-family: var(--font-body);
    white-space: nowrap;
}

.live-stat-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.07);
    margin: 0.5rem 0;
}

.live-record-btn {
    background: #22c55e;
    border: none;
    border-radius: 0.75rem;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 1rem;
    cursor: pointer;
    transition: background .15s, opacity .15s, transform .1s;
    flex-shrink: 0;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.live-record-btn:disabled {
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.3);
    cursor: not-allowed;
    transform: none;
}

.live-record-btn:not(:disabled):hover {
    background: #16a34a;
}

.live-record-btn:not(:disabled):active {
    transform: scale(0.98);
}

@keyframes scorePop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.22); }
    100% { transform: scale(1); }
}

.score-pop-p1 { animation: scorePop .4s cubic-bezier(.36,.07,.19,.97); color: #22c55e !important; }
.score-pop-p2 { animation: scorePop .4s cubic-bezier(.36,.07,.19,.97); color: #ef4444 !important; }

@keyframes legToastAnim {
    0%   { opacity: 0; transform: translate(-50%, -40%) scale(.85); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    75%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -55%) scale(.95); }
}

.live-leg-toast {
    position: fixed;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22,163,74,.92);
    color: #fff;
    padding: 0.55rem 1.5rem;
    border-radius: 2rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    pointer-events: none;
    animation: legToastAnim 1.6s ease forwards;
    white-space: nowrap;
    z-index: 2100;
    backdrop-filter: blur(4px);
}

