/* Game Modes Styles */

/* Battle 2P Mode */
#battle2p-container {
    display: flex;
    gap: 15px;
    width: calc(100% - 40px);
    height: calc(100% - 100px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 50px auto;
}

.battle2p-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.battle2p-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.battle2p-player canvas {
    width: 250px;
    height: 500px;
    border: 2px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.9);
}

.battle2p-hold, .battle2p-next {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.battle2p-hold h4, .battle2p-next h4 {
    color: #00ffff;
    margin: 0;
    font-size: 0.9rem;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
}

.battle2p-hold canvas {
    border: 1px solid #00ffff;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.battle2p-next canvas {
    border: 1px solid #00ffff;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.player-label {
    color: #00ffff;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    margin: 0;
}

.player-stats {
    display: flex;
    gap: 15px;
    color: #fff;
    font-size: 0.85rem;
}

.player-stats span {
    background: rgba(0, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.battle2p-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0 15px;
}

.versus {
    font-size: 2rem;
    font-weight: bold;
    color: #ff00ff;
    text-shadow: 0 0 20px rgba(255, 0, 255, 0.8);
    animation: pulse 2s infinite;
}

.round-info {
    text-align: center;
    color: #fff;
}

.wins-display {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 1.1rem;
}

.wins-display span:first-child {
    color: #00ff00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.wins-display span:last-child {
    color: #ff8800;
    text-shadow: 0 0 5px rgba(255, 136, 0, 0.8);
}

.controls-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.p1-controls, .p2-controls {
    text-align: center;
}

.p1-controls h5, .p2-controls h5 {
    color: #00ffff;
    margin: 0 0 5px 0;
    font-size: 0.9rem;
}

.p1-controls small, .p2-controls small {
    color: #aaa;
    font-size: 0.75rem;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Mode Selector Modal */
.mode-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.mode-selector-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f23 100%);
    border: 2px solid var(--neon-blue);
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
}

.mode-selector-content h2 {
    text-align: center;
    color: var(--neon-blue);
    margin-bottom: 30px;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* Mode Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.mode-card {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.mode-card:hover::before {
    transform: translateX(100%);
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Mode specific colors */
.mode-card[data-mode="classic"] {
    border-color: #00ffff;
}
.mode-card[data-mode="classic"]:hover {
    border-color: #00ffff;
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
}

.mode-card[data-mode="sprint"] {
    border-color: #ff00ff;
}
.mode-card[data-mode="sprint"]:hover {
    border-color: #ff00ff;
    box-shadow: 0 10px 30px rgba(255, 0, 255, 0.3);
}

.mode-card[data-mode="marathon"] {
    border-color: #ffff00;
}
.mode-card[data-mode="marathon"]:hover {
    border-color: #ffff00;
    box-shadow: 0 10px 30px rgba(255, 255, 0, 0.3);
}

.mode-card[data-mode="zen"] {
    border-color: #00ff00;
}
.mode-card[data-mode="zen"]:hover {
    border-color: #00ff00;
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.3);
}

.mode-card[data-mode="puzzle"] {
    border-color: #ff8800;
}
.mode-card[data-mode="puzzle"]:hover {
    border-color: #ff8800;
    box-shadow: 0 10px 30px rgba(255, 136, 0, 0.3);
}

.mode-card[data-mode="battle"] {
    border-color: #ff0000;
}
.mode-card[data-mode="battle"]:hover {
    border-color: #ff0000;
    box-shadow: 0 10px 30px rgba(255, 0, 0, 0.3);
}

.mode-card[data-mode="daily"] {
    border-color: #ffd700;
}
.mode-card[data-mode="daily"]:hover {
    border-color: #ffd700;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.mode-card h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Close button */
.close-mode-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-mode-selector:hover {
    background: var(--neon-blue);
    color: #0f0f23;
    transform: rotate(90deg);
}

/* Mode UI Elements */
.mode-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 2px solid var(--neon-blue);
    border-radius: 20px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.mode-indicator-icon {
    font-size: 1.2rem;
}

.mode-indicator-name {
    color: var(--neon-blue);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mode Specific UI Container */
.mode-specific-ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

/* Sprint Mode Timer */
#mode-timer,
.sprint-timer {
    font-size: 1.8rem;
    color: #ff00ff;
    text-align: center;
    font-family: 'Courier New', 'Orbitron', monospace;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    min-width: 240px;
    width: 240px;
    display: block;
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 15px;
    border-radius: 10px;
    border: 2px solid #ff00ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.sprint-best-time {
    font-size: 1rem;
    color: rgba(255, 0, 255, 0.7);
    text-align: center;
    margin-top: 5px;
}

/* Marathon Mode Progress */
.marathon-progress {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #ffff00;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.marathon-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffff00, #ff8800);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.marathon-checkpoint {
    color: #ffff00;
    text-align: center;
    font-weight: bold;
    margin-top: 5px;
}

/* Zen Mode Stats */
.zen-stats {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    border-radius: 10px;
    padding: 10px;
    margin: 10px 0;
}

.zen-stat-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    color: rgba(0, 255, 0, 0.9);
}

.zen-export-btn {
    background: #00ff00;
    color: #0f0f23;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.zen-export-btn:hover {
    background: #00cc00;
    transform: scale(1.05);
}

/* Puzzle Mode UI */
.puzzle-number {
    background: rgba(255, 136, 0, 0.2);
    border: 1px solid #ff8800;
    border-radius: 8px;
    padding: 8px 15px;
    margin: 5px 0;
    text-align: center;
    min-width: 150px;
}

.puzzle-number-text {
    color: #ff8800;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
}

.puzzle-objective {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.2), rgba(255, 136, 0, 0.1));
    border: 2px solid #ff8800;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 10px 0;
    text-align: center;
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.3);
    min-width: 280px;
}

.puzzle-objective-title {
    color: #ff8800;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px rgba(255, 136, 0, 0.5);
}

#puzzle-objective-text {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 5px;
    display: inline-block;
}

.puzzle-pieces {
    background: rgba(100, 100, 255, 0.1);
    border: 2px solid #6666ff;
    border-radius: 10px;
    padding: 12px 20px;
    margin: 10px 0;
    text-align: center;
    min-width: 200px;
}

.puzzle-pieces-title {
    color: #6666ff;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
}

#puzzle-pieces-count {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.puzzle-pieces-remaining {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 10px 0;
}

.puzzle-piece-icon {
    width: 30px;
    height: 30px;
    background: rgba(255, 136, 0, 0.2);
    border: 1px solid #ff8800;
    border-radius: 5px;
}

.puzzle-piece-icon.used {
    opacity: 0.3;
}

/* Battle Mode UI */
.battle-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.battle-player-side,
.battle-ai-side {
    border: 2px solid #ff0000;
    border-radius: 10px;
    padding: 10px;
    position: relative;
}

.battle-player-side {
    border-color: #00ffff;
}

.battle-ai-side {
    border-color: #ff0000;
}

.battle-side-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f0f23;
    padding: 0 10px;
    font-weight: bold;
    text-transform: uppercase;
}

.battle-garbage-indicator {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.garbage-line {
    width: 20px;
    height: 10px;
    background: #ff0000;
    border: 1px solid #fff;
    animation: blink 0.5s infinite;
}

.battle-powerups {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
}

.powerup-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #666;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.powerup-btn.ready {
    border-color: #00ff00;
    animation: glow 1s infinite;
}

.powerup-btn:hover.ready {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.powerup-cooldown {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #ff0000;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .mode-selector-content {
        padding: 20px;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .mode-card {
        padding: 20px;
    }
    
    .mode-icon {
        font-size: 2rem;
    }
    
    .mode-card h3 {
        font-size: 1.2rem;
    }
    
    .battle-grid-container {
        grid-template-columns: 1fr;
    }
}

/* Power-Up Mode UI */
#powerup-ui {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#powerup-ui h3 {
    color: #00ffff;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

.powerup-slots {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.powerup-slot {
    flex: 1;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    text-align: center;
    position: relative;
    min-height: 80px;
    transition: all 0.3s ease;
}

.powerup-slot.filled {
    animation: pulse 2s infinite;
}

.powerup-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.powerup-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.powerup-name {
    font-size: 0.9rem;
    color: #fff;
}

.powerup-empty {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

.slot-key {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #00ffff;
    font-weight: bold;
}

.active-powerups {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.active-powerup {
    padding: 5px 10px;
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid rgba(0, 255, 0, 0.5);
    border-radius: 5px;
    font-size: 0.8rem;
    color: #0f0;
    animation: blink 1s infinite;
}

/* Hide normal UI when Battle 2P is active */
body.battle2p-active .game-sidebar.left,
body.battle2p-active .game-sidebar.right,
body.battle2p-active .info-panel,
body.battle2p-active .next-panel {
    display: none !important;
}

body.battle2p-active #game-canvas {
    display: none !important;
}

body.battle2p-active #battle2p-container {
    display: flex !important;
}

/* Daily Challenge UI */
.daily-challenge-info {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.daily-challenge-info h3 {
    color: #ffd700;
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.2rem;
}

.challenge-objective {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid #ffd700;
}

.challenge-modifiers {
    margin-bottom: 10px;
}

.challenge-modifiers ul {
    list-style: none;
    padding-left: 10px;
    margin-top: 5px;
}

.challenge-modifiers li {
    padding: 3px 0;
    color: #ffaa00;
}

.challenge-modifiers li:before {
    content: '⚡ ';
    color: #ffd700;
}

.challenge-timer {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff4444;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 10px;
}

.challenge-timer span {
    color: #ff6666;
    font-weight: bold;
    font-size: 1.1rem;
}

.challenge-progress {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
}

.challenge-progress span {
    font-weight: bold;
}

#challenge-progress {
    color: #00ff88;
}

#challenge-target {
    color: #ffaa00;
}

@media (max-width: 480px) {
    .mode-selector-content h2 {
        font-size: 1.5rem;
    }
    
    .mode-card {
        padding: 15px;
    }
    
    .mode-icon {
        font-size: 1.5rem;
    }
    
    .mode-card h3 {
        font-size: 1rem;
    }
    
    .mode-card p {
        font-size: 0.8rem;
    }
}