* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a; color: #e2e8f0; min-height: 100vh; padding: 20px;
}
.container { max-width: 900px; margin: 0 auto; }
h1 { text-align: center; font-size: 1.8rem; margin-bottom: 24px; color: #f1c40f; }
h2 { font-size: 1.3rem; margin-bottom: 16px; color: #f8fafc; }
h3 { font-size: 1.05rem; margin-bottom: 12px; color: #94a3b8; }
.card {
    background: #1e293b; border-radius: 12px; padding: 24px; margin-bottom: 16px;
    border: 1px solid #334155; box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.subtitle { color: #94a3b8; margin-bottom: 16px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #cbd5e1; }
.player-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.player-inputs input {
    padding: 10px 14px; border: 1px solid #475569; border-radius: 8px;
    background: #0f172a; color: #e2e8f0; font-size: 0.95rem; width: 100%;
}
.player-inputs input:focus { outline: none; border-color: #3b82f6; }

.team-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.team-box {
    background: #0f172a; border: 2px solid #334155; border-radius: 10px;
    padding: 16px; text-align: center;
}
.team-box h3 { color: #f8fafc; margin-bottom: 10px; }
.team-box select {
    padding: 8px; border: 1px solid #475569; border-radius: 6px;
    background: #1e293b; color: #e2e8f0; font-size: 0.9rem;
}
.team-box span { color: #94a3b8; margin: 0 4px; }
.team-1 { border-color: #3b82f6; }
.team-2 { border-color: #ef4444; }

.btn {
    display: inline-block; padding: 10px 20px; border: none; border-radius: 8px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #475569; color: #fff; }
.btn-secondary:hover { background: #64748b; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm {
    width: 36px; height: 36px; border: 1px solid #475569; border-radius: 6px;
    background: #1e293b; color: #e2e8f0; font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.btn-sm:hover { background: #334155; }
.btn-group { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.round-badge {
    background: #3b82f6; color: #fff; padding: 6px 14px; border-radius: 20px;
    font-weight: 600; font-size: 0.9rem;
}

.stats-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: #0f172a; border-radius: 10px; padding: 14px; text-align: center;
    border: 1px solid #334155;
}
.stat-card strong { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #f8fafc; }
.team-1-bg { border-color: #3b82f6; }
.team-2-bg { border-color: #ef4444; }
.neutral-bg { border-color: #f1c40f; }

.score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score-field {
    background: #0f172a; border: 2px solid #334155; border-radius: 10px;
    padding: 14px; text-align: center;
}
.score-field label { display: block; margin-bottom: 8px; }
.score-field label strong { display: block; color: #f8fafc; }
.score-field label small { color: #64748b; font-size: 0.8rem; }
.team-1-border { border-color: #3b82f6; }
.team-2-border { border-color: #ef4444; }
.input-group { display: flex; align-items: center; justify-content: center; gap: 6px; }
.input-group input[type="number"] {
    width: 80px; padding: 8px; text-align: center; font-size: 1.1rem; font-weight: 600;
    border: 1px solid #475569; border-radius: 6px; background: #1e293b; color: #e2e8f0;
    -moz-appearance: textfield;
}
.input-group input[type="number"]::-webkit-outer-spin-button,
.input-group input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 8px 12px; text-align: center; border-bottom: 1px solid #334155; }
th { background: #0f172a; color: #94a3b8; font-weight: 600; }
tr:hover td { background: #1e293b; }
.total-row td { background: #1e293b; border-top: 2px solid #3b82f6; }
.team-1-text { color: #60a5fa; }
.team-2-text { color: #f87171; }

.final-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.result-card {
    background: #0f172a; border: 2px solid #334155; border-radius: 12px;
    padding: 20px; text-align: center; transition: transform 0.2s;
}
.result-card.winner { border-color: #f1c40f; transform: scale(1.03); }
.result-card h3 { color: #f8fafc; margin-bottom: 8px; }
.player-names { color: #94a3b8; margin-bottom: 12px; font-size: 0.9rem; line-height: 1.5; }
.big-score { font-size: 2.5rem; font-weight: 800; color: #f8fafc; }
.badge {
    display: inline-block; margin-top: 8px; padding: 4px 16px; border-radius: 20px;
    font-weight: 700; font-size: 0.85rem;
}
.win-badge { background: #f1c40f; color: #0f172a; }

.diff-info {
    background: #0f172a; border-radius: 10px; padding: 16px; margin-bottom: 20px;
    line-height: 1.8; font-size: 0.95rem;
}
.diff-info p { margin-bottom: 4px; }

.nav-links { text-align: center; margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; text-align: center;
}
.error { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }

@media (max-width: 600px) {
    .player-inputs, .team-setup, .score-inputs, .stats-summary, .final-stats { grid-template-columns: 1fr; }
}
