/* ============================================
   Oracle Cat Shooter - Hangar UI Styles
   Phase 3 - Upgrade System
   ============================================ */

/* Hangar Menu Container */
.hangar-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Deep navy base with volumetric atmosphere glows */
    background:
        radial-gradient(ellipse 70% 50% at 50% 15%, rgba(124, 58, 237, 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 50% 40% at 88% 80%, rgba(0, 212, 255, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 35% 25% at 12% 55%, rgba(245, 158, 11, 0.04) 0%, transparent 50%),
        #0a0e1a;
    z-index: 1000;
    display: none;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Subtle hex grid overlay for floor texture */
.hangar-menu::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cpolygon points='30,2 58,17 58,35 30,50 2,35 2,17' fill='none' stroke='rgba(255,255,255,0.018)' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 60px 52px;
}
.hangar-menu > * { position: relative; z-index: 1; }

.hangar-menu.active {
    display: block;
    animation: hngFadeIn 0.25s ease;
}

@keyframes hngFadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to   { opacity: 1; transform: scale(1); }
}

/* Hangar Header — military stencil aesthetic */
.hangar-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px 20px 12px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.08), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}
/* Scanline shimmer */
.hangar-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(255,255,255,0.012) 3px,
        rgba(255,255,255,0.012) 4px
    );
    pointer-events: none;
}

.hangar-title {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #c084fc 0%, #00d4ff 50%, #c084fc 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: hngTitleShimmer 4s linear infinite;
    margin-bottom: 2px;
}
@keyframes hngTitleShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.hangar-subtitle {
    color: rgba(148, 163, 184, 0.6);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ---- Hangar Pilot License card ---- */
@keyframes hPlScan {
    0%   { transform: translateX(-110%); opacity: 0; }
    15%  { opacity: 0.6; }
    85%  { opacity: 0.6; }
    100% { transform: translateX(110%);  opacity: 0; }
}
.h-pilot-license {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg,
        rgba(0,212,255,0.07) 0%,
        rgba(124,58,237,0.09) 50%,
        rgba(0,212,255,0.05) 100%);
    border: 1px solid rgba(0,212,255,0.38);
    border-radius: 12px;
    padding: 16px 28px;
    margin: 14px auto 0;
    max-width: 700px;
    box-shadow: 0 0 28px rgba(0,212,255,0.09), inset 0 0 24px rgba(0,212,255,0.03);
}
.h-pl-scan {
    position: absolute;
    top: 0; bottom: 0; width: 40%;
    pointer-events: none;
    background: linear-gradient(90deg,
        transparent, rgba(0,212,255,0.18), transparent);
    animation: hPlScan 3.5s ease-in-out infinite;
}
.h-pl-corner {
    position: absolute;
    width: 9px; height: 9px;
    border-color: rgba(0,212,255,0.65);
    border-style: solid;
    pointer-events: none;
}
.h-pl-c-tl { top: 5px; left: 5px;   border-width: 2px 0 0 2px; }
.h-pl-c-tr { top: 5px; right: 5px;  border-width: 2px 2px 0 0; }
.h-pl-c-bl { bottom: 5px; left: 5px;  border-width: 0 0 2px 2px; }
.h-pl-c-br { bottom: 5px; right: 5px; border-width: 0 2px 2px 0; }
.h-pl-left { flex: 1; min-width: 0; }
.h-pl-label {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(0,212,255,0.55);
    margin-bottom: 4px;
}
.h-pl-rank {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.1;
}
.h-pl-power {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: rgba(148,163,184,0.5);
    text-transform: uppercase;
    margin-top: 4px;
}
.h-pl-center {
    text-align: center;
    flex-shrink: 0;
    border-left: 1px solid rgba(0,212,255,0.18);
    border-right: 1px solid rgba(0,212,255,0.18);
    padding: 0 28px;
}
.h-pl-name {
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    color: #e2e8f0;
    text-shadow: 0 0 22px rgba(0,212,255,0.45), 0 0 44px rgba(124,58,237,0.22);
    line-height: 1.0;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.h-pl-right {
    text-align: right;
    flex-shrink: 0;
}
.h-pl-origin-label {
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: rgba(0,212,255,0.5);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.h-pl-origin {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #00d4ff;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(0,212,255,0.7);
}

/* ---- Tab bar (sci-fi navigation) ---- */
.h-tab-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

/* Scan line shimmer on tab hover */
@keyframes hTabScan {
    0%   { left: -100%; }
    100% { left:  200%; }
}
@keyframes hTabGlow {
    0%, 100% { box-shadow: 0 0 16px rgba(0,212,255,0.20), inset 0 0 10px rgba(0,212,255,0.07); }
    50%       { box-shadow: 0 0 28px rgba(0,212,255,0.40), inset 0 0 18px rgba(0,212,255,0.12); }
}

.h-tab {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(148, 163, 184, 0.8);
    border-radius: 8px;
    padding: 12px 36px;
    font-size: 1.0rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.22s, color 0.22s, background 0.22s, box-shadow 0.22s, transform 0.15s;
    font-family: inherit;
}
/* Scan shimmer pseudo */
.h-tab::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -100%;
    width: 60%;
    background: linear-gradient(90deg, transparent 0%, rgba(0,212,255,0.18) 50%, transparent 100%);
    transform: skewX(-15deg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
}
.h-tab:hover::before {
    opacity: 1;
    animation: hTabScan 0.65s ease-in-out;
}
.h-tab:hover {
    border-color: rgba(0, 212, 255, 0.5);
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.07);
    box-shadow: 0 0 18px rgba(0,212,255,0.18), 0 4px 12px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.h-tab:active { transform: translateY(0); }
.h-tab.is-active {
    border-color: rgba(0, 212, 255, 0.7);
    background: rgba(0, 212, 255, 0.12);
    color: #00d4ff;
    text-shadow: 0 0 12px rgba(0,212,255,0.6);
    animation: hTabGlow 3s ease-in-out infinite;
}

/* ---- Locked ship card ---- */
.h-ship-card.is-locked { opacity: 0.6; border-style: dashed !important; }
.h-ship-card.is-locked:hover {
    border-color: rgba(245, 158, 11, 0.6) !important;
    background: rgba(245, 158, 11, 0.06) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.12) !important;
}
.h-locked-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 800;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Resource Display */
.hangar-resources {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.resource-item {
    background: rgba(15, 23, 42, 0.7);
    padding: 15px 25px;
    border-radius: 10px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 160px;
    justify-content: center;
}

.resource-item:hover {
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-2px);
}

.resource-icon {
    font-size: 2rem;
}

.resource-info {
    text-align: left;
}

.resource-name {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.resource-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

/* Upgrade Sections */
.hangar-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.upgrade-section {
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 15px;
    padding: 25px;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.section-icon {
    font-size: 2.5rem;
}

/* Upgrade Card */
.upgrade-card {
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.upgrade-card:hover {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.upgrade-card.maxed {
    opacity: 0.6;
    border-color: rgba(34, 197, 94, 0.5);
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.upgrade-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.upgrade-level {
    font-size: 0.9rem;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
}

.upgrade-level.maxed {
    background: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.upgrade-progress {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.upgrade-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #06b6d4);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.upgrade-progress-fill.maxed {
    background: linear-gradient(90deg, #22c55e, #10b981);
}

.upgrade-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-cost {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #94a3b8;
}

.cost-item.insufficient {
    color: #ef4444;
}

.cost-item.sufficient {
    color: #22c55e;
}

.upgrade-button {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upgrade-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
}

.upgrade-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-button.maxed {
    background: linear-gradient(135deg, #22c55e, #10b981);
}

/* Unlock Cards */
.unlock-card {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.unlock-card:hover {
    border-color: rgba(168, 85, 247, 0.7);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
}

.unlock-card.unlocked {
    border-color: rgba(34, 197, 94, 0.5);
    opacity: 0.7;
}

.unlock-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.unlock-icon {
    font-size: 3rem;
}

.unlock-info {
    flex: 1;
}

.unlock-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.unlock-description {
    color: #94a3b8;
    font-size: 0.95rem;
}

.unlock-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.unlock-status {
    font-size: 1.2rem;
    font-weight: 700;
    color: #22c55e;
}

/* Close Button — sci-fi style */
/* Main Menu button — top-left, symmetric to hangar-close */
.hangar-main-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(0, 212, 255, 0.08);
    color: #67e8f9;
    border: 1px solid rgba(0, 212, 255, 0.40);
    padding: 8px 22px;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, color .2s, border-color .2s;
    z-index: 1001;
    overflow: hidden;
    font-family: inherit;
}
.hangar-main-menu::before,
.hangar-main-menu::after { content: none; }
.hangar-main-menu .hc-corner {
    position: absolute;
    width: 8px; height: 8px;
    border: 1.5px solid rgba(0, 212, 255, 0.55);
    border-radius: 1px;
    pointer-events: none;
}
.hangar-main-menu .hc-corner--tl { top: 4px; left: 4px;   border-width: 1.5px 0 0 1.5px; }
.hangar-main-menu .hc-corner--tr { top: 4px; right: 4px;  border-width: 1.5px 1.5px 0 0; }
.hangar-main-menu .hc-corner--bl { bottom: 4px; left: 4px;  border-width: 0 0 1.5px 1.5px; }
.hangar-main-menu .hc-corner--br { bottom: 4px; right: 4px; border-width: 0 1.5px 1.5px 0; }
.hangar-main-menu .hc-scan {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.hangar-main-menu .hc-scan::after {
    content: '';
    position: absolute;
    left: -100%; top: 0;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.18), transparent);
    transform: skewX(-15deg);
    transition: none;
}
.hangar-main-menu:hover .hc-scan::after {
    animation: hcScanMove 0.55s ease-in-out forwards;
}
.hangar-main-menu:hover {
    background: rgba(0, 212, 255, 0.14);
    border-color: rgba(0, 212, 255, 0.70);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(0,212,255,0.22), 0 4px 14px rgba(0,0,0,0.35);
}

.hangar-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 8px 22px;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, box-shadow .2s, color .2s, border-color .2s;
    z-index: 1001;
    overflow: hidden;
    font-family: inherit;
}
.hangar-close::before,
.hangar-close::after { content: none; }
/* corner brackets via box-shadow trick */
.hangar-close .hc-corner {
    position: absolute;
    width: 7px; height: 7px;
    border-color: rgba(239,68,68,0.65);
    border-style: solid;
    pointer-events: none;
}
.hangar-close .hc-corner--tl { top: 4px; left: 4px;   border-width: 1.5px 0 0 1.5px; }
.hangar-close .hc-corner--tr { top: 4px; right: 4px;  border-width: 1.5px 1.5px 0 0; }
.hangar-close .hc-corner--bl { bottom: 4px; left: 4px;  border-width: 0 0 1.5px 1.5px; }
.hangar-close .hc-corner--br { bottom: 4px; right: 4px; border-width: 0 1.5px 1.5px 0; }
/* scan shimmer */
@keyframes hcScan {
    0%   { transform: translateX(-100%) skewX(-10deg); }
    100% { transform: translateX(400%)  skewX(-10deg); }
}
.hangar-close .hc-scan {
    position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.hangar-close .hc-scan::after {
    content: ''; position: absolute;
    top: 0; bottom: 0; width: 30%;
    background: linear-gradient(90deg,
        transparent,
        rgba(239,68,68,0.14) 45%,
        rgba(239,68,68,0.28) 50%,
        rgba(239,68,68,0.14) 55%,
        transparent);
    opacity: 0; transition: opacity .1s;
}
.hangar-close:hover .hc-scan::after {
    opacity: 1;
    animation: hcScan .5s cubic-bezier(.4,0,.2,1) forwards;
}
.hangar-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.75);
    color: #fca5a5;
    box-shadow: 0 0 18px rgba(239,68,68,0.35), inset 0 0 10px rgba(239,68,68,0.08);
}

/* Power-Up HUD Styles */
.power-up-hud {
    position: fixed;
    top: 120px;
    left: 20px;  /* Changed from right to left to avoid overlap with Wave/Score/Resources */
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    padding: 15px;
    min-width: 200px;
    z-index: 100;
    display: none;
}

.power-up-hud-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.power-up-item {
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.power-up-icon {
    font-size: 2rem;
}

.power-up-info {
    flex: 1;
}

.power-up-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.power-up-stacks {
    font-size: 0.8rem;
    color: #94a3b8;
}

.power-up-stack-bar {
    width: 100%;
    height: 4px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.power-up-stack-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Laser Energy Bar */
.laser-energy-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.laser-energy-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 5px;
}

.laser-energy-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(168, 85, 247, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

.laser-energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #c084fc);
    border-radius: 8px;
    transition: width 0.2s ease, background 0.3s ease;
}

.laser-energy-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .hangar-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hangar-title {
        font-size: 2rem;
    }
    
    .hangar-resources {
        flex-direction: column;
        align-items: center;
    }
    
    .power-up-hud {
        top: 80px;
        left: 10px;  /* Changed from right to left for mobile too */
        min-width: 150px;
    }
}

/* Additional safe polish for preview and list items */
.hangar-preview-panel { display: inline-block; vertical-align: top; }
.hangar-preview-ship-view, .hangar-ship-view { height: 480px !important; }
.ship-item { padding: 12px; border-radius: 8px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.ship-item .ship-title { font-weight: 700; color: #fff; }
.ship-meta { color: #94a3b8; font-size: 0.9rem; }
.ship-actions { display: flex; gap: 8px; }
.upgrade-button { padding: 10px 16px; border-radius: 8px; font-weight: 700; }
.upgrade-button.secondary { background: rgba(255,255,255,0.06); color: #fff; border: 1px solid rgba(148,163,184,0.08); }
.hangar-preview-title { font-size: 1.1rem; }

/* Subtle hover affordance for preview to indicate interactivity */
.hangar-preview-ship-view:hover { outline: 2px dashed rgba(168,85,247,0.12); }

/* ============================================
   Hangar UI Redesign - 3-Panel Layout
   h- prefix = hangar redesign classes
   ============================================ */

/* 3-column grid layout — capped at 1560px */
.h-layout {
    display: grid;
    grid-template-columns: 230px 1fr 400px;
    gap: 12px;
    padding: 12px 16px;
    min-height: calc(100vh - 90px);
    box-sizing: border-box;
    max-width: 1560px;
    margin: 0 auto;
}

/* Glassmorphism panel base */
.h-ship-selector,
.h-center-panel,
.h-upgrades-panel {
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 14px;
    box-sizing: border-box;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.3);
}

.h-panel-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.5);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 8px;
}

/* ---- Ship selector (left panel) ---- */
.h-ship-selector { overflow-y: auto; max-height: calc(100vh - 130px); }

/* Base ship card */
.h-ship-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 7px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
/* Ship card hover — default purple */
.h-ship-card:hover {
    border-color: rgba(168, 85, 247, 0.45);
    background: rgba(168, 85, 247, 0.07);
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.12);
}
/* Active state */
.h-ship-card.is-active,
.h-ship-card.is-selected {
    border-color: rgba(168, 85, 247, 0.8);
    background: rgba(168, 85, 247, 0.12);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.18), inset 0 0 12px rgba(168,85,247,0.06);
}

/* ── Tier-specific card border colors ── */
.h-ship-card.h-tier-1 { border-left: 2px solid rgba(168, 85, 247, 0.5); }
.h-ship-card.h-tier-1:hover, .h-ship-card.h-tier-1.is-active {
    border-left-color: rgba(168, 85, 247, 0.9);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.18);
}
.h-ship-card.h-tier-2 { border-left: 2px solid rgba(0, 212, 255, 0.5); }
.h-ship-card.h-tier-2:hover { border-color: rgba(0, 212, 255, 0.45) !important; background: rgba(0,212,255,0.06) !important; }
.h-ship-card.h-tier-2.is-active {
    border-color: rgba(0, 212, 255, 0.8) !important;
    background: rgba(0, 212, 255, 0.1) !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.18) !important;
}
.h-ship-card.h-tier-3 { border-left: 2px solid rgba(245, 158, 11, 0.5); }
.h-ship-card.h-tier-3:hover { border-color: rgba(245,158,11,0.45) !important; background: rgba(245,158,11,0.06) !important; }
.h-ship-card.h-tier-3.is-active {
    border-color: rgba(245, 158, 11, 0.8) !important;
    background: rgba(245, 158, 11, 0.1) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.18) !important;
}

.h-ship-card-thumb {
    width: 86px;
    height: 65px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.05);
}
.h-ship-card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.h-ship-card-thumb canvas { display: block; }

.h-ship-card-info { flex: 1; min-width: 0; }
.h-ship-card-name { font-weight: 700; color: #e2d9f3; font-size: 1rem; line-height: 1.2; }
.h-ship-card-tier {
    font-size: 0.84rem;
    color: rgba(148, 163, 184, 0.6);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.h-active-dot {
    color: #22c55e;
    font-size: 0.62rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 4px;
    padding: 0px 5px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ---- Ship card action area (bottom of each card) ---- */
.h-ship-action {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}
.h-ship-active-badge {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #22c55e;
    letter-spacing: 0.1em;
    text-shadow: 0 0 8px rgba(34,197,94,0.6);
}
.h-ship-activate-btn {
    flex: 1;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.45);
    color: #22c55e;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s, box-shadow 0.18s, transform 0.15s;
}
.h-ship-activate-btn:hover {
    background: rgba(34, 197, 94, 0.22);
    box-shadow: 0 0 12px rgba(34,197,94,0.3);
    transform: translateY(-1px);
}
.h-ship-unlock-cost {
    font-size: 0.65rem;
    color: rgba(245, 158, 11, 0.75);
    white-space: nowrap;
}
.h-ship-unlock-btn {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #f59e0b;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s, box-shadow 0.18s, transform 0.15s;
    white-space: nowrap;
}
.h-ship-unlock-btn:hover {
    background: rgba(245, 158, 11, 0.22);
    box-shadow: 0 0 12px rgba(245,158,11,0.3);
    transform: translateY(-1px);
}

/* ---- Unlock modal ---- */
.h-unlock-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
}
.h-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
}
.h-modal-box {
    position: relative;
    background: #0d1526;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 32px 28px 24px;
    min-width: 340px;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 40px rgba(0,212,255,0.08);
    overflow: hidden;
    animation: hModalIn 0.22s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes hModalIn {
    from { transform: scale(0.88) translateY(12px); opacity: 0; }
    to   { transform: scale(1)    translateY(0px);  opacity: 1; }
}
.h-modal-tier-accent {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}
.h-modal-close {
    position: absolute;
    top: 10px; right: 12px;
    background: none;
    border: none;
    color: rgba(148,163,184,0.5);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}
.h-modal-close:hover { color: #ef4444; }
.h-modal-title {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: rgba(148,163,184,0.55);
    margin-bottom: 6px;
    text-transform: uppercase;
}
.h-modal-ship-name {
    font-size: 1.5rem;
    font-weight: 900;
    color: #e2d9f3;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.h-modal-tier-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 20px;
}
.h-modal-cost-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(148,163,184,0.5);
    text-transform: uppercase;
    margin-bottom: 10px;
}
.h-modal-cost-list { margin-bottom: 18px; }
.h-modal-cost-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.h-modal-cost-row.ok { border-color: rgba(34,197,94,0.25); color: #4ade80; }
.h-modal-cost-row.bad { border-color: rgba(239,68,68,0.25); color: #f87171; }
.h-modal-cost-val { font-weight: 800; font-variant-numeric: tabular-nums; flex: 1; }
.h-modal-cost-have { font-size: 0.72rem; color: rgba(148,163,184,0.5); }
.h-modal-afford-warn {
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    color: #f59e0b;
    margin-bottom: 14px;
    text-align: center;
}
.h-modal-actions { display: flex; gap: 10px; }
.h-modal-cancel {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(148,163,184,0.7);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.h-modal-cancel:hover { background: rgba(255,255,255,0.08); color: #e2d9f3; }
.h-modal-confirm {
    flex: 2;
    background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(124,58,237,0.15));
    border: 1px solid rgba(0,212,255,0.5);
    color: #00d4ff;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    transition: background 0.18s, box-shadow 0.18s, transform 0.15s;
}
.h-modal-confirm:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(0,212,255,0.28), rgba(124,58,237,0.28));
    box-shadow: 0 0 20px rgba(0,212,255,0.25);
    transform: translateY(-1px);
}
.h-modal-confirm.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.12);
    color: rgba(148,163,184,0.5);
}

/* ═══════════════════════════════════════════════════════════
   CENTER PANEL — SHIP ACTION BAR  (unlock / activate)
═══════════════════════════════════════════════════════════ */
.h-action-bar {
    width: 100%;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.07);
}

/* ── Locked state ── */
.h-action-bar.h-action-locked {
    border-color: rgba(245,158,11,0.3);
    background: rgba(245,158,11,0.04);
}
.h-act-cost-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.h-act-lock-icon { font-size: 1rem; }
.h-act-lock-title {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: rgba(245,158,11,0.75);
    text-transform: uppercase;
}
.h-act-cost-table { margin-bottom: 12px; }
.h-act-cost-cols {
    display: grid;
    grid-template-columns: 1fr 72px 72px 80px;
    gap: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(148,163,184,0.4);
    text-transform: uppercase;
    padding: 0 6px;
    margin-bottom: 4px;
}
.h-act-cost-row {
    display: grid;
    grid-template-columns: auto 1fr 72px 72px 80px;
    align-items: center;
    gap: 6px;
    padding: 6px 6px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.h-act-cost-row.ok  { color: #4ade80; border-color: rgba(34,197,94,0.2);   background: rgba(34,197,94,0.04); }
.h-act-cost-row.bad { color: #f87171; border-color: rgba(239,68,68,0.22);  background: rgba(239,68,68,0.04); }
.h-act-cost-icon  { font-size: 1rem; }
.h-act-cost-label { font-size: 0.78rem; }
.h-act-cost-need  { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.h-act-cost-have  { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.72rem; opacity: 0.65; }
.h-act-cost-still { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.72rem; font-weight: 800; }
.h-act-cost-still.ok  { color: #4ade80; }
.h-act-cost-still.bad { color: #f87171; }

/* ── Action buttons (shared & states) ── */
.h-action-btn {
    width: 100%;
    padding: 11px 0;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid transparent;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
}
.h-action-activate {
    background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(5,150,105,0.18));
    border-color: rgba(34,197,94,0.55);
    color: #4ade80;
}
.h-action-activate:hover {
    background: linear-gradient(135deg, rgba(34,197,94,0.32), rgba(5,150,105,0.32));
    box-shadow: 0 0 18px rgba(34,197,94,0.3);
    transform: translateY(-1px);
}
.h-action-unlock {
    background: linear-gradient(135deg, rgba(0,212,255,0.15), rgba(124,58,237,0.15));
    border-color: rgba(0,212,255,0.5);
    color: #00d4ff;
}
.h-action-unlock:hover:not(.disabled) {
    background: linear-gradient(135deg, rgba(0,212,255,0.28), rgba(124,58,237,0.28));
    box-shadow: 0 0 22px rgba(0,212,255,0.28);
    transform: translateY(-1px);
}
.h-action-unlock.disabled {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.08);
    color: rgba(148,163,184,0.4);
    cursor: not-allowed;
}

/* ── Active badge (center panel) ── */
.h-action-active-badge {
    text-align: center;
    color: #4ade80;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    padding: 10px;
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 9px;
    background: rgba(34,197,94,0.06);
}

/* ---- Center panel: vertical stack (preview showcase | stats below) ---- */
.h-center-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* ── Void showcase area ───────────────────────────────────────────────────── */
.h-preview-void {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    background:
        radial-gradient(ellipse 90% 100% at 50% 50%, rgba(124,58,237,0.16) 0%, rgba(0,212,255,0.05) 55%, transparent 80%);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
    /* Fixed height — lore scrolls inside, ship never moves */
    height: 576px;
}

/* Left half — ship preview, exactly 50% */
.h-preview-left {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border-right: 1px solid rgba(255,255,255,0.06);
    /* ship floats here, nothing else can push it */
    overflow: hidden;
}

/* Right half — lore terminal, fills remaining 50% and scrolls internally */
.h-ship-lore {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 18px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.79rem;
    line-height: 1.65;
    color: rgba(0,220,180,0.82);
    background: rgba(0,10,8,0.55);
    position: relative;
    background-image: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
    );
    scrollbar-width: thin;
    scrollbar-color: rgba(0,212,180,0.25) transparent;
    box-sizing: border-box;
}
.h-ship-lore::-webkit-scrollbar { width: 4px; }
.h-ship-lore::-webkit-scrollbar-thumb { background: rgba(0,212,180,0.25); border-radius: 2px; }

.h-lore-header {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.20em;
    color: rgba(0,212,255,0.35);
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(0,212,255,0.10);
}
.h-lore-line { display: block; white-space: pre-wrap; word-break: break-word; }
.h-lore-hl  { color: #00d4ff; font-weight: 700; text-shadow: 0 0 8px rgba(0,212,255,0.55); }
.h-lore-sep { color: rgba(0,200,160,0.25); }

.h-lore-cursor {
    display: inline-block;
    color: rgba(0,220,180,0.90);
    font-size: 0.78rem;
    animation: hLoreBlink 0.85s step-start infinite;
    line-height: 1;
    vertical-align: baseline;
    margin-left: 1px;
}
@keyframes hLoreBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Horizontal scan beam that sweeps top→bottom */
.h-preview-void::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,212,255,0.0) 10%,
        rgba(0,212,255,0.7) 35%,
        rgba(168,85,247,0.9) 65%,
        rgba(0,212,255,0.7) 85%,
        transparent 100%);
    filter: blur(1.5px);
    top: -3px;
    animation: hngScanLine 5s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}
@keyframes hngScanLine {
    0%          { top: -3px;   opacity: 0; }
    4%          { opacity: 1; }
    96%         { opacity: 0.7; }
    100%        { top: 100%;  opacity: 0; }
}

/* Ambient particle dust */
.h-preview-void::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 22%, rgba(0,212,255,0.35), transparent),
        radial-gradient(1px   1px   at 80% 14%, rgba(168,85,247,0.40), transparent),
        radial-gradient(2px   2px   at 88% 74%, rgba(0,212,255,0.28), transparent),
        radial-gradient(1px   1px   at 25% 85%, rgba(168,85,247,0.30), transparent),
        radial-gradient(1px   1px   at 55% 7%,  rgba(255,255,255,0.22), transparent),
        radial-gradient(1.5px 1.5px at 7%  60%, rgba(255,255,255,0.18), transparent),
        radial-gradient(1px   1px   at 94% 42%, rgba(0,212,255,0.22), transparent),
        radial-gradient(2px   2px   at 42% 97%, rgba(168,85,247,0.20), transparent);
    pointer-events: none;
    z-index: 0;
}

/* Pedestal beacon glow at bottom */
.h-pedestal {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 160px;
    height: 10px;
    background: radial-gradient(ellipse at center,
        rgba(0,212,255,0.55) 0%,
        rgba(124,58,237,0.35) 45%,
        transparent 75%);
    filter: blur(5px);
    pointer-events: none;
    z-index: 1;
    animation: hngPedestalPulse 3.5s ease-in-out infinite;
}
@keyframes hngPedestalPulse {
    0%, 100% { opacity: 0.55; width: 130px; }
    50%       { opacity: 1.0;  width: 210px; }
}

/* Frame wrapper for corner brackets */
.h-preview-frame {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Corner bracket decorations */
.h-preview-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #00d4ff;
    border-style: solid;
    pointer-events: none;
    z-index: 20;
    animation: hngCornerPulse 3s ease-in-out infinite;
}
@keyframes hngCornerPulse {
    0%, 100% { opacity: 0.65; filter: drop-shadow(0 0 4px rgba(0,212,255,0.55)); }
    50%       { opacity: 1.00; filter: drop-shadow(0 0 10px rgba(0,212,255,1.0)); }
}
.h-pc-tl { top: -7px; left: -7px; border-width: 2px 0 0 2px; border-radius: 3px 0 0 0; }
.h-pc-tr { top: -7px; right: -7px; border-width: 2px 2px 0 0; border-radius: 0 3px 0 0; }
.h-pc-bl { bottom: -7px; left: -7px; border-width: 0 0 2px 2px; border-radius: 0 0 0 3px; }
.h-pc-br { bottom: -7px; right: -7px; border-width: 0 2px 2px 0; border-radius: 0 0 3px 0; }
.h-pc-tl, .h-pc-bl { animation-delay: 0s; }
.h-pc-tr, .h-pc-br { animation-delay: 1.5s; }

/* The actual ship canvas card */
.h-preview-wrap {
    position: relative;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 10px;
    width: 374px;
    height: 509px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(124,58,237,0.30);
    box-shadow:
        0 0 0 1px rgba(0,212,255,0.08),
        0 0 35px rgba(124,58,237,0.40),
        0 0 80px rgba(0,212,255,0.10),
        0 24px 60px rgba(0,0,0,0.65);
    animation: hngFloat 6s ease-in-out infinite;
}
@keyframes hngFloat {
    0%, 100% {
        transform: translateY(0px);
        box-shadow: 0 0 0 1px rgba(0,212,255,0.08), 0 0 35px rgba(124,58,237,0.40), 0 0 80px rgba(0,212,255,0.10), 0 24px 60px rgba(0,0,0,0.65);
    }
    50% {
        transform: translateY(-10px);
        box-shadow: 0 0 0 1px rgba(0,212,255,0.18), 0 0 55px rgba(124,58,237,0.60), 0 0 110px rgba(0,212,255,0.22), 0 36px 70px rgba(0,0,0,0.55);
    }
}

/* Bottom inner vignette glow — makes ship feel grounded */
.h-preview-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 55% at 50% 108%, rgba(124,58,237,0.35) 0%, transparent 60%),
        linear-gradient(to top, rgba(0,212,255,0.07) 0%, transparent 35%);
    border-radius: 10px;
    z-index: 1;
}

.h-preview-wrap canvas,
.h-preview-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Animated card HTML — scale = 374/560 = 0.6679, perfect fit */
.h-preview-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 560px;
    height: 760px;
    border: none;
    transform: scale(0.6679);
    transform-origin: top left;
    pointer-events: none;
    background: transparent;
}

/* Stats panel — glassmorphism below preview */
.h-stats-panel {
    width: 100%;
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    box-sizing: border-box;
    overflow: visible;
}

.h-stats-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.h-stats-name { font-size: 1rem; font-weight: 800; color: #f0f4ff; letter-spacing: 0.03em; }
/* Tier badge: color changes via JS data-tier class on ship cards, badge stays purple default */
.h-stats-tier-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
}
.h-stats-tier-badge.tier-1 { color: #c084fc; border-color: rgba(192,132,252,0.4); background: rgba(168,85,247,0.12); }
.h-stats-tier-badge.tier-2 { color: #00d4ff; border-color: rgba(0,212,255,0.4); background: rgba(0,212,255,0.1); }
.h-stats-tier-badge.tier-3 { color: #f59e0b; border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.1); }

/* ── Stat rows — liquid fill tubes ─────────────────────────────────────── */
.h-stats-grid { margin-top: 12px; }

.h-stat-row {
    display: grid;
    grid-template-columns: 1.4rem 5rem 1fr;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 9px;
}
.h-si { font-size: 1rem; line-height: 1; }
.h-sl { font-size: 0.78rem; color: #9ca3af; font-weight: 600; white-space: nowrap; }

/* Liquid tube container */
.h-liq-tube {
    position: relative;
    height: 24px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
}

/* Base liquid fill (stat-specific color) */
.h-liq-base {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 12px;
    transition: width 0.5s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
/* Upgrade liquid fill (always cyan, pours in from where base ends) */
.h-liq-upg {
    position: absolute;
    top: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(0,212,255,0.55), rgba(0,212,255,0.90));
    border-radius: 0 12px 12px 0;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(.4,0,.2,1), left 0.5s cubic-bezier(.4,0,.2,1);
    box-shadow: inset 0 0 10px rgba(0,212,255,0.3);
}

/* Shimmer wave inside the fill */
.h-liq-wave {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.18) 40%,
        rgba(255,255,255,0.22) 50%,
        rgba(255,255,255,0.18) 60%,
        transparent 100%
    );
    background-size: 60% 100%;
    animation: liqShimmer 2.8s ease-in-out infinite;
    pointer-events: none;
}
.h-liq-wave-fast { animation-duration: 1.6s; }
@keyframes liqShimmer {
    0%   { background-position: -100% 0; }
    100% { background-position: 200% 0; }
}
/* Highlight line at top of liquid */
.h-liq-base::after, .h-liq-upg::after {
    content: '';
    position: absolute;
    top: 3px; left: 4px; right: 4px;
    height: 3px;
    background: rgba(255,255,255,0.22);
    border-radius: 2px;
    pointer-events: none;
}

/* Value text inside the tube */
.h-liq-val {
    position: absolute;
    right: 9px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.76rem; font-weight: 700;
    color: #e2d9f3;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    white-space: nowrap;
    z-index: 5; pointer-events: none;
}
.h-liq-delta { color: #00d4ff; }
.h-liq-hint  { color: #6b7280; font-weight: 400; font-size: 0.68rem; }

/* Per-stat fill colors */
.liq-health   .h-liq-base { background: linear-gradient(90deg, #be123c, #f43f5e); box-shadow: inset 0 0 10px rgba(244,63,94,0.25); }
.liq-shield   .h-liq-base { background: linear-gradient(90deg, #1d4ed8, #60a5fa); box-shadow: inset 0 0 10px rgba(96,165,250,0.25); }
.liq-firerate .h-liq-base { background: linear-gradient(90deg, #b45309, #f59e0b); box-shadow: inset 0 0 10px rgba(245,158,11,0.25); }
.liq-damage   .h-liq-base { background: linear-gradient(90deg, #c2410c, #fb923c); box-shadow: inset 0 0 10px rgba(251,146,60,0.25); }
.liq-speed    .h-liq-base { background: linear-gradient(90deg, #0e7490, #06b6d4); box-shadow: inset 0 0 10px rgba(6,182,212,0.25); }
.liq-armor    .h-liq-base { background: linear-gradient(90deg, #5b21b6, #8b5cf6); box-shadow: inset 0 0 10px rgba(139,92,246,0.25); }

/* PU Slots — grid of cells */
.h-slot-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.h-slot-cell {
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.4);
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.h-slot-cell.active {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #06b6d4 100%);
    border-color: rgba(168,85,247,0.5);
    box-shadow: 0 0 10px rgba(168,85,247,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}
.h-slot-cell.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    background-size: 60% 100%;
    animation: liqShimmer 3s ease-in-out infinite;
}
.h-slot-count {
    font-size: 0.82rem; font-weight: 800;
    color: #a855f7;
    margin-left: 4px;
}

/* Keep old delta/hint classes for any leftover reference */
.h-stat-upgraded { color: #22c55e; }
.h-stat-delta    { color: #22c55e; font-weight: 700; }
.h-stat-base-hint{ color: #6b7280; font-size: 0.72rem; }
.h-stat-nums     { font-size: 0.8rem; color: #d1d5db; white-space: nowrap; }

/* Power-up chips */
.h-pu-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.h-pu-tier-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.h-pu-legend { color: #4b5563; font-weight: 400; }
.h-pu-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.h-pu-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(100, 100, 100, 0.15);
    border-radius: 20px;
    padding: 3px 8px;
    font-size: 0.78rem;
}
.h-pu-name { color: #d1d5db; }
.h-pu-max { font-weight: 700; }
.h-pu-cur { color: #9ca3af; font-size: 0.72rem; }

/* Stack delta badge shown on T2+ ships vs T1 baseline */
.h-pu-delta { font-size: 0.72rem; font-weight: 700; border-radius: 4px; padding: 0 3px; }
.h-pu-delta--pos { color: #4ade80; }
.h-pu-delta--neg { color: #f87171; }
.h-pu-legend-bonus { color: #374151; }

/* PU Boosts row — inline inside stats grid for T2+ ships */
.h-stat-row--puboosts { align-items: flex-start; }
.h-pu-boosts-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.h-pu-boost-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(100,100,100,0.2);
    border-radius: 20px;
    padding: 2px 7px;
    font-size: 0.76rem;
}
.h-pu-boost-name { color: #d1d5db; }
.h-pu-boost-max  { font-weight: 700; }

/* Special Abilities row */
.h-stat-row--abilities { align-items: flex-start; }
.h-abilities-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.h-no-ability { color: #4b5563; font-size: 0.78rem; font-style: italic; }
.h-ability-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.35);
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 0.76rem;
    color: #c4b5fd;
    cursor: default;
}

/* ---- Upgrades panel (right panel) ---- */
.h-upgrades-panel { overflow: visible; }

.h-upgrade-section { margin-bottom: 20px; }
.h-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2d9f3;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.h-section-note { font-size: 0.72rem; color: #6b7280; font-weight: 400; }

/* Resources bar — premium currency chips (+40% size) */
.h-resources-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.h-res-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 7px 14px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.h-res-chip:hover { border-color: rgba(255,255,255,0.18); box-shadow: 0 0 14px rgba(255,255,255,0.06); transform: translateY(-1px); }
.h-res-credits { border-color: rgba(245, 158, 11, 0.3) !important; }
.h-res-credits:hover { border-color: rgba(245,158,11,0.6) !important; box-shadow: 0 0 14px rgba(245,158,11,0.12) !important; }
.h-res-icon { font-size: 1.68rem; flex-shrink: 0; }
.h-res-label { font-size: 0.87rem; color: rgba(148,163,184,0.65); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1px; }
.h-res-val { font-size: 1.33rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }

/* Upgrade cards — glassmorphism with neon glow */
.h-upg-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 11px 12px;
    margin-bottom: 8px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.h-upg-card:hover:not(.is-maxed) {
    border-color: rgba(124, 58, 237, 0.45);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.1);
}
.h-upg-card.is-maxed { opacity: 0.6; border-color: rgba(34, 197, 94, 0.25); }
.h-upg-card.cant-afford { opacity: 0.65; }

/* Locked ship notice shown instead of upgrade cards */
.h-upg-locked-notice {
    padding: 14px 12px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: rgba(252, 165, 165, 0.75);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.h-upg-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.h-upg-icon { font-size: 1.1rem; }
.h-upg-name { flex: 1; font-weight: 700; color: #e2d9f3; font-size: 0.88rem; }
.h-upg-lvl {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    color: rgba(148,163,184,0.7);
    border: 1px solid rgba(255,255,255,0.07);
}
.h-upg-lvl.is-maxed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34,197,94,0.3);
    text-shadow: 0 0 8px rgba(34,197,94,0.5);
}

/* Segmented progress bar — 10 seg per level */
.h-upg-bar-segs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}
.h-seg {
    flex: 1;
    height: 6px;
    border-radius: 2px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.3s, box-shadow 0.3s;
}
.h-seg.filled {
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    border-color: rgba(168,85,247,0.3);
    box-shadow: 0 0 4px rgba(168,85,247,0.4);
}
.h-seg.filled.maxed {
    background: linear-gradient(90deg, #10b981, #22c55e);
    border-color: rgba(34,197,94,0.3);
    box-shadow: 0 0 4px rgba(34,197,94,0.5);
}
/* Legacy smooth bar still used by stat bars */
.h-upg-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.h-upg-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #00d4ff);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.h-upg-bar-fill.is-maxed { background: linear-gradient(90deg, #22c55e, #10b981); }

.h-upg-effect { font-size: 0.76rem; color: rgba(148,163,184,0.7); margin-bottom: 8px; line-height: 1.4; }
.h-upg-next { color: #00d4ff; font-size: 0.7rem; margin-top: 2px; opacity: 0.8; }

.h-upg-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.h-upg-cost { display: flex; gap: 5px; flex-wrap: wrap; }

.h-cost-item {
    font-size: 0.76rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.07);
}
.h-cost-item.ok { color: #22c55e; border-color: rgba(34,197,94,0.2); }
.h-cost-item.bad { color: #f87171; border-color: rgba(248,113,113,0.2); }

/* Upgrade button — neon purple with pulse glow */
.h-upg-btn {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff;
    border: 1px solid rgba(168,85,247,0.5);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    white-space: nowrap;
}
.h-upg-btn:hover:not(:disabled) {
    box-shadow: 0 0 16px rgba(168,85,247,0.5), 0 0 30px rgba(168,85,247,0.2);
    transform: translateY(-1px);
    animation: hngBtnPulse 0.8s ease infinite;
}
@keyframes hngBtnPulse {
    0%, 100% { box-shadow: 0 0 16px rgba(168,85,247,0.5); }
    50%       { box-shadow: 0 0 28px rgba(168,85,247,0.8), 0 0 50px rgba(168,85,247,0.3); }
}
.h-upg-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.h-upg-maxed-badge {
    color: #22c55e;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-shadow: 0 0 8px rgba(34,197,94,0.5);
}

/* Responsive */
@media (max-width: 1280px) {
    .h-layout { grid-template-columns: 200px 1fr 360px; }
    .h-preview-void { height: 350px; }
    .h-ship-lore { font-size: 0.74rem; padding: 14px 16px; }
}
@media (max-width: 980px) {
    .h-layout { grid-template-columns: 180px 1fr; }
    .h-upgrades-panel { grid-column: 1 / -1; }
    .h-preview-void { height: 280px; }
    .h-ship-lore { font-size: 0.69rem; padding: 12px; }
}
@media (max-width: 700px) {
    .h-layout { grid-template-columns: 1fr; }
    .h-center-panel { align-items: center; }
    .h-preview-void { flex-direction: column; height: auto; }
    .h-preview-left { flex: 0 0 auto; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); overflow: visible; width: 100%; max-width: 260px; }
    .h-ship-lore { flex: none; height: 220px; font-size: 0.7rem; padding: 12px; }
    .h-ship-selector, .h-upgrades-panel { max-height: 45vh; }
}

/* Section title update — more military */
.h-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(224, 231, 255, 0.8);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.h-section-note { font-size: 0.65rem; color: rgba(148,163,184,0.45); font-weight: 400; letter-spacing: 0; text-transform: none; }

