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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

main {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 30px;
}

.form-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.team-selection {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: end;
}

.vs {
    font-weight: bold;
    font-size: 1.5rem;
    color: #7f8c8d;
    text-align: center;
    padding-bottom: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4CAF50;
}

#playersList {
    margin-bottom: 15px;
}

.player-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.player-name {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.remove-player {
    padding: 10px 15px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.remove-player:hover {
    background: #d32f2f;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #4CAF50;
    color: white;
    width: 100%;
    font-weight: 600;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.payout-summary {
    margin-top: 15px;
    padding: 12px 15px;
    background: #f5f7fa;
    border-radius: 5px;
    color: #444;
    font-size: 15px;
}

.payout-summary.payout-negative {
    background: #ffebee;
    color: #c62828;
    font-weight: 600;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

.success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 20px;
    border-radius: 5px;
    margin-top: 20px;
    text-align: center;
}

.success h3 {
    margin-bottom: 10px;
}

.success .btn-primary {
    margin-top: 15px;
    width: auto;
    display: inline-block;
}

.extras-note {
    font-weight: 500;
    margin-top: 8px;
}

/* In-browser 10x10 board (home = columns, away = rows, like the PDF) */
.grid-section {
    margin-top: 25px;
    text-align: left;
}

.grid-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.grid-inner {
    display: inline-block;
    min-width: 100%;
}

.team-bar {
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 5px;
    text-align: center;
    background: #2c3e50;
    color: white;
}

.team-bar-home {
    margin-bottom: 6px;
}

.team-bar-away {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 12px 8px;
    flex-shrink: 0;
}

.grid-row {
    display: flex;
    gap: 6px;
}

.squares-grid {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.squares-grid th,
.squares-grid td {
    border: 1px solid #ccc;
    font-size: 11px;
    padding: 4px 2px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 44px;
    max-width: 80px;
}

.squares-grid th {
    background: #eef1f4;
    color: #2c3e50;
}

.squares-grid td.no-win {
    background: #f5f5f5;
    color: #aaa;
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: #7f8c8d;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .team-selection {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .vs {
        order: -1;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 10px;
    }

    main {
        padding: 20px;
    }
}