/* Fixed Navigation Buttons (Top-Left) */
.fixed-nav-buttons {
    position: fixed;
    top: calc(16px + var(--safe-top));
    left: calc(16px + var(--safe-left));
    z-index: 1000;
}

/* Settings Dropdown Menu */
.settings-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(10, 22, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    min-width: 220px;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.settings-dropdown.show {
    display: block;
}

.settings-dropdown .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    min-height: 44px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.settings-dropdown .menu-item:first-child {
    border-radius: 8px 8px 0 0;
}

.settings-dropdown .menu-item:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
}

.settings-dropdown .menu-item:hover {
    background: rgba(0, 201, 183, 0.15);
    color: var(--accent-turquoise);
}

.settings-dropdown .menu-icon {
    font-size: 1.2rem;
}

/* Language Menu Item (contains select dropdown) */
.settings-dropdown .language-menu-item {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.settings-dropdown .language-select {
    background: rgba(19, 40, 68, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    width: auto;
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1L6 6L11 1" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    transition: all 0.2s ease;
}

.settings-dropdown .language-select:hover {
    background: rgba(19, 40, 68, 1);
    border-color: var(--accent-turquoise);
}

.settings-dropdown .language-select:focus {
    outline: none;
    border-color: var(--accent-turquoise);
    box-shadow: 0 0 0 2px rgba(0, 201, 183, 0.2);
}

.settings-dropdown .language-select option {
    background: var(--secondary-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 0.95rem;
}

/* Language Selector (Top-Right, only for auth and setup screens) */
.language-selector {
    position: fixed;
    top: calc(16px + var(--safe-top));
    right: calc(16px + var(--safe-right));
    z-index: 1000;
    display: none; /* Hidden by default */
}

/* Show language selector only on auth and setup screens */
#authScreen.active ~ .language-selector,
#setupScreen.active ~ .language-selector {
    display: block;
}

/* Alternative: if selector is inside screen, show it */
#authScreen .language-selector,
#setupScreen .language-selector {
    display: block;
}

.language-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1L6 6L11 1" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.language-select:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-turquoise);
}

.language-select:focus {
    outline: none;
    border-color: var(--accent-turquoise);
    box-shadow: 0 0 0 3px rgba(0, 201, 183, 0.2);
}

.language-select option {
    background: var(--secondary-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 0.95rem;
}

.language-select option:hover {
    background: var(--accent-turquoise);
    color: var(--primary-bg);
}

/* ===========================
   Padel Scoreboard - Modern Sports Design
   =========================== */

:root {
    /* Padel Court Color Palette */
    --primary-bg: #0a1628;
    --secondary-bg: #132844;
    --accent-blue: #005BBB;
    --accent-lime: #C7F000;
    --accent-turquoise: #00C9B7;
    --team-a-color: #C7F000;
    --team-b-color: #00C9B7;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --success-color: #C7F000;
    --warning-color: #ff9800;
    --danger-color: #ff4757;
    --border-radius: 16px;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --app-height: 100vh;
}

@supports (height: 100svh) {
    :root {
        --app-height: 100svh;
    }
}

@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    height: var(--app-height);
    min-height: var(--app-height);
    min-height: -webkit-fill-available; /* Safari fix */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary-bg);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 91, 187, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(199, 240, 0, 0.1) 0%, transparent 50%);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: hidden;
    height: var(--app-height);
    min-height: var(--app-height);
    min-height: -webkit-fill-available; /* Safari fix */
    width: 100%;
    position: fixed;
    inset: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

/* ===========================
   Screens
   =========================== */

.screen {
    display: none;
    min-height: var(--app-height);
    height: var(--app-height);
    width: 100%;
    position: fixed;
    inset: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ===========================
   Setup Screen
   =========================== */

#setupScreen {
    justify-content: center;
    align-items: flex-start;
    padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop: Center setup screen vertically */
@media (min-width: 768px) {
    #setupScreen {
        align-items: center;
        padding-top: calc(80px + var(--safe-top));
        padding-bottom: calc(80px + var(--safe-bottom));
        overflow-y: hidden; /* Hide scrollbar on screen, container will scroll if needed */
    }
    
    #setupScreen .container {
        max-height: calc(100vh - 160px - var(--safe-top) - var(--safe-bottom));
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Hide scrollbar but keep scrolling functionality */
    #setupScreen .container::-webkit-scrollbar {
        width: 8px;
    }
    
    #setupScreen .container::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #setupScreen .container::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }
    
    #setupScreen .container::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

#playersScreen,
#statsScreen {
    padding: calc(20px + var(--safe-top)) calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.setup-header {
    text-align: center;
    margin-bottom: 12px;
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

.app-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-lime) 0%, var(--accent-turquoise) 50%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px;
    min-height: 44px;
    background: rgba(19, 40, 68, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg width="14" height="9" viewBox="0 0 14 9" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1L7 7L13 1" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-group select:hover {
    background-color: rgba(19, 40, 68, 1);
    border-color: var(--accent-turquoise);
}

/* ===========================
   Setup - Add player by email
   =========================== */

.add-by-email {
    margin-top: 12px;
}

.add-by-email label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.add-by-email-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-by-email-row input[type="email"] {
    flex: 1;
    padding: 14px;
    background: rgba(19, 40, 68, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.add-by-email-row input[type="email"]:focus {
    outline: none;
    border-color: var(--accent-turquoise);
    box-shadow: 0 0 0 4px rgba(54, 197, 240, 0.15);
}

.add-by-email-row .btn {
    white-space: nowrap;
    padding-left: 16px;
    padding-right: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--team-b-color);
    box-shadow: 0 0 0 3px rgba(0, 201, 183, 0.2);
}

/* Option elements styling */
.form-group select option {
    background: var(--secondary-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 1rem;
}

.form-group select option:hover,
.form-group select option:checked {
    background: linear-gradient(135deg, var(--accent-turquoise) 0%, var(--accent-blue) 100%);
    color: var(--text-primary);
}

.toggle-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    background-color: var(--accent-color);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.toggle-group label:hover {
    background-color: rgba(15, 52, 96, 0.8);
}

.toggle-group input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    cursor: pointer;
}

.toggle-group span {
    font-size: 1rem;
    color: var(--text-primary);
}

.toggle-hint {
    display: block;
    margin-top: 6px;
    margin-left: 36px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.8;
    line-height: 1.4;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:active {
    transform: scale(0.98);
}

button,
.btn,
.btn-icon,
.icon-btn,
.menu-btn,
.tab-btn,
.team-section,
.score-btn,
.settings-dropdown .menu-item {
    touch-action: manipulation;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-lime) 0%, var(--accent-turquoise) 100%);
    color: var(--primary-bg);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(199, 240, 0, 0.4);
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(199, 240, 0, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--accent-color);
    color: var(--text-primary);
}

/* ===========================
   Scoreboard Screen - Default Layout
   =========================== */

#scoreboardScreen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--app-height);
}

.scoreboard-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    width: 100%;
    padding: calc(4px + var(--safe-top)) calc(4px + var(--safe-right)) calc(4px + var(--safe-bottom)) calc(4px + var(--safe-left));
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Safari smooth scrolling */
    overscroll-behavior: none;
    gap: 4px;
    position: relative;
    contain: layout style paint;
    box-sizing: border-box;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 0;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    flex-shrink: 0;
    gap: 8px;
}

.header-right-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.separator {
    color: var(--text-secondary);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover {
    background-color: var(--accent-color);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Team Sections */
.main-score-display {
    flex: 1 1 auto;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 4px;
    -webkit-box-align: stretch;
    -webkit-align-items: stretch;
    align-items: stretch;
    height: 100%;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
}

/* Default layout compatibility for points-section and stats-section */
.points-section {
    display: contents;
}

.stats-section {
    display: contents;
}

.team-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 12px 8px;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.2s;
    position: relative;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.team-section:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.team-section:active {
    transform: scale(0.98);
}

.team-section.scoring {
    animation: scoreFlash 0.5s ease-out;
}

@keyframes scoreFlash {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 0 30px currentColor; }
}

.team-a {
    border: 3px solid var(--team-a-color);
}

.team-b {
    border: 3px solid var(--team-b-color);
}

.team-section.serving {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
}

/* Server Indicator */
.server-indicator-wrapper {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-indicator {
    font-size: 3.5rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.8);
}

.server-indicator.active {
    opacity: 1;
    transform: scale(1);
    animation: serverPulse 2s ease-in-out infinite;
}

@keyframes serverPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.team-name {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

/* Score Details */
.score-details {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.score-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 50px;
}

.sets-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1;
    font-size: 1.8rem;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: left;
}

.games-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1;
    font-size: 3.5rem;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: left;
}

/* Points Score - Large and Dominant - Visible from across court */
.points-score {
    font-size: 20rem;
    font-weight: 900;
    line-height: 1;
    margin-top: 8px;
}

.team-a .points-score {
    color: var(--team-a-color);
}

.team-b .points-score {
    color: var(--team-b-color);
}

/* VS Separator */
.vs-separator {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    position: relative;
}

.vs-text {
    font-size: 3rem;
    font-weight: 300;
    color: var(--text-secondary);
    opacity: 0.3;
}

/* Touch Controls */
.touch-controls {
    display: none; /* Hidden - using clickable score sections instead */
}

.score-btn {
    flex: 1;
    padding: 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.score-btn:active {
    transform: scale(0.95);
}

.team-a-btn {
    background-color: var(--team-a-color);
}

.team-b-btn {
    background-color: var(--team-b-color);
}

/* Control Menu */
.control-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.control-menu.active {
    display: flex;
}

.menu-content {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    max-width: 400px;
    width: 90%;
}

.menu-content h2 {
    margin-bottom: 24px;
    text-align: center;
}

.menu-btn {
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background-color: rgba(15, 52, 96, 0.8);
}

.menu-btn.danger {
    background-color: var(--danger-color);
}

.menu-btn.danger:hover {
    background-color: rgba(244, 67, 54, 0.8);
}

/* Match End Overlay */
.match-end-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98), rgba(15, 52, 96, 0.98));
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.match-end-overlay.active {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.match-end-content {
    text-align: center;
    padding: 40px;
    max-width: 600px;
}

.match-end-title {
    font-size: 3rem;
    margin-bottom: 24px;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.winner-display {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--team-b-color);
}

.final-score {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.match-end-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Debug panel removed */

/* ===========================
   Portrait Mode Overlay
   =========================== */

.portrait-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--app-height);
    background: var(--primary-bg);
    z-index: 20000;
    justify-content: center;
    align-items: center;
}

.portrait-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.rotate-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: rotatePrompt 2s ease-in-out infinite;
}

@keyframes rotatePrompt {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.portrait-content h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.portrait-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Show overlay only on mobile devices in portrait mode during match */
@media (orientation: portrait) and (max-width: 768px) {
    #scoreboardScreen .portrait-overlay {
        display: flex;
    }
}

/* ===========================
   Game Score Flash
   =========================== */

.game-score-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(10, 22, 40, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 3px solid var(--accent-lime);
    box-shadow: 
        0 0 60px rgba(199, 240, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px 60px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-score-flash.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.game-score-flash-content {
    text-align: center;
}

.game-flash-label {
    font-size: 3rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: 8px;
}

.game-flash-score {
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

#gameFlashTeamA {
    color: var(--team-a-color);
}

#gameFlashTeamB {
    color: var(--team-b-color);
}

.game-flash-separator {
    color: var(--text-secondary);
    font-size: 6rem;
}

/* Responsive adjustments for game flash */
@media (max-width: 768px) {
    .game-score-flash {
        padding: 30px 40px;
    }
    
    .game-flash-label {
        font-size: 2rem;
        letter-spacing: 4px;
    }
    
    .game-flash-score {
        font-size: 6rem;
        gap: 20px;
    }
    
    .game-flash-separator {
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    .game-score-flash {
        padding: 20px 30px;
    }
    
    .game-flash-label {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .game-flash-score {
        font-size: 4rem;
        gap: 15px;
    }
    
    .game-flash-separator {
        font-size: 3rem;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: bottom 0.3s ease-out;
    z-index: 3000;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    bottom: calc(24px + var(--safe-bottom));
}

/* ===========================
   Landscape Optimizations
   =========================== */

/* Small landscape (phones) */
@media (orientation: landscape) and (max-height: 600px) {
    .main-score-display {
        gap: 3px;
    }

    .scoreboard-container {
        padding: 2px;
        gap: 2px;
    }

    .scoreboard-header {
        padding: 1px 4px;
        margin-bottom: 0;
        min-height: 28px;
    }

    .match-info {
        font-size: 0.65rem;
    }

    .icon-btn {
        font-size: 0.9rem;
        padding: 2px 4px;
    }

    .team-section {
        padding: 6px 4px;
        gap: 2px;
    }

    .server-indicator-wrapper {
        height: 18px;
    }

    .server-indicator {
        font-size: 1rem;
    }

    .team-name {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }

    .score-details {
        gap: 6px;
    }

    .score-label {
        font-size: 0.65rem;
        min-width: 35px;
    }

    .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 1.2rem;
    }

    .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 2.2rem;
    }

    .points-score {
        font-size: 10rem;
        margin-top: 2px;
    }

    .vs-separator {
        width: 40px;
    }

    .vs-text {
        font-size: 2rem;
    }

    .touch-controls {
        margin-top: 4px;
    }

    .score-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 6px;
    }
}

/* Medium landscape (tablets) */
@media (orientation: landscape) and (min-height: 601px) and (max-height: 900px) {
    .scoreboard-container {
        padding: 3px;
        gap: 3px;
    }

    .scoreboard-header {
        padding: 3px 6px;
        min-height: 32px;
    }

    .team-section {
        padding: 12px 8px;
        gap: 4px;
    }

    .team-name {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .server-indicator {
        font-size: 2rem;
    }

    .server-indicator-wrapper {
        height: 35px;
    }

    .score-details {
        gap: 10px;
    }

    .score-label {
        font-size: 0.75rem;
    }

    .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 1.6rem;
    }

    .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 3rem;
    }

    .points-score {
        font-size: 18rem;
        margin-top: 8px;
    }

    .touch-controls {
        margin-top: 6px;
    }

    .score-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Large landscape (desktop) */
@media (orientation: landscape) and (min-height: 901px) {
    .scoreboard-container {
        padding: 4px;
        gap: 4px;
    }

    .scoreboard-header {
        padding: 4px 8px;
        min-height: 36px;
    }

    .team-section {
        padding: 20px 12px;
        gap: 6px;
    }

    .server-indicator {
        font-size: 2.5rem;
    }

    .server-indicator-wrapper {
        height: 45px;
    }

    .team-name {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }

    .score-details {
        gap: 14px;
    }

    .score-label {
        font-size: 0.9rem;
    }

    .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 2rem;
    }

    .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 3.5rem;
    }

    .points-score {
        font-size: 24rem;
        margin-top: 10px;
    }

    .vs-separator {
        width: 80px;
    }

    .vs-text {
        font-size: 4rem;
    }

    .touch-controls {
        margin-top: 8px;
    }

    .score-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

/* ===========================
   Tablet & Desktop
   =========================== */

/* Small screens (portrait phones) */
@media (max-width: 400px) and (orientation: portrait) {
    .main-score-display {
        gap: 6px;
    }

    .scoreboard-container {
        padding: 8px;
    }

    .scoreboard-header {
        padding: 8px 0;
        margin-bottom: 8px;
    }

    .team-section {
        padding: 16px 6px;
        gap: 6px;
    }

    .server-indicator-wrapper {
        height: 30px;
    }

    .server-indicator {
        font-size: 1.5rem;
    }

    .team-name {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }

    .score-details {
        gap: 10px;
    }

    .score-label {
        font-size: 0.75rem;
        min-width: 45px;
    }

    .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 1.5rem;
    }

    .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 4rem;
    }

    .points-score {
        font-size: 30rem;
        margin-top: 6px;
    }

    .vs-separator {
        width: 50px;
    }

    .vs-text {
        font-size: 2.5rem;
    }

    .touch-controls {
        margin-top: 12px;
    }

    .score-btn {
        padding: 16px;
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 48px;
    }

    .app-title {
        font-size: 3rem;
    }

    .touch-controls {
        margin-top: 32px;
    }

    .score-btn {
        padding: 32px;
        font-size: 1.5rem;
    }

}

/* Mobile Setup Screen Optimization */
@media (max-width: 768px) {
    #setupScreen {
        justify-content: flex-start;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    #setupScreen .container {
        padding: 1rem;
        max-height: calc(var(--app-height) - 2rem - var(--safe-top) - var(--safe-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .setup-header {
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.6rem;
        font-size: 16px;
    }
    
    .toggle-group label {
        padding: 0.8rem;
    }
    
    .btn-primary {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #setupScreen .container {
        padding: 0.75rem;
    }
    
    .app-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.8rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.5rem;
        font-size: 16px;
    }
}

/* ===========================
   iOS PWA Standalone Mode - Smaller sizes to fit on screen
   =========================== */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari - make everything smaller for PWA */
    @media (display-mode: standalone) {
        .scoreboard-container {
            padding: calc(2px + var(--safe-top)) calc(2px + var(--safe-right)) calc(2px + var(--safe-bottom)) calc(2px + var(--safe-left));
            gap: 2px;
        }

        .main-score-display {
            gap: 2px;
            min-height: 0;
        }

        .team-section {
            padding: 4px 3px;
            gap: 2px;
            box-sizing: border-box;
        }

        .team-name {
            font-size: 0.75rem;
            margin-bottom: 2px;
        }

        .server-indicator-wrapper {
            height: 16px;
        }

        .server-indicator {
            font-size: 0.9rem;
        }

        .score-details {
            gap: 4px;
        }

        .score-label {
            font-size: 0.6rem;
            min-width: 30px;
        }

        .sets-score {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            font-variant-numeric: tabular-nums;
            font-size: 1rem;
        }

        .games-score {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            font-variant-numeric: tabular-nums;
            font-size: 1.8rem;
        }

        .points-score {
            font-size: 7rem;
            margin-top: 1px;
        }

        .vs-separator {
            width: 30px;
        }

        .vs-text {
            font-size: 1.5rem;
        }
    }

    /* iOS Safari landscape - even more compact */
    @media (display-mode: standalone) and (orientation: landscape) {
        .scoreboard-container {
            padding: calc(1px + var(--safe-top)) calc(1px + var(--safe-right)) calc(1px + var(--safe-bottom)) calc(1px + var(--safe-left));
            gap: 1px;
        }

        .scoreboard-header {
            padding: 2px 4px;
            min-height: 32px;
            gap: 4px;
        }

        .icon-btn {
            min-width: 36px;
            min-height: 36px;
            font-size: 1.2rem;
            padding: 6px;
        }

        .trial-badge {
            font-size: 0.7rem;
            padding: 4px 8px;
        }

        .match-info {
            font-size: 0.7rem;
        }

        .main-score-display {
            gap: 1px;
        }

        .team-section {
            padding: 2px 1px;
            gap: 1px;
            box-sizing: border-box;
        }

        /* Symmetric scoreboard specific adjustments */
        .symmetric-scoreboard .team-section {
            padding: 4px 2px;
            gap: 2px;
            border-radius: 4px;
        }

        .symmetric-scoreboard .main-score-display {
            gap: 1px;
        }

        .symmetric-scoreboard .team-a .stats-section,
        .symmetric-scoreboard .team-b .stats-section {
            min-width: 80px;
            top: 4px;
        }

        /* Stats always toward center regardless of team */
        .symmetric-scoreboard #teamA .stats-section {
            right: 4px;  /* Physical left position: stats on right (toward center) */
        }

        .symmetric-scoreboard #teamB .stats-section {
            left: 4px;   /* Physical right position: stats on left (toward center) */
        }

        .symmetric-scoreboard .team-name {
            font-size: 0.8rem;
            top: 4px;
        }

        .team-section {
            border-radius: 4px;
        }

        .team-name {
            font-size: 0.7rem;
            margin-bottom: 1px;
        }

        .score-label {
            font-size: 0.55rem;
        }

        .sets-score {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            font-variant-numeric: tabular-nums;
            font-size: 0.9rem;
        }

        .games-score {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            font-variant-numeric: tabular-nums;
            font-size: 1.6rem;
        }

        .points-score {
            font-size: 6rem;
            margin-top: 0;
        }
    }
}

/* ===========================
   Fullscreen Mode
   =========================== */

:fullscreen .scoreboard-header {
    display: none;
}

:-webkit-full-screen .scoreboard-header {
    display: none;
}

:-moz-full-screen .scoreboard-header {
    display: none;
}

/* Hide fullscreen button on iOS (not supported) */
@supports (-webkit-touch-callout: none) {
    /* This targets iOS Safari */
    #fullscreenBtn {
        display: none !important;
    }
}

/* Alternative iOS detection via user agent (fallback) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    @supports (-webkit-appearance: none) and (not (appearance: none)) {
        /* iOS Safari specific */
        #fullscreenBtn {
            display: none !important;
        }
    }
}

/* ===========================
   ALTERNATIVE SCOREBOARD DESIGN
   Small Names, Large Games, Largest Points
   =========================== */

.alternative-scoreboard .team-section {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 4px;
    gap: 2px;
    min-height: 100%;
}

.alternative-scoreboard .server-indicator-wrapper {
    height: 20px;
    order: -1;
    margin-bottom: 4px;
}

.alternative-scoreboard .server-indicator {
    font-size: 1rem;
}

.alternative-scoreboard .team-name {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 2px;
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alternative-scoreboard .score-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin-bottom: 8px;
}

.alternative-scoreboard .score-details .score-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.alternative-scoreboard .sets-score,
.alternative-scoreboard .games-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    min-width: 50px;
}

.alternative-scoreboard .games-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 6rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-top: 4px;
}

.alternative-scoreboard .points-score {
    font-size: 35rem;
    font-weight: 900;
    line-height: 0.9;
    margin-top: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Mobile alternative design */
@media (max-width: 768px) {
    .alternative-scoreboard .team-section {
        padding: 6px 3px;
        gap: 1px;
    }

    .alternative-scoreboard .team-name {
        font-size: 0.7rem;
    }

    .alternative-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 4.5rem;
    }

    .alternative-scoreboard .points-score {
        font-size: 25rem;
        min-height: 200px;
    }
}

/* Landscape optimizations for alternative design */
@media (orientation: landscape) and (max-height: 600px) {
    .alternative-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 4rem;
    }

    .alternative-scoreboard .points-score {
        font-size: 20rem;
        min-height: 150px;
    }
}

/* ===========================
   SYMMETRIC SCOREBOARD DESIGN
   Team A Points Left, Team B Points Right
   =========================== */

.symmetric-scoreboard .main-score-display {
    gap: 2px;
    height: 100%;
    overflow: hidden;
}

.symmetric-scoreboard .team-section {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 8px;
    gap: 8px;
    height: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.symmetric-scoreboard .vs-separator {
    width: 2px;
    background: var(--text-secondary);
    opacity: 0.3;
    border-radius: 1px;
}

/* Team Layout: Points take full width, stats in corners */
.symmetric-scoreboard .team-a,
.symmetric-scoreboard .team-b {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.symmetric-scoreboard .team-a .points-section,
.symmetric-scoreboard .team-b .points-section {
    flex: 1;
    width: 100%;
    text-align: center;
}

.symmetric-scoreboard #teamA .stats-section {
    position: absolute;
    top: 8px;
    right: 8px;  /* Physical left position: stats on right (toward center) */
    text-align: right;
    min-width: 120px;
}

.symmetric-scoreboard #teamB .stats-section {
    position: absolute;
    top: 8px;
    left: 8px;   /* Physical right position: stats on left (toward center) */
    text-align: left;
    min-width: 120px;
}

/* Team Name - Position at top center (where server indicator was) */
.symmetric-scoreboard .team-name {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Server Indicator - Only show for serving team */
.symmetric-scoreboard .server-indicator-wrapper {
    position: absolute;
    top: 32px; /* Below team name */
    left: 50%;
    transform: translateX(-50%);
    height: 24px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.symmetric-scoreboard .server-indicator {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.symmetric-scoreboard .team-section.serving .server-indicator-wrapper {
    opacity: 1;
}

/* Points Section */
.symmetric-scoreboard .points-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    padding: 50px 8px 50px 8px; /* Extra padding for team name and corner stats */
    overflow: hidden;
}

.symmetric-scoreboard .points-score {
    font-size: 24rem;
    font-weight: 900;
    line-height: 0.9;
    margin: 0;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

/* Stats Section */
.symmetric-scoreboard .stats-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 40px 8px 20px 8px; /* Extra top padding for team name */
    justify-content: center;
    max-width: 40%;
    overflow: hidden;
}

.symmetric-scoreboard .score-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.symmetric-scoreboard .score-details .score-label {
    font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 1;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    -webkit-text-stroke: 2px rgba(0, 0, 0, 0.7);
    text-stroke: 2px rgba(0, 0, 0, 0.7);
    color: #ffffff;
}

.symmetric-scoreboard .sets-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 0.9;
    text-align: center;
    min-width: 80px;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.symmetric-scoreboard .games-score {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 6.5rem;
    font-weight: 900;
    line-height: 0.9;
    text-align: center;
    min-width: 80px;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Team colors for points */
.symmetric-scoreboard .team-a .points-score {
    color: var(--team-a-color);
}

.symmetric-scoreboard .team-b .points-score {
    color: var(--team-b-color);
}

/* Mobile symmetric design */
@media (max-width: 768px) {
    .symmetric-scoreboard .team-section {
        padding: 40px 6px 8px 6px; /* Extra top padding for team name */
        gap: 6px;
        overflow: hidden;
    }

    .symmetric-scoreboard .team-name {
        font-size: 1.1rem;
        top: 6px;
    }

    .symmetric-scoreboard .points-score {
        font-size: 18rem;
    }

    .symmetric-scoreboard .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 3.5rem;
    }

    .symmetric-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 5.5rem;
    }

    .symmetric-scoreboard .stats-section {
        min-width: 100px;
        gap: 6px;
        padding: 0;
    }

    .symmetric-scoreboard #teamA .stats-section {
        top: 6px;
        right: 6px;  /* Physical left position: stats on right (toward center) */
    }

    .symmetric-scoreboard #teamB .stats-section {
        top: 6px;
        left: 6px;   /* Physical right position: stats on left (toward center) */
    }

    .symmetric-scoreboard .score-details .score-label {
        font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        font-size: 0.7rem;
        text-align: center;
        -webkit-text-stroke: 1.5px rgba(0, 0, 0, 0.6);
        text-stroke: 1.5px rgba(0, 0, 0, 0.6);
    }

    .symmetric-scoreboard .server-indicator-wrapper {
        top: 28px;
    }

    .symmetric-scoreboard .server-indicator {
        font-size: 1rem;
    }
}

/* Small landscape (phones) */
@media (orientation: landscape) and (max-height: 600px) {
    .symmetric-scoreboard .team-section {
        padding: 35px 4px 4px 4px;
        gap: 4px;
        overflow: hidden;
    }

    .symmetric-scoreboard .team-name {
        font-size: 0.9rem;
        top: 4px;
    }

    .symmetric-scoreboard .points-score {
        font-size: 16rem;
    }

    .symmetric-scoreboard .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 2.5rem;
    }

    .symmetric-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 4.5rem;
    }

    .symmetric-scoreboard .stats-section {
        min-width: 80px;
        gap: 4px;
        padding: 0;
    }

    .symmetric-scoreboard #teamA .stats-section {
        top: 4px;
        right: 4px;  /* Physical left position: stats on right (toward center) */
    }

    .symmetric-scoreboard #teamB .stats-section {
        top: 4px;
        left: 4px;   /* Physical right position: stats on left (toward center) */
    }

    .symmetric-scoreboard .score-details .score-label {
        font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        font-size: 0.6rem;
        text-align: center;
        -webkit-text-stroke: 1px rgba(0, 0, 0, 0.6);
        text-stroke: 1px rgba(0, 0, 0, 0.6);
    }

    .symmetric-scoreboard .server-indicator-wrapper {
        top: 24px;
    }
}

/* Medium landscape (tablets) */
@media (orientation: landscape) and (min-height: 601px) and (max-height: 900px) {
    .symmetric-scoreboard .points-score {
        font-size: 22rem;
    }

    .symmetric-scoreboard .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 4rem;
    }

    .symmetric-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 6rem;
    }

    .symmetric-scoreboard .team-name {
        font-size: 1.2rem;
    }
}

/* Large landscape (desktop) */
@media (orientation: landscape) and (min-height: 901px) {
    .symmetric-scoreboard .points-score {
        font-size: 28rem;
    }

    .symmetric-scoreboard .sets-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 5rem;
    }

    .symmetric-scoreboard .games-score {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
        font-variant-numeric: tabular-nums;
        font-size: 8rem;
    }

    .symmetric-scoreboard .team-name {
        font-size: 1.6rem;
    }

    .symmetric-scoreboard .stats-section {
        min-width: 160px;
    }
}

/* ===========================
   First Point Server Selection Popup
   =========================== */

.first-point-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.first-point-popup.show {
    opacity: 1;
}

.first-point-popup-content {
    background: linear-gradient(135deg, rgba(20, 40, 70, 0.98), rgba(30, 50, 80, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    text-align: center;
    min-width: 280px;
    animation: pulse 2s ease-in-out infinite;
}

.first-point-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: bounce 1.5s ease-in-out infinite;
}

.first-point-text {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 12px 48px rgba(50, 120, 255, 0.4);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    body {
        background-color: white;
        color: black;
    }

    .scoreboard-header,
    .touch-controls,
    .control-menu,
    .toast {
        display: none !important;
    }
}
