* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none !important;
}

/* Match Options / Toggle */
.match-options {
    margin-bottom: 15px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background: #2a5298;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(20px);
}

/* Team Setup */
.team-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.team-config h3 {
    margin-bottom: 15px;
    color: #2a5298;
    font-size: 1.5rem;
}

.team-config select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.team-config input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1.1rem;
}

.ratings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ratings-grid label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.ratings-grid input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-primary {
    background: #28a745;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Scoreboard */
.scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: start;
    margin-bottom: 20px;
}

.team {
    text-align: center;
}

.team h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

/* Team name colors are now set dynamically via JavaScript */

.score {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 15px;
}

/* Score colors inherit from team name colors */

.team-info {
    font-size: 0.9rem;
    text-align: left;
}

.match-info {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    min-width: 200px;
}

.time-display {
    font-size: 3rem;
    font-weight: bold;
    color: #2a5298;
    margin-bottom: 10px;
}

.half-display {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 10px;
}

.added-time {
    font-size: 1rem;
    color: #666;
    margin-top: 10px;
}

.added-time span {
    font-weight: bold;
    color: #dc3545;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-controls button {
    flex: 1;
    max-width: 300px;
}

/* Event Log */
#event-log h2 {
    margin-bottom: 20px;
    color: #2a5298;
}

#events-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.event {
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #2a5298;
    background: #f8f9fa;
    border-radius: 4px;
}

.event-time {
    font-weight: bold;
    color: #2a5298;
    margin-right: 10px;
}

.event-goal {
    border-left-color: #28a745;
    background: #d4edda;
}

.event-card {
    border-left-color: #ffc107;
    background: #fff3cd;
}

.event-red-card {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.event-substitution {
    border-left-color: #6f42c1;
    background: #e7d6f8;
}

.event-injury {
    border-left-color: #fd7e14;
    background: #ffe5d0;
}

.event-pitch-battle {
    border-left-color: #ffc107;
}

.event-attack {
    border-left-color: #17a2b8;
}

/* Cards Display */
.cards-display {
    margin-top: 10px;
}

.card-icon {
    display: inline-block;
    padding: 3px 8px;
    margin-right: 5px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}

.yellow-card {
    background: #ffc107;
    color: #000;
}

.red-card {
    background: #dc3545;
    color: white;
}

/* Goal Scorers Display */
#home-scorers, #away-scorers {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.scorers-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2a5298;
    font-size: 0.9rem;
}

.scorer-item {
    font-size: 0.85rem;
    margin-bottom: 4px;
    padding: 3px 0;
}

.scorer-minute {
    color: #666;
    font-weight: bold;
    margin-right: 5px;
}

.booked-players {
    margin-top: 10px;
    font-size: 0.85rem;
}

.booked-player {
    margin-bottom: 3px;
}

/* Match Summary */
#match-summary {
    max-width: 900px;
    margin: 0 auto;
}

.summary-section {
    margin-bottom: 25px;
}

.summary-section h3 {
    color: #2a5298;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2a5298;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.summary-team {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.summary-team h4 {
    margin-bottom: 12px;
    color: #333;
}

.summary-list {
    list-style: none;
}

.summary-list li {
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.summary-list li:last-child {
    border-bottom: none;
}

.final-score {
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
}

/* Final score colors are now set dynamically via JavaScript */

#close-summary {
    margin-top: 20px;
}

/* Play-by-Play Section */
.play-by-play-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

.play-by-play-section h3 {
    color: #2a5298;
    margin-bottom: 15px;
}

#play-by-play-text {
    width: 100%;
    height: 400px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

#copy-play-by-play {
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .team-setup-grid {
        grid-template-columns: 1fr;
    }

    .scoreboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .score {
        font-size: 3rem;
    }

    .action-controls {
        flex-direction: column;
    }

    .action-controls button {
        max-width: 100%;
    }
}

/* Scrollbar Styling */
#events-container::-webkit-scrollbar {
    width: 8px;
}

#events-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#events-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#events-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ---- Penalty shootout ---- */
.shootout-score {
    font-size: 1.5rem;
    text-align: center;
    margin: 8px 0 4px;
}
.shootout-status {
    text-align: center;
    margin: 4px 0 12px;
    color: #444;
}
.shootout-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.shootout-controls select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    min-width: 180px;
}
.shootout-log {
    max-width: 420px;
    margin: 0 auto 12px;
    padding-left: 28px;
}
.shootout-log li { padding: 2px 0; }
.shootout-log .so-goal { color: #2e7d32; }
.shootout-log .so-miss { color: #c62828; }
