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

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

html, body {
    width: 100%;
    height: 100%;
}

 body {
     background: url('bg.jpg') no-repeat center center fixed;
     background-size: cover;
     margin: 0;
     overflow: hidden;
     font-family: 'Orbitron', monospace;
     position: relative;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
 }

 /* Animated background stars */
 .stars {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     pointer-events: none;
     z-index: 0;
 }

 .star {
     position: absolute;
     width: 2px;
     height: 2px;
     background: #fff;
     border-radius: 50%;
     animation: twinkle 3s infinite alternate;
 }

 @keyframes twinkle {
     0% {
         opacity: 0.3;
         transform: scale(1);
     }

     100% {
         opacity: 1;
         transform: scale(1.2);
     }
 }

 /* Preloader */
 .preloader {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
     display: flex;
     justify-content: center;
     align-items: center;
     z-index: 1000;
     transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
 }

 .preloader.hidden {
     opacity: 0;
     visibility: hidden;
 }

 .loader-content {
     text-align: center;
     color: #00ff88;
 }

 .loader-title {
     font-size: 3rem;
     font-weight: 900;
     margin-bottom: 2rem;
     text-shadow: 0 0 20px #00ff88;
     animation: glow 2s ease-in-out infinite alternate;
 }

 @keyframes glow {
     from {
         text-shadow: 0 0 20px #00ff88;
     }

     to {
         text-shadow: 0 0 30px #00ff88, 0 0 40px #00ff88;
     }
 }

 .loader-spinner {
     width: 60px;
     height: 60px;
     border: 3px solid rgba(0, 255, 136, 0.3);
     border-top: 3px solid #00ff88;
     border-radius: 50%;
     animation: spin 1s linear infinite;
     margin: 0 auto 1rem;
 }

 @keyframes spin {
     0% {
         transform: rotate(0deg);
     }

     100% {
         transform: rotate(360deg);
     }
 }

 .loader-text {
     font-size: 1.2rem;
     opacity: 0.8;
 }

 /* Game UI */
svg#game {
     width: 100%;
    height: 100vh;
    height: 100dvh;
     position: fixed;
     top: 0;
     left: 0;
     z-index: 1;
 }

/* Mobile: prevent browser gestures while aiming */
#game {
    touch-action: none;
}

/* Ensure UI SVG icons don't inherit game SVG sizing */
.in-game-home svg {
    width: 22px;
    height: 22px;
    position: static;
}

/* Tez Shooter-style overlays (menu + modals) */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.78);
    z-index: 200;
    padding: 2rem;
}

.menu-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(92vw, 420px);
}

.menu-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.menu-button:active {
    transform: scale(0.99);
}

.menu-icon {
    width: 26px;
    display: inline-flex;
    justify-content: center;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    z-index: 300;
    padding: 1.25rem;
}

.modal-content {
    width: min(92vw, 720px);
    max-height: min(86vh, 780px);
    overflow: auto;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 14px;
    padding: 16px;
    color: #fff;
    backdrop-filter: blur(12px);
}

.close-modal-btn {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
}

.leaderboard-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 14px;
}

.leaderboard-select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-family: 'Orbitron', monospace;
}

.leaderboard-header,
.leaderboard-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px;
    gap: 10px;
    align-items: center;
}

.leaderboard-header {
    color: #00ff88;
    opacity: 0.9;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.18);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
}

.leaderboard-item {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-pagination {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: center;
}

.pagination-btn {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.profile-field-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-field label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 6px;
}

.profile-field input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-family: 'Orbitron', monospace;
}

.profile-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.profile-save-btn {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
}

@media (max-width: 720px) {
    .profile-field-group {
        grid-template-columns: 1fr;
    }
}

 .game-ui {
     position: fixed;
    top: calc(20px + env(safe-area-inset-top));
    left: calc(20px + env(safe-area-inset-left));
     color: #00ff88;
     font-family: 'Orbitron', monospace;
     z-index: 10;
     text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
 }

.in-game-home {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    line-height: 1;
    cursor: pointer;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.in-game-home-icon {
    display: block;
    filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.35));
}

.in-game-home:active {
    transform: scale(0.99);
}

 .score-board {
     background: rgba(0, 0, 0, 0.7);
    padding: 10px 12px;
    border-radius: 8px;
     border: 2px solid rgba(0, 255, 136, 0.3);
    margin-bottom: 10px;
     backdrop-filter: blur(10px);
 }

 .score {
    font-size: 1.2rem;
     font-weight: 700;
    margin-bottom: 4px;
 }

 .arrows-count {
    font-size: 0.85rem;
     opacity: 0.8;
 }

 .instructions {
     position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom));
     left: 50%;
     transform: translateX(-50%);
     color: #00ff88;
     font-family: 'Orbitron', monospace;
     font-size: 1.1rem;
     text-align: center;
     text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
     z-index: 10;
     animation: pulse 2s ease-in-out infinite alternate;
 }

 @keyframes pulse {
     from {
         opacity: 0.6;
     }

     to {
         opacity: 1;
     }
 }

 /* Enhanced target glow effect */
 #target {
     filter: drop-shadow(0 0 15px rgba(244, 83, 28, 0.6));
     animation: targetGlow 3s ease-in-out infinite alternate;
 }

 @keyframes targetGlow {
     from {
         filter: drop-shadow(0 0 15px rgba(244, 83, 28, 0.6));
     }

     to {
         filter: drop-shadow(0 0 25px rgba(244, 83, 28, 0.8));
     }
 }

 /* Enhanced bow styling */
 #bow {
     filter: drop-shadow(0 0 8px rgba(136, 206, 2, 0.4));
 }

 /* Arrow trail effect */
 .arrow-trail {
     opacity: 0;
     stroke: #00ff88;
     stroke-width: 2;
     fill: none;
     filter: blur(1px);
 }

 /* Particle effects */
 .particles {
     position: fixed;
     pointer-events: none;
     z-index: 5;
 }

 .particle {
     position: absolute;
     width: 4px;
     height: 4px;
     background: #00ff88;
     border-radius: 50%;
 }

 .game-over {
     position: fixed;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
     background: rgba(0, 0, 0, 0.85);
     /* dark overlay */
     display: flex;
     align-items: center;
     justify-content: center;
     opacity: 0;
     visibility: hidden;
     transition: opacity 0.6s ease-in-out, visibility 0.6s;
     z-index: 9999;
 }

 .game-over.show {
     opacity: 1;
     visibility: visible;
 }

 .game-over-content {
     text-align: center;
     color: #fff;
     animation: popIn 0.8s ease forwards;
 }

 .game-over-content h1 {
     font-size: 4rem;
     color: #ff3333;
     text-shadow: 0 0 15px #ff0000, 0 0 30px #ff6666;
     margin: 0 0 20px;
     animation: pulse 1.5s infinite;
 }

 .game-over-content p {
     font-size: 1.5rem;
     color: #f5f5f5;
 }

.game-over-content button {
    margin-top: 18px;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.35);
    background: rgba(0, 0, 0, 0.55);
    color: #00ff88;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    width: min(86vw, 360px);
    margin-left: auto;
    margin-right: auto;
}

.game-over-content button:active {
    transform: scale(0.98);
}

 /* Animations */
 @keyframes popIn {
     0% {
         transform: scale(0.5);
         opacity: 0;
     }

     100% {
         transform: scale(1);
         opacity: 1;
     }
 }

 @keyframes pulse {

     0%,
     100% {
         text-shadow: 0 0 15px #ff0000, 0 0 30px #ff6666;
     }

     50% {
         text-shadow: 0 0 25px #ff3333, 0 0 50px #ff9999;
     }
 }



 /* Wind effect indicator */
 .wind-indicator {
     position: fixed;
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
     color: #00ff88;
     font-family: 'Orbitron', monospace;
     background: rgba(0, 0, 0, 0.7);
     padding: 10px 15px;
     border-radius: 8px;
     border: 1px solid rgba(0, 255, 136, 0.3);
     backdrop-filter: blur(10px);
     z-index: 10;
 }

 .wind-arrow {
     display: inline-block;
     transition: transform 0.3s ease;
     margin-left: 10px;
 }

 /* Power meter */
 .power-meter {
     position: fixed;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(520px, 86vw);
    height: 18px;
     background: rgba(0, 0, 0, 0.7);
     border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 999px;
     z-index: 10;
     backdrop-filter: blur(10px);
    overflow: hidden;
 }

 .power-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00ff88 0%, #ffaa00 55%, #ff4444 100%);
    border-radius: 999px;
     position: absolute;
    left: 0;
    top: 0;
    transition: width 0.1s ease;
 }

 /* Success particles */
 @keyframes successParticle {
     0% {
         opacity: 1;
         transform: translate(0, 0) scale(1);
     }

     100% {
         opacity: 0;
         transform: translate(var(--random-x), var(--random-y)) scale(0);
     }
 }

/* Mobile: rotate hint overlay (portrait phones) */
.rotate-hint {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 12px;
    padding: 14px 16px;
    z-index: 20;
    display: none;
    text-align: center;
    width: min(90vw, 420px);
    backdrop-filter: blur(10px);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.35);
}

@media (max-width: 720px) and (orientation: portrait) {
    .rotate-hint {
        display: block;
    }
}

/* Mobile: tighten HUD so it doesn't cover gameplay */
@media (max-width: 720px) {
    .loader-title {
        font-size: 2rem;
    }

    .score {
        font-size: 1.1rem;
    }

    .score-board {
        padding: 10px 12px;
    }

    .wind-indicator {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .power-meter {
        width: min(440px, 90vw);
        height: 16px;
        bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .instructions {
        /* keep above power meter */
        bottom: calc(52px + env(safe-area-inset-bottom));
        font-size: 0.95rem;
        width: min(92vw, 520px);
    }
}