:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f8f9fa;
    --border-color: #e9ecef;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --selected-color: #28a745;
    --hover-color: #f1f3f4;
    --button-bg: #ffffff;
    --button-text: #333333;
    --button-border: #dee2e6;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --selected-color: #198754;
    --hover-color: #3a3a3a;
    --button-bg: #2d2d2d;
    --button-text: #ffffff;
    --button-border: #404040;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--button-border);
    border-radius: 8px;
    background-color: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 44px;
}

button:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
}

.theme-toggle {
    font-size: 1.2rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 1px solid var(--border-color);
}

.week-selector {
    margin-bottom: 2rem;
}

#week-select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--button-bg);
    color: var(--button-text);
    min-width: 150px;
}

.loading {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: #dc3545;
}

.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.game-date {
    text-align: center;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.matchup {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.team {
    flex: 1;
    text-align: center;
    cursor: pointer;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-height: 44px;
    touch-action: manipulation;
}

.team:hover {
    background-color: var(--hover-color);
}

.team:active {
    transform: scale(0.98);
}

.team.selected {
    background-color: var(--selected-color);
    color: white;
    border-color: var(--selected-color);
}

.team-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.team-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-name {
    font-weight: 600;
    font-size: 1rem;
}

.vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.footer-controls {
    text-align: center;
    margin-top: 2rem;
}

.copy-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.copy-button:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
}

.reset-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
}

.reset-button:hover {
    background-color: var(--secondary-color);
    opacity: 0.9;
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.8rem;
        text-align: center;
    }
    
    header p {
        text-align: center;
        font-size: 0.9rem;
    }
    
    .games-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-card {
        padding: 1rem;
    }
    
    .team-logo {
        width: 50px;
        height: 50px;
    }
    
    .header-controls {
        justify-content: center;
        width: 100%;
    }
    
    .header-controls button {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .team {
        padding: 1.25rem 1rem;
        min-height: 48px;
    }
    
    .team-name {
        font-size: 0.9rem;
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.25rem;
    }
    
    h1 {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .matchup {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    .team {
        width: 100%;
        max-width: 240px;
        padding: 1.5rem 1rem;
        min-height: 52px;
    }
    
    .team-name {
        font-size: 0.85rem;
        font-weight: 700;
    }
    
    .vs {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .header-controls button {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 52px;
    }
    
    #week-select {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 52px;
    }
    
    .footer-controls button {
        width: 100%;
        max-width: 300px;
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 52px;
    }
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--selected-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    background-color: #dc3545;
}

@media (max-width: 768px) {
    .toast {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.modal-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.modal-content ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-content li {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.modal-button {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
}

.modal-button:hover {
    background-color: var(--primary-color);
    opacity: 0.9;
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .modal-content h2 {
        font-size: 1.3rem;
    }
}