:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-p1: #3b82f6;
    --accent-p2: #ef4444;
    --success: #22c55e;
    --danger: #dc2626;
    --radius: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

h1 {
    font-weight: 800;
    font-size: 1.5rem;
    margin: 0;
    letter-spacing: -0.025em;
    color: var(--text-secondary);
}

.match-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.match-settings select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: inherit;
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.player-pane {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    transition: var(--transition);
}

.p1 { border-color: rgba(59, 130, 246, 0.2); }
.p2 { border-color: rgba(239, 68, 68, 0.2); }

.player-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.player-info input {
    background: transparent;
    border: none;
    border-bottom: 2px solid #334155;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    padding: 8px;
    width: 80%;
    outline: none;
    transition: var(--transition);
}

.player-info input:focus {
    border-bottom-color: var(--text-primary);
}

.set-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    margin: 10px 0;
}

.score-controls {
    display: flex;
    gap: 16px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-plus, .btn-minus {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 600;
}

.p1 .btn-plus { background: var(--accent-p1); color: white; }
.p2 .btn-plus { background: var(--accent-p2); color: white; }
.btn-minus { background: #334155; color: var(--text-primary); }

button:active { transform: scale(0.9); }
.btn-plus:hover { filter: brightness(1.1); }
.btn-minus:hover { background: #475569; }

.vs-badge {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.global-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
}

.btn-secondary, .btn-danger {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
}

.btn-secondary { background: #334155; color: var(--text-primary); }
.btn-danger { background: rgba(220, 38, 38, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.modal {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

.modal h2 {
    font-size: 2rem;
    margin: 0 0 16px;
}

.modal p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--success);
    color: white;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.hidden { display: none; opacity: 0; }

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

@media (max-width: 600px) {
    .scoreboard {
        grid-template-columns: 1fr;
    }
    .vs-badge {
        text-align: center;
        margin: -10px 0;
    }
    .score-display {
        font-size: 6rem;
    }
}
