/* ============================================================================
   AWESOME BREAKOUT - THE ULTIMATE EDITION
   Vibe-coded by Frédéric Bogaerts • netpack.pt
   ============================================================================ */

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

html, body {
    height: 100%;
    overflow: hidden;
    touch-action: none;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #0a0a15 0%, #1a0a25 50%, #050510 100%);
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.back-link {
    color: #4ECDC4;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.back-link:hover {
    background: rgba(78, 205, 196, 0.2);
}

.top-bar-right {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Game Container */
.game-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #111 0%, #0a0a0a 100%);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 0 60px rgba(100, 50, 150, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
}

#gameCanvas {
    display: block;
    background: #000;
    border-radius: 8px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 70px);
    transform: translateZ(0);
}

/* In-Game HUD */
.game-hud {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 50;
}

.hud-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
}

.hud-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
    transform: scale(1.1);
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
    border-radius: 8px;
}

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

.overlay-content {
    text-align: center;
    padding: 20px 15px;
    max-width: 500px;
    width: 95%;
    animation: slideIn 0.3s ease;
}

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

/* Start Screen */
.start-screen { background: radial-gradient(ellipse at center, rgba(30, 10, 50, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); }

.game-title {
    font-size: clamp(28px, 6vw, 42px);
    color: #FFD700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 4px 0 #B8860B;
    margin-bottom: 5px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: brightness(1); }
    to { filter: brightness(1.2); }
}

.game-subtitle {
    font-size: clamp(12px, 3vw, 16px);
    color: #4ECDC4;
    letter-spacing: 4px;
    margin-bottom: 20px;
}

.features-grid {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.feature {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.feature:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.feature-icon { font-size: 20px; margin-right: 8px; }
.feature-text { font-size: 12px; color: #aaa; font-weight: 600; }

/* Mode Buttons */
.mode-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mode-button {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 110px;
}

.mode-button:hover { transform: translateY(-3px) scale(1.02); }
.mode-button:active { transform: scale(0.98); }

.mode-icon { font-size: 28px; }
.mode-name { font-size: 15px; font-weight: bold; color: #fff; }
.mode-desc { font-size: 10px; color: #888; }

.campaign-btn { border-color: rgba(255, 215, 0, 0.4); }
.campaign-btn:hover { background: rgba(255, 215, 0, 0.15); border-color: #FFD700; box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
.campaign-btn .mode-name { color: #FFD700; }

.endless-btn { border-color: rgba(78, 205, 196, 0.4); }
.endless-btn:hover { background: rgba(78, 205, 196, 0.15); border-color: #4ECDC4; box-shadow: 0 0 20px rgba(78, 205, 196, 0.3); }
.endless-btn .mode-name { color: #4ECDC4; }

.daily-btn { border-color: rgba(155, 89, 182, 0.4); }
.daily-btn:hover { background: rgba(155, 89, 182, 0.15); border-color: #9B59B6; box-shadow: 0 0 20px rgba(155, 89, 182, 0.3); }
.daily-btn .mode-name { color: #9B59B6; }

/* High Scores */
.high-scores-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    flex-wrap: wrap;
}

.high-score-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hs-label { font-size: 10px; color: #888; text-transform: uppercase; }
.hs-value { font-size: 18px; font-weight: bold; color: #FFD700; }

/* Controls Info */
.controls-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    color: #666;
    font-size: 11px;
}

.credits-small { color: #444; font-size: 11px; }
.credits-small a { color: #4ECDC4; text-decoration: none; }

/* Buttons */
.continue-button, .restart-button, .play-again-button, .resume-button, .retry-daily-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    border: none;
    padding: 14px 35px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.continue-button:hover, .restart-button:hover, .play-again-button:hover, .resume-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
}

.back-menu-button, .quit-button {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 25px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-menu-button:hover, .quit-button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(255, 215, 0, 0.7); }
}

/* Level Complete */
.level-complete-screen { background: radial-gradient(ellipse at center, rgba(0, 50, 30, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); }
.level-complete-title { font-size: clamp(24px, 5vw, 32px); color: #2ECC71; text-shadow: 0 0 20px rgba(46, 204, 113, 0.8); margin-bottom: 10px; }
.level-name { font-size: 20px; color: #FFD700; margin-bottom: 20px; }

.bonus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.bonus-item { background: rgba(255, 255, 255, 0.05); padding: 12px; border-radius: 8px; }
.bonus-item.total { grid-column: span 3; background: rgba(255, 215, 0, 0.1); }
.bonus-label { display: block; font-size: 10px; color: #888; text-transform: uppercase; margin-bottom: 3px; }
.bonus-value { display: block; font-size: 20px; font-weight: bold; color: #4ECDC4; }
.bonus-item.total .bonus-value { color: #FFD700; font-size: 26px; }

/* Boss Intro */
.boss-intro-screen { background: radial-gradient(ellipse at center, rgba(80, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); }
.boss-intro-content { animation: bossShake 0.3s ease-in-out infinite; }
@keyframes bossShake { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
.boss-warning { font-size: 24px; color: #E74C3C; animation: blink 0.4s infinite; margin-bottom: 15px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.boss-name { font-size: clamp(32px, 8vw, 48px); color: #FFD700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.8); margin-bottom: 10px; }
.boss-subtitle { font-size: 20px; color: #E74C3C; margin-bottom: 20px; }
.boss-loading { width: 250px; max-width: 80%; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; margin: 0 auto; overflow: hidden; }
.boss-loading-bar { height: 100%; background: linear-gradient(90deg, #E74C3C, #FFD700); animation: loadingBar 2.5s ease-in-out forwards; }
@keyframes loadingBar { from { width: 0; } to { width: 100%; } }

/* Game Over */
.game-over-screen { background: radial-gradient(ellipse at center, rgba(50, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); }
.game-over-title { font-size: clamp(28px, 6vw, 38px); color: #E74C3C; text-shadow: 0 0 20px rgba(231, 76, 60, 0.8); margin-bottom: 20px; }
.final-stats { background: rgba(0, 0, 0, 0.3); padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.stat-row:last-child { border-bottom: none; }
.stat-label { color: #888; font-size: 14px; }
.stat-value { color: #fff; font-size: 16px; font-weight: bold; }
.stat-value.highlight { color: #FFD700; font-size: 20px; }
.game-over-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Daily Challenge */
.daily-complete-screen { background: radial-gradient(ellipse at center, rgba(50, 20, 70, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); }
.daily-complete-title { font-size: clamp(24px, 5vw, 32px); color: #9B59B6; margin-bottom: 10px; }
.daily-record { font-size: 20px; color: #FFD700; margin-bottom: 20px; animation: recordPulse 0.8s infinite; }
@keyframes recordPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.daily-stats { background: rgba(0, 0, 0, 0.3); padding: 15px; border-radius: 12px; margin-bottom: 15px; }
.daily-stat-row { display: flex; justify-content: space-between; padding: 8px 0; }
.daily-stat-label { color: #888; }
.daily-stat-value { color: #fff; font-weight: bold; }
.daily-stat-value.highlight { color: #9B59B6; font-size: 20px; }
.daily-buttons { display: flex; gap: 10px; justify-content: center; }
.retry-daily-button { background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%); }

/* Victory */
.victory-screen { background: radial-gradient(ellipse at center, rgba(50, 30, 0, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%); overflow: hidden; }
.victory-title { font-size: clamp(28px, 6vw, 42px); color: #FFD700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.8); margin-bottom: 5px; animation: victoryPulse 0.8s infinite; }
@keyframes victoryPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.victory-subtitle { font-size: clamp(14px, 3vw, 20px); color: #4ECDC4; margin-bottom: 25px; }
.victory-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 20px; }
.victory-stat { background: rgba(255, 255, 255, 0.05); padding: 12px 18px; border-radius: 10px; border: 1px solid rgba(255, 215, 0, 0.2); min-width: 80px; }
.victory-stat-value { display: block; font-size: 22px; font-weight: bold; color: #FFD700; }
.victory-stat-label { display: block; font-size: 10px; color: #888; text-transform: uppercase; }
.thank-you-section { margin: 20px 0; }
.credits-text { color: #aaa; font-size: 14px; margin-bottom: 10px; }
.credits-text strong { color: #FFD700; }
.credits-link { display: inline-block; background: linear-gradient(135deg, #4ECDC4 0%, #26A69A 100%); color: #fff; text-decoration: none; padding: 10px 25px; border-radius: 20px; font-weight: bold; transition: all 0.2s; }
.credits-link:hover { transform: scale(1.05); }
.confetti-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-container::before { content: ''; position: absolute; top: -100%; left: 0; right: 0; height: 200%; background-image: radial-gradient(circle, #FFD700 2px, transparent 2px), radial-gradient(circle, #E74C3C 2px, transparent 2px), radial-gradient(circle, #4ECDC4 2px, transparent 2px); background-size: 50px 50px, 70px 70px, 60px 60px; animation: confettiFall 8s linear infinite; }
@keyframes confettiFall { from { transform: translateY(0); } to { transform: translateY(50%); } }

/* Pause */
.pause-overlay { background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(5px); }
.pause-title { font-size: 42px; color: #FFD700; margin-bottom: 15px; }
.pause-stats { display: flex; gap: 30px; justify-content: center; margin-bottom: 25px; color: #888; font-size: 14px; }
.pause-stats span span { color: #4ECDC4; font-weight: bold; }
.pause-buttons { display: flex; gap: 15px; justify-content: center; margin-bottom: 15px; }
.pause-hint { color: #555; font-size: 12px; }

/* Share Section */
.share-section { margin: 15px 0; padding: 15px; background: rgba(255, 255, 255, 0.03); border-radius: 10px; }
.share-label { color: #888; font-size: 12px; margin-bottom: 10px; }
.share-buttons { display: flex; gap: 10px; justify-content: center; }
.share-btn { width: 40px; height: 40px; border: none; border-radius: 50%; cursor: pointer; font-size: 16px; font-weight: bold; transition: all 0.2s; }
.share-btn:hover { transform: scale(1.15); }
.share-btn.twitter { background: #000; color: #fff; }
.share-btn.facebook { background: #1877F2; color: #fff; }
.share-btn.whatsapp { background: #25D366; color: #fff; }
.share-btn.copy { background: #666; color: #fff; }

/* Combo Popup */
.combo-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 200;
    animation: comboAppear 0.5s ease-out forwards;
}
@keyframes comboAppear {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-30px); }
}
.combo-text { display: block; font-size: 14px; color: #FFD700; letter-spacing: 3px; }
.combo-count { display: block; font-size: 60px; font-weight: bold; color: #FFD700; text-shadow: 0 0 30px rgba(255, 215, 0, 0.8); }

/* Speed Indicator */
.speed-indicator {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #FF00FF, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 3px;
    animation: feverGlow 0.3s ease-in-out infinite alternate;
    z-index: 50;
}
@keyframes feverGlow { from { filter: brightness(1); } to { filter: brightness(1.5); } }

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 50px;
    right: -350px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 300px;
}
.achievement-popup.show { right: 15px; }
.achievement-icon { font-size: 32px; animation: achievementBounce 0.4s ease infinite; }
@keyframes achievementBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.achievement-info { flex: 1; }
.achievement-title { font-size: 10px; text-transform: uppercase; opacity: 0.7; }
.achievement-name { font-size: 15px; font-weight: bold; }
.achievement-desc { font-size: 11px; opacity: 0.8; }

/* Responsive */
@media (max-width: 600px) {
    .top-bar { height: 35px; }
    .back-link { font-size: 11px; padding: 4px 8px; }
    .game-container { padding: 5px; }
    .features-grid { gap: 8px; }
    .feature { padding: 8px 10px; }
    .mode-buttons { gap: 8px; }
    .mode-button { padding: 12px 15px; min-width: 95px; }
    .mode-icon { font-size: 24px; }
    .high-scores-panel { gap: 12px; padding: 10px; }
    .controls-info { display: none; }
    .bonus-grid { grid-template-columns: 1fr 1fr; }
    .bonus-item.total { grid-column: span 2; }
    .share-btn { width: 36px; height: 36px; font-size: 14px; }
}

@media (max-height: 500px) {
    .features-grid, .high-scores-panel, .controls-info { display: none; }
    .overlay-content { padding: 15px 10px; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

button:focus, a:focus { outline: 2px solid #FFD700; outline-offset: 2px; }

/* Touch devices */
@media (hover: none) {
    .mode-button:hover, .share-btn:hover { transform: none; }
    .mode-button:active, .share-btn:active { transform: scale(0.95); }
}
