/* Island Shooter - Cyberpunk Theme Styles */

:root {
    --bg-color: #030308;
    --hud-bg: rgba(6, 6, 18, 0.75);
    --border-color: rgba(0, 242, 254, 0.2);
    --neon-cyan: #00f2fe;
    --neon-magenta: #ff007f;
    --neon-yellow: #fefe00;
    --neon-green: #39ff14;
    
    --font-primary: 'Outfit', sans-serif;
    --font-header: 'Orbitron', sans-serif;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-primary);
    color: #e2e8f0;
}

/* Three.js canvas container injected by JS */
canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Screen Damage Indicator Flash – v2: radiální vignette místo plné plochy */
#damage-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        rgba(255, 0, 0, 0.02) 35%,
        rgba(255, 0, 0, 0.28) 72%,
        rgba(180, 0, 20, 0.66) 100%);
    pointer-events: none;
    z-index: 9;
    opacity: 0;
    transition: opacity 0.08s ease-out;
}

/* Boss health bar (TASK-04) */
#boss-bar-wrap {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
    width: min(46vw, 560px);
    text-align: center;
    pointer-events: none;
}
#boss-bar-wrap.hidden { display: none; }
#boss-bar-wrap .boss-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #ff2244;
    text-shadow: 0 0 12px rgba(255, 0, 51, 0.85);
}
.boss-bar-track {
    margin-top: 5px;
    height: 12px;
    border: 1px solid rgba(255, 0, 51, 0.55);
    border-radius: 7px;
    background: rgba(20, 0, 8, 0.65);
    overflow: hidden;
    box-shadow: 0 0 16px rgba(255, 0, 51, 0.35);
}
#boss-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff0033, #ff5577);
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.9) inset;
    transition: width 0.18s ease-out;
}

/* Přepínač kvality (start screen) */
#quality-btn {
    margin-top: 14px;
    background: transparent;
    border: 1px solid rgba(0, 246, 255, 0.35);
    color: #7ee7ef;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
#quality-btn:hover {
    border-color: rgba(0, 246, 255, 0.9);
    box-shadow: 0 0 14px rgba(0, 246, 255, 0.35);
}

/* Crosshair (Reticle) */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    pointer-events: none;
    z-index: 10;
    display: none; /* Only shown when pointer is locked */
    align-items: center;
    justify-content: center;
}

#crosshair .dot {
    width: 4px;
    height: 4px;
    background-color: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon-cyan);
}

#crosshair .line {
    position: absolute;
    background-color: rgba(0, 242, 254, 0.5);
    box-shadow: 0 0 4px rgba(0, 242, 254, 0.3);
}

#crosshair .line.horizontal {
    width: 12px;
    height: 2px;
}

#crosshair .line.vertical {
    width: 2px;
    height: 12px;
}

/* HUD System */
#hud-container {
    position: absolute;
    inset: 0;
    padding: 24px;
    pointer-events: none; /* Click through to pointerlock */
    z-index: 5;
}

/* Glassmorphic Panels */
.glass-hud {
    background: var(--hud-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    padding: 16px;
    pointer-events: auto; /* Buttons inside HUD can be clicked if needed */
}

/* Top Left Stats */
.stats-hud {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    gap: 24px;
    min-width: 220px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

/* Radar (Top Right) */
.radar-hud {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 150px;
}

.radar-title {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.6);
}

.radar-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 242, 254, 0.3);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.05) 0%, rgba(0, 0, 0, 0.6) 80%);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.2);
}

.radar-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 1px;
    background: rgba(0, 242, 254, 0.15);
    transform: translate(-50%, -50%);
}

.radar-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 100%;
    background: rgba(0, 242, 254, 0.15);
    transform: translate(-50%, -50%);
}

.radar-sweep {
    position: absolute;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, rgba(0, 242, 254, 0.25) 0deg, transparent 90deg);
    border-radius: 50%;
    transform-origin: center;
    animation: radarSweep 3s linear infinite;
}

@keyframes radarSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radar-player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px #fff;
    z-index: 3;
}

.radar-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: var(--neon-magenta);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--neon-magenta);
    z-index: 2;
    transition: all 0.1s ease-out;
}

/* Bottom Left Health HUD */
.health-hud {
    position: absolute;
    bottom: 24px;
    left: 24px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.health-bar-track {
    width: 100%;
    height: 14px;
    background: rgba(255, 0, 85, 0.15);
    border: 1px solid rgba(255, 0, 85, 0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff0055 0%, #ff5e00 100%);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.6);
    transition: width 0.15s ease-out;
}

.health-text {
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 900;
    color: #ff0055;
    text-shadow: 0 0 8px rgba(255, 0, 85, 0.4);
    letter-spacing: 1px;
}

/* Bottom Right Ammo Panel */
.ammo-hud {
    position: absolute;
    bottom: 24px;
    right: 24px;
    min-width: 240px;
    text-align: center;
}

.weapon-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weapon-name {
    font-family: var(--font-header);
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1.5px;
}

.ammo-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ammo-count {
    font-family: var(--font-header);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--neon-green);
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
}

.ammo-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

/* Overlays (Start, Pause, Game Over) */
.overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(3, 3, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: flex-start;       /* scroll-safe: vysoký obsah se neuřízne nahoře */
    overflow-y: auto;              /* když je karta vyšší než okno, jde scrollovat (nic se neuřízne) */
    padding: 24px 0;
    z-index: 100;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.overlay-card {
    padding: 22px 30px;
    width: 90%;
    max-width: 540px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: auto;   /* svisle vycentruje, když je místo; jinak scroll od vrchu (nic se neuřízne) */
}

.glass-card {
    background: rgba(10, 10, 25, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 242, 254, 0.05);
}

.neon-title {
    font-family: var(--font-header);
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    text-shadow: 0 0 12px var(--neon-cyan), 0 0 24px rgba(0, 242, 254, 0.4);
    white-space: nowrap;   /* titulek vč. 🐷 na jeden řádek (jinak poslední emoji spadl dolů) */
}

.subtitle {
    font-size: 0.9rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-top: -10px;
}

.instructions {
    text-align: left;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.instructions h3 {
    margin-bottom: 10px;
    color: #fff;
    font-family: var(--font-header);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.instructions ul {
    list-style: none;
}

.instructions li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.instructions li:last-child {
    margin-bottom: 0;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

.glow-btn {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #0066ff 100%);
    border: none;
    outline: none;
    color: #fff;
    padding: 16px 32px;
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 2px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
    transition: all 0.3s ease;
}

.glow-btn:hover {
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.7);
    transform: scale(1.05);
}

.glow-btn:active {
    transform: scale(0.98);
}

/* Red / Yellow / Blue Screen variations */
.neon-text-yellow {
    color: #fff;
    font-family: var(--font-header);
    text-shadow: 0 0 10px var(--neon-yellow), 0 0 20px rgba(254, 254, 0, 0.4);
}

.neon-text-red {
    color: #fff;
    font-family: var(--font-header);
    text-shadow: 0 0 10px var(--neon-magenta), 0 0 20px rgba(255, 0, 127, 0.4);
}

.neon-text-blue {
    color: #fff;
    font-family: var(--font-header);
    text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 242, 254, 0.4);
}

.pause-text, .game-over-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 380px;
    line-height: 1.5;
}

.final-score {
    font-size: 1.2rem;
    color: #fff;
}

.final-score span {
    color: var(--neon-cyan);
    font-weight: 900;
    font-family: var(--font-header);
}

.red-btn {
    background: linear-gradient(135deg, var(--neon-magenta) 0%, #bd00ff 100%);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.red-btn:hover {
    box-shadow: 0 0 25px rgba(255, 0, 127, 0.7);
}

/* Responsive adjustments */
@media (max-width: 720px) {
    .overlay-card {
        padding: 30px 20px;
    }
    
    .neon-title {
        font-size: 2rem;
    }
    
    .stats-hud {
        top: 12px;
        left: 12px;
        padding: 10px;
        min-width: 150px;
        gap: 12px;
    }
    
    .hud-value {
        font-size: 1.2rem;
    }
    
    .radar-hud {
        top: 12px;
        right: 12px;
        padding: 8px;
        width: 100px;
    }
    
    .radar-title {
        font-size: 0.6rem;
    }
    
    .radar-circle {
        width: 65px;
        height: 65px;
    }
    
    .health-hud {
        bottom: 12px;
        left: 12px;
        padding: 10px;
        min-width: 150px;
    }
    
    .ammo-hud {
        bottom: 12px;
        right: 12px;
        padding: 10px;
        min-width: 150px;
    }
    
    .ammo-count {
        font-size: 1.1rem;
    }
}

/* High Score Submission & Table styles */
.high-score-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    width: 100%;
}

.neon-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-cyan);
    border-radius: 8px;
    padding: 8px 16px;
    color: #fff;
    font-family: var(--font-header);
    font-size: 0.95rem;
    text-align: center;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
    transition: all 0.3s ease;
    width: 220px;
}

.neon-input:focus {
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
    border-color: #fff;
}

.small-btn {
    padding: 8px 24px;
    font-size: 0.85rem;
    border-radius: 20px;
    margin-top: 4px;
    letter-spacing: 1.5px;
}

.high-scores-container {
    margin: 8px 0;
    width: 100%;
    max-width: 340px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
}

.high-scores-container h3 {
    font-family: var(--font-header);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.scores-table-wrapper {
    max-height: none;    /* žádný vnitřní ořez; celý žebříček se ukáže, scrolluje se celá obrazovka */
    overflow-y: visible;
    width: 100%;
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.scores-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.scores-table tr:last-child {
    border-bottom: none;
}

.scores-table td {
    padding: 3px 12px;
    color: rgba(255, 255, 255, 0.8);
}

.scores-table td.score-rank {
    font-weight: 700;
    color: var(--neon-yellow);
    width: 40px;
    text-align: left;
}

.scores-table td.score-name {
    text-align: left;
    font-weight: 600;
}

.scores-table td.score-val {
    text-align: right;
    font-family: var(--font-header);
    color: var(--neon-green);
    font-weight: 700;
}

.start-high-scores {
    max-width: 380px;
    margin-top: 4px;
    margin-bottom: 16px;
}
