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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--success-color);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.help-text {
    font-size: 0.875rem;
    color: var(--warning-color);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #fef3c7;
    border-radius: 6px;
    border-left: 3px solid var(--warning-color);
}

select, input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.score-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.score-input-row input,
.score-input-row select {
    flex: 1;
}

.score-input-row .player-name {
    flex: 2;
}

.btn-remove {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-remove:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.sum-display {
    background: #f1f5f9;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.sum-display .label {
    color: var(--text-secondary);
}

.sum-display .value {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.sum-display .status {
    margin-left: auto;
    font-size: 1.5rem;
}

.sum-display.valid {
    background: #dcfce7;
    border: 2px solid var(--success-color);
}

.sum-display.valid .value {
    color: var(--success-color);
}

.sum-display.invalid {
    background: #fee2e2;
    border: 2px solid var(--error-color);
}

.sum-display.invalid .value {
    color: var(--error-color);
}

.status-message {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
    font-weight: 500;
    display: none;
}

.status-message.success {
    display: block;
    background: #dcfce7;
    color: #166534;
    border: 2px solid var(--success-color);
}

.status-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid var(--error-color);
}

.info-card {
    background: #f0fdf4;
    border: 2px solid var(--success-color);
}

.info-card #lastSubmission {
    color: var(--text-primary);
    line-height: 1.6;
}

.info-card #lastSubmission strong {
    color: var(--text-primary);
}

footer {
    text-align: center;
    color: white;
    margin-top: 32px;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: slideIn 0.4s ease;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        max-width: 100%;
    }

    header {
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }
    
    .card {
        padding: 20px 16px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .card h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .card h3 {
        font-size: 1.125rem;
    }
    
    .score-input-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .score-input-row input,
    .score-input-row select {
        width: 100%;
    }

    .score-input-row .player-name {
        flex: 1;
    }

    select, input {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn-primary {
        padding: 14px 24px;
        font-size: 1rem;
        /* Ensure minimum touch target size */
        min-height: 48px;
    }

    .btn-secondary {
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .btn-remove {
        padding: 10px 14px;
        min-height: 44px;
        width: 100%;
    }

    .sum-display {
        padding: 12px 16px;
        font-size: 1rem;
        flex-wrap: wrap;
    }

    .sum-display .value {
        font-size: 1.25rem;
    }

    .status-message {
        padding: 12px;
        font-size: 0.9rem;
    }

    footer {
        margin-top: 24px;
        font-size: 0.85rem;
    }
}

/* Extra small devices (phones in portrait mode) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .card {
        padding: 16px 12px;
        border-radius: 10px;
    }

    .card h2 {
        font-size: 1.25rem;
        margin-bottom: 16px;
    }

    .sum-display {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .sum-display .value {
        font-size: 1.15rem;
    }

    .sum-display .status {
        font-size: 1.25rem;
    }
}

