/* AstroBlitz: Infinite Shards - Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
    touch-action: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* HUD Styles */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
    font-family: 'Courier New', monospace;
}

.hud.hidden {
    display: none;
}

.hud > * {
    pointer-events: auto;
}

.hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-score {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#score {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.multiplier {
    font-size: 18px;
    color: #ffd700;
    margin-left: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    transition: transform 0.2s;
}

.multiplier.pulse {
    animation: pulse 0.3s ease-out;
}

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

.hud-hearts {
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hud-hearts img {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
    transition: opacity 0.3s, transform 0.3s;
}

.hud-hearts img.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

.hud-hearts img.damaged {
    animation: damage-shake 0.5s;
}

@keyframes damage-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Shield Indicator */
.shield-indicator {
    position: absolute;
    top: 70px;
    right: 10px;
    background: rgba(0, 200, 255, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(0, 200, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
}

.shield-indicator img {
    width: 24px;
    height: 24px;
}

.shield-indicator span {
    color: #0cf;
    font-weight: bold;
    font-size: 14px;
}

/* Bottom HUD */
.hud-bottom {
    position: absolute;
    bottom: 80px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.hud-powerups {
    display: flex;
    gap: 10px;
}

.powerup-slot {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s;
}

.powerup-slot.hidden {
    display: none;
}

.powerup-slot.active {
    border-color: #0f0;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
}

.powerup-slot img {
    width: 40px;
    height: 40px;
    display: block;
}

.powerup-charges,
.powerup-timer {
    position: absolute;
    bottom: 2px;
    right: 4px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 20px;
    text-align: center;
}

.powerup-charges {
    color: #ffd700;
}

.powerup-timer {
    color: #0f0;
}

.hud-weapon {
    background: rgba(0, 0, 0, 0.8);
    padding: 8px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.hud-weapon img {
    width: 48px;
    height: 48px;
    display: block;
}

.weapon-heat-bar {
    margin-top: 4px;
    width: 48px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.heat-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #0f0, #ff0, #f00);
    width: 0%;
    transition: width 0.1s linear;
}

/* Pause Button */
.pause-btn {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
}

.pause-btn:active {
    transform: translateX(-50%) scale(0.9);
}

.pause-btn img {
    width: 32px;
    height: 32px;
    display: block;
}

/* Dash Indicator */
.dash-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.dash-indicator::before {
    content: '⚡';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
}

.dash-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    clip-path: polygon(50% 50%, 50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%);
    transition: clip-path 0.1s linear;
}

/* Screen Overlays */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.screen.hidden {
    display: none;
}

.screen-content {
    text-align: center;
    padding: 20px;
    max-width: 90vw;
    color: #fff;
}

/* Title Screen */
.game-title {
    margin-bottom: 10px;
}

.title-main {
    display: block;
    font-size: 48px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    animation: title-glow 2s ease-in-out infinite alternate;
}

.title-sub {
    display: block;
    font-size: 18px;
    color: #aaa;
    margin-top: 5px;
    letter-spacing: 2px;
}

@keyframes title-glow {
    from { filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.5)); }
    to { filter: drop-shadow(0 0 40px rgba(102, 126, 234, 0.8)); }
}

.tagline {
    font-size: 16px;
    color: #ccc;
    margin: 20px 0 40px 0;
    font-style: italic;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}

.menu-btn {
    padding: 15px 30px;
    font-size: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.menu-btn img {
    width: 24px;
    height: 24px;
}

.menu-btn:hover,
.menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #764ba2;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.primary-btn:hover,
.primary-btn:active {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-3px);
}

.high-score {
    margin-top: 30px;
    font-size: 18px;
    color: #aaa;
}

.high-score strong {
    color: #ffd700;
    font-size: 24px;
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

/* Game Over Screen */
.screen-title {
    font-size: 36px;
    margin-bottom: 30px;
    color: #fff;
}

.stats {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    color: #aaa;
    font-size: 16px;
}

.stat-value {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}

.new-best {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    padding: 15px 25px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 20px;
    font-weight: bold;
    animation: celebration 0.5s ease-out;
}

@keyframes celebration {
    0% { transform: scale(0.5) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Settings Screen */
.settings-panel {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting-item label {
    color: #fff;
    font-size: 16px;
}

.setting-item input[type="checkbox"] {
    width: 50px;
    height: 26px;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.setting-item input[type="checkbox"]:checked {
    background: #667eea;
}

.setting-item input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.setting-item input[type="checkbox"]:checked::before {
    transform: translateX(24px);
}

/* Loading Screen */
.loading-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 20px auto;
    overflow: hidden;
}

.loading-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

#loading-text {
    color: #aaa;
    font-size: 14px;
    margin-top: 10px;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-content {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    text-align: left;
    backdrop-filter: blur(10px);
}

.tutorial-content h3 {
    color: #fff;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.tutorial-content ul {
    list-style: none;
    margin-bottom: 25px;
    color: #fff;
}

.tutorial-content li {
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.5;
}

.tutorial-content strong {
    color: #667eea;
}

#tutorial-close-btn {
    width: 100%;
}

/* Left-Hand Mode */
body.left-hand .hud-bottom {
    flex-direction: row-reverse;
}

body.left-hand .hud-top {
    flex-direction: row-reverse;
}

/* Responsive for larger screens */
@media (min-width: 768px) {
    .screen-content {
        max-width: 500px;
    }
    
    .title-main {
        font-size: 64px;
    }
    
    .title-sub {
        font-size: 24px;
    }
}

/* Touch feedback */
.icon-btn:active {
    transform: scale(0.95);
}

/* Animations for powerup collection */
@keyframes powerup-collect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.powerup-slot.collected {
    animation: powerup-collect 0.5s ease-out;
}
