/* Global HUD Shell */
html, body {
    height: 100vh;
    overflow: hidden;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text);
}

header {
    margin-bottom: 0 !important;
}

.app-body {
    flex: 1 !important;
    min-height: 0 !important;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
}

/* Game Layout */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90%;
    margin: 0 auto;
    height: 100%;
    max-height: 100%;
    overflow: visible;
    gap: 1rem;
    box-sizing: border-box;
    padding: 0.5rem;
    animation: fadeIn 0.4s ease-out;
}

/* Glassmorphic Panel Elements */
.glassmorphic {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
}

/* HUD Metric Styling */
/* Minimal Control Row Layout */
.control-row-minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0.5rem auto 0 auto;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}

.mode-toggles {
    display: flex;
    gap: 0.5rem;
}

.stats-counter {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.flags-counter, .timer-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.hud-label {
    opacity: 0.6;
    font-size: 0.8rem;
}

.hud-value {
    font-size: 1.25rem;
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary);
}

.sector-buttons button, .mode-toggles button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.sector-buttons button:hover, .mode-toggles button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sector-buttons button.active, .mode-toggles button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 10px var(--primary);
}

.btn-reset {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.btn-reset-guide {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.25) !important;
    cursor: default !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.btn-reset-guide:hover {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* Board frame */
.board-frame {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Defend SVG Board Frame */
.defend-board-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.defend-svg-canvas {
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    width: 100%;
    max-width: min(100%, calc(100vh - 280px));
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
}

/* Neon SVG Entities styling */
.neon-player-ship {
    fill: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary));
    transition: all 0.05s ease-out;
}

.neon-laser {
    stroke: #00ffff;
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px #00ffff);
}

.neon-threat {
    fill: #ef4444;
    stroke: #ef4444;
    stroke-width: 0.5;
    filter: drop-shadow(0 0 5px #ef4444);
}

.neon-particle {
    fill: #ffaa00;
    filter: drop-shadow(0 0 4px #ffaa00);
}

/* Start Game Overlay Glow */
.glow-cyan {
    color: var(--primary) !important;
    text-shadow: 0 0 10px var(--primary) !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Outcomes & Overlays */
.game-overlay {
    position: absolute;
    top: 5%;
    left: 5%;
    right: 5%;
    bottom: 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 2rem;
    box-sizing: border-box;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.outcome-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.2rem;
    margin: 0 0 1rem 0;
}

.outcome-title.secured {
    color: var(--primary);
    text-shadow: 0 0 12px var(--primary);
}

.outcome-title.compromised {
    color: #ef4444;
    text-shadow: 0 0 12px #ef4444;
}

.stat-line {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
}

.highlight {
    font-weight: 700;
    color: var(--primary);
}

/* Submit Record Forms */
.score-submission-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 320px;
    align-items: center;
}

.score-submission-form label {
    font-size: 0.75rem;
    opacity: 0.6;
    letter-spacing: 0.05rem;
    font-family: 'JetBrains Mono', monospace;
}

.input-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.input-row input {
    flex: 1;
    padding: 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.2rem;
}

.input-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 6px var(--primary);
}



/* Buttons styling */
.btn-submit, .btn-restart {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn-submit:hover:not(:disabled), .btn-restart:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4), 0 0 8px var(--primary);
}

.btn-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Touch control buttons styling */
.btn-touch {
    font-size: 1.1rem !important;
    padding: 0.5rem 1.2rem !important;
    user-select: none;
    -webkit-user-select: none;
}

.control-left, .control-right {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.control-fire {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    position: relative;
    overflow: hidden;
    transition: background 0.05s linear;
}

.control-fire.fully-charged {
    border-color: #ffeb3b !important;
    color: #ffeb3b !important;
    box-shadow: 0 0 15px #ffeb3b !important;
    animation: pulseGlow 0.4s infinite alternate;
}

/* Charge shot and orb visuals */
.neon-charge-orb {
    fill: #ffaa00;
    filter: drop-shadow(0 0 5px #ffaa00);
    opacity: 0.85;
}

.neon-charge-orb.fully-charged {
    fill: #ffeb3b;
    filter: drop-shadow(0 0 10px #ffeb3b);
    animation: pulseGlow 0.2s infinite alternate;
}

.neon-charge-shot {
    fill: #ff5500;
    stroke: #ffeb3b;
    stroke-width: 1.0;
    filter: drop-shadow(0 0 12px #ff5500);
}

@keyframes pulseGlow {
    from { filter: drop-shadow(0 0 4px currentColor); }
    to { filter: drop-shadow(0 0 12px currentColor); }
}

.neon-helper-drone {
    fill: #00ffff;
    stroke: #00ffff;
    stroke-width: 0.5;
    filter: drop-shadow(0 0 5px #00ffff);
    animation: hoverPulse 0.6s infinite alternate ease-in-out;
}

.neon-shield-powerup {
    fill: #10b981;
    stroke: #ffffff;
    stroke-width: 0.5;
    filter: drop-shadow(0 0 7px #10b981);
    animation: itemPulse 0.4s infinite alternate ease-in-out;
}

.neon-helper-powerup {
    fill: #eab308;
    stroke: #ffffff;
    stroke-width: 0.5;
    filter: drop-shadow(0 0 7px #eab308);
    animation: itemPulse 0.4s infinite alternate ease-in-out;
}

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

@keyframes itemPulse {
    from { filter: drop-shadow(0 0 4px currentColor); }
    to { filter: drop-shadow(0 0 10px currentColor); }
}

.neon-charge-orb.level2-charged {
    fill: #e879f9;
    filter: drop-shadow(0 0 15px #e879f9);
    animation: pulseGlow 0.15s infinite alternate;
}

.neon-level2-beam {
    stroke: #f59e0b;
    stroke-width: 4.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 15px #f59e0b) drop-shadow(0 0 30px #ef4444);
    opacity: 0.85;
}

.neon-level2-beam-core {
    stroke: #ffffff;
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px #ffffff);
    opacity: 0.95;
}

.neon-boss-ship {
    fill: #ef4444;
    stroke: #c084fc;
    stroke-width: 0.8;
    filter: drop-shadow(0 0 12px #ef4444);
    animation: hoverPulse 0.4s infinite alternate ease-in-out;
}

.neon-boss-health-bar {
    filter: drop-shadow(0 0 4px #ef4444);
}

.neon-boss-label {
    filter: drop-shadow(0 0 3px #ef4444);
    font-weight: bold;
    letter-spacing: 0.5px;
}

.neon-enemy-bullet {
    stroke: #f59e0b;
    stroke-width: 1.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 5px #ef4444);
}

.neon-scout {
    fill: #a855f7;
    stroke: #f472b6;
    stroke-width: 0.6;
    filter: drop-shadow(0 0 8px #a855f7);
}

/* Hide the touch dpad/buttons on devices with a mouse */
@media (pointer: fine) {
    .btn-touch {
        display: none !important;
    }
}
