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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    flex: 1;
}

/* Sign In Button */
.sign-in-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.3);
    white-space: nowrap;
}

.sign-in-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6);
}

/* User Info Display */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-menu-btn {
    background: transparent;
    color: white;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.user-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.mode-indicator {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    padding: 8px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    animation: pulse 2s infinite;
}

/* Pickleball mode indicator styling */
body:not(.casual-mode) .mode-indicator {
    background: linear-gradient(135deg, #00b894, #00a085);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.mode-indicator span {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.match-score {
    background: rgba(255,255,255,0.3);
    padding: 8px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
}

.match-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.game-info {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.2);
    padding: 10px 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.serving-info, .server-info {
    font-size: 1.1rem;
    font-weight: 600;
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.team {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.team:active {
    transform: scale(0.98);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.team.serving {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    transform: scale(1.02);
}

.team-name {
    color: #2d3436;
    margin-bottom: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.team-name:hover {
    background-color: rgba(0,0,0,0.1);
}

.team-name:active {
    background-color: rgba(0,0,0,0.2);
}

.score-display {
    margin-bottom: 25px;
}

.score {
    font-size: 4rem;
    font-weight: bold;
    color: #2d3436;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

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

.score-tap-hint {
    color: #636e72;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    margin-top: 5px;
}

.score-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    width: 100%;
}

.scored-btn {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
}

.scored-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #00a085, #008f75);
}


.game-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.control-row {
    display: flex;
    gap: 10px;
}

.control-row .control-btn {
    flex: 1;
}

.control-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.9);
    color: #2d3436;
    touch-action: manipulation;
}

.control-btn:active {
    transform: scale(0.98);
    background: rgba(255,255,255,0.8);
}

.reset-btn {
    background: linear-gradient(135deg, #e17055, #d63031);
    color: white;
}

.reset-btn:active {
    background: linear-gradient(135deg, #d63031, #c0392b);
}

.game-status {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.score-call {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2d3436;
    margin-bottom: 15px;
}

.win-message {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.win-message h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.win-message p {
    font-size: 1.3rem;
}

@media (max-width: 480px) {
    .app {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .scoreboard {
        gap: 15px;
    }
    
    .team {
        padding: 20px;
    }
    
    .score {
        font-size: 3rem;
    }
    
    .control-row {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-height: 700px) {
    .app {
        padding: 10px;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .team {
        padding: 15px;
    }
    
    .score {
        font-size: 3rem;
    }
}

/* Overlays and Popups */
.game-over-overlay, .settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Higher than fullscreen mode (2000) */
}

.game-over-popup, .settings-popup {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 350px;
    width: 90%;
    margin: 20px;
}

.game-over-popup h2, .settings-popup h3 {
    color: #2d3436;
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-over-popup p {
    color: #2d3436;
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 25px;
}

.popup-btn {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    margin: 5px;
}

.popup-btn:active {
    transform: scale(0.95);
}

.popup-btn.secondary {
    background: linear-gradient(135deg, #636e72, #2d3436);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    text-align: left;
}

.settings-row label {
    font-weight: 600;
    color: #2d3436;
}

.settings-row select {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1rem;
    color: #2d3436;
}

.settings-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

/* Casual Mode Styling */
.casual-mode .game-info {
    background: rgba(255, 193, 7, 0.3);
}

.casual-mode header h1 {
    color: #ffc107;
}

.casual-mode-active {
    background: linear-gradient(135deg, #ffc107, #ff9800) !important;
    color: white !important;
}

/* Notification Bar */
.notification-bar {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 3500; /* Above everything except QR/settings modals */
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: slideIn 0.3s ease-out;
    pointer-events: none; /* Don't block touches */
    backdrop-filter: blur(10px);
}

.notification-content {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fullscreen Notification Bar */
.fs-notification-bar {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 4000; /* Above everything in fullscreen */
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    pointer-events: none; /* Don't block touches */
}

.fs-notification-content {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Fullscreen Button */
.fullscreen-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe) !important;
    color: white !important;
}

/* Help Button */
.help-btn {
    background: linear-gradient(135deg, #e17055, #d63031) !important;
    color: white !important;
}

/* Dark Mode Button */
.dark-mode-btn {
    background: linear-gradient(135deg, #2d3436, #636e72) !important;
    color: white !important;
}

.dark-mode-active {
    background: linear-gradient(135deg, #000000, #2d3436) !important;
    color: #ffeaa7 !important;
}

/* Dark Mode Styles - Pure Black for OLED */
.dark-mode {
    background: #000000 !important;
}

.dark-mode .app {
    background: #000000 !important;
}

.dark-mode header h1 {
    color: #ffffff !important;
}

.dark-mode .mode-indicator {
    background: linear-gradient(135deg, #ffc107, #ff9800) !important;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.5) !important;
}

.dark-mode .match-score {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
}

.dark-mode .game-info {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
}

.dark-mode .serving-info, 
.dark-mode .server-info {
    color: #ffffff !important;
}

.dark-mode .team {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .team.serving {
    background: linear-gradient(135deg, #2d2d00, #4a4a00) !important;
    border-color: #ffc107 !important;
}

.dark-mode .team-name {
    color: #ffffff !important;
}

.dark-mode .team-name:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.dark-mode .score {
    color: #ffffff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8) !important;
}

.dark-mode .score-tap-hint {
    color: #ffffff !important;
    opacity: 0.7 !important;
}

.dark-mode .fs-tap-hint {
    color: rgba(255, 255, 255, 0.9) !important;
}

.dark-mode .scored-btn {
    background: linear-gradient(135deg, #00a085, #008f75) !important;
}

.dark-mode .control-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
    backdrop-filter: blur(10px) !important;
}

.dark-mode .control-btn:active {
    background: rgba(255, 255, 255, 0.2) !important;
}

.dark-mode .reset-btn {
    background: linear-gradient(135deg, #d63031, #c0392b) !important;
    border: none !important;
}

.dark-mode .game-status {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid #333333 !important;
}

.dark-mode .score-call {
    color: #ffffff !important;
}

.dark-mode .notification-bar {
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6) !important;
    box-shadow: 0 4px 15px rgba(90, 79, 207, 0.5) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

/* Dark Mode Fullscreen */
.dark-mode .fullscreen-mode {
    background: #000000 !important;
}

.dark-mode .fullscreen-header {
    color: #ffffff !important;
}

.dark-mode .exit-fullscreen-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid #333333 !important;
}

.dark-mode .fs-team {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid #333333 !important;
}

.dark-mode .fs-team.serving {
    background: rgba(255, 193, 7, 0.2) !important;
    border-color: #ffc107 !important;
}

.dark-mode .fs-team h2 {
    color: #ffffff !important;
}

.dark-mode .fs-score {
    color: #ffffff !important;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8) !important;
}

.dark-mode .fs-scored-btn {
    background: linear-gradient(135deg, #00a085, #008f75) !important;
}

.dark-mode .fs-control-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid #333333 !important;
}

.dark-mode .fs-notification-bar {
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6) !important;
    box-shadow: 0 6px 20px rgba(90, 79, 207, 0.5) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

/* Live Sharing Notification */
.sharing-notification {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
    animation: slideIn 0.3s ease-out;
}

.sharing-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sharing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.close-sharing-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-sharing-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.sharing-id {
    font-size: 1.1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 10px;
    font-family: monospace;
    letter-spacing: 2px;
}

.sharing-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sharing-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 15px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    color: #2d3436;
}

.sharing-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.8);
}

/* QR Code Modal */
.qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.qr-popup {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 350px;
    width: 90%;
    margin: 20px;
}

.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.qr-header h3 {
    color: #2d3436;
    font-size: 1.5rem;
    margin: 0;
}

.close-qr-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-qr-btn:active {
    background: #c0392b;
}

.qr-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#qr-code-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 200px;
    align-items: center;
}

.qr-url {
    display: flex;
    gap: 10px;
    align-items: center;
}

#share-url-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2d3436;
    background: #f8f9fa;
    text-overflow: ellipsis;
}

.copy-url-btn {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-url-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #00a085, #008f75);
}

.qr-instructions {
    color: #636e72;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Dark Mode Sharing Styles */
.dark-mode .sharing-notification {
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6) !important;
    box-shadow: 0 6px 20px rgba(90, 79, 207, 0.4) !important;
}

.dark-mode .sharing-id {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.dark-mode .sharing-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
}

.dark-mode .qr-overlay {
    background: rgba(0, 0, 0, 0.95) !important;
}

.dark-mode .qr-popup {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
}

.dark-mode .qr-header h3 {
    color: #ffffff !important;
}

.dark-mode #qr-code-container {
    background: #2d2d2d !important;
    border: 1px solid #333333 !important;
}

.dark-mode #share-url-input {
    background: #2d2d2d !important;
    border: 2px solid #555555 !important;
    color: #ffffff !important;
}

.dark-mode .qr-instructions {
    color: #ffffff !important;
}

/* Help Modal */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    overflow-y: auto;
}

.help-popup {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    margin: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.help-header h3 {
    color: #2d3436;
    font-size: 1.8rem;
    margin: 0;
}

.close-help-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-help-btn:active {
    background: #c0392b;
}

.help-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-section {
    border-left: 4px solid #6c5ce7;
    padding-left: 20px;
    margin-bottom: 15px;
}

.help-section h4 {
    color: #2d3436;
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.help-section p {
    color: #636e72;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.help-section p strong {
    color: #2d3436;
    font-weight: 600;
}

/* Dark Mode Help Modal */
.dark-mode .help-overlay {
    background: rgba(0, 0, 0, 0.95) !important;
}

.dark-mode .help-popup {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
}

.dark-mode .help-header {
    border-bottom: 2px solid #333333 !important;
}

.dark-mode .help-header h3 {
    color: #ffffff !important;
}

.dark-mode .help-section {
    border-left: 4px solid #8b7cf6 !important;
}

.dark-mode .help-section h4 {
    color: #ffffff !important;
}

.dark-mode .help-section p {
    color: #cccccc !important;
}

.dark-mode .help-section p strong {
    color: #ffffff !important;
}

/* Authentication Modal */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    overflow-y: auto;
}

.auth-popup {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    margin: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.auth-header h3 {
    color: #2d3436;
    font-size: 1.8rem;
    margin: 0;
}

.close-auth-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-auth-btn:active {
    background: #c0392b;
}

.auth-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-description {
    text-align: center;
    color: #636e72;
    font-size: 1rem;
    line-height: 1.4;
}

.auth-btn {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.google-signin-btn {
    background: #4285f4;
    color: white;
    margin-bottom: 10px;
}

.google-signin-btn:active {
    background: #3367d6;
    transform: scale(0.98);
}

.google-icon {
    background: white;
    color: #4285f4;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.auth-divider {
    text-align: center;
    position: relative;
    color: #636e72;
    margin: 10px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
    z-index: 1;
}

.auth-divider span {
    background: white;
    padding: 0 15px;
    position: relative;
    z-index: 2;
}

.auth-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 15px;
}

.auth-tab {
    flex: 1;
    padding: 8px 15px;
    border: none;
    background: transparent;
    color: #636e72;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: white;
    color: #2d3436;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.auth-input {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    outline: none;
}

.auth-input:focus {
    border-color: #6c5ce7;
}

.email-auth-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.email-auth-btn:active {
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6);
    transform: scale(0.98);
}

.guest-option {
    text-align: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}

.guest-btn {
    background: #636e72;
    color: white;
    margin-bottom: 10px;
}

.guest-btn:active {
    background: #2d3436;
    transform: scale(0.98);
}

.guest-note {
    color: #636e72;
    font-size: 0.85rem;
    margin: 0;
}

/* User Menu Dropdown */
.user-menu {
    position: fixed;
    top: 70px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 3500;
    min-width: 180px;
}

.user-menu-item {
    padding: 15px 20px;
    color: #2d3436;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.user-menu-item:last-child {
    border-bottom: none;
}

.user-menu-item:hover {
    background: #f8f9fa;
}

.user-menu-item:active {
    background: #e9ecef;
}

.user-menu-item.sign-out {
    color: #e74c3c;
}

.user-menu-divider {
    height: 1px;
    background: #e9ecef;
    margin: 5px 0;
}

/* Dark Mode Overlays */
.dark-mode .game-over-overlay,
.dark-mode .settings-overlay {
    background: rgba(0, 0, 0, 0.95) !important;
}

.dark-mode .game-over-popup,
.dark-mode .settings-popup {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
}

/* Dark Mode Authentication */
.dark-mode .sign-in-btn {
    background: linear-gradient(135deg, #5a4fcf, #8b7cf6) !important;
    box-shadow: 0 2px 10px rgba(90, 79, 207, 0.4) !important;
}

.dark-mode .user-info {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
}

.dark-mode .auth-overlay {
    background: rgba(0, 0, 0, 0.95) !important;
}

.dark-mode .auth-popup {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
}

.dark-mode .auth-header {
    border-bottom: 2px solid #333333 !important;
}

.dark-mode .auth-header h3 {
    color: #ffffff !important;
}

.dark-mode .auth-description {
    color: #cccccc !important;
}

.dark-mode .auth-tabs {
    background: #2d2d2d !important;
}

.dark-mode .auth-tab {
    color: #cccccc !important;
}

.dark-mode .auth-tab.active {
    background: #333333 !important;
    color: #ffffff !important;
}

.dark-mode .auth-input {
    background: #2d2d2d !important;
    border: 2px solid #555555 !important;
    color: #ffffff !important;
}

.dark-mode .auth-input:focus {
    border-color: #8b7cf6 !important;
}

.dark-mode .auth-divider span {
    background: #1a1a1a !important;
    color: #cccccc !important;
}

.dark-mode .guest-option {
    border-top: 1px solid #333333 !important;
}

.dark-mode .guest-note {
    color: #cccccc !important;
}

.dark-mode .user-menu {
    background: #1a1a1a !important;
    border: 1px solid #333333 !important;
}

.dark-mode .user-menu-item {
    color: #ffffff !important;
    border-bottom: 1px solid #333333 !important;
}

.dark-mode .user-menu-item:hover {
    background: #333333 !important;
}

.dark-mode .user-menu-item:active {
    background: #444444 !important;
}

.dark-mode .game-over-popup h2,
.dark-mode .settings-popup h3 {
    color: #ffffff !important;
}

.dark-mode .game-over-popup p {
    color: #ffffff !important;
}

.dark-mode .settings-row label {
    color: #ffffff !important;
}

.dark-mode .settings-row select {
    background: #2d2d2d !important;
    border: 2px solid #555555 !important;
    color: #ffffff !important;
}

/* Fullscreen Mode */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.fs-mode-indicator {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    padding: 8px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    text-align: center;
    animation: pulse 2s infinite;
}

/* Fullscreen pickleball mode indicator styling */
body:not(.casual-mode) .fs-mode-indicator {
    background: linear-gradient(135deg, #00b894, #00a085);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.fs-mode-indicator span {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: white;
    height: 60px;
}

.fullscreen-info {
    display: flex;
    gap: 30px;
    font-size: 1.2rem;
    font-weight: 600;
}

.exit-fullscreen-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.exit-fullscreen-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.fullscreen-scores {
    flex: 1;
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

.fs-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 20px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.fs-team:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.2);
}

.fs-team.serving {
    background: rgba(255, 193, 7, 0.3);
    transform: scale(1.02);
}

.fs-team h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.fs-score {
    font-size: 8rem;
    font-weight: bold;
    color: white;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    line-height: 0.8;
}

.fs-tap-hint {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 15px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.fullscreen-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    height: 60px;
}

.fs-score-call {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.fs-controls {
    display: flex;
    gap: 15px;
}

.fs-control-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.fs-control-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* Landscape Mode for Mobile */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body {
        overflow: hidden;
    }
    
    .app {
        max-width: none;
        width: 100%;
        height: 100vh;
        padding: 10px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    header {
        margin-bottom: 10px;
        flex-shrink: 0;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .mode-indicator, .match-score {
        padding: 4px 10px;
        margin-bottom: 5px;
    }
    
    .game-info {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    main {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .scoreboard {
        flex: 1;
        display: flex;
        gap: 15px;
        align-items: center;
        margin-bottom: 10px;
    }
    
    .team {
        flex: 1;
        padding: 15px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
        min-height: 200px;
    }
    
    .team-name {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .score {
        font-size: 4rem;
        margin-bottom: 15px;
    }
    
    .score-btn {
        padding: 12px 20px;
        font-size: 1.1rem;
    }
    
    .game-controls {
        flex-shrink: 0;
        margin-bottom: 10px;
    }
    
    .control-row {
        margin-bottom: 8px;
    }
    
    .control-row:last-child {
        margin-bottom: 0;
    }
    
    .control-btn {
        padding: 10px 15px;
        font-size: 1rem;
    }
    
    .game-status {
        flex-shrink: 0;
        padding: 10px;
        margin-bottom: 0;
    }
    
    .score-call {
        font-size: 1.4rem;
        margin-bottom: 0;
    }
    
    /* Landscape notification adjustments */
    .notification-bar {
        padding: 10px 15px;
        margin-bottom: 10px;
    }
    
    .notification-content {
        font-size: 1rem;
    }
}

/* Landscape Fullscreen Mode */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .fullscreen-mode {
        padding: 15px;
    }
    
    .fullscreen-header {
        height: 50px;
        margin-bottom: 15px;
    }
    
    .fullscreen-info {
        font-size: 1rem;
        gap: 20px;
    }
    
    .exit-fullscreen-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .fs-team {
        padding: 20px 15px;
    }
    
    .fs-team h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .fs-score {
        font-size: 6rem;
        margin-bottom: 20px;
    }
    
    .fs-scored-btn {
        padding: 15px 30px;
        font-size: 1.2rem;
    }
    
    .fullscreen-bottom {
        height: 50px;
    }
    
    .fs-score-call {
        font-size: 1.4rem;
    }
    
    .fs-control-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

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

.profile-popup {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.profile-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4rem;
}

.close-profile-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-profile-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.profile-content {
    padding: 25px;
}

.profile-section {
    margin-bottom: 30px;
}

.profile-section h4 {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 1.1rem;
    border-bottom: 2px solid #00b894;
    padding-bottom: 5px;
    display: inline-block;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-avatar {
    position: relative;
    width: 64px;
    height: 64px;
}

.profile-avatar img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-initial {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.profile-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.profile-email {
    color: #666;
    font-size: 0.9rem;
}

.profile-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-row label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.setting-row input,
.setting-row select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.setting-row input:focus,
.setting-row select:focus {
    outline: none;
    border-color: #00b894;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.stat-item:hover {
    border-color: #00b894;
    transform: translateY(-2px);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #00b894;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.save-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.3);
}

.danger-btn {
    background: linear-gradient(135deg, #e17055, #fdcb6e);
    color: white;
}

.danger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(225, 112, 85, 0.3);
}

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

.history-popup {
    background: white;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.history-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.4rem;
}

.close-history-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-history-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.history-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.history-controls {
    display: flex;
    gap: 10px;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.history-search,
.history-filter {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.history-search {
    flex: 1;
}

.history-search:focus,
.history-filter:focus {
    outline: none;
    border-color: #00b894;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px;
    min-height: 200px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: #666;
}

.history-empty p {
    margin: 5px 0;
}

.match-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.match-item:hover {
    border-color: #00b894;
    transform: translateY(-1px);
}

.match-info {
    flex: 1;
}

.match-teams {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.match-details {
    color: #666;
    font-size: 0.9rem;
    display: flex;
    gap: 15px;
}

.match-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00b894;
    text-align: right;
}

.match-winner {
    color: #e17055;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.history-pagination button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-pagination button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 184, 148, 0.3);
}

.history-pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Dark Mode for Profile and History */
.dark-mode .profile-overlay,
.dark-mode .history-overlay {
    background: rgba(0, 0, 0, 0.95) !important;
}

.dark-mode .profile-popup,
.dark-mode .history-popup {
    background: #1a1a1a !important;
}

.dark-mode .profile-header,
.dark-mode .history-header,
.dark-mode .history-controls {
    border-color: #333 !important;
}

.dark-mode .profile-header h3,
.dark-mode .history-header h3,
.dark-mode .profile-name {
    color: #fff !important;
}

.dark-mode .profile-section h4 {
    color: #ccc !important;
}

.dark-mode .setting-row label {
    color: #ccc !important;
}

.dark-mode .setting-row input,
.dark-mode .setting-row select,
.dark-mode .history-search,
.dark-mode .history-filter {
    background: #2a2a2a !important;
    border-color: #444 !important;
    color: #fff !important;
}

.dark-mode .stat-item,
.dark-mode .match-item {
    background: #2a2a2a !important;
}

.dark-mode .profile-email,
.dark-mode .stat-label,
.dark-mode .match-details,
.dark-mode .history-empty {
    color: #aaa !important;
}

.dark-mode .match-teams {
    color: #fff !important;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .profile-popup,
    .history-popup {
        width: 95%;
        max-height: 85vh;
    }
    
    .profile-content,
    .history-content {
        padding: 20px;
    }
    
    .profile-header,
    .history-header,
    .history-controls {
        padding: 15px 20px;
    }
    
    .history-controls {
        flex-direction: column;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .match-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .match-score {
        text-align: left;
    }
    
    .history-pagination {
        padding: 15px 20px;
    }
}