@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* Light theme (default) */
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --border-color: #cbd5e1;

    --team1-primary: #2563eb;
    --team1-dark: #dbeafe;
    --team1-darker: #bfdbfe;
    --team1-light: #1d4ed8;
    --team1-bg: #dbeafe;

    --team2-primary: #dc2626;
    --team2-dark: #fee2e2;
    --team2-darker: #fecaca;
    --team2-light: #b91c1c;
    --team2-bg: #fee2e2;

    --accent-gold: #d97706;
    --accent-gold-dark: #b45309;
    --accent-gold-darker: #92400e;

    --live-green: #16a34a;
    --live-green-bg: rgba(22, 163, 74, 0.1);

    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow-blue: 0 0 20px rgba(37, 99, 235, 0.2);
    --shadow-glow-red: 0 0 20px rgba(220, 38, 38, 0.2);
    --shadow-glow-green: 0 0 12px rgba(22, 163, 74, 0.25);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --border-color: #334155;

    --team1-primary: #3b82f6;
    --team1-dark: #1e3a5f;
    --team1-darker: #172554;
    --team1-light: #93c5fd;
    --team1-bg: #dbeafe;

    --team2-primary: #ef4444;
    --team2-dark: #450a0a;
    --team2-darker: #3b1323;
    --team2-light: #fca5a5;
    --team2-bg: #fee2e2;

    --accent-gold: #f59e0b;
    --accent-gold-dark: #d97706;
    --accent-gold-darker: #b45309;

    --live-green: #22c55e;
    --live-green-bg: rgba(34, 197, 94, 0.15);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dark: #0f172a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);
    --shadow-glow-green: 0 0 12px rgba(34, 197, 94, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

header, .card, .match-item, .admin-section, .regulation-section,
.scoreboard, .sets-table, .points-timeline, .set-timeline,
.stat-card, .team-stat-card, .standings-info, .auth-panel,
.auth-status-badge, .auth-toggle, .theme-toggle, .team-item,
.admin-match-item, .admin-live-scoreboard, .team-card,
.btn-secondary, .input-group input, .auth-form-group input,
.nav-btn, nav {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

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

/* ===== AUTH BAR ===== */
.auth-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.auth-status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 6px 16px;
}

.auth-status-icon { font-size: 1.1rem; }

.auth-status-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.auth-status-label { color: var(--text-muted); }
.auth-status-text strong { color: var(--text-primary); }
.auth-status-role {
    background: var(--accent-gold);
    color: var(--text-dark);
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-dropdown { position: relative; }

.auth-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 18px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}

.auth-toggle:hover {
    border-color: var(--team1-primary);
    color: var(--text-primary);
}

.auth-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    width: 300px;
    box-shadow: var(--shadow-xl);
    z-index: 100;
}

.auth-panel.open { display: block; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-form-group { display: flex; flex-direction: column; gap: 4px; }

.auth-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-form-group input {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--team1-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-form-group input::placeholder { color: var(--text-muted); }

.auth-feedback {
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    display: none;
    text-align: center;
}

.auth-feedback.visible { display: block; }

.auth-feedback-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.auth-feedback-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

/* ===== HEADER ===== */
header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

header h1 {
    text-align: center;
    background: linear-gradient(135deg, var(--team1-primary), var(--team2-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.75rem;
    font-weight: 900;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

/* ===== NAVIGATION ===== */
nav {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-xl);
}

.nav-btn {
    padding: 0.65rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--team1-primary), #2563eb);
    color: white;
    box-shadow: var(--shadow-glow-blue);
}

.nav-btn-admin {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    color: white;
    border-color: transparent;
}

.nav-btn-admin:hover {
    background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold-darker));
}

.nav-btn-admin.active {
    background: linear-gradient(135deg, var(--accent-gold-darker), #92400e);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.mobile-quick-actions { display: none; }

/* ===== VIEW SYSTEM ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--team1-primary), #2563eb);
    color: white;
}

.btn-primary:hover { filter: brightness(1.1); box-shadow: var(--shadow-glow-blue); }

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover { background: var(--border-color); color: var(--text-primary); }

.btn-success {
    background: linear-gradient(135deg, var(--live-green), #16a34a);
    color: white;
}

.btn-success:hover { filter: brightness(1.1); }

.btn-danger {
    background: linear-gradient(135deg, var(--team2-primary), #dc2626);
    color: white;
}

.btn-danger:hover { filter: brightness(1.1); box-shadow: var(--shadow-glow-red); }

.btn-warning {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    color: white;
}

.btn-warning:hover { filter: brightness(1.1); }

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
}

.btn-whatsapp:hover { filter: brightness(1.1); }

.btn-full { width: 100%; justify-content: center; }

.auth-button { width: 100%; justify-content: center; }

/* ===== COMMON ===== */
.info {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 10px 14px;
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--team1-primary);
}

.text-center { text-align: center; color: var(--text-muted); }

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

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

.input-group input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--team1-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-group input::placeholder { color: var(--text-muted); }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.form-feedback {
    font-size: 0.85rem;
    margin-top: 8px;
    color: var(--live-green);
    display: none;
}

.form-feedback.visible { display: block; }

.radio-group {
    display: flex;
    gap: 16px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.radio-group input[type="radio"] { accent-color: var(--team1-primary); }

/* ===== MATCHES PAGE ===== */
.match-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    margin-bottom: 10px;
    transition: var(--transition);
    border-left: 4px solid var(--border-color);
}

.match-item:hover {
    border-color: var(--text-muted);
    background: var(--bg-tertiary);
}

.match-item.pending { border-left-color: var(--team1-primary); opacity: 0.75; }
.match-item.live {
    border-left-color: var(--live-green);
    box-shadow: var(--shadow-glow-green);
}
.match-item.completed { border-left-color: var(--text-muted); }

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.match-info { flex: 1; }

.match-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.match-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.match-status {
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.match-status-pending {
    background: rgba(59, 130, 246, 0.15);
    color: var(--team1-light);
}

.match-status-live {
    background: var(--live-green-bg);
    color: var(--live-green);
    animation: pulse 2s infinite;
}

.match-status-completed {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

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

.match-info h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.match-actions { display: flex; gap: 8px; }

.winner {
    font-size: 0.8rem;
    color: var(--accent-gold);
    font-weight: 600;
    margin-top: 4px;
}

.match-controls { display: flex; gap: 4px; }

/* ===== LIVE SCOREBOARD — SPLIT SCREEN ===== */
.scoreboard {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-xl);
}

.scoreboard-header {
    background: var(--bg-primary);
    padding: 16px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.scoreboard-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.scoreboard-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

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

.scoreboard-sets {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
}

.set-counter {
    text-align: center;
    padding: 6px 20px;
    border-radius: var(--radius-lg);
}

.set-counter.team1 { background: rgba(59, 130, 246, 0.15); }
.set-counter.team2 { background: rgba(239, 68, 68, 0.15); }

.set-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.set-value {
    font-size: 1.5rem;
    font-weight: 900;
}

.set-counter.team1 .set-value { color: var(--team1-primary); }
.set-counter.team2 .set-value { color: var(--team2-primary); }

/* Fullscreen scoreboard */
.scoreboard-fullscreen {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.scoreboard-fullscreen .scoreboard-main {
    flex: 1;
}

.live-badge-inline {
    display: inline-block;
    background: var(--live-green);
    color: white;
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    animation: pulse 2s infinite;
    margin-bottom: 8px;
}

/* Split screen main area */
.scoreboard-main {
    display: flex;
    min-height: 300px;
}

.team-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

.team-card.team1 {
    background: linear-gradient(135deg, var(--team1-dark), var(--team1-darker));
    border-right: 3px solid var(--accent-gold);
}

.team-card.team2 {
    background: linear-gradient(135deg, var(--team2-darker), var(--team2-dark));
}

.scoreboard-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    background: var(--bg-primary);
    border-left: 3px solid var(--accent-gold);
    border-right: 3px solid var(--accent-gold);
    padding: 20px 16px;
    gap: 4px;
}

.scoreboard-center-vs {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.2em;
}

.scoreboard-center-sets {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
}

.scoreboard-center-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.scoreboard-center-setinfo {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-top: 8px;
}

.scoreboard-center-duration {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.team-sets-won {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.team-card.winner {
    box-shadow: inset 0 0 40px rgba(245, 158, 11, 0.15);
}

.winner-tag {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gold);
    color: var(--text-dark);
    padding: 2px 12px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.team-card .team-name {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.team-card.team1 .team-name { color: var(--team1-light); }
.team-card.team2 .team-name { color: var(--team2-light); }

.team-name--medium { font-size: 0.95rem; }
.team-name--small { font-size: 0.85rem; }
.team-name--xsmall { font-size: 0.75rem; }

.team-points {
    font-size: 18vw;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
}

.team-card.team1 .team-points { color: var(--team1-primary); text-shadow: 0 0 30px rgba(59, 130, 246, 0.4); }
.team-card.team2 .team-points { color: var(--team2-primary); text-shadow: 0 0 30px rgba(239, 68, 68, 0.4); }

.team-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scoreboard-meta {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 14px 24px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.meta-item { text-align: center; }

.meta-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.winner-banner {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    color: var(--text-dark);
    text-align: center;
    padding: 14px;
    border-radius: var(--radius-xl);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Sets table */
.sets-table {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 1.5rem;
}

.sets-table h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

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

.sets-table th {
    background: var(--bg-primary);
    color: var(--text-muted);
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}

.sets-table td {
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.sets-table tr.set-current td { color: var(--live-green); font-weight: 600; }
.sets-table tr.set-complete td { color: var(--text-muted); }

/* ===== POINTS TIMELINE ===== */
.points-timeline {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 1.5rem;
}

.points-timeline.live { border-color: var(--live-green); }

.points-timeline h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.points-timeline-content { display: flex; flex-direction: column; gap: 16px; }

.timeline-legend {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.legend-item, .team-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.legend-dot, .team-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.team1, .team-dot.team1 { background: var(--team1-primary); }
.legend-dot.team2, .team-dot.team2 { background: var(--team2-primary); }

.timeline-sets { display: flex; flex-direction: column; gap: 12px; }

.set-timeline {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
}

.set-timeline-live {
    border-color: var(--live-green);
    box-shadow: var(--shadow-glow-green);
}

.set-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.set-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.set-score {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
}

.set-score span { color: var(--text-muted); margin: 0 4px; }

.set-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.timeline-team-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* timeline-sequence is defined below with point-circle */

.timeline-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 12px;
}

/* Point badges (kept for stats page compatibility) */
.point-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: default;
}

.point-badge.team1 { background: rgba(59, 130, 246, 0.2); color: var(--team1-light); }
.point-badge.team2 { background: rgba(239, 68, 68, 0.2); color: var(--team2-light); }
.point-badge.latest { outline: 2px solid var(--live-green); outline-offset: 1px; }

/* Point circles (timeline) */
.point-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    border-radius: var(--radius-full);
    cursor: default;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    padding: 2px 6px;
    transition: transform 0.15s ease;
    line-height: 1;
}

.point-circle:hover {
    transform: scale(1.15);
    z-index: 1;
}

.point-circle.team1 { background: var(--team1-primary); }
.point-circle.team2 { background: var(--team2-primary); }

.point-circle.latest {
    outline: 2px solid var(--live-green);
    outline-offset: 1px;
    box-shadow: 0 0 8px var(--live-green);
}

.timeline-sequence {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* ===== STANDINGS — PODIUM + TABLE ===== */
.standings-table { margin-bottom: 1.5rem; }

.standings-actions, .stats-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.standings-table-wrapper { overflow-x: auto; }

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

.standings-table-wrapper th {
    background: var(--bg-primary);
    color: var(--text-muted);
    padding: 10px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    white-space: nowrap;
}

.standings-table-wrapper td {
    padding: 12px 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.standings-row:hover td { background: rgba(59, 130, 246, 0.05); }

.standings-gold { border-left: 3px solid var(--accent-gold); }
.standings-silver { border-left: 3px solid #9ca3af; }
.standings-bronze { border-left: 3px solid var(--accent-gold-dark); }

.standings-gold td:first-child,
.standings-silver td:first-child,
.standings-bronze td:first-child { font-weight: 800; }

.rank-badge {
    font-weight: 800;
    color: var(--text-primary);
}

.standings-gold .rank-badge { color: var(--accent-gold); }
.standings-silver .rank-badge { color: #9ca3af; }
.standings-bronze .rank-badge { color: var(--accent-gold-dark); }

.standings-team .team-name { font-weight: 700; color: var(--text-primary); }

.points-pill {
    background: linear-gradient(135deg, var(--team1-primary), #2563eb);
    color: white;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
}

.stat-line { display: flex; align-items: center; gap: 6px; }
.stat-line-main { font-weight: 600; color: var(--text-primary); }
.stat-line-diff { font-size: 0.8rem; font-weight: 600; }
.stat-line-diff.positive { color: var(--live-green); }
.stat-line-diff.negative { color: var(--team2-primary); }

.standings-info {
    margin-top: 1.5rem;
    padding: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.standings-info h3 { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 10px; }

.standings-info ul {
    list-style: none;
    padding: 0;
}

.standings-info li {
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.standings-info li:last-child { border-bottom: none; }
.standings-info strong { color: var(--text-secondary); }

/* ===== STATS PAGE ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 900;
    color: var(--team1-primary);
    margin: 0;
}

.team-stats-section {
    margin-bottom: 1.5rem;
}

.team-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 18px;
}

.team-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.team-stat-header h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

.team-stat-record {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.team-stat-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stat-pill {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    color: var(--team1-light);
}

.stat-pill.matches {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.team-stat-results { margin-bottom: 12px; }

.team-results-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.no-team-results {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.team-stat-details { display: flex; flex-direction: column; gap: 6px; }

.team-stat-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.team-stat-detail:last-child { border-bottom: none; }

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
}

.diff.positive { color: var(--live-green); }
.diff.negative { color: var(--team2-primary); }

/* Team stats grid inside stats page */
.team-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

/* Match history cards (stats page) */
.match-history-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin-bottom: 16px;
    overflow: hidden;
}

.match-history-card.completed { border-left: 4px solid var(--text-muted); }
.match-history-card.live { border-left: 4px solid var(--live-green); }
.match-history-card.pending { border-left: 4px solid var(--team1-primary); }

.match-history-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
}

.match-history-header strong {
    color: var(--text-primary);
}

.match-history-header > div:first-child {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    word-break: break-word;
}

.match-history-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.match-history-meta span {
    font-weight: 600;
}

.match-history-body {
    padding: 16px 20px;
}

.match-history-body .points-timeline {
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.empty-points {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: 12px;
}

/* Export mode */
.standings-export-mode {
    padding: 24px !important;
    background: #ffffff !important;
    color: #0f172a !important;
}

.standings-export-mode * {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

.standings-export-mode h2 {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: #0f172a !important;
}

.standings-export-mode .standings-table-wrapper th {
    background: #f1f5f9 !important;
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

.standings-export-mode .standings-table-wrapper td {
    border-bottom-color: #e2e8f0 !important;
    color: #334155 !important;
    -webkit-text-fill-color: #334155 !important;
}

.standings-export-mode .points-pill {
    -webkit-text-fill-color: white !important;
    color: white !important;
}

.standings-export-mode .rank-badge { -webkit-text-fill-color: inherit !important; }
.standings-export-mode .standings-gold .rank-badge { color: #d97706 !important; -webkit-text-fill-color: #d97706 !important; }
.standings-export-mode .standings-silver .rank-badge { color: #6b7280 !important; -webkit-text-fill-color: #6b7280 !important; }
.standings-export-mode .standings-bronze .rank-badge { color: #b45309 !important; -webkit-text-fill-color: #b45309 !important; }

.standings-export-mode .stat-line-diff.positive { color: #16a34a !important; -webkit-text-fill-color: #16a34a !important; }
.standings-export-mode .stat-line-diff.negative { color: #dc2626 !important; -webkit-text-fill-color: #dc2626 !important; }

/* ===== REGULATIONS ===== */
.regulation-card { color: var(--text-secondary); }

.regulation-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-gold);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.regulation-section h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 10px;
}

.regulation-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

.regulation-list {
    list-style: none;
    padding: 0;
}

.regulation-list li {
    padding: 6px 0 6px 20px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.regulation-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-gold);
    font-weight: 700;
}

.regulation-list strong { color: var(--text-primary); }

.regulation-contact {
    border-left-color: var(--live-green);
}

/* ===== ADMIN ===== */
.admin-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-gold);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
}

.admin-section h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.admin-section h4 {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    transition: var(--transition);
}

.team-item span { color: var(--text-primary); font-size: 0.9rem; }
.team-item strong { color: var(--text-primary); }

.team-item button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.team-item button:hover { background: rgba(239, 68, 68, 0.2); }

/* Admin match items */
.admin-match-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.admin-match-item.pending { border-left: 4px solid var(--team1-primary); }
.admin-match-item.live { border-left: 4px solid var(--live-green); background: rgba(34, 197, 94, 0.05); }
.admin-match-item.completed { border-left: 4px solid var(--text-muted); }

.admin-match-info { flex: 1; }
.admin-match-info h4 { margin: 0 0 4px 0; color: var(--text-primary); font-size: 0.95rem; }
.admin-match-info p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

.admin-match-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Admin live controls */
.admin-live-scoreboard {
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 24px;
    color: white;
    margin-bottom: 20px;
}

.admin-live-teams {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-live-team { text-align: center; }
.admin-live-team h4 { margin: 0 0 12px 0; font-size: 1.1rem; color: var(--text-primary); }

.admin-live-score {
    font-size: 3rem;
    font-weight: 900;
    margin: 12px 0;
    color: var(--text-primary);
}

.admin-live-team button { margin-top: 12px; }

.points-timeline.admin-live-timeline { margin-top: 24px; }
.points-timeline.admin-live-timeline h3 { font-size: 1.15rem; }

/* ===== SCORE CONTROL (ADMIN LIVE) ===== */
.score-header {
    text-align: center;
    margin-bottom: 20px;
}

.score-status {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--live-green);
    margin-bottom: 4px;
}

.score-set-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.score-teams {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 16px;
}

.score-team-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 3px solid transparent;
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    min-height: 140px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.score-team-btn:active:not(:disabled) {
    transform: scale(0.96);
}

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

.team1-btn {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.05));
    border-color: var(--team1-primary);
}

.team1-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25), rgba(37, 99, 235, 0.1));
    box-shadow: 0 0 25px rgba(37, 99, 235, 0.3);
}

.team2-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-color: var(--team2-primary);
}

.team2-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.1));
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.3);
}

.score-team-name {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.team1-btn .score-team-name { color: var(--team1-primary); }
.team2-btn .score-team-name { color: var(--team2-primary); }

.score-team-points {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.score-team-hint {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    opacity: 0.6;
}

.score-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.score-sets {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
}

.score-sets-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.score-undo-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 2px dashed var(--accent-gold);
    border-radius: var(--radius-lg);
    color: var(--accent-gold);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.score-undo-btn:hover {
    background: rgba(245, 158, 11, 0.2);
}

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

/* ===== RESPONSIVE — TABLET (iPad) ===== */
@media (max-width: 1024px) and (min-width: 769px) {
    body { padding: 1rem; }

    header { padding: 1.25rem 1.5rem; }
    header h1 { font-size: 1.5rem; }

    .nav-btn { padding: 0.6rem 1rem; font-size: 0.8rem; }

    .card { padding: 1.25rem; }

    /* Scoreboard pe tablet — pastram split dar ajustam */
    .scoreboard-fullscreen { min-height: calc(100vh - 150px); }
    .team-points { font-size: 14vw; }
    .team-card .team-name { font-size: 1rem; }
    .scoreboard-center { min-width: 90px; padding: 16px 12px; }
    .scoreboard-center-sets { font-size: 1.75rem; }

    /* Score control */
    .score-team-points { font-size: 3rem; }

    /* Stats */
    .team-stats-section { grid-template-columns: repeat(2, 1fr); }
}

/* ===== RESPONSIVE — MOBIL ===== */
@media (max-width: 768px) {
    body { padding: 0.5rem; }

    /* Header compact */
    header { padding: 0.75rem 1rem; border-radius: var(--radius-xl); margin-bottom: 0.75rem; }
    header h1 { font-size: 1.15rem; margin-bottom: 0.75rem; }

    /* Ascunde nav desktop, arata doar quick actions */
    nav { display: none; }

    .mobile-quick-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-top: 10px;
    }

    .mobile-quick-action {
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 12px 6px;
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
        transition: var(--transition);
        text-align: center;
    }

    .mobile-quick-action:hover,
    .mobile-quick-action.active {
        background: var(--team1-primary);
        color: white;
        border-color: var(--team1-primary);
    }

    .mobile-quick-action-admin {
        background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
        color: white;
        border-color: var(--accent-gold);
    }

    .mobile-quick-action-admin:hover,
    .mobile-quick-action-admin.active {
        background: linear-gradient(135deg, var(--accent-gold-dark), var(--accent-gold-darker));
        border-color: var(--accent-gold-dark);
    }

    /* Auth bar */
    .auth-bar {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .auth-panel { right: auto; left: 50%; transform: translateX(-50%); width: calc(100vw - 2rem); max-width: 320px; }
    .theme-toggle span:last-child { display: none; }

    /* Cards */
    .card { padding: 1rem; border-radius: var(--radius-xl); }

    /* Scoreboard pe mobil */
    .scoreboard-fullscreen { min-height: auto; }
    .scoreboard-main { min-height: 200px; flex-direction: column; }
    .team-card.team1 { border-right: none; border-bottom: 3px solid var(--accent-gold); }
    .team-card { padding: 20px 10px; }
    .team-points { font-size: 18vw; }
    .team-card .team-name { font-size: 0.8rem; letter-spacing: 0.05em; }
    .team-sets-won { font-size: 0.6rem; }

    /* Scoreboard header pe mobil */
    .scoreboard-header { padding: 12px 14px; }
    .scoreboard-title h2 { font-size: 0.9rem; }
    .scoreboard-title p { font-size: 0.75rem; }
    .scoreboard-subtitle { font-size: 0.65rem; }
    .scoreboard-sets { gap: 10px; margin-top: 8px; }
    .set-counter { padding: 4px 10px; }
    .set-label { font-size: 0.55rem; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; max-width: 120px; white-space: nowrap; }
    .set-value { font-size: 1.3rem; }

    /* Scoreboard meta pe mobil */
    .scoreboard-meta { gap: 20px; padding: 10px 14px; }
    .meta-label { font-size: 0.6rem; }
    .meta-value { font-size: 0.9rem; }

    /* Scor pe seturi tabel pe mobil */
    .sets-table { padding: 12px; }
    .sets-table h3 { font-size: 0.9rem; }
    .sets-table table { font-size: 0.7rem; }
    .sets-table th { padding: 6px 6px; font-size: 0.55rem; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sets-table td { padding: 6px 6px; font-size: 0.75rem; }

    /* Live controls bar pe mobil */
    .live-controls-bar { gap: 6px; padding: 8px 0; }
    .btn-scoreboard-mode { padding: 8px 12px; font-size: 0.75rem; }
    .btn-qr-share, .btn-sound-toggle { padding: 6px 10px; font-size: 0.7rem; }

    /* Winner banner pe mobil */
    .winner-banner { font-size: 0.9rem; padding: 10px; }

    /* Admin */
    .admin-match-item { flex-direction: column; align-items: stretch; }
    .admin-match-actions { width: 100%; }
    .admin-match-actions button { flex: 1; }
    .admin-live-teams { flex-direction: column; gap: 16px; }

    /* Score control pe mobil */
    .score-team-btn { min-height: 100px; padding: 14px 10px; }
    .score-team-points { font-size: 2.5rem; }
    .score-vs { min-width: 36px; }
    .score-sets { font-size: 1.1rem; }
    .score-teams { gap: 8px; }

    /* Meciuri */
    .match-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .match-actions { width: 100%; }
    .match-actions .btn { width: 100%; justify-content: center; }

    /* Standings */
    .standings-table-wrapper { margin: 0 -1rem; }
    .standings-table-wrapper table { font-size: 0.8rem; }
    .standings-table-wrapper th,
    .standings-table-wrapper td { padding: 8px 10px; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .team-stats-section { grid-template-columns: 1fr; }

    .teams-grid { grid-template-columns: 1fr; }
    .team-stats-grid { grid-template-columns: 1fr; }

    .match-history-header { flex-direction: column; align-items: flex-start; }
    .match-history-body { padding: 12px; }

    .standings-actions, .stats-actions { flex-direction: column; }
    .standings-actions .btn, .stats-actions .btn { width: 100%; justify-content: center; }
}

/* ===== RESPONSIVE — LANDSCAPE (orice ecran rotit) ===== */
/* Landscape fullscreen scor — doar pe telefon/tableta, NU pe desktop */
@media (orientation: landscape) and (max-width: 1024px) and (max-height: 600px) {
    header { display: none !important; }
    .auth-bar { display: none !important; }
    body { padding: 0 !important; overflow: hidden; }

    .container { max-width: 100%; }
    .view.active { padding: 0; }
    .card { padding: 0; margin: 0; border: none; border-radius: 0; box-shadow: none; background: transparent; }

    #view-live { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999; background: var(--bg-primary); }

    .scoreboard { border: none; border-radius: 0; box-shadow: none; }
    .scoreboard-fullscreen { min-height: 100vh !important; height: 100vh; border-radius: 0; }

    .scoreboard-header { display: none !important; }
    .scoreboard-meta { display: none !important; }

    .scoreboard-main { min-height: 100vh !important; flex: 1; flex-direction: row !important; }
    .team-card.team1 { border-right: 3px solid var(--accent-gold) !important; border-bottom: none !important; }

    .team-card { padding: 0 !important; }
    .team-points { font-size: 42vh !important; }
    .team-card .team-name { font-size: 2.5vw; margin-bottom: 0; }
    .team-meta { display: none; }
    .winner-tag { font-size: 1.5vw; }

    #live-match-container .sets-table,
    #live-match-container .points-timeline,
    #live-match-container .winner-banner { display: none; }
}

/* Landscape pe iPad */
@media (orientation: landscape) and (min-width: 1025px) and (max-height: 900px) {
    .scoreboard-fullscreen { min-height: calc(100vh - 140px); }
    .team-points { font-size: 14vw; }
}

/* ===== RESPONSIVE — TELEFON MIC ===== */
@media (max-width: 480px) {
    header h1 { font-size: 1rem; margin-bottom: 0.5rem; }
    .mobile-quick-actions { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .mobile-quick-action { padding: 10px 4px; font-size: 0.7rem; }
    .team-points { font-size: 14vw; }
    .scoreboard-center { min-width: 40px; padding: 8px 6px; }
    .scoreboard-center-sets { font-size: 1.1rem; }
    .score-team-points { font-size: 2rem; }
    .score-team-btn { min-height: 80px; padding: 10px 8px; }
    .score-team-name { font-size: 0.7rem; }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
}

.theme-toggle:hover {
    border-color: var(--accent-gold);
    color: var(--text-primary);
}

.theme-toggle-icon { font-size: 1rem; }

/* ===== LIGHT THEME SPECIFICS ===== */
:root:not([data-theme="dark"]) .team-card.team1 {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

:root:not([data-theme="dark"]) .team-card.team2 {
    background: linear-gradient(135deg, #fecaca, #fee2e2);
}

:root:not([data-theme="dark"]) .team-card.team1 .team-name { color: #1e40af; }
:root:not([data-theme="dark"]) .team-card.team2 .team-name { color: #991b1b; }

:root:not([data-theme="dark"]) .team-card.team1 .team-points { color: #2563eb; text-shadow: none; }
:root:not([data-theme="dark"]) .team-card.team2 .team-points { color: #dc2626; text-shadow: none; }

:root:not([data-theme="dark"]) .team-card.team1 .team-meta,
:root:not([data-theme="dark"]) .team-card.team2 .team-meta { color: #64748b; }

:root:not([data-theme="dark"]) .winner-tag {
    background: var(--accent-gold);
    color: white;
}

:root:not([data-theme="dark"]) .admin-live-scoreboard {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

:root:not([data-theme="dark"]) .point-badge.team1 { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
:root:not([data-theme="dark"]) .point-badge.team2 { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }

:root:not([data-theme="dark"]) .set-counter.team1 { background: rgba(37, 99, 235, 0.08); }
:root:not([data-theme="dark"]) .set-counter.team2 { background: rgba(220, 38, 38, 0.08); }

:root:not([data-theme="dark"]) .auth-status-role { color: #ffffff; }

:root:not([data-theme="dark"]) .match-item { background: #ffffff; }
:root:not([data-theme="dark"]) .match-item:hover { background: #f8fafc; }

:root:not([data-theme="dark"]) .stat-pill { background: rgba(37, 99, 235, 0.1); color: #2563eb; }

:root:not([data-theme="dark"]) .regulation-section { background: #ffffff; }

:root:not([data-theme="dark"]) .admin-section { background: #ffffff; }

:root:not([data-theme="dark"]) .set-timeline { background: #f8fafc; }

:root:not([data-theme="dark"]) .stat-card { background: #f8fafc; }
:root:not([data-theme="dark"]) .team-stat-card { background: #f8fafc; }

:root:not([data-theme="dark"]) .standings-info { background: #f8fafc; }

:root:not([data-theme="dark"]) .scoreboard-center { background: #f8fafc; }
:root:not([data-theme="dark"]) .live-badge-bar { background: #f1f5f9; }

/* Dark theme overrides */
[data-theme="dark"] .team-card.team1 {
    background: linear-gradient(135deg, #1e3a5f, #172554);
}

[data-theme="dark"] .team-card.team2 {
    background: linear-gradient(135deg, #3b1323, #450a0a);
}

[data-theme="dark"] .team-card.team1 .team-name { color: #93c5fd; }
[data-theme="dark"] .team-card.team2 .team-name { color: #fca5a5; }

[data-theme="dark"] .team-card.team1 .team-points { color: #3b82f6; text-shadow: 0 0 30px rgba(59, 130, 246, 0.4); }
[data-theme="dark"] .team-card.team2 .team-points { color: #ef4444; text-shadow: 0 0 30px rgba(239, 68, 68, 0.4); }

[data-theme="dark"] .admin-live-scoreboard {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
}

[data-theme="dark"] .point-badge.team1 { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
[data-theme="dark"] .point-badge.team2 { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

[data-theme="dark"] header {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] header h1 {
    background: linear-gradient(135deg, #3b82f6, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== SCOREBOARD MODE (MOD TABLA) ===== */
.scoreboard-mode {
    background: #0a0f1a !important;
    overflow: hidden !important;
}

.scoreboard-mode .auth-bar,
.scoreboard-mode header,
.scoreboard-mode .view:not(#view-live),
.scoreboard-mode #view-live .sets-table,
.scoreboard-mode #view-live .points-timeline,
.scoreboard-mode #view-live .winner-banner,
.scoreboard-mode .scoreboard-header,
.scoreboard-mode .scoreboard-meta,
.scoreboard-mode .btn-scoreboard-mode,
.scoreboard-mode .btn-sound-toggle,
.scoreboard-mode .btn-qr-share,
.scoreboard-mode .refresh-indicator {
    display: none !important;
}

.scoreboard-mode .container { max-width: 100%; padding: 0; }
.scoreboard-mode .card { padding: 0; margin: 0; border: none; border-radius: 0; box-shadow: none; background: transparent; }

.scoreboard-mode .scoreboard {
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh !important;
    height: 100vh;
}

.scoreboard-mode .scoreboard-main {
    min-height: 100vh !important;
    height: 100vh;
}

.scoreboard-mode .team-card {
    background: #0a0f1a !important;
    padding: 10px !important;
}

.scoreboard-mode .team-card.team1 {
    background: linear-gradient(135deg, #0c1929, #0f2240) !important;
    border-right: 4px solid #f59e0b !important;
    border-bottom: none !important;
}

.scoreboard-mode .team-card.team2 {
    background: linear-gradient(135deg, #200a0a, #2d0f0f) !important;
}

.scoreboard-mode .team-points {
    font-size: 38vh !important;
    color: #ffffff !important;
    text-shadow: 0 0 40px rgba(255,255,255,0.2) !important;
}

.scoreboard-mode .team-card .team-name {
    font-size: 2.5vw !important;
    color: #ffffff !important;
    opacity: 0.9;
}

.scoreboard-mode .team-meta {
    display: none !important;
}

.scoreboard-mode .scoreboard-mode-sets {
    display: flex !important;
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    padding: 6px 20px;
    border-radius: 20px;
    color: #f59e0b;
    font-size: 2vh;
    font-weight: 800;
    letter-spacing: 0.1em;
    z-index: 10000;
}

.scoreboard-mode-sets {
    display: none;
}

/* Portrait scoreboard mode */
@media (orientation: portrait) {
    .scoreboard-mode .scoreboard-main {
        flex-direction: column !important;
    }
    .scoreboard-mode .team-card.team1 {
        border-right: none !important;
        border-bottom: 4px solid #f59e0b !important;
    }
    .scoreboard-mode .team-points {
        font-size: 30vw !important;
    }
    .scoreboard-mode .team-card .team-name {
        font-size: 4vw !important;
    }
}

/* Scoreboard mode button */
.btn-scoreboard-mode {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #f59e0b;
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-scoreboard-mode:hover {
    background: #f59e0b;
    color: #0f172a;
}

/* ===== SPECTATOR MODE ===== */
.spectator-active .auth-bar,
.spectator-active header,
.spectator-active .view {
    display: none !important;
}

.spectator-active #spectator-container {
    display: block !important;
}

#spectator-container {
    display: none;
}

.spectator-scoreboard {
    min-height: calc(100vh - 60px);
}

.spectator-footer {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.spectator-footer a {
    color: var(--team1-primary);
    text-decoration: none;
    font-weight: 600;
}

.spectator-no-match {
    padding: 2rem;
}

.spectator-no-match h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* QR Modal */
.qr-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.qr-modal-overlay.open {
    display: flex;
}

.qr-modal {
    background: #ffffff;
    border-radius: var(--radius-2xl);
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.qr-modal h3 {
    color: #0f172a;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.qr-modal #qr-code {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.qr-modal .qr-url {
    font-size: 0.75rem;
    color: #64748b;
    word-break: break-all;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-family: monospace;
}

.qr-modal button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

/* QR share and sound buttons */
.live-controls-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 12px 0;
}

.btn-qr-share,
.btn-sound-toggle {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-qr-share:hover,
.btn-sound-toggle:hover {
    border-color: var(--team1-primary);
    color: var(--text-primary);
}

/* Refresh indicator */
.refresh-indicator {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 4px 0;
    opacity: 0.7;
}

/* ===== FLIP ANIMATION ===== */
.team-points {
    perspective: 600px;
}

.team-points-inner {
    display: inline-block;
    transition: none;
}

@keyframes flipOut {
    0% { transform: rotateX(0); opacity: 1; }
    100% { transform: rotateX(90deg); opacity: 0; }
}

@keyframes flipIn {
    0% { transform: rotateX(-90deg); opacity: 0; }
    100% { transform: rotateX(0); opacity: 1; }
}

.flip-out {
    animation: flipOut 0.2s ease-in forwards;
}

.flip-in {
    animation: flipIn 0.2s ease-out forwards;
}

/* Team scored flash */
@keyframes teamScored {
    0% { box-shadow: inset 0 0 0 rgba(245, 158, 11, 0); }
    50% { box-shadow: inset 0 0 60px rgba(245, 158, 11, 0.3); }
    100% { box-shadow: inset 0 0 0 rgba(245, 158, 11, 0); }
}

.team-scored {
    animation: teamScored 0.6s ease-out;
}
