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

body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

/* Make configuration screen scrollable on all devices */
.match-setup {
    overflow-y: auto;
    height: 100vh;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

.match-setup body {
    overflow: visible !important;
    height: auto !important;
}

#team-assignment-section {
    margin-top: 0;
}

/* Auth and Setup Screens */
.auth-screen, .match-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #2d5016;
    color: white;
}

.auth-form, .setup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    max-width: 400px;
    width: 90%;
}

.auth-form input, .setup-form input {
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    /* min-width: 300px; */
    width: 100%;
}

.auth-form button, .setup-form button {
    padding: 15px 30px;
    font-size: 18px;
    background: #4a7c59;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-width: 150px;
    min-height: 44px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.auth-form button:hover, .setup-form button:hover {
    background: #5a8c69;
}

.auth-form button:disabled, .setup-form button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Two-Step Authentication Styles */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    gap: 20px;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    background: #6c757d;
    color: white;
    transition: all 0.3s ease;
}

.step.active {
    background: #4a7c59;
    box-shadow: 0 0 10px rgba(74, 124, 89, 0.5);
}

.step.completed {
    background: #28a745;
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: #6c757d;
    transition: all 0.3s ease;
}

.step.completed + .step-line {
    background: #28a745;
}

.contact-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-buttons {
    display: flex;
    gap: 15px;
    width: 100%;
    justify-content: center;
}

.back-btn {
    background: #6c757d !important;
    color: white;
    padding: 15px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #5a6268 !important;
}

.resend-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

#resend-btn {
    background: #ffc107;
    color: #212529;
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-height: 40px;
    transition: all 0.2s ease;
}

#resend-btn:hover:not(:disabled) {
    background: #e0a800;
}

#resend-btn:disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
}

#resend-timer {
    font-size: 12px;
    color: #ccc;
    font-style: italic;
}

/* 6-Digit Verification Input Styles */
.digit-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.digit-input {
    width: 40px;
    height: 50px;
    min-width: unset;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    font-family: monospace;
    transition: all 0.2s ease;
}

.digit-input:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 8px rgba(74, 124, 89, 0.3);
    transform: scale(1.05);
}

.digit-input:valid {
    border-color: #28a745;
    background: #f8fff8;
}

#verification-code {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 4px;
    font-family: monospace;
}

.auth-form h3 {
    margin: 0 0 20px 0;
    color: #90EE90;
    font-size: 24px;
    text-align: center;
}

.game-mode {
    display: flex;
    gap: 20px;
}

.game-mode label {
    font-size: 16px;
    cursor: pointer;
}

/* Demo information styling */
.demo-codes, .demo-matches {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

.demo-codes p, .demo-matches p {
    margin: 5px 0;
}

/* Auth error styling */
.auth-error {
    background: #dc3545;
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #c82333;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Match confirmation styling */
.match-confirmation {
    background: rgba(74, 124, 89, 0.8);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 2px solid #4a7c59;
}

.match-confirmation h3 {
    margin: 0 0 10px 0;
    color: #90EE90;
}

.match-confirmation p {
    margin: 5px 0;
    font-size: 14px;
}

/* Top Bar Styles */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.top-bar-left {
    display: flex;
    align-items: center;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.connection-indicator {
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* Main Title */
.main-title {
    text-align: center;
    color: #90EE90;
    font-size: 32px;
    font-weight: bold;
    margin: 20px 0;
    line-height: 1.2;
}

/* Team Assignment Mode - Hide elements */
.team-assignment-mode .main-title,
.team-assignment-mode .demo-matches,
.team-assignment-mode #match-uuid,
.team-assignment-mode button[onclick="app.loadMatch()"],
.team-assignment-mode .match-confirmation {
    display: none;
}

/* Header with user info and logout */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.logout-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.logout-btn:hover {
    background: #c82333;
}

/* Team Assignment Interface */
.team-assignment {
    margin: 20px auto;
    max-width: 800px;
    width: 100%;
}

.court-preview {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    justify-content: center;
}

.left-court-preview, .right-court-preview {
    width: 350px;
    height: 150px;
    background: #4a7c59;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    border: 3px solid white;
    text-align: center;
    white-space: pre-line;
    padding: 10px;
    transition: all 0.2s ease;
}

.server-court {
    border: 4px solid #FFD700 !important;
    background: #5a8c69 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.receiver-court {
    border: 4px solid #87CEEB !important;
    background: #5a8c69 !important;
    box-shadow: 0 0 15px rgba(135, 206, 235, 0.5);
}

.serving-instruction {
    text-align: center;
    font-style: italic;
    color: #666;
    margin: 10px 0;
    font-size: 14px;
}

.team-buttons {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#switch-btn {
    padding: 12px 24px;
    font-size: 16px;
    background: #FFA500;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    min-height: 44px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

#switch-btn:hover {
    background: #FF8C00;
}

.team-buttons button:hover {
    background: #5a8c69;
}

#start-game-btn {
    background: #28a745;
    color: white;
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    width: 100%;
    min-height: 44px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

#start-game-btn:hover {
    background: #218838;
}

/* Player Selection */
.player-selection {
    margin: 20px 0;
    padding: 20px;
    background: rgba(74, 124, 89, 0.1);
    border-radius: 8px;
    border: 1px solid #4a7c59;
}

.player-selection h4 {
    text-align: center;
    color: #4a7c59;
    margin: 0 0 20px 0;
    font-size: 18px;
}

.player-config-court {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 20px 0;
}

.config-left-side, .config-right-side {
    flex: 1;
    max-width: 350px;
    background: #4a7c59;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.config-court-label {
    color: white;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.config-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-player-btn {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: bold;
    background: white;
    color: #4a7c59;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.config-player-btn:hover {
    background: #f0f8f0;
    transform: scale(1.02);
}

.config-player-btn.selected-server {
    background: #FFD700;
    color: #333;
    border-color: #FFA500;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.config-player-btn.selected-receiver {
    background: #87CEEB;
    color: #333;
    border-color: #4682B4;
    box-shadow: 0 0 10px rgba(135, 206, 235, 0.5);
}

.config-instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid #4a7c59;
}

.config-instructions p {
    margin: 5px 0;
    font-size: 14px;
    color: #333;
}

.config-status {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    margin-top: 15px;
}

.config-waiting {
    color: #666;
    font-style: italic;
    margin: 5px 0;
}

.config-progress {
    color: #4a7c59;
    margin: 5px 0;
}

.config-complete {
    color: #28a745;
    margin: 5px 0;
}

.config-ready {
    color: #28a745;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    margin: 10px 0 5px 0;
    padding: 8px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
}

/* Court Layout */
.court {
    width: 100vw;
    height: 100vh;
    display: flex;
    box-sizing: border-box;
    position: relative;
}

/* Score Display - BIG and visible */
#score-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    font-size: 28vh;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 20px;
    border-radius: 15px;
    z-index: 10;
    text-align: center;
    white-space: nowrap;
    transition: all 0.3s ease;
}



#score-display.updating {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 165, 0, 0.9);
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
}

.left-side {
    flex: 38;
    display: flex;
    flex-direction: column;
    border-right: 2px solid white;
    background: #00AA00;
}

.left-top, .left-bottom {
    flex: 1;
    background: #00AA00;
    position: relative;
}

.left-bottom {
    border-top: 3px solid white;
}



.kitchen {
    flex: 24;
    background: #ccc;
    border-right: 2px solid white;
}

.right-side {
    flex: 38;
    display: flex;
    flex-direction: column;
    background: #00AA00;
}

.right-top, .right-bottom {
    flex: 1;
    background: #00AA00;
    position: relative;
}

.right-bottom {
    border-top: 3px solid white;
}



.net {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: white;
    transform: translateX(-50%);
    z-index: 2;
}

.service-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: white;
    transform: translateY(-50%);
}

/* Player Names */
.left-side, .right-side {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.player-1, .player-2 {
    position: absolute;
    font-size: 4vh;
    font-weight: bold;
    color: #74afda;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    min-width: 150px;
}

.left-side .player-1, .right-side .player-1 {
    top: 50%;
    transform: translateY(-50%);
}

/* Singles player positioning based on serving side */
.left-side .player-1.player-top, .right-side .player-1.player-top {
    top: 10%;
    transform: translateY(0);
}

.left-side .player-1.player-bottom, .right-side .player-1.player-bottom {
    bottom: 10%;
    top: auto;
    transform: translateY(0);
}

.left-side .player-top, .right-side .player-top {
    top: 10%;
}

.left-side .player-bottom, .right-side .player-bottom {
    bottom: 10%;
}

.player-top, .player-bottom {
    position: absolute;
    font-size: 4vh;
    font-weight: bold;
    color: #74afda;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    min-width: 150px;
}

/* Current Server Highlighting */
.current-server {
    border: 4px solid #FFFF00 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: #FFFF00 !important;
    font-weight: 900 !important;
    box-shadow: 0 4px 12px rgba(255, 255, 0, 0.8);
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #FFA500;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Touch feedback */
.left-side, .right-side {
    transition: background-color 0.1s ease;
    touch-action: manipulation;
}

.left-side:active, .right-side:active {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(0.98);
}

.left-side.touch-feedback, .right-side.touch-feedback {
    background: rgba(255, 165, 0, 0.3) !important;
    animation: touchPulse 0.3s ease;
}

@keyframes touchPulse {
    0% { background: rgba(255, 165, 0, 0.3); }
    50% { background: rgba(255, 165, 0, 0.6); }
    100% { background: rgba(255, 165, 0, 0.3); }
}

/* Game Control Buttons */
#game-controls {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
}

#undo-btn, #reset-btn, #adjust-btn {
    padding: 15px;
    font-size: 6vh;
    font-weight: bold;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

#undo-btn {
    background: #FFA500;
    color: white;
}

#undo-btn:hover {
    background: #FF8C00;
}

#reset-btn {
    background: #DC3545;
    color: white;
}

#reset-btn:hover {
    background: #C82333;
}

#adjust-btn {
    background: #17a2b8;
    color: white;
}

#adjust-btn:hover {
    background: #138496;
}

#undo-btn:active, #reset-btn:active, #adjust-btn:active {
    transform: scale(0.95);
}

/* Score Adjustment Modal */
#score-modal {
    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;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 400px;
    max-width: 500px;
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
}

.score-inputs {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 20px 0;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.team-score label {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.team-score input {
    width: 80px;
    height: 50px;
    font-size: 24px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-weight: bold;
}

.team-score input:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 5px rgba(74, 124, 89, 0.3);
}

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

.confirm-btn, .cancel-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-width: 100px;
    min-height: 44px;
    transition: all 0.2s ease;
}

.confirm-btn {
    background: #28a745;
    color: white;
}

.confirm-btn:hover {
    background: #218838;
}

.cancel-btn {
    background: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background: #5a6268;
}

/* Score Submission Modal */
#submission-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.submission-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    min-width: 400px;
    max-width: 500px;
    text-align: center;
}

.submission-content h2 {
    margin: 0 0 20px 0;
    color: #2d5016;
    font-size: 28px;
}

.game-result h3 {
    margin: 0 0 10px 0;
    color: #28a745;
    font-size: 24px;
}

.final-score {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    margin: 10px 0 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #28a745;
}

.match-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #4a7c59;
}

.match-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #495057;
}

.submission-status {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    background: #e3f2fd;
    border: 1px solid #2196f3;
}

.submission-status .success {
    color: #28a745;
    font-weight: bold;
}

.submission-status .error {
    color: #dc3545;
    font-weight: bold;
}

.submission-status .submitting {
    color: #ffc107;
    font-weight: bold;
}

.submission-status .saved {
    color: #17a2b8;
    font-weight: bold;
}

.submission-status .demo-mode {
    color: #6f42c1;
    font-weight: bold;
}

.retry-info {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.submission-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
}

.submit-btn, .later-btn, .new-game-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-width: 120px;
    min-height: 44px;
    transition: all 0.2s ease;
}

.submit-btn {
    background: #007bff;
    color: white;
}

.submit-btn:hover:not(:disabled) {
    background: #0056b3;
}

.submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.later-btn {
    background: #6c757d;
    color: white;
}

.later-btn:hover {
    background: #545b62;
}

.new-game-btn {
    background: #28a745;
    color: white;
}

.new-game-btn:hover {
    background: #218838;
}

/* Pending Submissions Button */
.pending-btn {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

.pending-btn:hover {
    background: #e0a800;
}

/* Queue Button */
.queue-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

.queue-btn:hover {
    background: #138496;
}

/* Pending Submissions Modal */
#pending-modal {
    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: 2000;
}

.pending-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 500px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.pending-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    text-align: center;
}

.pending-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.pending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}

.pending-info {
    flex: 1;
}

.pending-info strong {
    color: #495057;
}

.pending-info small {
    color: #6c757d;
}

.resubmit-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.resubmit-btn:hover {
    background: #0056b3;
}

.pending-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.retry-all-btn, .clear-btn, .close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-all-btn {
    background: #28a745;
    color: white;
}

.retry-all-btn:hover {
    background: #218838;
}

.clear-btn {
    background: #dc3545;
    color: white;
}

.clear-btn:hover {
    background: #c82333;
}

.close-btn {
    background: #6c757d;
    color: white;
}

.close-btn:hover {
    background: #545b62;
}

/* Demo Controls */
.demo-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border: 2px dashed #6c757d;
    text-align: center;
}

.demo-controls p {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
}

.demo-btn {
    padding: 8px 16px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-btn.success {
    background: #28a745;
    color: white;
}

.demo-btn.fail {
    background: #dc3545;
    color: white;
}

.demo-btn.random {
    background: #ffc107;
    color: #212529;
}

.demo-btn.active {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    transform: scale(1.05);
}

.demo-mode {
    color: #6f42c1;
    font-weight: bold;
    font-style: italic;
}

/* Debug Panel */
.debug-panel {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 2px solid #6c757d;
    text-align: center;
}

.debug-panel p {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    font-weight: bold;
}

.debug-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.debug-btn {
    padding: 6px 12px;
    margin: 0 2px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #6c757d;
    color: white;
}

.debug-btn:hover {
    background: #545b62;
}

.debug-btn.real-mode {
    background: #dc3545;
    animation: pulse 2s infinite;
}

.debug-status {
    font-size: 10px;
    color: #6c757d;
    font-family: monospace;
    background: #f8f9fa;
    padding: 5px 8px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

.real-mode {
    color: #dc3545;
    font-weight: bold;
}

.debug-mode {
    color: #fd7e14;
    font-weight: bold;
}

/* Pending Submissions Notification */
.pending-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.notification-content {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #856404;
}

.retry-all-btn {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

.retry-all-btn:hover {
    background: #e0a800;
}

.dismiss-btn {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #856404;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dismiss-btn:hover {
    color: #533f03;
}

/* Submission Result */
.submission-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1600;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.result-content {
    padding: 20px 30px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Server Controls */
.server-controls {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.server-controls h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 18px;
}

.server-inputs {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.server-team, .server-number {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.server-team label, .server-number label {
    font-weight: bold;
    color: #495057;
    font-size: 14px;
}

.server-team select, .server-number select {
    padding: 8px 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    min-width: 120px;
    font-weight: bold;
}

.server-team select:focus, .server-number select:focus {
    outline: none;
    border-color: #4a7c59;
    box-shadow: 0 0 5px rgba(74, 124, 89, 0.3);
}

/* Server Number Control */
.server-number-control {
    margin: 25px 0;
    padding: 20px;
    background: #e8f5e8;
    border-radius: 10px;
    border: 2px solid #4a7c59;
}

.server-number-control h4 {
    margin: 0 0 15px 0;
    color: #2d5016;
    font-size: 18px;
}

.server-number-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.server-number-input label {
    font-weight: bold;
    color: #2d5016;
    font-size: 14px;
}

.server-number-input select {
    padding: 10px 15px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #4a7c59;
    border-radius: 6px;
    background: white;
    min-width: 80px;
    text-align: center;
}

.server-number-input select:focus {
    outline: none;
    border-color: #2d5016;
    box-shadow: 0 0 8px rgba(74, 124, 89, 0.4);
}

/* Home Button */
#home-control {
    position: absolute;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

#home-btn {
    padding: 15px;
    font-size: 6vh;
    font-weight: bold;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 60px;
    height: 60px;
    background: #4a7c59;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

#home-btn:hover {
    background: #5a8c69;
}

#home-btn:active {
    transform: scale(0.95);
}

/* Serving Side Indicator */
#serving-side-indicator {
    position: absolute;
    top: 20vh;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.serving-indicator.serving-left {
    left: 5vh;
}

.serving-indicator.serving-right {
    right: 5vh;
}

.indicator-arrow {
    width: 0;
    height: 0;
    margin-bottom: 8px;
}

.serving-left .indicator-arrow {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 25px solid #FFA500;
}

.serving-right .indicator-arrow {
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 25px solid #FFA500;
}

.indicator-text {
    background: #FFA500;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 3vh;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: servePulse 2s infinite;
}

@keyframes servePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Mobile portrait responsive design */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .match-setup {
        padding: 10px;
        overflow-y: auto;
        height: 100vh;
    }
    
    .setup-form {
        gap: 15px;
    }
    
    .court-preview {
        flex-direction: column;
        gap: 15px;
    }
    
    .left-court-preview, .right-court-preview {
        width: 100%;
        max-width: 300px;
        height: 80px;
        font-size: 12px;
    }
    
    .player-config-court {
        flex-direction: column;
        gap: 20px;
    }
    
    .config-left-side, .config-right-side {
        max-width: 100%;
        width: 100%;
    }
    
    .config-instructions {
        font-size: 12px;
        padding: 10px;
    }
    
    .config-player-btn {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    #switch-btn, #start-game-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .user-info {
        font-size: 12px;
    }
}

/* Tablet responsive adjustments */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    #score-display {
        font-size: 26vh;
    }
    
    .player-1, .player-2 {
        font-size: 3vh;
    }
}

/* Mobile landscape responsive design */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .match-setup {
        padding: 5px;
    }
    
    .setup-form {
        padding-bottom: 50px;
    }
    
    .header {
        padding: 0 10px;
        margin-bottom: 10px;
    }
    
    .header h2 {
        font-size: 18px;
        margin: 0;
    }
    
    .user-info {
        font-size: 11px;
    }
    
    .setup-form {
        gap: 10px;
        padding: 0 10px;
    }
    
    .court-preview {
        flex-direction: row;
        gap: 10px;
        margin: 10px 0;
    }
    
    .left-court-preview, .right-court-preview {
        width: 45%;
        height: 50px;
        font-size: 10px;
        padding: 4px;
    }
    
    .player-config-court {
        flex-direction: row;
        gap: 15px;
        margin: 10px 0;
    }
    
    .config-left-side, .config-right-side {
        flex: 1;
        max-width: 45%;
        padding: 8px;
    }
    
    .config-court-label {
        font-size: 12px;
        margin-bottom: 8px;
        padding: 4px;
    }
    
    .config-player-btn {
        font-size: 11px;
        padding: 6px 8px;
        min-height: 32px;
        margin-bottom: 4px;
    }
    
    .config-instructions {
        font-size: 10px;
        padding: 6px;
        margin: 6px 0;
    }
    
    .config-status {
        font-size: 11px;
        padding: 6px;
        margin: 6px 0;
    }
    
    .player-selection h4 {
        font-size: 14px;
        margin: 0 0 10px 0;
    }
    
    #switch-btn, #start-game-btn {
        font-size: 14px;
        padding: 10px 20px;
        min-height: 40px;
    }
    
    .demo-matches, .match-confirmation {
        font-size: 11px;
        padding: 8px;
        margin: 8px 0;
    }
}

/* Portrait orientation warning for game screen */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .court {
        display: none;
    }
    
    .orientation-warning {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background: #2d5016;
        color: white;
        text-align: center;
        padding: 20px;
    }
    
    .orientation-warning h2 {
        margin-bottom: 20px;
        color: #FFD700;
    }
    
    .orientation-warning p {
        font-size: 16px;
        line-height: 1.5;
        margin-bottom: 10px;
    }
}

.orientation-warning {
    display: none;
}

/* Score Submission Visual Feedback */
.submission-loading, .submission-success, .submission-fail {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2500;
    padding: 20px 30px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 250px;
}

.submission-loading {
    background: #ffc107;
    color: #212529;
    border: 2px solid #e0a800;
}

.submission-loading::before {
    content: '⏳ ';
    animation: spin 1s linear infinite;
    display: inline-block;
}

.submission-success {
    background: #28a745;
    color: white;
    border: 2px solid #1e7e34;
    text-align: left;
}

.submission-success.success-animation {
    animation: successPulse 0.6s ease;
}

.submission-fail {
    background: #dc3545;
    color: white;
    border: 2px solid #c82333;
    text-align: left;
    max-width: 400px;
}

.submission-fail.fail-animation {
    animation: failShake 0.6s ease;
}

.indicator-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.clickable-close {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.clickable-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.indicator-code {
    font-size: 14px;
    font-weight: bold;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    display: inline-block;
}

.indicator-details {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.3;
}

@keyframes successPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes failShake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-10px); }
    75% { transform: translate(-50%, -50%) translateX(10px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.match-error {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  border: 2px solid #dc3545;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  max-width: 350px;
}

.error-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #721c24;
}

.error-content .dismiss-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #721c24;
  padding: 0;
  margin-left: 10px;
}