@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* Base Styles */
:root {
    /* === Primary Colors === */
    --primary-color: #1a5f2a;
    --primary-dark: #0d3d18;
    --secondary-color: #2c5282;

    /* Aliases for consistency (used by admin templates) */
    --primary: var(--primary-color);

    /* === Team Colors === */
    --team-a-color: #2563eb;
    --team-b-color: #dc2626;
    /* Aliases */
    --team-a: var(--team-a-color);
    --team-b: var(--team-b-color);

    /* === Background Colors === */
    --bg-color: #f0f4f8;
    --bg-secondary: #e2e8f0;
    --card-bg: #ffffff;
    --card-bg-dark: #2d3748;
    --input-bg: #ffffff;
    --scoreboard-bg: #1a1a2e;
    --scoreboard-row-a: #16213e;
    --scoreboard-row-b: #1f3460;

    /* === Text Colors === */
    --text-color: #1a202c;
    --text-muted: #718096;
    /* Aliases */
    --text-primary: var(--text-color);
    --text-secondary: var(--text-muted);

    /* === Other Colors === */
    --white: #ffffff;
    --border-color: #e2e8f0;
    --gold: #ffd700;
    --danger: #e53e3e;
    --danger-dark: #c53030;
    --success: #48bb78;

    /* === Spacing Scale (4px base) === */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */

    /* === Border Radius === */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* === Shadows === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
}

.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    position: relative;
}

.header-archive-link {
    position: absolute;
    right: 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.header-archive-link:hover {
    background: var(--border-color);
    color: var(--primary-color);
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Forms */
.create-match {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.create-match h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 14px 12px;
    border: 2px solid var(--border-color);
    background: var(--white);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.toggle-btn:hover {
    border-color: var(--primary-color);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.teams-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.team-input {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 12px;
}

.team-input h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.team-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 8px;
}

.team-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.vs {
    text-align: center;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-danger {
    background: #e53e3e;
    color: var(--white);
}

.btn-danger:hover {
    background: #c53030;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.2rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== Match Page ==================== */
.match-page {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E") repeat,
        linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    min-height: 100vh;
    padding: 16px;
}

/* OLED-optimized dark mode for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .match-page {
        background: #000000;
    }

    .scoreboard {
        background: #0a0a0a;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
    }

    .scoreboard-row.team-a {
        background: #0d0d14;
    }

    .scoreboard-row.team-b {
        background: #14141a;
    }

    .score-btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }
}

.match-container {
    max-width: 600px;
    margin: 0 auto;
}

/* TV-Style Scoreboard */
.scoreboard {
    background: var(--scoreboard-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    margin-bottom: 20px;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.match-status {
    background: #e53e3e;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-family: 'Chakra Petch', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    animation: pulse 2s infinite;
}

.match-status.finished {
    background: var(--gold);
    color: #1a1a2e;
    animation: none;
}

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

.connection-status {
    color: #48bb78;
    font-size: 0.8rem;
    transition: color 0.3s;
    cursor: help;
}

.connection-status.disconnected {
    color: #fc8181;
}

.connection-status.reconnecting {
    color: #ffd700;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.match-type {
    font-family: 'Chakra Petch', monospace;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
}

.score-table {
    width: 100%;
}

.score-header {
    display: grid;
    grid-template-columns: 1fr 48px 48px 48px 64px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    font-family: 'Chakra Petch', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

.score-header .player-col {
    text-align: left;
    padding-left: 16px;
}

.score-row {
    display: grid;
    grid-template-columns: 1fr 48px 48px 48px 64px;
    padding: 12px 0;
    font-family: 'Chakra Petch', monospace;
    font-size: 1.1rem;
    color: var(--white);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row.team-a {
    background: var(--scoreboard-row-a);
}

.score-row.team-b {
    background: var(--scoreboard-row-b);
}

.player-col {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

.serve-indicator {
    color: transparent;
    font-size: 0.6rem;
    transition: color 0.3s;
}

.serve-indicator.active {
    color: var(--gold);
}

.player-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.set-col, .points-col {
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.set-col.current-set {
    color: var(--gold);
}

.points-col {
    background: rgba(0, 0, 0, 0.2);
    font-family: 'Chakra Petch', monospace;
    font-size: 1.3rem;
    color: var(--gold);
}

.scoreboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    font-family: 'Chakra Petch', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.2);
    min-height: 32px;
}

.match-timer {
    font-family: 'Chakra Petch', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

/* Winner Banner */
.winner-banner {
    background: linear-gradient(135deg, var(--gold) 0%, #ffed4a 100%);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    animation: celebrate 0.5s ease-out;
}

@keyframes celebrate {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.winner-text {
    font-family: 'Chakra Petch', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--scoreboard-bg);
}

/* Scoring Controls */
.controls {
    margin-bottom: 20px;
}

.score-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.score-btn {
    padding: 48px 20px;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

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

.score-btn.scoring {
    opacity: 0.7;
}

.score-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.team-a-btn {
    background: linear-gradient(135deg, var(--team-a-color) 0%, #1d4ed8 100%);
    color: white;
}

.team-b-btn {
    background: linear-gradient(135deg, var(--team-b-color) 0%, #b91c1c 100%);
    color: white;
}

.btn-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.btn-team {
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.action-buttons .btn {
    flex: 1;
}

/* Spectator Notice */
.spectator-notice {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.share-hint {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
}

/* Share Section */
.share-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.share-section h3 {
    color: var(--white);
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
}

.share-link {
    display: flex;
    gap: 8px;
}

.share-link input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    font-size: 0.9rem;
    min-height: 44px;
}

.share-link .btn {
    min-height: 44px;
}

.share-code {
    text-align: center;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.share-code strong {
    color: var(--gold);
    font-family: monospace;
    letter-spacing: 2px;
}

/* Back Link */
.back-link {
    text-align: center;
    padding: 16px 0;
}

.back-link a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link a:hover {
    color: var(--white);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 2rem;
    }

    .teams-container {
        gap: 12px;
    }

    .team-input {
        padding: 12px;
    }

    .score-header {
        grid-template-columns: 1fr 40px 40px 40px 56px;
        font-size: 0.7rem;
    }

    .score-row {
        grid-template-columns: 1fr 40px 40px 40px 56px;
        font-size: 1rem;
    }

    .player-name {
        max-width: 100px;
        font-size: 0.95rem;
    }

    .points-col {
        font-size: 1.1rem;
    }

    .score-btn {
        padding: 56px 16px;
        font-size: 1.05rem;
    }

    .btn-team {
        font-size: 1.15rem;
        font-weight: 800;
    }

    .btn-label {
        font-size: 0.95rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .score-btn {
        padding: 52px 24px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .match-page {
        padding: 8px;
    }

    .scoreboard {
        margin-bottom: 12px;
    }

    .score-row {
        padding: 8px 0;
    }

    .score-btn {
        padding: 20px 16px;
    }

    .share-section {
        padding: 12px;
    }
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: var(--primary-color);
}

/* Prevent text selection during tapping */
.score-btn,
.scoreboard,
.controls,
.scoreboard-card,
.match-card {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Accessibility - Focus states */
.btn:focus,
.toggle-btn:focus,
.score-btn:focus,
.enter-score-btn:focus,
.match-card:focus,
.winner-btn:focus,
.player-select:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast focus for dark backgrounds */
.matchday-page a:focus,
.match-page a:focus,
.matchday-page button:focus,
.match-page button:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ==================== Mode Selection ==================== */
.mode-selection {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.mode-selection h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary-color);
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mode-icon {
    font-size: 3rem;
}

.mode-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
}

.mode-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 16px;
    padding: 8px 0;
}

.back-btn:hover {
    color: var(--primary-color);
}

/* Player input styling */
.player-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 8px;
}

.player-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==================== Match Day Page ==================== */
.matchday-page {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E") repeat,
        linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    min-height: 100vh;
    padding: 16px;
}

/* OLED-optimized dark mode for match day on mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .matchday-page {
        background: #000000;
    }

    .team-scores {
        background: #0a0a0a;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
    }

    .scoreboard-card {
        background: #1a1a1a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    }
}

.matchday-container {
    max-width: 800px;
    margin: 0 auto;
}

.matchday-timer {
    font-family: 'Chakra Petch', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    margin-top: 8px;
    min-height: 1.2em;
}

.matchday-header {
    text-align: center;
    margin-bottom: 24px;
}

.matchday-header h1 {
    font-family: 'Chakra Petch', monospace;
    font-weight: 700;
    color: var(--white);
    font-size: 1.8rem;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Live updates indicator */
.live-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48bb78;
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.live-text {
    font-family: 'Chakra Petch', monospace;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.team-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: var(--scoreboard-bg);
    border-radius: 12px;
    padding: 20px 32px;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.team-score .team-name {
    font-family: 'Chakra Petch', monospace;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    order: -1;
}

.team-score .score {
    font-family: 'Chakra Petch', monospace;
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
}

.score-separator {
    color: rgba(255, 255, 255, 0.4);
    font-size: 2.5rem;
    font-weight: 300;
    margin: 0 8px;
}

.matches-section {
    margin-bottom: 24px;
}

.matches-section h2 {
    font-family: 'Chakra Petch', monospace;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--white);
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 3px solid var(--gold);
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

/* TV-Style Scoreboard */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.scoreboard-card {
    background: #3d4a5c;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.scoreboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scoreboard-card.finished {
    opacity: 0.6;
}

.scoreboard-card.live {
    border-left: 3px solid #48bb78;
}

.scoreboard-card.upcoming {
    opacity: 0.9;
}

.status-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 10;
    pointer-events: none;
}

.status-badge.live {
    font-family: 'Chakra Petch', monospace;
    background: #48bb78;
    color: white;
    letter-spacing: 0.5px;
    animation: live-pulse 2s infinite;
}

.status-badge.final {
    background: #ffd700;
    color: #1a1a2e;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scoreboard-link {
    display: block;
    text-decoration: none;
}

.scoreboard-table {
    width: 100%;
    border-collapse: collapse;
}

.scoreboard-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.scoreboard-table tr:last-child {
    border-bottom: none;
}

.scoreboard-table tr.winner .player-name {
    color: var(--gold);
}

.scoreboard-table td {
    padding: 12px 8px;
    vertical-align: middle;
}

.scoreboard-table .team-color {
    width: 4px;
    padding: 0;
}

.scoreboard-table .team-color.team-a {
    background: var(--team-a-color);
}

.scoreboard-table .team-color.team-b {
    background: var(--team-b-color);
}

.scoreboard-table .player-name {
    font-family: 'DM Sans', sans-serif;
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 500;
    padding-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Add padding when badge is present */
.scoreboard-card.live .scoreboard-table .player-name,
.scoreboard-card.finished .scoreboard-table .player-name {
    padding-left: 80px;
}

.scoreboard-table .set-score {
    width: 32px;
    text-align: center;
    font-family: 'Chakra Petch', monospace;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: rgba(0, 0, 0, 0.2);
}

.enter-score-btn {
    display: block;
    width: 100%;
    background: var(--gold);
    color: #1a1a2e;
    border: none;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.enter-score-btn:hover {
    background: #e6c200;
}

/* Match Duration */
.match-duration {
    text-align: center;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.match-duration::before {
    content: "⏱ ";
}

/* Legacy match card styles (keep for backwards compatibility) */
.match-card {
    background: var(--scoreboard-bg);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.match-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.match-card.finished {
    opacity: 0.4;
}

.match-number {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.match-players {
    margin-bottom: 8px;
}

.match-players .player {
    color: var(--white);
    font-weight: 600;
    padding: 4px 0;
}

.match-players .player.winner {
    color: var(--gold);
}

.match-players .team-tag {
    display: inline-block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 8px;
    font-weight: 400;
}

.match-vs {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    padding: 2px 0;
}

.match-score-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--gold);
    font-weight: 700;
}

.match-score-mini .final {
    font-size: 0.7rem;
    background: var(--gold);
    color: var(--scoreboard-bg);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ==================== Player Info in Scoreboard ==================== */
.player-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-info .player-name {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

/* Serve indicator as ball icon */
.serve-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.serve-indicator.active {
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

/* ==================== Game Buttons ==================== */
.game-buttons {
    margin-bottom: 12px;
}

.game-btn {
    padding: 20px 16px;
    opacity: 0.85;
}

.game-btn .btn-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==================== Responsive Additions ==================== */
@media (max-width: 480px) {
    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .mode-btn {
        padding: 24px 16px;
    }

    .team-scores {
        flex-direction: row;
        gap: 16px;
        padding: 16px 20px;
    }

    .team-score {
        min-width: 90px;
    }

    .team-score .team-name {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .team-score .score {
        font-size: 2.5rem;
    }

    .score-separator {
        font-size: 1.8rem;
        margin-top: 20px;
    }

    /* Scoreboard mobile */
    .scoreboard-table .player-name {
        font-size: 0.85rem;
        max-width: 140px;
    }

    /* Adjust badge padding on mobile */
    .scoreboard-card.live .scoreboard-table .player-name,
    .scoreboard-card.finished .scoreboard-table .player-name {
        padding-left: 70px;
    }

    .scoreboard-table .set-score {
        width: 28px;
        font-size: 0.9rem;
    }

    .scoreboard-table td {
        padding: 10px 6px;
    }

    .player-info .player-name {
        font-size: 0.9rem;
        max-width: 120px;
    }

    .game-btn {
        padding: 16px 12px;
    }

    /* Live indicator mobile */
    .live-indicator {
        margin-bottom: 12px;
    }

    .live-text {
        font-size: 0.75rem;
    }

    /* Header archive link mobile */
    .header-archive-link {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

/* ==================== Doubles Pairing Section ==================== */
.doubles-pairing-section {
    background: rgba(255, 215, 0, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.pairing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pairing-header h3 {
    color: var(--gold);
    font-size: 1.1rem;
    margin: 0;
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.85rem;
    min-height: 44px;
}

.btn-small.active {
    background: var(--gold);
    color: var(--scoreboard-bg);
}

#pairing-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pairing-match {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.pairing-match-header {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.pairing-teams {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.pairing-team {
    flex: 1;
    min-width: 180px;
}

.pairing-team .team-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.pairing-players {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pairing-vs {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    font-weight: 600;
}

.player-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

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

.player-select option {
    background: var(--scoreboard-bg);
    color: var(--white);
}

.player-select option:disabled {
    color: rgba(255, 255, 255, 0.3);
}

.doubles-pairing-section .player-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.doubles-pairing-section .player-input:focus {
    outline: none;
    border-color: var(--gold);
}

.doubles-pairing-section .player-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.pairing-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pairing-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.pairing-status.success {
    color: #48bb78;
}

.pairing-status.error {
    color: #fc8181;
}

@media (max-width: 480px) {
    .doubles-pairing-section {
        padding: 16px;
    }

    .pairing-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pairing-teams {
        flex-direction: column;
        gap: 12px;
    }

    .pairing-team {
        width: 100%;
    }

    .pairing-vs {
        align-self: center;
    }
}

/* Spectator notice for match day page */
.spectator-notice-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 12px;
    font-style: italic;
}

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

.modal-content {
    background: var(--scoreboard-bg);
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--white);
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--white);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: flex-end;
}

/* Score Entry Form */
.score-entry-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.set-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.set-entry label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.set-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.set-inputs span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
}

.set-input {
    width: 60px;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    font-size: 1.2rem;
    text-align: center;
}

.set-input:focus {
    outline: none;
    border-color: var(--gold);
}

.winner-selection {
    margin-top: 8px;
}

.winner-selection label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.winner-buttons {
    display: flex;
    gap: 12px;
}

.winner-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.winner-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.winner-btn.selected {
    background: var(--gold);
    color: var(--scoreboard-bg);
    border-color: var(--gold);
}

@media (max-width: 480px) {
    .winner-buttons {
        flex-direction: column;
    }
}

/* Archive link on home page */
.archive-link {
    margin-top: 24px;
    text-align: center;
}

.archive-text-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.archive-text-link:hover {
    text-decoration: underline;
}

/* Archive Page Styles */
.archive-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    margin-top: 8px;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.archive-card {
    background: var(--scoreboard-bg);
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.archive-card:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
}

.archive-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.archive-name {
    color: var(--white);
    font-size: 1.1rem;
    margin: 0;
}

.archive-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

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

.archive-team {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    min-width: 100px;
}

.archive-team:first-child {
    text-align: right;
}

.archive-team:last-child {
    text-align: left;
}

.archive-score {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.archive-score .team-a-score,
.archive-score .team-b-score {
    font-size: 1.5rem;
    color: var(--gold);
}

.archive-score .score-dash {
    color: rgba(255, 255, 255, 0.4);
}

.archive-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.archive-format {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.archive-progress {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.completed-badge {
    background: #48bb78;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.empty-archive {
    text-align: center;
    padding: 48px 24px;
    color: rgba(255, 255, 255, 0.6);
}

.empty-archive p {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

/* Share section - collapsible */
.share-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.share-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
}

.share-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.share-toggle-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
}

.share-content {
    padding: 0 20px 20px;
}

.share-section.collapsed .share-content {
    display: none;
}

/* Share options styling */
.share-option {
    margin-bottom: 16px;
}

.share-option label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.share-warning {
    color: #fc8181;
    font-size: 0.75rem;
    margin-top: 6px;
    font-style: italic;
}

@media (max-width: 480px) {
    .archive-teams {
        flex-direction: column;
        gap: 8px;
    }

    .archive-team {
        text-align: center !important;
        min-width: auto;
    }

    .archive-card-header {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
}

/* ==================== Admin Pages ==================== */

/* Admin Container */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-4);
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.admin-header h1 {
    font-size: 1.75rem;
    margin: 0;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Button Variants for Admin */
.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-outline-danger:hover {
    background: rgba(229, 62, 62, 0.1);
}

/* Admin Create Section */
.create-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    display: none;
    box-shadow: var(--shadow-md);
}

.create-section.active {
    display: block;
}

.create-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-6);
    color: var(--primary-color);
}

/* Admin Match Days List */
.match-days-section h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.match-day-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-4);
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.match-day-card:hover {
    border-color: var(--primary-color);
}

.match-day-info h3 {
    font-size: 1rem;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.match-day-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.match-day-score {
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: var(--space-2);
}

.match-day-score .team-a-score {
    color: var(--team-a-color);
}

.match-day-score .team-b-score {
    color: var(--team-b-color);
}

.match-day-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.link-group {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    flex-wrap: wrap;
}

.link-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-block;
}

.link-btn:hover {
    background: var(--border-color);
}

.link-btn.btn-delete {
    color: var(--danger);
    border-color: var(--danger);
}

.link-btn.btn-delete:hover {
    background: rgba(229, 62, 62, 0.1);
}

/* Admin Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--text-secondary);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-state p {
    margin-bottom: var(--space-4);
}

/* Admin Responsive */
@media (max-width: 768px) {
    .admin-container {
        padding: var(--space-4);
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .match-day-card {
        grid-template-columns: 1fr;
    }

    .link-group {
        flex-direction: column;
    }
}

/* ==================== Login Page ==================== */

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: var(--space-8);
}

.login-form {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-2);
    color: var(--primary-color);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: var(--space-6);
}

.login-form .form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--text-primary);
}

.login-form .form-group input[type="password"] {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
}

.login-form .form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 95, 42, 0.2);
}

.error-message {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
    color: var(--danger);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
    font-size: 0.9rem;
}

.btn-login {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.archive-link-login {
    text-align: center;
    margin-top: var(--space-6);
}

.archive-link-login a {
    color: var(--text-secondary);
    text-decoration: none;
}

.archive-link-login a:hover {
    color: var(--primary-color);
}

/* ========================================
   WTB Data Management Section
   ======================================== */

.wtb-section {
    background: var(--card-bg);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wtb-section h2 {
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    font-size: 1.25rem;
}

.wtb-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
}

.sync-status {
    font-size: 0.9rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
}

.wtb-club-selector {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.wtb-club-selector label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Autocomplete Dropdowns
   ======================================== */

.player-input-wrapper {
    position: relative;
    margin-bottom: var(--space-3);
}

.autocomplete-wrapper {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.autocomplete-wrapper input {
    margin-bottom: 0 !important;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--primary-color);
    color: #fff;
}

.autocomplete-item:hover .ac-meta,
.autocomplete-item.selected .ac-meta {
    color: rgba(255, 255, 255, 0.8);
}

.ac-name {
    font-weight: 500;
    flex: 1;
}

.ac-meta {
    font-size: 0.8em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.club-search-hint {
    display: block;
    font-size: 0.75em;
    color: var(--text-secondary);
    margin-top: -4px;
    margin-bottom: 6px;
}

/* Ensure dropdowns appear above other content */
.player-dropdown {
    margin-top: 0;
}

/* ========================================
   Doubles Setup Panel
   ======================================== */

.doubles-setup-panel {
    border-top: 1px solid var(--border-color);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.doubles-setup-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.doubles-pairings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.doubles-pairing-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.doubles-pairing-label {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 70px;
    color: var(--primary-color);
}

.doubles-pairing-team {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.doubles-team-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 40px;
}

.doubles-select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 130px;
    cursor: pointer;
}

.doubles-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.doubles-slash {
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 2px;
}

.doubles-vs {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0 var(--space-2);
}

.doubles-setup-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.btn-setup-doubles {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.btn-setup-doubles:hover {
    background: var(--primary-dark, #2563eb);
}

@media (max-width: 768px) {
    .doubles-pairing-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .doubles-pairing-team {
        width: 100%;
    }

    .doubles-select {
        flex: 1;
        min-width: 100px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .wtb-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .autocomplete-dropdown {
        font-size: 0.9rem;
    }

    .autocomplete-item {
        padding: var(--space-2) var(--space-3);
    }
}

/* ==================== Serve Selection Overlay ==================== */
.serve-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.serve-overlay-content {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.serve-overlay-content h3 {
    color: var(--gold);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.serve-overlay-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.serve-pick-btn {
    padding: 20px 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    color: white;
}

.serve-pick-btn.team-a-btn {
    background: linear-gradient(135deg, var(--team-a) 0%, #2563eb 100%);
}

.serve-pick-btn.team-b-btn {
    background: linear-gradient(135deg, var(--team-b) 0%, #dc2626 100%);
}

.serve-pick-btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

/* Clickable serve indicator for correction */
.serve-indicator.clickable {
    cursor: pointer;
}

.serve-indicator.clickable.active {
    animation: pulse-gold 2s infinite;
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 8px var(--gold); }
    50% { box-shadow: 0 0 14px var(--gold); }
}
