/* css/style.css */

/* 1. Global Reset & Performance Base Layouts */
* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #101621;
    font-family: 'Courier New', Courier, monospace;
    color: #ffffff;
}

/* 3D WebGL Rendering Target Element */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* 2. Liquid Glassmorphism Start/Splash Menu Overlay */
.liquid-glass-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, rgba(129, 187, 245, 0.35) 0%, rgba(16, 22, 33, 0.9) 100%);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card {
    position: relative;
    padding: 3.5rem 2.5rem;
    border-radius: 28px;
    width: 500px;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.fluid-glow-blob {
    position: absolute;
    top: -60%;
    left: -60%;
    width: 220%;
    height: 220%;
    background: radial-gradient(circle at 40% 40%, rgba(133, 93, 245, 0.25) 0%, rgba(0, 0, 0, 0) 55%);
    animation: liquidBlobRotation 14s infinite linear;
    z-index: -1;
    pointer-events: none;
}

@keyframes liquidBlobRotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pixel-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ffffff;
    margin-bottom: 0.25rem;
    text-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.lobby-meta {
    font-size: 0.85rem;
    color: #a0b6cd;
    margin-bottom: 2.5rem;
    font-family: sans-serif;
    letter-spacing: 0.5px;
}

.pulse-online {
    color: #55ff55;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(85, 255, 85, 0.5);
}

.glass-action-btn {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 2px;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.glass-action-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.08) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(129, 187, 245, 0.35);
    border-color: rgba(255, 255, 255, 0.4);
}

.control-legend {
    margin-top: 2.5rem;
    font-family: sans-serif;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.8;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.25rem;
}

/* Menu Clear State Animation Hook */
.hidden-ui-fade {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 3. Primary Crosshair UI Reticle */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

#crosshair::before, #crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
}

#crosshair::before { top: 5px; left: 0; width: 12px; height: 2px; }
#crosshair::after { top: 0; left: 5px; width: 2px; height: 12px; }

/* 4. Active Gameplay HUD Canvas Layout Elements */
#game-hud-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 5;
    pointer-events: none;
}

#global-alert-banner {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff3333;
    text-shadow: 2px 2px 0px #000;
    text-align: center;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.banner-visible { opacity: 1 !important; }

/* HUD Resource Generators Inventory Counters Tracking Panel */
#resource-counters {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.res-node {
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.55);
    border-left: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.iron-hud { border-left-color: #dddddd; }
.gold-hud { border-left-color: #ffd700; }
.diamond-hud { border-left-color: #55ffff; }
.emerald-hud { border-left-color: #55ff55; }
.res-glyph { margin-right: 4px; }

/* Scoreboard Panel Widget Alignment */
#scoreboard-widget {
    position: absolute;
    top: 40px;
    right: 30px;
    width: 190px;
    padding: 14px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.scoreboard-title {
    text-align: center;
    font-weight: 900;
    color: #ffaa00;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.scoreboard-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 0;
}

.scoreboard-row {
    font-size: 0.88rem;
    margin: 4px 0;
    display: flex;
    justify-content: space-between;
}

.text-muted { color: #aaaaaa; }
.team-label { font-weight: bold; }
.status-alive { color: #55ff55; }
.status-dead { color: #ff5555; }

/* Bottom Center Running Health Bar Metrics */
#health-bar-container {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    text-align: center;
}

.health-label {
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: #ff5555;
    margin-bottom: 4px;
    text-shadow: 1px 1px 0px #000;
}

#hp-bar-outer {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    border-radius: 2px;
    overflow: hidden;
}

#hp-bar-fill {
    width: 100%;
    height: 100%;
    background: #ff2222;
    transition: width 0.15s ease-out;
}

/* 5. Voxel Style 9-Slot Hotbar Tray Layout */
#hotbar-tray {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.65);
    border: 2px solid #444444;
    border-radius: 4px;
}

.hotbar-slot {
    position: relative;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid transparent;
    border-radius: 2px;
}

.active-slot {
    border-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.28);
}

.item-icon-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #ffff55;
    text-shadow: 1px 1px 0px #000;
}

/* 6. Base Merchant Interactive Shop Window Overlay */
#merchant-shop-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(10, 15, 25, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
}

.shop-window-modal {
    width: 680px;
    height: 440px;
    background: #2c2c2c;
    border: 3px solid #1a1a1a;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
    pointer-events: auto; /* Re-allows mouse selections inside HUD layers */
}

.shop-header-wrapper {
    padding: 14px 20px;
    background: #1e1e1e;
    border-bottom: 2px solid #121212;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.shop-header-wrapper h2 {
    font-size: 1.2rem;
    color: #ffaa00;
    letter-spacing: 1.5px;
}

#close-shop-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.8rem;
    cursor: pointer;
}
#close-shop-btn:hover { color: #fff; }

.shop-body-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.shop-navigation-tabs {
    width: 180px;
    background: #222222;
    border-right: 2px solid #1a1a1a;
    display: flex;
    flex-direction: column;
}

.shop-tab-btn {
    padding: 16px;
    text-align: left;
    background: transparent;
    border: none;
    color: #bbb;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
    transition: all 0.15s ease;
}

.shop-tab-btn:hover { background: rgba(255,255,255,0.03); color: #fff; }
.active-tab { background: #2c2c2c !important; color: #ffaa00 !important; font-weight: bold; }

#shop-items-grid {
    flex: 1;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    overflow-y: auto;
    background: #2a2a2a;
}

.shop-item-card {
    background: #333333;
    border: 2px solid #1e1e1e;
    border-radius: 4px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100px;
}

.shop-item-name { font-weight: bold; font-size: 0.95rem; color: #fff; }
.shop-item-cost { font-size: 0.85rem; margin-top: 4px; color: #aaa; }

.buy-execute-btn {
    align-self: flex-end;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    background: #55ff55;
    color: #000;
}
.buy-execute-btn:hover { background: #33cc33; }

/* Display Toggles Override Flags */
.locked-funds { opacity: 0.55; }
.locked-funds .buy-execute-btn {
    background: #444 !important;
    color: #888 !important;
    cursor: not-allowed;
}

.hidden-ui { display: none !important; }
