:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #48dbfb;
    --secondary-dark: #2ec4ea;
    --success-color: #2ecc71;
    --danger-color: #ff4757;
    --danger-dark: #ee2f3f;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --bg-light: #f8f9fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

h1 {
    color: var(--text-color);
    font-size: 28px;
    font-weight: 700;
}

h2 {
    color: var(--text-color);
    font-size: 22px;
    margin-bottom: 15px;
}

.step {
    display: none;
}

.step.active {
    display: block;
}

.instruction {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 14px;
}

/* Contestant inputs */
.contestant-input {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.contestant-input input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.contestant-input input:focus {
    outline: none;
    border-color: #667eea;
}

.contestant-input .number {
    width: 30px;
    text-align: center;
    font-weight: 600;
    color: #666;
}

.contestant-input .remove-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.contestant-input .remove-btn:hover {
    background: #ee2f3f;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #48dbfb;
    color: white;
}

.btn-secondary:hover {
    background: #2ec4ea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 219, 251, 0.4);
}

.btn-inline {
    margin-top: 0;
    padding: 10px 20px;
    font-size: 14px;
}

#step-results .btn {
    margin-right: 10px;
}

#step-results .btn:last-child {
    margin-right: 0;
}

.tournament-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.tournament-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Tournament info */
#tournament-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.standings-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: center;
}

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

.standings-table th,
.standings-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.standings-table th {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.standings-table td {
    color: var(--text-color);
}

.standings-table .rank,
.standings-table .rank-1,
.standings-table .rank-2,
.standings-table .rank-3 {
    font-weight: 700;
    color: var(--text-color);
}

.standings-hidden {
    display: none;
}

.standings-toggle {
    text-align: center;
    margin-top: 10px;
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.standings-toggle:hover {
    color: #5568d3;
    text-decoration: underline;
}

.standings-empty {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    margin: 0;
}

/* Rounds */
.round {
    margin-bottom: 30px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.round.active {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.round.completed {
    opacity: 0.75;
}

.round.completed:hover {
    opacity: 1;
    border-color: #667eea;
}

.round.future {
    opacity: 0.5;
    pointer-events: none;
}

.round-header {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.round.completed .round-header::before {
    content: '✓';
    color: #2ecc71;
}

.pairing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.pairing:last-child {
    margin-bottom: 0;
}

.players {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.player {
    font-weight: 600;
    color: #333;
}

.vs {
    color: #999;
    font-size: 14px;
}

.result-buttons {
    display: flex;
    gap: 8px;
}

.result-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.result-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.result-btn:hover:not(.selected):not(:disabled) {
    border-color: #667eea;
    background: #f8f9ff;
}

.result-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.bye-notice {
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-weight: 600;
}

/* Results table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.results-table th,
.results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.results-table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #555;
}

.results-table tr:hover {
    background: #f8f9ff;
}

.results-table .rank {
    font-weight: 700;
    color: #667eea;
}

.results-table .rank-1 {
    color: #f1c40f;
}

.results-table .rank-2 {
    color: #95a5a6;
}

.results-table .rank-3 {
    color: #cd7f32;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    .pairing {
        flex-direction: column;
        gap: 15px;
    }

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

    .result-buttons {
        width: 100%;
        justify-content: center;
    }

    .info-row {
        flex-direction: column;
        gap: 5px;
    }

    .results-table {
        font-size: 14px;
    }

    .results-table th,
    .results-table td {
        padding: 8px 6px;
    }
}
