@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

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

:root[data-theme="dark"] {
    --bg: #1a1a2e;
    --surface: #16213e;
    --primary: #4CAF50;
    --secondary: #2196F3;
    --text: #ffffff;
    --text-light: #a0aec0;
    --border: #2d3748;
    --shadow: rgba(0, 0, 0, 0.3);
    --ball-color: #ffffff;
    --ball-trail: rgba(255, 255, 255, 0.3);
    --level-text: rgba(255, 255, 255, 0.2);
}

:root[data-theme="light"] {
    --bg: #f7fafc;
    --surface: #ffffff;
    --primary: #2563eb;
    --secondary: #16a34a;
    --text: #1a202c;
    --text-light: #4a5568;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    --ball-color: #2d3748;
    --ball-trail: rgba(45, 55, 72, 0.3);
    --level-text: rgba(45, 55, 72, 0.1);
}

body {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    padding: 20px;
    gap: 20px;
}

.top-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.theme-button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.theme-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px var(--shadow);
}

.theme-button .light-icon {
    display: none;
}

.theme-button .dark-icon {
    display: block;
}

[data-theme="light"] .theme-button .light-icon {
    display: block;
}

[data-theme="light"] .theme-button .dark-icon {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--bg-rgb), 0.98);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 30px;
    box-shadow: 0 4px 6px -1px var(--shadow),
                0 10px 15px -3px var(--shadow);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 500px;
}

.modal-content h2 {
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
}

.controls-guide {
    display: flex;
    justify-content: space-around;
    gap: 40px;
    text-align: left;
}

.player-guide h3 {
    color: var(--text);
    font-size: 16px;
    margin-bottom: 15px;
}

.key-guide {
    color: var(--text-light);
    line-height: 2;
}

.key {
    display: inline-block;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-weight: 500;
    min-width: 30px;
    text-align: center;
    margin: 0 4px;
}

.games-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

.game-container {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px var(--shadow),
                0 10px 15px -3px var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.game-container:hover {
    transform: translateY(-2px);
}

.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 18px;
    align-items: center;
}

.player-scores {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player1, .player2 {
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg);
    min-width: 140px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player1:hover, .player2:hover {
    background: var(--surface);
    transform: translateY(-1px);
}

.player1 {
    color: var(--secondary);
}

.player2 {
    color: var(--primary);
}

.hidden {
    display: none !important;
}

#gameCanvas, #gameCanvas2 {
    background: var(--bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.controls {
    margin-top: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.mode-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.mode-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.mode-button:active {
    transform: translateY(0);
}

.mode-button.active {
    background: var(--secondary);
}

.best {
    background: #fef3c7;
    color: #92400e;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

.control-text {
    background: var(--bg);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

.game-log {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--surface);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px var(--shadow),
                0 10px 15px -3px var(--shadow);
    border: 1px solid var(--border);
    width: 350px;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.game-log.hidden {
    transform: translateX(calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
}

.game-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.game-log-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.log-controls .mode-button {
    padding: 4px 8px;
    font-size: 12px;
}

.log-filter {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.log-entries {
    max-height: 300px;
    overflow-y: auto;
    font-size: 14px;
    color: var(--text-light);
}

.log-entry {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry .timestamp {
    color: var(--text-light);
    font-size: 12px;
}

.log-entry .game-type {
    color: var(--primary);
    font-weight: 500;
}

.log-entry .score {
    color: var(--text);
}

.log-entry .details {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 4px;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .games-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .game-container {
        width: 100%;
        max-width: 500px;
    }

    .controls-guide {
        flex-direction: column;
        gap: 20px;
    }

    .game-log {
        position: fixed;
        top: auto;
        bottom: 20px;
        right: 20px;
        width: calc(100% - 40px);
        max-width: 350px;
    }
} 

.transition-theme {
    transition: all 0.3s ease;
}

.player-names {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.name-input {
    flex: 1;
}

.name-input label {
    display: block;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 14px;
}

.name-input input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.name-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.single-player-name {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.single-player-name.hidden {
    opacity: 0;
    pointer-events: none;
}

.name-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.name-popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.name-popup-content {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px var(--shadow),
                0 10px 15px -3px var(--shadow);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.name-popup-content h3 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.name-popup-content input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.name-popup-content input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.popup-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.popup-buttons .mode-button {
    padding: 6px 12px;
    font-size: 14px;
}

@keyframes fadeUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-50px);
    }
}

.power-up-message {
    font-size: 18px;
    text-shadow: 0 0 10px currentColor;
    z-index: 1000;
}

.powerups-info {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--surface);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px var(--shadow),
                0 10px 15px -3px var(--shadow);
    border: 1px solid var(--border);
    width: 350px;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.powerups-info.hidden {
    transform: translateX(calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
}

.powerups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.powerups-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.powerups-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg);
    transition: transform 0.2s ease;
}

.powerup-item:hover {
    transform: translateX(-5px);
}

.powerup-item.good {
    border-left: 4px solid #4CAF50;
}

.powerup-item.bad {
    border-left: 4px solid #FF5252;
}

.powerup-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
}

.powerup-details {
    flex: 1;
}

.powerup-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.powerup-details p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text-light);
}