/* ═══════════════════════════════════════════════════════
   PADEL AMERICANA - Styles
   ══════════════════════════════════════════════════════ */

:root {
    --p1: #4f46e5;    /* Índigo */
    --p2: #0ea5e9;    /* Cielo */
    --p3: #10b981;    /* Esmeralda */
    --p4: #f59e0b;    /* Ámbar */

    --team-a: #4f46e5;
    --team-b: #10b981;

    --bg: #0f0f1a;
    --bg2: #161626;
    --bg3: #1e1e32;
    --card: #1e1e32;
    --card2: #252540;
    --border: rgba(255,255,255,0.08);
    --text: #f0f0ff;
    --text2: #9999bb;
    --text3: #6666aa;

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

    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-sm: 0 4px 16px rgba(0,0,0,0.3);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; }

/* ── Screens ────────────────────────────────────────── */
.screen {
    display: none;
    min-height: 100vh;
    position: relative;
    animation: fadeIn 0.35s ease;
}
.screen.active { display: block; }

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

/* ══════════════════════════════════════════════════════
   WELCOME SCREEN
══════════════════════════════════════════════════════ */
#screen-welcome {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1035 50%, #0f1a20 100%);
    display: flex;
    flex-direction: column;
}
#screen-welcome.active { display: flex; }

.welcome-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.court-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(79,70,229,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,70,229,0.06) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.welcome-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 20px;
    gap: 32px;
}

.logo-area {
    text-align: center;
}

.ball-icon {
    font-size: 64px;
    animation: bounce 2s ease-in-out infinite;
    display: block;
    margin-bottom: 12px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.app-title {
    font-size: clamp(36px, 10vw, 56px);
    font-weight: 900;
    letter-spacing: -2px;
    color: #fff;
    line-height: 1;
}
.app-title span {
    display: block;
    background: linear-gradient(90deg, var(--p1), var(--p2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    color: var(--text2);
    font-size: 15px;
    margin-top: 8px;
}

.welcome-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}

.welcome-card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

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

.rule-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rule-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: linear-gradient(135deg, var(--p1), var(--p2));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.rule-item span:last-child {
    font-size: 14px;
    color: var(--text2);
    line-height: 1.4;
}

/* ══════════════════════════════════════════════════════
   SETUP SCREEN
══════════════════════════════════════════════════════ */
#screen-setup {
    background: var(--bg);
    padding-bottom: 40px;
}

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.screen-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.btn-back {
    width: 40px; height: 40px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
}
.btn-back:hover { background: var(--card); }

.setup-content {
    padding: 24px 20px;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.setup-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.player-input-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
}
.player-input-card:focus-within {
    border-color: rgba(79,70,229,0.5);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.player-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.player-name-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    padding: 6px 4px;
    outline: none;
    transition: var(--transition);
}
.player-name-input::placeholder { color: var(--text3); }
.player-name-input:focus { border-bottom-color: var(--p1); }

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.option-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.option-card label {
    font-size: 13px;
    color: var(--text2);
    text-align: center;
}

.number-picker {
    display: flex;
    align-items: center;
    gap: 14px;
}

.number-picker button {
    width: 34px; height: 34px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.number-picker button:hover { background: var(--p1); border-color: var(--p1); }

.number-picker span {
    font-size: 26px;
    font-weight: 800;
    min-width: 32px;
    text-align: center;
}

.rotation-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    cursor: pointer;
    transition: var(--transition);
}

.radio-card input[type="radio"] {
    accent-color: var(--p1);
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.radio-card input[type="radio"]:checked ~ .radio-content strong {
    color: var(--p1);
}

.radio-card:has(input:checked) {
    border-color: var(--p1);
    background: rgba(79,70,229,0.08);
}

.radio-content { display: flex; flex-direction: column; gap: 4px; }
.radio-content strong { font-size: 15px; font-weight: 600; }
.radio-content span { font-size: 12px; color: var(--text2); line-height: 1.4; }

/* ══════════════════════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════════════════════ */
#screen-game {
    background: var(--bg);
    padding-bottom: 20px;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}

.round-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.round-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(90deg, var(--p1), var(--p2));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.game-count {
    font-size: 12px;
    color: var(--text2);
    padding-left: 4px;
}

.btn-menu {
    width: 40px; height: 40px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
}
.btn-menu:hover { background: var(--card); }

/* Scoreboard */
.scoreboard {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 20px 16px;
    gap: 12px;
}

.team {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.team::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.team-a::before { background: linear-gradient(90deg, var(--p1), var(--p2)); }
.team-b::before { background: linear-gradient(90deg, var(--p3), var(--p4)); }

.team.winning { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.06); }
.team-a.winning { border-color: rgba(79,70,229,0.4); background: rgba(79,70,229,0.06); }

.team-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text3);
}

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

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

.tp-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.tp-name {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tp-score {
    font-size: 11px;
    color: var(--text2);
}

.team-divider {
    font-size: 18px;
    color: var(--text3);
    font-weight: 700;
}

.team-total-score {
    font-size: 52px;
    font-weight: 900;
    line-height: 1;
    color: var(--text);
    letter-spacing: -2px;
}

.vs-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 50px;
}

.vs-text {
    font-size: 20px;
    font-weight: 900;
    color: var(--text3);
    letter-spacing: -1px;
}

.serve-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.serve-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

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

#serve-name {
    font-size: 10px;
    color: var(--text3);
    text-align: center;
    white-space: nowrap;
}

/* Score Controls */
.score-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px 16px;
}

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

.score-label {
    font-size: 12px;
    color: var(--text2);
    text-align: center;
}

.score-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-score {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-weight: 700;
}

.btn-score-minus {
    background: var(--card2);
    color: var(--text2);
}
.btn-score-minus:hover { background: var(--danger); color: #fff; }

.btn-score-plus {
    width: 56px; height: 56px;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.team-a-btn { background: linear-gradient(135deg, var(--p1), var(--p2)); }
.team-a-btn:hover { transform: scale(1.08); }
.team-b-btn { background: linear-gradient(135deg, var(--p3), var(--p4)); }
.team-b-btn:hover { transform: scale(1.08); }

.current-score {
    font-size: 42px;
    font-weight: 900;
    min-width: 44px;
    text-align: center;
    line-height: 1;
}

.score-divider-v {
    width: 1px;
    background: var(--border);
    height: 70px;
    flex-shrink: 0;
}

/* Games Progress */
.games-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 16px;
    justify-content: center;
}

.game-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text3);
    transition: var(--transition);
    position: relative;
}

.game-dot.win-a {
    background: rgba(79,70,229,0.2);
    border-color: var(--p1);
    color: var(--p1);
}
.game-dot.win-b {
    background: rgba(16,185,129,0.2);
    border-color: var(--p3);
    color: var(--p3);
}
.game-dot.current {
    border-color: var(--warning);
    color: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Game Footer */
.game-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 16px;
    gap: 12px;
}

.score-summary {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    text-align: center;
}

.btn-advance {
    flex-shrink: 0;
    padding: 10px 20px;
}

/* Live Scores */
.live-scores {
    margin: 0 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.live-scores h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-scores-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.live-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg2);
    border-radius: 8px;
}

.live-row-pos {
    font-size: 12px;
    font-weight: 700;
    color: var(--text3);
    min-width: 18px;
}

.live-row-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.live-row-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.live-row-score {
    font-size: 18px;
    font-weight: 800;
}

.live-row-bar {
    height: 4px;
    border-radius: 2px;
    min-width: 20px;
    max-width: 60px;
    transition: var(--transition);
}

/* ══════════════════════════════════════════════════════
   BETWEEN ROUNDS SCREEN
══════════════════════════════════════════════════════ */
#screen-between-rounds {
    background: var(--bg);
}

.between-content {
    padding: 32px 20px;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.between-header {
    text-align: center;
}

.round-complete-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
}

.between-header h2 {
    font-size: 26px;
    font-weight: 800;
}

.round-results {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.round-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.round-result-row:last-child { border-bottom: none; }

.rrr-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rrr-score-chip {
    background: var(--bg2);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 16px;
    font-weight: 800;
}
.rrr-score-chip.positive { background: rgba(16,185,129,0.15); color: var(--p3); }

.next-round-preview {
    background: var(--card);
    border: 2px solid var(--p1);
    border-radius: var(--radius);
    padding: 20px;
}

.nrp-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.nrp-matchup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
    font-size: 16px;
}

.nrp-team {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nrp-vs {
    font-size: 13px;
    color: var(--text3);
    font-weight: 800;
}

.between-actions {
    display: flex;
    gap: 12px;
}
.between-actions .btn { flex: 1; }

/* ══════════════════════════════════════════════════════
   PODIO SCREEN
══════════════════════════════════════════════════════ */
#screen-podium {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1035 100%);
    overflow: hidden;
}

.podium-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.confetti-container {
    position: absolute;
    inset: 0;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
    animation: confetti-fall linear forwards;
    border-radius: 2px;
}

@keyframes confetti-fall {
    to {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

.podium-content {
    position: relative;
    z-index: 1;
    padding: 32px 20px 40px;
    max-width: 520px;
    margin: 0 auto;
}

.podium-header {
    text-align: center;
    margin-bottom: 32px;
}

.trophy-icon {
    font-size: 64px;
    display: block;
    animation: trophy-bounce 1s ease-in-out;
}

@keyframes trophy-bounce {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.podium-header h1 {
    font-size: 32px;
    font-weight: 900;
    margin-top: 12px;
    letter-spacing: -1px;
}

.tournament-name {
    font-size: 14px;
    color: var(--text2);
    margin-top: 6px;
}

/* Podio Visual */
.podium-visual {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.podium-player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.podium-crown {
    font-size: 20px;
    display: block;
}

.podium-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    border: 3px solid transparent;
}

.podium-place.place-1 .podium-avatar {
    width: 64px; height: 64px;
    font-size: 20px;
    border-color: gold;
    box-shadow: 0 0 20px rgba(255,215,0,0.4);
}

.podium-player-name {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-score-label {
    font-size: 11px;
    color: var(--text2);
}

.podium-block {
    border-radius: 12px 12px 0 0;
    width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: rgba(255,255,255,0.9);
}

.podium-place.place-1 .podium-block {
    height: 110px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    width: 100px;
}

.podium-place.place-2 .podium-block {
    height: 80px;
    background: linear-gradient(180deg, #9ca3af, #6b7280);
}

.podium-place.place-3 .podium-block {
    height: 55px;
    background: linear-gradient(180deg, #b45309, #92400e);
}

/* Final Table */
.final-table-section {
    margin-bottom: 28px;
}

.final-table-section h3,
.history-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.final-table {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.final-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.final-row:last-child { border-bottom: none; }
.final-row:first-child { background: rgba(255,215,0,0.06); }

.final-pos {
    font-size: 18px;
    font-weight: 800;
    min-width: 28px;
    text-align: center;
}
.final-pos.p1 { color: gold; }
.final-pos.p2 { color: #9ca3af; }
.final-pos.p3 { color: #b45309; }

.final-name {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.final-breakdown {
    font-size: 12px;
    color: var(--text2);
    text-align: right;
}

.final-score {
    font-size: 24px;
    font-weight: 900;
    min-width: 40px;
    text-align: right;
}

/* History */
.history-section { margin-bottom: 28px; }

.history-round {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}

.history-round-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-game-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.history-game-row:last-child { border-bottom: none; }

.history-teams { color: var(--text2); font-size: 12px; }
.history-score-final { font-weight: 800; }

.podium-actions {
    display: flex;
    gap: 12px;
}
.podium-actions .btn { flex: 1; }

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--p1), var(--p2));
    color: #fff;
    box-shadow: 0 4px 20px rgba(79,70,229,0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(79,70,229,0.5); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--card2);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--card); }

.btn-danger {
    background: rgba(239,68,68,0.15);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

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

/* ══════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
}

.modal-wide { max-width: 480px; max-height: 85vh; overflow-y: auto; }

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

.modal-box h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.modal-header h3 { margin-bottom: 0; }

.btn-close-modal {
    width: 32px; height: 32px;
    background: var(--card2);
    border: none;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-close-modal:hover { background: var(--danger); }

.modal-result { text-align: center; gap: 12px; }
.modal-result-icon { font-size: 52px; }

.modal-result-btns {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.modal-result-btns .btn { flex: 1; }

.share-text-area {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    max-height: 300px;
    overflow-y: auto;
}

.share-text-area pre {
    font-family: 'Inter', monospace;
    font-size: 13px;
    color: var(--text2);
    white-space: pre-wrap;
    line-height: 1.6;
}

.copy-feedback {
    text-align: center;
    color: var(--success);
    font-weight: 600;
    font-size: 14px;
    padding: 4px;
}
.copy-feedback.hidden { display: none; }

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
}
.toast.hidden { display: none; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ══════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════ */
.hidden { display: none !important; }

.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text2); }

/* Responsive */
@media (max-width: 380px) {
    .scoreboard { padding: 14px 10px; gap: 8px; }
    .team { padding: 12px 8px; }
    .team-total-score { font-size: 42px; }
    .current-score { font-size: 36px; }
    .btn-score-plus { width: 50px; height: 50px; }
    .players-grid { grid-template-columns: 1fr 1fr; }
    .options-grid { grid-template-columns: 1fr; }
}

@media (min-width: 600px) {
    .scoreboard { padding: 24px 24px; gap: 20px; }
    .score-controls { padding: 0 24px 20px; }
    .game-footer { padding: 0 24px 20px; }
    .live-scores { margin: 0 24px; }
    .games-progress { padding: 0 24px 20px; }
}
