/**
 * Retro Arcade Aesthetic Styles
 * CRT effects, scanlines, 8-bit fonts, and classic arcade styling
 */

/* Import 8-bit style font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* CSS Custom Properties for Retro Theme */
:root {
    --retro-green: #39ff14;
    --retro-amber: #ffbf00;
    --retro-cyan: #00ffff;
    --retro-magenta: #ff00ff;
    --retro-red: #ff0040;
    --retro-blue: #0080ff;
    
    /* Arcade cabinet colors */
    --arcade-black: #0a0a0a;
    --arcade-dark: #1a1a2e;
    --arcade-trim: #2d2d44;
}

/* 8-bit Font Class */
.retro-font,
.pixel-font {
    font-family: 'Press Start 2P', 'Courier New', monospace !important;
    letter-spacing: 1px;
}

/* CRT Scanlines Filter */
.crt-effect {
    position: relative;
}

.crt-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
}

/* CRT screen glow effect */
.crt-glow {
    box-shadow: 
        0 0 10px rgba(0, 255, 255, 0.3),
        0 0 20px rgba(0, 255, 255, 0.2),
        0 0 30px rgba(0, 255, 255, 0.1),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* CRT screen curvature effect (optional) */
.crt-curved {
    border-radius: 20px;
    overflow: hidden;
}

/* Arcade Insert Coin Animation */
@keyframes insertCoinBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes insertCoinPulse {
    0%, 100% { text-shadow: 0 0 6px var(--retro-amber); }
    50% { text-shadow: 0 0 10px var(--retro-amber); }
}

.insert-coin {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: var(--retro-amber);
    text-align: center;
    animation: insertCoinBlink 1s step-end infinite;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--retro-amber);
    border-radius: 8px;
    margin: 10px auto;
    max-width: fit-content;
    cursor: pointer;
    display: block;
}

.insert-coin:hover,
.insert-coin:focus {
    outline: 2px solid var(--retro-cyan);
    outline-offset: 2px;
}

.insert-coin.pulse {
    animation: insertCoinPulse 1.5s ease-in-out infinite;
}

/* High Score Display */
.high-scores {
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    border: 3px solid var(--retro-cyan);
    border-radius: 10px;
    padding: 20px;
    font-family: 'Press Start 2P', monospace;
    margin: 20px auto;
    max-width: 400px;
}

.high-scores h3 {
    color: var(--retro-cyan);
    text-align: center;
    font-size: clamp(0.7rem, 2vw, 1rem);
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0,255,255,0.5);
}

.high-score-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.high-score-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: clamp(0.5rem, 1.5vw, 0.7rem);
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.high-score-item:last-child {
    border-bottom: none;
}

.high-score-rank {
    color: var(--retro-amber);
    width: 30px;
}

.high-score-name {
    color: var(--retro-green);
    flex: 1;
    text-transform: uppercase;
}

.high-score-score {
    color: var(--retro-magenta);
    text-align: right;
}

/* Arcade Cabinet Frame Effect */
.arcade-frame {
    background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
    border: 5px solid #444;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 
        inset 0 5px 15px rgba(255, 255, 255, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Retro Button Style */
.retro-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.6rem, 1.5vw, 0.8rem);
    padding: 15px 25px;
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border: 3px solid #fff;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s ease;
    box-shadow: 
        0 4px 0 #922b21,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.retro-btn:hover {
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #922b21,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

.retro-btn:active {
    transform: translateY(4px);
    box-shadow: 
        0 0 0 #922b21,
        0 2px 5px rgba(0, 0, 0, 0.3);
}

.retro-btn.green {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
    box-shadow: 
        0 4px 0 #145a32,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.retro-btn.blue {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    box-shadow: 
        0 4px 0 #1a5276,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

/* Pixel Art Border */
.pixel-border {
    border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='2' height='2' fill='%234a90e2'/%3E%3Crect x='2' y='2' width='2' height='2' fill='%234a90e2'/%3E%3Crect x='4' y='4' width='2' height='2' fill='%234a90e2'/%3E%3Crect x='6' y='6' width='2' height='2' fill='%234a90e2'/%3E%3C/svg%3E") 2 stretch;
    border-width: 4px;
    border-style: solid;
}

/* Neon Text Glow Effects */
.neon-text {
    text-shadow: 0 0 6px currentColor, 0 0 12px currentColor;
}

.neon-cyan { color: var(--retro-cyan); }
.neon-magenta { color: var(--retro-magenta); }
.neon-green { color: var(--retro-green); }
.neon-amber { color: var(--retro-amber); }

/* Educational Fact Card */
.edu-fact-card {
    background: linear-gradient(135deg, #1a1a4e 0%, #2d2d66 100%);
    border: 2px solid var(--retro-green);
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.edu-fact-card::before {
    content: '💡';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    opacity: 0.3;
}

.edu-fact-card h4 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--retro-green);
    margin-bottom: 10px;
}

.edu-fact-card p {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Family/Parental Controls Panel */
.parent-controls {
    background: var(--secondary-bg);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.parent-controls h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-limit-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.time-limit-control label {
    color: var(--text-secondary);
    min-width: 120px;
}

.time-limit-control input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.time-limit-display {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--retro-cyan);
    min-width: 60px;
}

/* Progress Tracking */
.progress-tracker {
    background: var(--secondary-bg);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.progress-tracker h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.progress-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(74, 144, 226, 0.3);
}

.progress-stat:last-child {
    border-bottom: none;
}

.progress-stat-label {
    color: var(--text-secondary);
}

.progress-stat-value {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--retro-green);
}

/* Time Warning Overlay */
.time-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.time-warning.show {
    opacity: 1;
    pointer-events: all;
}

.time-warning h2 {
    font-family: 'Press Start 2P', monospace;
    color: var(--retro-amber);
    font-size: clamp(1rem, 3vw, 1.5rem);
    text-align: center;
    /* Use slower pulse animation to comply with WCAG (no more than 3 flashes per second) */
    animation: insertCoinPulse 2s ease-in-out infinite;
}

.time-warning p {
    color: #fff;
    margin-top: 20px;
    font-size: 1.1rem;
}

/* Limited Color Palette Mode */
body.limited-colors {
    filter: saturate(0.3) contrast(1.2);
}

body.limited-colors .game-card,
body.limited-colors .high-scores,
body.limited-colors .edu-fact-card {
    filter: saturate(2);
}

/* Monochrome Mode (Classic Gameboy style) */
body.monochrome {
    filter: grayscale(1) contrast(1.3);
    --primary-color: #8bac0f;
    --secondary-color: #306230;
    --accent-color: #9bbc0f;
    --primary-bg: #0f380f;
    --secondary-bg: #306230;
}

/* Reduced Motion - Disable animations */
@media (prefers-reduced-motion: reduce) {
    .insert-coin,
    .crt-effect::before,
    .neon-text {
        animation: none !important;
        text-shadow: none !important;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .high-scores {
        padding: 15px;
    }
    
    .high-score-item {
        font-size: 0.5rem;
        padding: 6px 8px;
    }
    
    .retro-btn {
        padding: 12px 18px;
        font-size: 0.5rem;
    }
    
    .edu-fact-card {
        padding: 15px;
    }
    
    .edu-fact-card::before {
        font-size: 1.5rem;
    }
}
