/* ===== Orbital Drift Custom Styles ===== */

/* Custom neon gradients and shadows */
:root {
    --neon-yellow: #facc15;
    --neon-yellow-light: #fef08a;
    --neon-pink: #f43f5e;
    --neon-pink-light: #fda4af;
    --neon-cyan: #06b6d4;
    --neon-purple-light: #c4b5fd;
}

#game-container {
    position: relative;
    border-color: rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
    background: #05050a;
    overscroll-behavior: none;
    touch-action: none;
}

#TEMPLATE-4weird-gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(circle at center, #0a0a20 0%, #030308 100%);
    touch-action: none;
}

/* HUD elements */
#game-hud {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: none;
    z-index: 5;
    font-family: var(--font-display);
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

#game-hud.hidden {
    display: none !important;
}

.hud-item {
    background: rgba(10, 10, 18, 0.7);
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.25);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}

.hud-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.hud-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.hud-value.low-shield {
    color: var(--neon-pink) !important;
    animation: TEMPLATE-4weird-blink 0.6s steps(2) infinite;
}

/* Combo bar + tier */
.combo-bar-bg {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
}
#hud-combo-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-cyan), #fff);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.8);
}
.combo-tier {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--neon-yellow);
    min-height: 1em;
    margin-top: 2px;
}

/* Integrity / Health Shield Bar */
.integrity-container {
    width: 180px;
}

.integrity-bar-bg {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
    margin-top: 2px;
}

#hud-integrity-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-pink) 0%, var(--neon-cyan) 100%);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
    transition: width 0.2s ease-out;
    width: 100%;
}
#hud-integrity-bar.warn {
    background: linear-gradient(90deg, #f59e0b, #facc15);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.9);
}
#hud-integrity-bar.crit {
    background: linear-gradient(90deg, #f43f5e, #fb7185);
    box-shadow: 0 0 14px rgba(244, 63, 94, 1);
    animation: critBlink 0.5s steps(2) infinite;
}

.score-container {
    border-color: rgba(250, 204, 21, 0.3);
}

#hud-score {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.multiplier-container {
    border-color: rgba(6, 182, 212, 0.3);
}

#hud-multiplier {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* HUD controls (clickable) */
.TEMPLATE-4weird-hud-controls {
    position: absolute;
    top: calc(76px + env(safe-area-inset-top, 0px));
    right: calc(20px + env(safe-area-inset-right, 0px));
    display: flex;
    gap: 8px;
    z-index: 8;
}
.TEMPLATE-4weird-icon-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(10, 10, 18, 0.75);
    color: #fff;
    backdrop-filter: blur(5px);
    cursor: pointer;
}
.TEMPLATE-4weird-icon-btn:hover { border-color: rgba(6, 182, 212, 0.6); }
.TEMPLATE-4weird-icon-btn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }

/* Powerup chips */
.TEMPLATE-4weird-powerup-chip { min-width: 110px; }
.TEMPLATE-4weird-powerup-bar-bg {
    width: 100%; height: 8px; border-radius: 4px;
    background: rgba(255, 255, 255, 0.1); overflow: hidden;
}
#TEMPLATE-4weird-magnet-bar, #TEMPLATE-4weird-fx-bar {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), #fff);
}
#TEMPLATE-4weird-shield-bar {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #10b981, #fff);
}

/* Wave banner */
.TEMPLATE-4weird-wave-banner {
    position: absolute; top: 22%; left: 50%;
    transform: translateX(-50%);
    text-align: center; pointer-events: none; z-index: 6;
    font-family: var(--font-display);
    animation: TEMPLATE-4weird-wave-in 2.4s ease forwards;
}
#TEMPLATE-4weird-wave-title {
    display: block; font-size: 2rem; font-weight: 800; letter-spacing: 3px;
    color: #fff; text-shadow: 0 0 15px rgba(6, 182, 212, 0.8);
}
#TEMPLATE-4weird-wave-sub { display: block; color: var(--text-secondary); letter-spacing: 1px; }

/* Tutorial hint */
.TEMPLATE-4weird-tutorial-hint {
    position: absolute; bottom: 12%; left: 50%;
    transform: translateX(-50%);
    text-align: center; z-index: 6; pointer-events: none;
    background: rgba(10, 10, 18, 0.85);
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 12px; padding: 12px 18px;
    color: #fff; font-family: var(--font-display);
}
.TEMPLATE-4weird-tutorial-ring {
    width: 54px; height: 54px; margin: 0 auto 8px;
    border: 2px solid var(--neon-cyan); border-radius: 50%;
    animation: TEMPLATE-4weird-ring-pulse 1.2s ease-in-out infinite;
}

/* Hit flash + vignette + popups */
#hit-flash {
    position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 6;
    background: radial-gradient(circle, rgba(255,255,255,0.85) 0%, rgba(244,63,94,0.45) 45%, rgba(244,63,94,0) 75%);
}
#hit-flash.fire { animation: hitFlash 0.32s ease-out; }
#vignette {
    position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 6;
    background: radial-gradient(ellipse at center, transparent 52%, rgba(244,63,94,0.55) 100%);
    transition: opacity 0.25s;
}
#vignette.low-hp { opacity: 1; animation: lowHpPulse 1.1s ease-in-out infinite; }
#popup-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 7; }
.score-popup {
    position: absolute; transform: translate(-50%, -50%);
    font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
    color: #fef08a; text-shadow: 0 0 12px rgba(250, 204, 21, 0.8);
    opacity: 0; white-space: nowrap;
}
.score-popup.big {
    font-size: 1.6rem; color: #fff;
    text-shadow: 0 0 18px rgba(250,204,21,1), 0 0 40px rgba(250,204,21,0.6);
}
.score-popup.graze { color: #a5f3fc; text-shadow: 0 0 12px rgba(6,182,212,0.9); }
.score-popup.rise { animation: popupRise 0.9s ease-out forwards; }
.hud-pop { animation: hudPop 0.28s ease-out; }

/* Best badge + breakdown */
.TEMPLATE-4weird-best-badge {
    display: inline-block; margin: 8px 0; padding: 6px 14px; border-radius: 999px;
    font-weight: 800; letter-spacing: 1px; color: #000;
    background: linear-gradient(90deg, var(--neon-yellow), var(--neon-yellow-light));
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.7);
    animation: TEMPLATE-4weird-best-pop 0.5s ease;
}
.TEMPLATE-4weird-score-breakdown {
    list-style: none; margin: 10px 0 16px; padding: 0;
    color: var(--text-primary); line-height: 1.7;
}
.TEMPLATE-4weird-score-breakdown span { color: var(--neon-yellow); font-weight: 700; }

/* Glow Text for start and game over screens */
.glow-text {
    font-family: var(--font-display);
    text-shadow: 0 0 15px rgba(139, 92, 246, 0.8), 0 0 30px rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, #fff 0%, var(--neon-purple-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: 2px;
    animation: titleGlow 2.6s ease-in-out infinite;
}

.header-fail {
    text-shadow: 0 0 15px rgba(244, 63, 94, 0.8), 0 0 30px rgba(244, 63, 94, 0.4);
    background: linear-gradient(135deg, #fff 0%, var(--neon-pink-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.TEMPLATE-4weird-final-score {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 15px 0;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

/* Overlays */
#TEMPLATE-4weird-start-screen .TEMPLATE-4weird-overlay-content,
#TEMPLATE-4weird-game-over-screen .TEMPLATE-4weird-overlay-content,
#TEMPLATE-4weird-pause-screen .TEMPLATE-4weird-overlay-content {
    animation: overlayIn 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.btn-primary { transition: transform 0.12s ease, box-shadow 0.12s ease; min-height: 44px; }
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 24px rgba(6, 182, 212, 0.6); }
.btn-primary:active { transform: scale(0.96); }

/* Ship select */
.TEMPLATE-4weird-ship-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0 6px;
}
.TEMPLATE-4weird-ship-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px; border-radius: 12px; cursor: pointer;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(255, 255, 255, 0.04); color: #fff;
    font-family: var(--font-display);
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    min-height: 44px;
}
.TEMPLATE-4weird-ship-card:hover { transform: translateY(-2px); border-color: rgba(6, 182, 212, 0.6); }
.TEMPLATE-4weird-ship-card.selected {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.5);
    background: rgba(6, 182, 212, 0.1);
}
.TEMPLATE-4weird-ship-card:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
.TEMPLATE-4weird-ship-emoji { font-size: 1.8rem; }
.TEMPLATE-4weird-ship-name { font-weight: 800; letter-spacing: 1px; }
.TEMPLATE-4weird-ship-desc { font-size: 0.72rem; color: var(--text-secondary); text-align: center; }
.TEMPLATE-4weird-ship-stats { font-size: 0.68rem; color: var(--neon-yellow); text-align: center; }
.TEMPLATE-4weird-ship-hint { font-size: 0.75rem; color: var(--text-secondary); margin: 4px 0 12px; }
@media (max-width: 600px) {
    .TEMPLATE-4weird-ship-select { grid-template-columns: 1fr; }
}

.TEMPLATE-4weird-hangar-eyebrow {
    letter-spacing: 4px;
    font-size: 0.75rem;
    color: var(--neon-cyan);
    margin: 0 0 2px;
    font-family: var(--font-display);
}
.TEMPLATE-4weird-hangar-summary {
    color: var(--neon-yellow);
    font-weight: 600;
    margin: 4px 0 8px;
}
.TEMPLATE-4weird-overlay-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 6px;
}
.btn-secondary {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(139, 92, 246, 0.45);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: var(--font-display);
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.btn-secondary:hover { transform: translateY(-2px); border-color: rgba(6, 182, 212, 0.6); }
.btn-secondary:active { transform: scale(0.96); }
.TEMPLATE-4weird-ship-best {
    font-size: 0.68rem;
    color: var(--neon-purple-light);
    letter-spacing: 1px;
}

/* Key cap style for inline shortcuts */
kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.8rem;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.fatal-overlay {
    position: absolute; inset: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 24px;
    background: rgba(5, 5, 10, 0.92); color: #fff;
    font-family: var(--font-display);
}

/* Keyframes */
@keyframes popupRise {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
    12% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}
@keyframes hudPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}
@keyframes hitFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lowHpPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes critBlink { 50% { filter: brightness(1.7); } }
@keyframes overlayIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: none; }
}
@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(139,92,246,0.8), 0 0 30px rgba(139,92,246,0.4); }
    50% { text-shadow: 0 0 25px rgba(6,182,212,0.9), 0 0 60px rgba(6,182,212,0.5); }
}
@keyframes TEMPLATE-4weird-blink { 50% { opacity: 0.4; } }
@keyframes TEMPLATE-4weird-wave-in {
    0% { opacity: 0; transform: translateX(-50%) scale(0.9); }
    15% { opacity: 1; transform: translateX(-50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes TEMPLATE-4weird-ring-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}
@keyframes TEMPLATE-4weird-best-pop {
    0% { transform: scale(0.5); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media (max-width: 600px) {
    #game-hud {
        top: calc(10px + env(safe-area-inset-top, 0px));
        left: calc(10px + env(safe-area-inset-left, 0px));
        right: calc(10px + env(safe-area-inset-right, 0px));
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .integrity-container { grid-column: 1 / -1; width: 100%; }
    .hud-item {
        padding: 6px 10px;
        min-width: 60px;
    }
    .hud-value { font-size: 1rem; }
    .TEMPLATE-4weird-hud-controls { top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
    .TEMPLATE-4weird-tutorial-ring,
    .TEMPLATE-4weird-wave-banner,
    .TEMPLATE-4weird-best-badge,
    .glow-text { animation: none; }
}

/* FW-ARCADE-A fullscreen: ⛶ overlay top-right, HUD stays visible. */
.fw-fs-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.5);
    background: rgba(10, 10, 18, 0.8);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(5px);
}
.fw-fs-btn:hover { border-color: #fff; }
.fw-fs-btn:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
#game-container:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
}
#game-container:fullscreen #TEMPLATE-4weird-gameCanvas {
    width: 100%;
    height: 100%;
}
#game-container:fullscreen #game-hud {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
}
