:root {
    --primary-gradient: #ffffff; /* Changed from gradient to solid white */
    --glass-bg: rgba(0, 0, 0, 0.05); /* Adjusted to be less prominent on white */
    --glass-border: rgba(0, 0, 0, 0.1); /* Adjusted */
    --text-white: #333333; /* Changed to dark text */
    --accent-green: #4CAF50;
    --accent-orange: #ff9800;
    --accent-red: #f44336;
    --highlight-color: #ff9800; /* Matching accent */
    --bg-color: #ffffff; /* Changed to white */
    --text-color: #333333; /* Changed to dark text */
    --card-bg: rgba(0, 0, 0, 0.05); /* Adjusted */
    --border-color: rgba(0, 0, 0, 0.1); /* Adjusted */
    --input-bg: rgba(0, 0, 0, 0.05); /* Adjusted */
    --input-text: #333; /* Changed to dark text */
    --modal-bg: #fff;
    --modal-text: #333; /* Changed to dark text */
}

[data-theme="dark"] {
    --primary-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --glass-bg: rgba(0, 0, 0, 0.3);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #e0e0e0;
    --accent-green: #2e7d32;
    --accent-orange: #f57c00;
    --accent-red: #c62828;
    --highlight-color: #ffd54f;
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-bg: rgba(0, 0, 0, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-text: #e0e0e0;
    --modal-bg: #1e1e1e;
    --modal-text: #e0e0e0;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100vh;
    min-width: 100vw;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--primary-gradient);
    background-color: var(--bg-color);
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    height: 100vh;
    width: 100vw;
    color: var(--text-white);
    overflow: hidden;
    overscroll-behavior-y: contain;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.container {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

header {
    text-align: center;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.header-actions {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center; /* Center logo with buttons */
    justify-content: center;
    gap: 12px;
    z-index: 100;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 6px 20px; /* Adjusted padding */
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.logo-link {
    display: flex;
    align-items: center;
    transition: transform 0.2s;
    margin: 0 8px;
}

.logo-link:hover {
    transform: scale(1.1);
}

.club-logo {
    width: 40px; /* Match icon button size roughly */
    height: 40px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .club-logo {
    background: white; /* White background in dark mode */
    padding: 2px;
}

.icon-btn {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn .material-icons {
    font-size: 24px;
}

.icon-btn:hover {
    transform: scale(1.15);
    background: var(--glass-bg);
}

[data-theme="dark"] .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .icon-btn .material-icons {
    color: white;
}

h1 {
    font-size: 1.3rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 15px;
    flex: 1;
    min-height: 0;
    margin-bottom: 80px; /* Space for bottom action bar */
}

/* Team Containers */
.team {
    flex: 1;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    transition: all 0.3s ease;
    min-width: 0;
    cursor: pointer; /* Indicates clickable area */
    user-select: none; /* Prevents text selection on rapid clicks */
    -webkit-tap-highlight-color: transparent; /* Removes tap highlight on mobile */
}

.team:active {
    transform: scale(0.98); /* Subtle feedback on click */
}

.team.serving {
    background: var(--glass-bg);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-orange);
}

[data-theme="dark"] .team.serving {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.team-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.server-marker {
    position: absolute;
    top: -10px;
    font-size: 1.8rem;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.team-name {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.5rem;
    text-align: center;
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 5px;
}

.player-select {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 5px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    margin-bottom: 5px;
}

.player-select:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.player-selects {
    display: flex;
    gap: 5px;
    width: 100%;
    margin-bottom: 10px;
}

.player-selects .player-select {
    flex: 1;
    padding: 10px 5px;
    font-size: 0.9rem;
    min-height: 36px;
    cursor: pointer;
}

.score-display {
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Ensure it takes up remaining vertical space */
    height: 100%; 
}

.score {
    /* Large font size that scales with viewport width/height */
    font-size: min(35vw, 60vh);
    font-weight: 700;
    line-height: 0.9;
    user-select: none;
}

/* Position Indicators */
.position-display {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.pos-box {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    opacity: 0.5;
    color: var(--text-color);
}

.pos-box.active {
    background: var(--text-white);
    color: #667eea;
    opacity: 1;
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
}

/* Controls - REMOVED */

/* Center Info */
.center-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    min-width: 160px;
    padding: 20px;
}

.logo-link {
    display: block;
    transition: transform 0.2s;
}

.logo-link:hover {
    transform: scale(1.05);
}

.club-logo {
    max-width: 120px;
    height: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.score-readout {
    background: var(--card-bg);
    padding: 15px 30px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

#full-score-display {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.serving-details {
    text-align: center;
}

#serving-text {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 3px;
}

#server-number-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

.game-options label {
    font-size: 0.9rem;
}

.game-options select {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 8px;
    margin-left: 5px;
    font-size: 0.9rem;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn-undo, .btn-reset, .btn-manual, .btn-toggle-server, .btn-switch-sides {
    padding: 10px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-undo:hover, .btn-reset:hover, .btn-toggle-server:hover, .btn-switch-sides:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-manual:hover {
    background: var(--glass-bg);
}

.btn-undo:active, .btn-reset:active, .btn-manual:active, .btn-toggle-server:active, .btn-switch-sides:active {
    transform: translateY(0);
}

.btn-undo { background: #607d8b; color: white; }
.btn-reset { background: var(--accent-orange); color: white; }
.btn-toggle-server { background: #667eea; color: white; }
.btn-manual { 
    background: transparent; 
    border: 1px solid var(--border-color); 
    color: var(--text-color);
}
.btn-switch-sides { 
    background: #9c27b0; 
    color: white; 
}

/* --- Desktop --- */
@media (min-width: 1024px) {
    .score {
        font-size: min(40vw, 65vh);
    }

    .team-name {
        font-size: 2rem;
    }

    .center-info {
        min-width: 200px;
    }

    #full-score-display {
        font-size: 2.2rem;
    }
}

/* --- Tablet --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .score {
        font-size: min(45vw, 55vh);
    }

    .team {
        padding: 20px;
    }
}

/* --- Mobile Portrait --- */
@media (max-width: 600px) and (orientation: portrait) {
    .container {
        padding: 8px;
    }
    
    header {
        margin-bottom: 5px;
    }
    
    h1 {
        font-size: 1.1rem;
        margin-bottom: 3px;
    }
    
    .scoreboard {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 90px;
    }
    
    .team {
        flex-direction: column;
        padding: 15px;
        min-height: auto;
        position: relative;
        border-radius: 15px;
        flex: 1;
    }

    .team-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        width: 100%;
        align-items: center;
    }

    .team-name {
        text-align: center;
        margin: 0 0 10px 0;
        font-size: 1.1rem;
        padding: 4px;
    }

    .position-display {
        margin: 10px 0 0 0;
        justify-content: center;
        gap: 8px;
    }

    .pos-box {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .score-display {
        flex: 1;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

    .score {
        font-size: min(50vw, 35vh); /* Adjust for mobile portrait */
        line-height: 0.85;
    }

    .server-marker {
        top: -8px;
        font-size: 1.4rem;
        left: 50%;
        transform: translateX(-50%);
    }

    .center-info {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        background: var(--card-bg);
        border-radius: 12px;
        width: 100%;
        min-width: unset;
        gap: 6px;
        justify-content: space-between;
        align-items: center;
    }

    .score-readout {
        order: 1;
        flex: 1;
        text-align: center;
        padding: 6px 12px;
    }

    .serving-details {
        order: 2;
        flex: 1;
        text-align: center;
    }

    .game-options {
        order: 3;
        flex: 1;
        text-align: center;
    }

    .control-buttons {
        order: 4;
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        gap: 4px;
        margin-top: 4px;
    }

    .btn-undo, .btn-reset, .btn-manual, .btn-toggle-server, .btn-switch-sides {
        flex: 1;
        padding: 10px 4px;
        font-size: 0.75rem;
        min-height: 40px;
        border-radius: 8px;
    }

    #full-score-display {
        font-size: 1.2rem;
    }
    
    #serving-text {
        font-size: 0.85rem;
    }
    
    #server-number-text {
        font-size: 0.75rem;
    }
    
    .header-actions {
        bottom: 15px;
        padding: 8px 15px;
        gap: 8px;
    }
    
    .icon-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* --- Mobile Landscape --- */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding: 5px;
    }

    header {
        margin-bottom: 3px;
    }

    h1 { font-size: 0.9rem; }

    .scoreboard {
        gap: 8px;
        margin-bottom: 10px;
    }

    .team {
        padding: 8px;
        border-radius: 10px;
    }

    .score {
        font-size: 55vh; /* Very large for landscape */
        line-height: 0.85;
    }

    .team-name {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    .player-selects {
        margin-bottom: 5px;
    }

    .player-selects .player-select {
        padding: 4px 2px;
        font-size: 0.75rem;
    }

    .position-display {
        margin-top: 5px;
        gap: 5px;
    }

    .pos-box {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }

    /* .btn-rally removed */

    .center-info {
        min-width: 100px;
        gap: 6px;
        padding: 8px;
    }

    #full-score-display {
        font-size: 1.1rem;
        padding: 6px 12px;
    }

    .serving-details {
        font-size: 0.8rem;
    }

    #serving-text {
        font-size: 0.75rem;
        margin-bottom: 1px;
    }

    #server-number-text {
        font-size: 0.65rem;
    }

    .control-buttons {
        flex-direction: column;
        gap: 3px;
    }

    .btn-undo, .btn-reset, .btn-manual, .btn-toggle-server, .btn-switch-sides {
        padding: 5px 6px;
        font-size: 0.65rem;
        min-height: 28px;
    }

    .server-marker {
        font-size: 1.2rem;
        top: -6px;
    }

    .header-actions {
        bottom: 8px;
        padding: 5px 10px;
        gap: 5px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* --- Small Mobile Portrait --- */
@media (max-width: 380px) and (orientation: portrait) {
    .score {
        font-size: 32vw;
    }

    .team-name {
        font-size: 1rem;
    }

    .btn-rally {
        padding: 12px;
        font-size: 0.9rem;
    }

    #full-score-display {
        font-size: 1.1rem;
    }
}

/* Rotation Container Styles */
.rotation-container {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.rotation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.rotation-header h2 {
    font-size: 1.1rem;
}

/* Missing Rotation Styles Restored */
.add-player-form {
    display: flex;
    gap: 8px;
    flex: 1;
}

.add-player-form input {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    flex: 1;
}

.add-player-form input::placeholder {
    color: rgba(255,255,255,0.6);
}

.btn-toggle-bulk {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-toggle-bulk:hover {
    background: rgba(255,255,255,0.3);
}

.bulk-add-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bulk-add-form textarea {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.bulk-add-form textarea::placeholder {
    color: rgba(255,255,255,0.6);
}

.bulk-add-buttons {
    display: flex;
    gap: 8px;
}

.btn-cancel {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-add-player {
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
}

.rotation-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .rotation-content {
        grid-template-columns: 1fr;
    }
}

.roster-panel, .match-generator-panel {
    background: rgba(0,0,0,0.1);
    padding: 15px;
    border-radius: 12px;
}

.roster-panel h3, .match-generator-panel h3 {
    margin-bottom: 12px;
    font-size: 1rem;
    opacity: 0.9;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}

.player-count {
    font-weight: normal;
    opacity: 0.7;
    font-size: 0.85rem;
}

.roster-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    opacity: 0.8;
    flex-wrap: wrap;
}

.roster-stat {
    background: rgba(255,255,255,0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.roster-stat.playing {
    background: rgba(76, 175, 80, 0.3);
}

.roster-stat.resting {
    background: rgba(255, 152, 0, 0.3);
}

.roster-stat.bench {
    background: rgba(255,255,255,0.15);
}

#player-roster-list {
    list-style: none;
    margin-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.roster-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.roster-item .games-count {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.roster-item .remove-player {
    color: var(--accent-red);
    cursor: pointer;
    margin-left: 10px;
    font-weight: bold;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.btn-reset-stats {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-stats:hover {
    background: rgba(255,255,255,0.1);
}

/* Match Generator Card */
.next-match-card {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.match-teams {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.match-team {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 10px;
    min-width: 100px;
}

.match-team strong {
    color: var(--highlight-color);
    font-size: 0.85rem;
}

.vs-divider {
    font-weight: bold;
    opacity: 0.5;
    font-size: 0.8rem;
}

.bench-info {
    font-size: 0.85rem;
    margin-bottom: 12px;
    opacity: 0.8;
}

.btn-generate, .btn-start-match {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-generate { background: #667eea; color: white; }
.btn-generate:hover { background: #5a6fd6; }
.btn-start-match { background: var(--accent-green); color: white; }
.btn-start-match:hover { background: #45a049; }

.match-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.match-controls .btn-generate {
    flex: 2;
}

.match-controls .btn-secondary {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.match-controls .btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

.match-controls .btn-primary {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--accent-orange);
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.match-controls .btn-primary:hover {
    background: #e68900;
}

.match-mode-info {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-style: italic;
}

#next-match-placeholder {
    text-align: center;
    padding: 20px;
    opacity: 0.5;
    font-style: italic;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--modal-bg);
    color: var(--modal-text);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    max-width: 90%;
    width: 350px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.winner-content {
    border: 4px solid var(--highlight-color);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    color: var(--accent-orange);
    margin-bottom: 15px;
    font-size: 1.6rem;
}

.modal-content p {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #555;
}

.modal-content button {
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: transform 0.2s;
}

.modal-content button:hover {
    transform: scale(1.05);
}

.winner-message {
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
}

.winner-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-green);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-close {
    background: #999 !important;
}

.btn-push-result {
    background: #2196F3 !important;
}

/* Rotation Modal */
.rotation-modal {
    display: none;
}

.rotation-modal.active {
    display: flex;
}

.rotation-modal-content {
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: var(--modal-bg);
}

.rotation-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

.rotation-modal-header h2 {
    margin: 0;
    color: var(--modal-text);
    font-size: 1.3rem;
}

.rotation-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

[data-theme="dark"] .rotation-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

/* History Modal */
.history-modal {
    display: none;
}

.history-modal.active {
    display: flex;
}

.history-modal-content {
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

.history-modal-header h2 {
    margin: 0;
    color: var(--modal-text);
}

[data-theme="dark"] .history-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.history-modal-actions {
    display: flex;
    gap: 10px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--modal-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.history-modal-body .history-table {
    font-size: 1rem;
}

.history-modal-body .history-table th,
.history-modal-body .history-table td {
    padding: 12px;
}

.history-modal-body .no-history {
    padding: 40px;
    font-size: 1.1rem;
}

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

.history-table th {
    text-align: left;
    padding: 10px;
    color: rgba(255,255,255,0.6);
    font-weight: normal;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.history-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.history-winner {
    color: var(--highlight-color);
    font-weight: bold;
}

.btn-clear-history {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-history:hover {
    opacity: 1;
    background: rgba(244, 67, 54, 0.1);
}

.no-history {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.4);
    font-style: italic;
    font-size: 1rem;
}

/* Statistics Modal Styles */
.stats-modal {
    display: none;
}

.stats-modal.active {
    display: flex;
}

.stats-modal-content {
    width: 95%;
    max-width: 750px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
}

.stats-modal-header h2 {
    margin: 0;
    color: var(--modal-text);
}

[data-theme="dark"] .stats-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.stats-modal-actions {
    display: flex;
    gap: 10px;
}

.btn-clear-stats {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-stats:hover {
    opacity: 1;
    background: rgba(244, 67, 54, 0.1);
}

.stats-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .stat-card {
    background: rgba(255, 255, 255, 0.05);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.stat-card.wide {
    grid-column: span 2;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1;
}

.stat-sublabel {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.6;
    margin-top: 8px;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.stat-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-bar-label {
    width: 80px;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    text-align: left;
}

.stat-bar {
    flex: 1;
    height: 28px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .stat-bar {
    background: rgba(255, 255, 255, 0.1);
}

.stat-bar-fill {
    height: 100%;
    border-radius: 14px;
    transition: width 0.5s ease;
}

.stat-bar-fill.team1 {
    background: linear-gradient(90deg, #4CAF50, #81C784);
}

.stat-bar-fill.team2 {
    background: linear-gradient(90deg, #2196F3, #64B5F6);
}

.stat-bar-value {
    width: 45px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-color);
    text-align: right;
}

.score-timeline {
    margin-top: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .score-timeline {
    background: rgba(255, 255, 255, 0.03);
}

.timeline-placeholder {
    color: var(--text-color);
    opacity: 0.5;
    font-style: italic;
}

.timeline-graph {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100px;
    gap: 4px;
}

.timeline-point {
    flex: 1;
    min-width: 8px;
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
}

.timeline-point.team1 {
    background: #4CAF50;
}

.timeline-point.team2 {
    background: #2196F3;
}

@media (max-width: 600px) {
    .stats-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card.wide {
        grid-column: span 1;
    }
    
    .stat-value {
        font-size: 2.5rem;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stats-modal-content,
    .history-modal-content,
    .rotation-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .stats-modal-body .history-table {
        font-size: 0.9rem;
    }
    
    .stats-modal-body .history-table th,
    .stats-modal-body .history-table td {
        padding: 10px 8px;
    }
}
