/* Dark Mode (Default) */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #111111;
    --border-color: #1a1a1a;
    --border-accent: #2a2a2a;
    --border-bright: #4a9b6f;
    --text-primary: #b8b8b8;
    --text-secondary: #6a6a6a;
    --text-muted: #4a4a4a;
    --accent-red: #c94a44;
    --accent-orange: #d17a3a;
    --accent-blue: #4a9bb8;
    --accent-green: #4a9b6f;
    --accent-yellow: #c9b84a;
    --highlight: #4a9b6f;
    --code-bg: #000000;
    --shadow-sm: 0 0 15px rgba(74, 155, 111, 0.08);
    --shadow-md: 0 0 20px rgba(0, 0, 0, 0.5);
    --glow-text: 0 0 8px rgba(74, 155, 111, 0.2);
    --glow-hover: 0 0 8px rgba(74, 155, 111, 0.15);
}

/* Light Mode */
:root[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --nav-bg: #3f4d5c;
    --border-color: #e5e7eb;
    --border-accent: #d1d5db;
    --border-bright: #059669;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent-red: #dc2626;
    --accent-orange: #ea580c;
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-green-light: #d1fae5;
    --accent-yellow: #d97706;
    --highlight: #059669;
    --code-bg: #f9fafb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --glow-text: none;
    --glow-hover: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Dynamic winner tints - switch from dark to light mode values */
:root[data-theme="light"] [style*="--winner-tint-light"] {
    background-color: var(--winner-tint-light) !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.01em;
    font-size: 15px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
nav {
    background: var(--nav-bg, var(--bg-secondary));
    border-bottom: none;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

:root[data-theme="light"] nav {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}

.nav-brand-group .nav-logo {
    height: 1.8em;
    width: auto;
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none !important;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.2s ease;
    line-height: 1;
    border-bottom: none !important;
}

.nav-brand svg {
    flex-shrink: 0;
}

/* Update SVG colors for dark theme - make horizontal lines white */
.nav-brand svg path:nth-child(2),
.nav-brand svg path:nth-child(3),
.nav-brand svg path:nth-child(4) {
    stroke: #ffffff;
}

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

:root[data-theme="light"] .nav-brand {
    color: var(--text-primary);
}

/* Light theme - keep original colors (green + dark gray) */
:root[data-theme="light"] .nav-brand svg path:nth-child(2),
:root[data-theme="light"] .nav-brand svg path:nth-child(3),
:root[data-theme="light"] .nav-brand svg path:nth-child(4) {
    stroke: #333333;
}

:root[data-theme="light"] .nav-brand:hover {
    color: var(--accent-green);
}

/* Hierarchical Navigation Selector */
.nav-league-wrapper {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
}

.nav-selector {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.nav-sport-icon {
    font-size: 1rem;
    line-height: 1;
}

.nav-season-display {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: #d97706;
    color: #ffffff;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    align-self: flex-end;
    margin-bottom: 0.1rem;
}

:root[data-theme="light"] .nav-season-display {
    background: #f59e0b;
    color: #1a1a1a;
}

.nav-selector-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    transition: color 0.2s ease;
}

.nav-selector-btn:hover {
    color: var(--accent-green);
}

:root[data-theme="light"] .nav-selector-btn {
    color: var(--text-primary);
}

:root[data-theme="light"] .nav-selector-btn:hover {
    color: var(--accent-green);
}

.nav-selector-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.nav-selector-display .sport-icon {
    font-size: 1rem;
    line-height: 1;
}

.nav-selector-display .league-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.nav-selector-display .season-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.03em;
}

:root[data-theme="light"] .nav-selector-display .season-text {
    color: var(--text-secondary);
}

.nav-selector-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.nav-selector.open .nav-selector-arrow {
    transform: rotate(180deg);
}

/* Navigation Dropdown Panel */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
    display: none;
    flex-direction: column;
    padding: 0.25rem 0;
}

.nav-selector.open .nav-dropdown {
    display: flex;
}

/* Sport Header Row */
.nav-sport {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.nav-sport .sport-icon {
    font-size: 0.9rem;
}

.nav-sport:not(:first-child) {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.6rem;
}

/* League Row */
.nav-league {
    display: block;
    padding: 0.5rem 0.75rem 0.5rem 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.nav-league:hover {
    background: var(--bg-tertiary);
    color: var(--accent-green);
}

.nav-league.active {
    color: var(--accent-green);
}

/* Season Links */
.nav-season {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-season:hover {
    background: var(--bg-tertiary);
    color: var(--accent-green);
}

.nav-season.active {
    color: var(--accent-green);
    font-weight: 600;
}

.nav-season.active::before {
    content: '✓';
    font-size: 0.7rem;
    margin-left: -1rem;
    margin-right: 0.25rem;
    color: var(--accent-green);
}

/* Divider between leagues */
.nav-league-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0.75rem;
}

/* Older Seasons Submenu */
.nav-older-seasons {
    position: relative;
}

.nav-older-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-older-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-older-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.nav-older-seasons.open .nav-older-arrow {
    transform: rotate(90deg);
}

.nav-older-submenu {
    display: none;
    background: var(--bg-tertiary);
    border-left: 2px solid var(--accent-green);
    margin-left: 1.5rem;
}

.nav-older-seasons.open .nav-older-submenu {
    display: block;
}

.nav-older-submenu .nav-season {
    padding-left: 1.5rem;
    font-size: 0.7rem;
}

/* NBL1 Divisions Submenu */
.nav-divisions-league {
    position: relative;
}

.nav-divisions-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    cursor: pointer;
}

.nav-divisions-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.nav-divisions-league.open .nav-divisions-arrow {
    transform: rotate(90deg);
}

.nav-divisions-submenu {
    display: none;
    background: var(--bg-tertiary);
    border-left: 2px solid var(--accent-green);
    margin-left: 1.5rem;
}

.nav-divisions-league.open .nav-divisions-submenu {
    display: block;
}

.nav-division-gender {
    padding: 0.5rem 0.75rem 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nav-division-gender:not(:first-child) {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}

.nav-division {
    display: block;
    padding: 0.35rem 0.75rem 0.35rem 1.25rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-division:hover {
    background: var(--bg-secondary);
    color: var(--accent-green);
}
/* NBL1 Nested Submenu Hierarchy (Year → Gender → Division) */
.nav-nbl1-season,
.nav-nbl1-gender {
    position: relative;
}

.nav-nbl1-season-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.75rem 0.4rem 2.25rem; /* Indent like .nav-season */
    background: transparent;
    border: none;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.nav-nbl1-gender-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.75rem 0.4rem 1rem; /* Less indent since parent submenu has margin-left */
    background: transparent;
    border: none;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.nav-nbl1-season-btn:hover,
.nav-nbl1-gender-btn:hover {
    background: var(--bg-secondary);
}

.nav-nbl1-season-submenu,
.nav-nbl1-gender-submenu {
    display: none;
    background: var(--bg-tertiary);
    border-left: 2px solid var(--accent-green);
    margin-left: 0.75rem;
}

.nav-nbl1-season.open > .nav-nbl1-season-submenu,
.nav-nbl1-gender.open > .nav-nbl1-gender-submenu {
    display: block;
}

.nav-nbl1-season.open > .nav-nbl1-season-btn .nav-divisions-arrow,
.nav-nbl1-gender.open > .nav-nbl1-gender-btn .nav-divisions-arrow {
    transform: rotate(90deg);
}


/* Legacy support - keep old class names working */
.league-selector {
    position: relative;
}

.league-selector-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s ease;
}

.league-selector-btn:hover {
    color: var(--accent-green);
}

:root[data-theme="light"] .league-selector-btn {
    color: var(--text-primary);
}

:root[data-theme="light"] .league-selector-btn:hover {
    color: var(--accent-green);
}

.league-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.league-selector.open .league-arrow {
    transform: rotate(180deg);
}

.league-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    min-width: 80px;
    z-index: 200;
    display: none;
    flex-direction: column;
}

.league-selector.open .league-dropdown {
    display: flex;
}

.league-option {
    padding: 0.5rem 0.75rem;
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease;
}

.league-option:hover {
    background: var(--bg-tertiary);
}

.league-option.active {
    color: var(--accent-green);
}

/* Season Selector (legacy) */
.season-selector {
    position: relative;
}

.season-selector-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s ease;
}

.season-selector-btn:hover {
    color: #ffffff;
}

:root[data-theme="light"] .season-selector-btn {
    color: var(--text-secondary);
}

:root[data-theme="light"] .season-selector-btn:hover {
    color: var(--text-primary);
}

.season-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.season-selector.open .season-arrow {
    transform: rotate(180deg);
}

.season-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-md);
    min-width: 100px;
    z-index: 200;
    display: none;
    flex-direction: column;
}

.season-selector.open .season-dropdown {
    display: flex;
}

.season-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease;
}

.season-option:hover {
    background: var(--bg-tertiary);
}

.season-option.active {
    color: var(--accent-green);
    font-weight: 600;
}


.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-right-group {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: #ffffff;
    border-bottom-color: var(--accent-green);
}

:root[data-theme="light"] .nav-links a {
    color: var(--text-secondary);
}

:root[data-theme="light"] .nav-links a:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-green);
}

/* Theme Toggle Switch */
.theme-toggle-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    min-width: 40px;
}

.theme-toggle {
    position: relative;
    width: 52px;
    height: 26px;
    background: var(--border-accent);
    border: 2px solid var(--border-accent);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.theme-toggle:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(74, 155, 111, 0.3);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle-slider #themeIcon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Light mode toggle state */
.theme-toggle[data-theme="light"] {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.theme-toggle[data-theme="light"] .theme-toggle-slider {
    left: 28px;
    background: #ffffff;
}

/* Main Container */
.container {
    max-width: 1800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

:root[data-theme="light"] .container {
    background: transparent;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: all 0.3s ease;
}

:root[data-theme="light"] .card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Headers */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2::before {
    content: '▸';
    color: var(--text-muted);
    font-size: 1rem;
}

h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Section Headers with Icons */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header::before {
    content: none !important;
}

.section-icon {
    font-size: 0.6em;
    line-height: 1;
    color: var(--accent-green);
}

:root[data-theme="light"] .section-header {
    border-bottom-color: #d1d5db;
}

:root[data-theme="light"] .section-icon {
    color: #059669;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    border: none;
    border-radius: 0;
    overflow: visible;
}

:root[data-theme="light"] table {
    background: transparent;
}

th {
    background: transparent;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    position: relative;
}

th:hover {
    color: var(--text-primary);
}

th::after {
    content: '';
    display: none;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

:root[data-theme="light"] td {
    border-bottom: 1px solid #f0f2f4;
}

/* Removed hover background to preserve conditional formatting */

tbody tr:last-child td {
    border-bottom: none;
}

/* Sticky First Column - Keep player/team names visible when scrolling */
table th:first-child,
table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
}

table th:first-child {
    background: var(--bg-secondary);
    z-index: 11;
}

:root[data-theme="light"] table th:first-child {
    background: #ffffff;
}

table td:first-child {
    background: var(--bg-secondary);
    font-weight: 600;
}

:root[data-theme="light"] table td:first-child {
    background: #ffffff;
}

.stat-cell, .sc {
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
}

/* Visual separator before Total column in quarter scores */
.total-score {
    border-left: 2px solid var(--border-color) !important;
}

/* Plus/minus coloring */
.pm-pos { color: var(--accent-blue); }
.pm-neg { color: var(--accent-red); }

/* Sorted column highlighting - use borders instead of background */
.stat-highlight {
    font-weight: 700;
    border-left: 3px solid var(--accent-green) !important;
    border-right: 3px solid var(--accent-green) !important;
    position: relative;
}

/* Light mode specific stat highlight */
:root[data-theme="light"] .stat-highlight {
    border-left: 3px solid #059669 !important;
    border-right: 3px solid #059669 !important;
}

/* Winner score highlighting for games pages - matches original stat-highlight styling */
.winner-highlight {
    font-weight: 700;
    color: #22c55e;
    background-color: rgba(34, 197, 94, 0.15);
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

:root[data-theme="light"] .winner-highlight {
    background-color: #d1fae5;
    color: #065f46;
    text-shadow: none;
}

/* Loser score styling - muted appearance */
.loser-score {
    color: var(--text-muted);
    font-weight: 400;
}

.loser-score strong {
    font-weight: 400;
}

/* Team color bar - no longer used, using border-left on td instead
.team-color-bar {
    display: inline-block;
    width: 4px;
    height: 1em;
    margin-right: 0.5rem;
    border-radius: 2px;
    vertical-align: middle;
}
*/

/* Header highlighting for sorted column */
th.stat-highlight {
    border-left: 3px solid var(--accent-green) !important;
    border-right: 3px solid var(--accent-green) !important;
    border-bottom: 3px solid var(--accent-green) !important;
}

:root[data-theme="light"] th.stat-highlight {
    border-left: 3px solid #059669 !important;
    border-right: 3px solid #059669 !important;
    border-bottom: 3px solid #059669 !important;
}

/* Row hover effect */
table tbody tr {
    transition: all 0.15s ease;
}

table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--accent-green), inset -3px 0 0 var(--accent-green);
}

:root[data-theme="light"] table tbody tr:hover {
    box-shadow: inset 3px 0 0 #059669, inset -3px 0 0 #059669;
}

/* Make sure first column also shows the left border on hover */
table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--accent-green);
}

:root[data-theme="light"] table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 #059669;
}

/* Links */
a {
    color: var(--accent-green);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

a:hover {
    color: var(--accent-green);
    text-decoration: none;
    border-bottom-color: var(--accent-green);
}

:root[data-theme="light"] a {
    color: #059669;
}

:root[data-theme="light"] a:hover {
    color: #047857;
    border-bottom-color: #047857;
}

/* Light mode specific hover effects - removed to preserve conditional formatting */

/* Footer */
footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.75rem;
}

footer a {
    color: var(--accent-green);
}

/* Badges and Stats */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.badge-win {
    background: rgba(74, 155, 111, 0.12);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 155, 111, 0.15);
}

.badge-loss {
    background: rgba(201, 74, 68, 0.12);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 6px rgba(201, 74, 68, 0.15);
}

/* Leader cards - hide team abbreviation on desktop */
.team-abbr {
    display: none;
}

/* Responsive */
/* Intermediate breakpoint for tablet-sized viewports */
@media (max-width: 1100px) and (min-width: 769px) {
    .nav-container {
        padding: 0 0.5rem;
    }

    .nav-right-group {
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .nav-links a {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }
    
    .theme-toggle-wrapper {
    flex-shrink: 0;
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .theme-toggle-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 768px) {
    /* Navigation - Keep sticky on mobile */
    nav {
        position: sticky;
        padding: 0.75rem 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
    }

    .nav-brand-group {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-brand-group .nav-logo {
        height: 1.8em;
    }

    .nav-brand {
        font-size: 1.25rem;
        text-align: center;
    }

    .nav-links {
        gap: 0.25rem;
        flex-wrap: nowrap;
        justify-content: center;
        width: 100%;
    }

    .nav-links a {
        padding: 0.4rem 0.4rem;
        font-size: clamp(0.55rem, 2.5vw, 0.75rem);
    }

    /* Theme Toggle - Compact top-right position */
    .theme-toggle-wrapper {
    flex-shrink: 0;
        position: absolute;
        top: 1rem;
        right: 1rem;
        gap: 0.35rem;
        flex-direction: row-reverse; /* Icon first, then label */
    }

    .theme-toggle-label {
        font-size: 0.6rem;
        min-width: auto;
        writing-mode: horizontal-tb;
    }

    .theme-toggle {
        width: 40px;
        height: 22px;
    }

    .theme-toggle-slider {
        width: 16px;
        height: 16px;
        top: 1px;
        left: 1px;
        font-size: 9px;
    }

    .theme-toggle[data-theme="light"] .theme-toggle-slider {
        left: 21px;
    }

    /* Container */
    .container {
        padding: 0 0.75rem;
        max-width: 100%;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Headers */
    h1 {
        font-size: 1.5rem;
        padding-left: 0.75rem;
    }

    h2 {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    h2::before {
        font-size: 1rem;
    }

    h3 {
        font-size: 0.95rem;
    }

    /* Tables */
    table {
        font-size: 0.7rem;
    }

    th {
        padding: 0.75rem 0.4rem;
        font-size: 0.65rem;
        letter-spacing: 0.05em;
    }

    th::after {
        right: 0.25rem;
        font-size: 0.7rem;
    }

    td {
        padding: 0.75rem 0.4rem;
    }

    /* Enhance sticky column shadow on mobile */
    table th:first-child,
    table td:first-child {
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15);
    }

    /* View Toggle Buttons */
    .view-toggle-btn,
    .tab-btn,
    .stats-subtab-btn,
    .subtab-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.7rem !important;
        flex-shrink: 0;
    }

    /* Tab containers - make horizontally scrollable on mobile */
    div[style*="display: flex"][style*="border-bottom"]:has(.view-toggle-btn, .tab-btn, .stats-subtab-btn, .subtab-btn) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 2px;
    }

    /* Prevent tab buttons from shrinking */
    .view-toggle-btn, .tab-btn, .stats-subtab-btn, .subtab-btn {
        flex-shrink: 0;
    }

    /* Search Input */
    input[type="text"] {
        font-size: 0.85rem !important;
        padding: 0.75rem 0.75rem !important;
    }

    /* Flex containers with buttons - header with view toggles */
    .card > div[style*="display: flex"][style*="justify-content: space-between"] {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }

    .card > div[style*="display: flex"][style*="justify-content: space-between"] h2 {
        text-align: center;
    }

    .card > div[style*="display: flex"][style*="justify-content: space-between"] > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.4rem !important;
    }

    /* Box Score specific */
    .box-score-header {
        font-size: 0.9rem;
    }

    /* Recent Games table - make boxscore link more compact on mobile */
    .boxscore-link {
        white-space: nowrap;
        font-size: 0.65rem;
    }

    .boxscore-link a {
        display: inline-block;
    }

    /* Make matchup scores more compact on mobile */
    .game-matchup strong {
        font-size: 0.75rem;
    }

    /* Show team abbreviation inline on mobile for all tables */
    .team-name-full {
        display: none;
    }

    .team-abbr {
        display: inline;
    }

    /* Increase font sizes on mobile for better readability */
    table td strong {
        font-size: 0.9rem;
    }

    table td.stat-cell, table td.sc {
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.75rem;
    }
}

/* Recent Games Matchup Styling */
.game-matchup .score-separator {
    margin: 0 0.5rem;
    color: var(--text-muted);
    font-weight: normal;
}

.game-matchup .winner-highlight {
    background-color: var(--highlight-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
}

.game-matchup .winner-highlight a {
    font-weight: bold;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Faster tooltip delay for garbage time icons */
span[title*="garbage time"] {
    cursor: help;
    position: relative;
}

span[title*="garbage time"]::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

span[title*="garbage time"]:hover::after {
    opacity: 1;
    transition-delay: 0.2s;
}

/* Recent Games Card Layout */
.recent-games-section {
    margin-bottom: 2rem;
}

.recent-games-section h2 {
    margin-bottom: 1.5rem;
}

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

.game-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.game-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
}

/* Date group separator - vertical line on wide screens */
.game-card.new-date-group {
    position: relative;
}

.game-card.new-date-group::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-accent);
}

.game-card-date {
    text-align: center;
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.game-card-date a {
    color: var(--text-secondary);
    text-decoration: none;
}

.game-card-date a:hover {
    color: var(--highlight);
}

/* Date separator - hidden on desktop, shown on mobile */
.date-separator {
    display: none;
}

/* 3-Column Matchup Layout */
.game-card-matchup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.75rem;
}

.game-card-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    min-width: 0; /* Allow grid cells to shrink below content size for equal widths */
}

.game-card-side .team-name {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.game-card-side .team-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.game-card-side .team-name a:hover {
    color: var(--highlight);
}

.game-card-side .team-score {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-muted);
}

.game-card-side .team-record {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Winner side styling */
.game-card-side.winner-side .team-name a {
    font-weight: 500;
}

.game-card-side.winner-side .team-score {
    color: var(--text-primary);
}

/* Center Column - Box Score Link */
.game-card-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
    gap: 0.25rem;
}

.game-card-center .ot-badge {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.15rem 0.35rem;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.game-card-center .box-score-link {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.game-card-center .box-score-link:hover {
    color: var(--highlight);
    background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] .game-card-center .box-score-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.game-card-center .garbage-icon {
    font-size: 0.75rem;
    cursor: help;
}

/* Top scorer summary at bottom of game card */
.game-card-scorers {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

/* Games Log - Row-based layout for games list page */
.games-log {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-log-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: stretch;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.game-log-row:last-child {
    border-bottom: none;
}

.game-log-team {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.game-log-home {
    text-align: center;
}

.game-log-away {
    text-align: center;
}

.game-log-team-name {
    font-size: 0.95rem;
}

.game-log-team-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.game-log-team-name a:hover {
    color: var(--highlight);
}

.game-log-winner .game-log-team-name a {
    font-weight: 600;
}

.game-log-top-scorer {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Center cluster - scores and box score link */
.game-log-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    min-width: 120px;
}

.game-log-scores {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.game-log-score {
    min-width: 2rem;
    text-align: center;
}

.game-log-score.score-winner {
    color: var(--text-primary);
}

.game-log-score.score-loser {
    color: var(--text-muted);
    font-weight: 400;
}

.game-log-vs {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.game-log-boxscore {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    margin-top: 0.35rem;
    transition: color 0.15s ease;
}

.game-log-boxscore:hover {
    color: var(--highlight);
}

.game-log-garbage {
    font-size: 0.75rem;
    cursor: help;
    margin-top: 0.15rem;
}

.game-log-upcoming {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Team logos in games log */
.game-log-logo {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 100%;
    width: auto;
    opacity: 0.12;
    pointer-events: none;
}

.game-log-logo-left,
.game-log-logo-right {
    left: 50%;
    transform: translate(-50%, -50%);
}

.game-log-logo-loser {
    filter: grayscale(100%);
    opacity: 0.08;
}

/* Mobile adjustments for games log */
@media (max-width: 640px) {
    .game-log-row {
        /* Keep horizontal layout, just tighter */
        grid-template-columns: 1fr auto 1fr;
        gap: 0.25rem;
        padding: 0.35rem 0;
    }

    .game-log-team {
        padding: 0.35rem 0.5rem;
    }

    .game-log-team-name {
        font-size: 0.8rem;
    }

    .game-log-top-scorer {
        font-size: 0.6rem;
    }

    .game-log-center {
        min-width: 80px;
        padding: 0 0.25rem;
    }

    .game-log-scores {
        font-size: 0.95rem;
        gap: 0.2rem;
    }

    .game-log-score {
        min-width: 1.5rem;
    }

    .game-log-boxscore {
        font-size: 0.6rem;
        padding: 0.15rem 0.35rem;
    }

    .game-log-logo {
        height: 80%;
    }
}

/* Box Score Button - Full Width Card Footer (DEPRECATED - now using center link)
.game-card-link {
    margin: 0 -1rem -1rem -1rem;
    padding: 0;
}

.game-card-link a {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.game-card-link a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.game-card-link a:active {
    background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .game-card-link a {
    background: transparent;
    border-top-color: #e5e7eb;
}

:root[data-theme="light"] .game-card-link a:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

:root[data-theme="light"] .game-card-link a:active {
    background: rgba(0, 0, 0, 0.06);
}
*/

/* Mobile adjustments for game cards */
@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        padding: 0.875rem;
    }

    /* Hide date on individual cards on mobile - shown in separator instead */
    .game-card-date {
        display: none;
    }

    /* Show date separator on mobile */
    .date-separator {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        grid-column: 1 / -1;
        padding: 0.5rem 0;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .date-separator::before,
    .date-separator::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-color);
    }

    .date-separator a {
        color: var(--text-secondary);
        text-decoration: none;
        white-space: nowrap;
    }

    .date-separator a:hover {
        color: var(--highlight);
    }

    /* Remove old date group separator line on mobile - using date-separator instead */
    .game-card.new-date-group::before {
        display: none;
    }

    /* Tighter spacing on mobile for matchup layout */
    .game-card-matchup {
        gap: 0.25rem;
    }

    .game-card-side {
        padding: 0.25rem;
    }

    .game-card-side .team-name {
        font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    }

    .game-card-side .team-score {
        font-size: 1.25rem;
    }

    .game-card-side .team-record {
        font-size: 0.65rem;
    }

    /* Center Box Score link mobile adjustments */
    .game-card-center .ot-badge {
        font-size: 0.55rem;
        padding: 0.1rem 0.25rem;
    }

    .game-card-center .box-score-link {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Game card winner/loser score styling */
.game-card-team .team-score.score-winner {
    font-weight: 600;
    color: var(--text-primary);
}

.game-card-team .team-score.score-loser {
    font-weight: 400;
    color: var(--text-muted);
}

/* Responsive player names - show full on desktop, abbreviated on mobile */
.player-name-full {
    display: inline;
}

.player-name-abbr {
    display: none;
}

@media (max-width: 768px) {
    .player-name-full {
        display: none;
    }

    .player-name-abbr {
        display: inline;
    }
}

/* Responsive lineup names - comma-separated on desktop, stacked on mobile */
.lineup-names {
    display: inline;
}

.lineup-names span:not(:last-child)::after {
    content: ', ';
}

@media (max-width: 768px) {
    .lineup-names {
        display: flex;
        flex-direction: column;
        line-height: 1.4;
    }

    .lineup-names span::after {
        content: '';
    }
}

/* Team color bar for inline display - no longer used, using border-left on td instead
.team-color-bar {
    display: inline-block;
    width: 4px;
    height: 1em;
    margin-right: 0.5rem;
    border-radius: 2px;
    vertical-align: middle;
}
*/
