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

/**
 * PACMAN Game CSS - Modernes 2025 Neon-Design
 * Vollständig überarbeitet für WordPress Plugin
 * @version 2.4.0
 * @author Kosecom
 */

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */
:root {
    /* Neon Colors */
    --neon-blue: #00FFFF;
    --neon-pink: #FF0080;
    --neon-yellow: #FFFF00;
    --neon-green: #00FF80;
    --neon-purple: #8000FF;
    --neon-orange: #FF8000;
    
    /* Primary Theme */
    --primary-color: #329780;
    --primary-light: #3db88a;
    --primary-dark: #2a7a68;
    
    /* Background Colors */
    --bg-dark: #0a0a1a;
    --bg-darker: #050510;
    --bg-card: rgba(15, 15, 35, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0c0;
    --text-muted: #606080;
    
    /* Effects */
    --glow-primary: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    --glow-neon: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-blue);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================
   MAIN GAME CONTAINER
   ======================================== */
.kosecom-snake-game {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-lg);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: 
        linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 50%, var(--bg-dark) 100%),
        radial-gradient(ellipse at 20% 0%, rgba(50, 151, 128, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 255, 255, 0.1) 0%, transparent 50%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(50, 151, 128, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Animated top border */
.kosecom-snake-game::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--neon-blue), 
        var(--primary-color), 
        var(--neon-pink), 
        transparent
    );
    animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========================================
   GAME HEADER
   ======================================== */
.game-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.game-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--neon-yellow) 0%, var(--neon-orange) 50%, var(--neon-yellow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 255, 0, 0.5));
    animation: titlePulse 2s ease-in-out infinite alternate;
}

@keyframes titlePulse {
    from { filter: drop-shadow(0 0 20px rgba(255, 255, 0, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(255, 255, 0, 0.8)); }
}

/* ========================================
   GAME CONTAINER INNER
   ======================================== */
.game-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ========================================
   GAME INFO BAR
   ======================================== */
.game-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.game-info > div,
.info-item {
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    transition: var(--transition-normal);
}

.game-info > div:hover,
.info-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.info-item .label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.info-item .value,
#score, #level, #lives, #high-score {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   GAME CANVAS
   ======================================== */
#gameCanvas {
    display: block;
    margin: 0 auto var(--space-md);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    background: #000033;
    box-shadow: 
        0 0 30px rgba(50, 151, 128, 0.3),
        0 0 60px rgba(50, 151, 128, 0.1),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    transition: var(--transition-normal);
    max-width: 100%;
    height: auto;
}

#gameCanvas:hover {
    box-shadow: 
        0 0 40px rgba(50, 151, 128, 0.5),
        0 0 80px rgba(50, 151, 128, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

/* ========================================
   GAME CONTROLS
   ======================================== */
.game-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.control-btn,
.snake-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    min-height: 44px;
    background: linear-gradient(135deg, rgba(50, 151, 128, 0.8) 0%, rgba(50, 151, 128, 0.6) 100%);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.control-btn .btn-icon {
    font-size: 1rem;
}

.control-btn .btn-text {
    display: none;
}

@media (min-width: 400px) {
    .control-btn .btn-text {
        display: inline;
    }
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.control-btn:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(50, 151, 128, 0.4);
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(50, 151, 128, 0.3);
}

/* Start Button Special Style */
.start-btn {
    background: linear-gradient(135deg, rgba(0, 255, 128, 0.8) 0%, rgba(0, 200, 100, 0.6) 100%);
}

.start-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 128, 1) 0%, rgba(0, 200, 100, 0.8) 100%);
    box-shadow: 0 8px 25px rgba(0, 255, 128, 0.4);
}

/* ========================================
   HIGHSCORE CONTAINER
   ======================================== */
.highscore-container {
    display: none;
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-md);
    backdrop-filter: blur(20px);
    animation: slideIn 0.3s ease-out;
}

.highscore-container.show {
    display: block;
}

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

.highscore-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: var(--space-md);
    text-shadow: 0 0 10px rgba(50, 151, 128, 0.5);
}

/* ========================================
   HIGHSCORE TABLE
   ======================================== */
.highscore-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.highscore-table th,
.highscore-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
}

.highscore-table th {
    background: rgba(50, 151, 128, 0.2);
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.highscore-table td {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.highscore-table tbody tr {
    transition: var(--transition-fast);
}

.highscore-table tbody tr:hover {
    background: var(--bg-glass);
}

.highscore-table .rank {
    font-weight: 700;
    color: var(--neon-yellow);
}

.close-highscore {
    display: block;
    width: 100%;
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: var(--radius-md);
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.close-highscore:hover {
    background: rgba(255, 71, 87, 0.4);
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

/* ========================================
   MOBILE CONTROLS
   ======================================== */
.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.touch-row {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.touch-row-middle {
    gap: var(--space-xl);
}

.touch-center {
    width: 60px;
    height: 60px;
}

.touch-arrow-btn {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-primary);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: 0 4px 15px rgba(50, 151, 128, 0.3);
}

.touch-arrow-btn:hover,
.touch-arrow-btn:active {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(50, 151, 128, 0.5);
}

/* ========================================
   INSTRUCTIONS
   ======================================== */
.instructions {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.instructions h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: var(--space-md);
    text-shadow: 0 0 10px rgba(50, 151, 128, 0.5);
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.instruction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.instruction-item .key {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--neon-blue);
}

.instruction-item .desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
}

.gameplay-tip {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

.gameplay-tip strong {
    color: var(--neon-yellow);
}

/* ========================================
   GAME OVER SCREEN
   ======================================== */
#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.game-over-content {
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 50px rgba(50, 151, 128, 0.5);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.game-over-content h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 800;
    color: #ff4757;
    margin-bottom: var(--space-lg);
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
    animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(255, 71, 87, 0.5); }
    to { text-shadow: 0 0 30px rgba(255, 71, 87, 0.8), 0 0 40px rgba(255, 71, 87, 0.4); }
}

.final-stats {
    margin-bottom: var(--space-lg);
}

.final-stats p {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.final-stats .highlight {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
}

#save-score-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

#player-name {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: var(--transition-normal);
}

#player-name:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(50, 151, 128, 0.3);
}

#player-name::placeholder {
    color: var(--text-muted);
}

.play-again-btn {
    width: 100%;
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--neon-green) 0%, rgba(0, 200, 100, 0.8) 100%);
    color: #000;
    font-weight: 700;
}

.play-again-btn:hover {
    background: linear-gradient(135deg, var(--neon-green) 0%, rgba(0, 255, 128, 1) 100%);
    box-shadow: 0 8px 30px rgba(0, 255, 128, 0.5);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 480px) {
    .kosecom-snake-game {
        padding: var(--space-md);
        margin: var(--space-sm);
        border-radius: var(--radius-lg);
    }
    
    .game-header h1 {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
    
    .game-container {
        padding: var(--space-md);
    }
    
    .game-info {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-controls {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .instruction-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-controls {
        display: flex;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .mobile-controls {
        display: none;
    }
}

/* Touch device detection */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: flex !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .kosecom-snake-game {
        display: none;
    }
}