/* ========================================
   BRICK BREAKER - STYLES
   ======================================== */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a2e;
    --bg-card: rgba(20, 20, 35, 0.8);
    --neon-cyan: #00d9ff;
    --neon-purple: #a855f7;
    --neon-pink: #ec4899;
    --neon-orange: #f59e0b;
    --neon-red: #ef4444;
    --neon-green: #22c55e;
    --neon-blue: #3b82f6;
    --gradient-aurora: linear-gradient(135deg, #00d9ff 0%, #a855f7 50%, #ec4899 100%);
    --gradient-brick: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --glow-orange: 0 0 20px rgba(245, 158, 11, 0.5), 0 0 40px rgba(245, 158, 11, 0.3);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Background */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(245, 158, 11, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 158, 11, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.floating-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--neon-orange);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--neon-red);
    top: 50%;
    right: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--neon-purple);
    bottom: -100px;
    left: 30%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 10px) scale(1.05); }
}

/* Game Wrapper */
.game-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.back-link {
    color: var(--neon-orange);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--neon-red);
}

.game-logo {
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--gradient-brick);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sound-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.sound-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.sound-btn.muted {
    opacity: 0.4;
}

/* Game Container */
.game-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screens */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s, transform 0.3s;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* Menu Screen */
.menu-screen {
    overflow-y: auto;
    padding: 20px;
}

.menu-content {
    max-width: 400px;
    margin: 0 auto;
}

.title-glow {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
    background: var(--gradient-brick);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.7)); }
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    padding: 15px 30px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--gradient-brick);
    color: white;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(245, 158, 11, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--neon-orange);
}

.btn-glow {
    animation: button-glow 2s ease-in-out infinite;
}

@keyframes button-glow {
    0%, 100% { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(239, 68, 68, 0.5), 0 0 60px rgba(245, 158, 11, 0.3); }
}

/* Instructions */
.instructions, .leaderboard-preview, .leaderboard-full {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.instructions h3, .leaderboard-preview h3, .leaderboard-full h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--neon-orange);
}

.instruction-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instruction {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.instruction .icon {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

/* Leaderboard */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
}

.leaderboard-entry.top-3 {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.leaderboard-entry .rank {
    width: 30px;
    font-weight: 700;
    color: var(--neon-orange);
}

.leaderboard-entry .pseudo {
    flex: 1;
    color: var(--text-primary);
}

.leaderboard-entry .score {
    font-weight: 600;
    color: var(--neon-red);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* Game Screen */
.game-screen {
    background: transparent;
}

.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 15px;
    z-index: 10;
    pointer-events: none;
}

.hud-left, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-right {
    align-items: flex-end;
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

#currentScore {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-brick);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.lives-display {
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.level-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.level-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#currentLevel {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--neon-orange);
}

.pause-btn {
    pointer-events: auto;
    background: var(--bg-card);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

.pause-btn:hover {
    background: rgba(245, 158, 11, 0.3);
    transform: scale(1.1);
}

#gameCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: none;
}

/* Overlay */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.3s;
}

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

.overlay-content {
    text-align: center;
    padding: 30px;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    background: var(--gradient-brick);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-bonus {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.level-bonus span:last-child {
    font-weight: 800;
    color: var(--neon-green);
}

/* Game Over Screen */
.gameover-screen {
    overflow-y: auto;
    padding: 20px;
}

.gameover-content {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.gameover-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-final {
    margin: 20px 0;
}

.score-big {
    font-size: 4rem;
    font-weight: 800;
    background: var(--gradient-brick);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--neon-orange);
}

/* Save Score Form */
.save-score-form {
    display: flex;
    gap: 10px;
    max-width: 320px;
    margin: 20px auto;
}

.pseudo-input {
    flex: 1;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.pseudo-input:focus {
    border-color: var(--neon-orange);
}

.pseudo-input::placeholder {
    color: var(--text-muted);
}

.save-score-form .btn-primary {
    width: auto;
    margin: 0;
    padding: 12px 20px;
    font-size: 0.95rem;
}

.save-status {
    min-height: 30px;
    margin: 10px 0;
    font-size: 0.9rem;
}

.save-status.success {
    color: #22c55e;
}

.save-status.error {
    color: #ef4444;
}

.gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--neon-orange);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neon-red);
}

/* Responsive */
@media (max-width: 480px) {
    .title-glow {
        font-size: 2rem;
    }
    
    .score-big {
        font-size: 3rem;
    }
    
    .save-score-form {
        flex-direction: column;
    }
    
    .save-score-form .btn-primary {
        width: 100%;
    }
    
    .stats-row {
        gap: 20px;
    }
}

/* Power-up notification */
.powerup-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    padding: 15px 30px;
    background: var(--bg-card);
    border-radius: 15px;
    border: 2px solid var(--neon-green);
    animation: powerup-pop 1s ease-out forwards;
    z-index: 15;
    pointer-events: none;
}

@keyframes powerup-pop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(1);
    }
}
