@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

/* Custom Icon Styles */
.game-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: 0;
    transition: filter 0.3s ease, transform 0.2s ease;
}

.icon-wrapper {
    display: inline-block;
    line-height: 0;
    vertical-align: middle;
}

/* Hover glow effect for clickable elements with icons */
button:hover .game-icon,
.meta-card:hover .game-icon,
.sanctuary-card:hover .game-icon {
    filter: drop-shadow(0 0 8px currentColor) brightness(1.2);
    transform: scale(1.05);
}

/* Sanctuary icon specific styles */
.sanctuary-icon svg {
    filter: drop-shadow(0 0 10px currentColor);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.sanctuary-card:hover .sanctuary-icon svg {
    transform: scale(1.15);
    filter: drop-shadow(0 0 20px currentColor) brightness(1.3);
    animation: icon-pulse 1s ease-in-out infinite;
}

/* Icon pulse animation */
@keyframes icon-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 15px currentColor) brightness(1.2);
    }
    50% {
        filter: drop-shadow(0 0 25px currentColor) brightness(1.4);
    }
}

/* Achievement and stat icons */
.meta-card .game-icon {
    transition: all 0.3s ease;
}

.meta-card:hover .game-icon {
    filter: drop-shadow(0 0 12px currentColor) brightness(1.3);
}

/* Currency display icons */
.currency-display .game-icon {
    animation: currency-shimmer 3s ease-in-out infinite;
}

@keyframes currency-shimmer {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3) drop-shadow(0 0 8px #00ffff);
    }
}

/* Completion tracker rank icon */
.completion-tracker .game-icon {
    filter: drop-shadow(0 0 15px currentColor);
    animation: rank-glow 2s ease-in-out infinite;
}

@keyframes rank-glow {
    0%, 100% {
        filter: drop-shadow(0 0 15px currentColor) brightness(1.1);
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 30px currentColor) brightness(1.3);
        transform: scale(1.05);
    }
}

/* Boot Screen Styles */
.boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2a 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'VT323', monospace;
    color: #00ffff;
    transition: opacity 0.5s ease;
}
.boot-screen.boot-complete {
    /* Flash animation removed */
}
.boot-container {
    width: 90%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.boot-header {
    text-align: center;
    border-bottom: 2px solid #00ffff;
    padding-bottom: 20px;
    animation: boot-header-glow 2s ease-in-out infinite;
}
@keyframes boot-header-glow {
    0%, 100% { text-shadow: 0 0 10px #00ffff; }
    50% { text-shadow: 0 0 20px #00ffff, 0 0 30px #00ff88; }
}
.boot-logo {
    font-size: 3rem;
    color: #00ffff;
    text-shadow: 0 0 15px #00ffff;
    margin-bottom: 10px;
    letter-spacing: 3px;
}
.boot-subtitle {
    font-size: 1.2rem;
    color: #00ffff;
    letter-spacing: 2px;
}
.boot-console {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00ffff;
    border-radius: 5px;
    padding: 20px;
    height: 300px;
    overflow-y: auto;
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 255, 0.1),
        0 0 20px rgba(0, 255, 255, 0.3);
}
.boot-console::-webkit-scrollbar {
    width: 8px;
}
.boot-console::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}
.boot-console::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
}
.boot-message {
    font-size: 1.1rem;
    color: #00ffff;
    margin-bottom: 8px;
    text-shadow: 0 0 5px #00ffff;
    animation: boot-message-fade-in 0.3s ease;
}
@keyframes boot-message-fade-in {
    from { 
        opacity: 0; 
        transform: translateX(-10px);
    }
    to { 
        opacity: 1; 
        transform: translateX(0);
    }
}
.boot-progress-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.boot-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    color: #00ffff;
}
#boot-status {
    color: #00ffff;
    text-shadow: 0 0 8px #00ffff;
}
#boot-status.boot-ready {
    color: #00ff88;
    text-shadow: 0 0 15px #00ff88;
    animation: boot-ready-pulse 0.5s ease-in-out 3;
}
@keyframes boot-ready-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.02);
        opacity: 0.9;
    }
}
#boot-percentage {
    color: #c77dff;
    min-width: 50px;
    text-align: right;
}
.boot-progress-bar-container {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00ffff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(0, 255, 255, 0.3);
}
.boot-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        #00ffff 0%, 
        #00ff88 50%, 
        #00ffff 100%);
    background-size: 200% 100%;
    animation: boot-progress-shimmer 2s linear infinite;
    box-shadow: 0 0 15px #00ffff;
    transition: width 0.3s ease;
}
@keyframes boot-progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.boot-footer {
    text-align: right;
    font-size: 1.5rem;
    color: #00ffff;
}
.boot-blink {
    animation: boot-cursor-blink 1s step-end infinite;
}
@keyframes boot-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
/* Mobile responsiveness */
@media (max-width: 768px) {
    .boot-logo {
        font-size: 2rem;
    }
    
    .boot-subtitle {
        font-size: 1rem;
    }
    
    .boot-console {
        height: 200px;
        padding: 15px;
    }
    
    .boot-message {
        font-size: 0.9rem;
    }
    
    .boot-progress-bar-container {
        height: 25px;
    }
}
@media (max-width: 480px) {
    .boot-logo {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .boot-subtitle {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }
    
    .boot-console {
        height: 150px;
        padding: 10px;
    }
    
    .boot-message {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .boot-progress-label {
        font-size: 1rem;
    }
    
    .boot-progress-bar-container {
        height: 20px;
    }
}
:root {
    /* HUD Theme Variables - can be overridden by skins */
    --hud-primary: #00ffff;
    --hud-secondary: #00ff88;
    --hud-accent: #c77dff;
    --hud-bar-bg: rgba(0, 0, 0, 0.7);
    --hud-bar-fill: linear-gradient(90deg, rgba(0,255,255,1) 0%, rgba(0,150,255,1) 100%);
    --hud-bg-gradient: linear-gradient(135deg, #1f1f2e 0%, #1a1a2a 100%);
    --hud-border-width: 2px;
    --hud-border-style: solid;
    --hud-radius: 8px;
    --hud-shadow: 0 0 10px #00ffff;
    --hud-bar-height: 20px;
}

body {
    font-family: 'VT323', monospace;
    overflow: hidden;
    background-color: #111;
    color: white;
    user-select: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
}

/* Gamepad control hint */
.gamepad-hint {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: #00ffff;
    z-index: 9999;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.gamepad-hint:hover {
    opacity: 1;
}
}

canvas {
    background-color: #1f1f2e;
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
}

.hidden { display: none !important; }

/* --- Main Menu & Meta Screens --- */
.meta-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--hud-bg-gradient) !important;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.main-menu-title { 
    font-size: 6rem; 
    color: var(--hud-primary) !important; 
    text-shadow: 0 0 15px var(--hud-primary) !important; 
    margin-bottom: 40px; 
}
.menu-button {
    background: var(--hud-primary) !important; 
    color: #1a1a2a; 
    font-size: 1.5rem; 
    font-family: 'VT323', monospace;
    font-weight: 400;
    padding: 15px 40px;
    border-radius: var(--hud-radius) !important; 
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-secondary) !important; 
    cursor: pointer; 
    margin: 10px;
    transition: all 0.2s ease;
    box-shadow: var(--hud-shadow) !important;
}
.menu-button:hover { 
    transform: scale(1.05); 
    box-shadow: 0 0 20px var(--hud-primary) !important; 
}
.currency-display {
    position: absolute; 
    top: 20px; 
    right: 20px;
    background: var(--hud-bar-bg) !important; 
    padding: 10px 20px; 
    border-radius: var(--hud-radius) !important;
    font-size: 1.2rem; 
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-accent) !important;
    box-shadow: var(--hud-shadow) !important;
}

/* --- Settings Screen --- */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 500px;
}
.setting-option {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 1.5rem;
    align-items: flex-start;
    width: 100%;
}

.setting-option > span {
    font-size: 1.5rem;
    color: var(--hud-primary);
}

.setting-option > div {
    width: 100%;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}
.setting-button {
    font-size: 1.2rem;
    padding: 8px 16px;
    background-color: var(--hud-bar-bg);
    border: var(--hud-border-width) var(--hud-border-style) #555;
    border-radius: var(--hud-radius);
    cursor: pointer;
    margin-left: 10px;
    color: #fff;
    font-family: 'VT323', monospace;
}
.setting-button.active {
    background-color: var(--hud-primary);
    color: #1a1a2a;
    border-color: var(--hud-secondary);
    box-shadow: var(--hud-shadow);
}

/* Volume Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
}

input[type="range"]::-webkit-slider-track {
    background: #333;
    height: 8px;
    border-radius: 4px;
    border: 1px solid #555;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--hud-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--hud-secondary);
    box-shadow: var(--hud-shadow);
}
input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--hud-secondary);
    box-shadow: 0 0 15px var(--hud-primary);
}

input[type="range"]::-moz-range-track {
    background: #333;
    height: 8px;
    border-radius: 4px;
    border: 1px solid #555;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--hud-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--hud-secondary);
    box-shadow: var(--hud-shadow);
}
input[type="range"]::-moz-range-thumb:hover {
    background: var(--hud-secondary);
    box-shadow: 0 0 15px var(--hud-primary);
}


/* --- Meta Screens (Upgrades, Codex, Stats) --- */
.meta-container {
    width: 95%; 
    max-width: 1600px; 
    max-height: 85%;
    background: #1a1a2a;
    border-radius: var(--hud-radius) !important; 
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary) !important; 
    padding: 35px;
    display: flex; 
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--hud-shadow) !important;
}

.meta-container::-webkit-scrollbar {
    width: 12px;
}

.meta-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin: 10px;
}

.meta-container::-webkit-scrollbar-thumb {
    background: var(--hud-primary);
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.meta-container::-webkit-scrollbar-thumb:hover {
    background: var(--hud-secondary);
}

.meta-title { 
    font-size: 3rem; 
    text-align: center; 
    margin-top: 0;
    margin-bottom: 15px; 
    color: var(--hud-primary) !important; 
    text-shadow: 0 0 10px var(--hud-primary) !important;
    flex-shrink: 0;
}
.codex-tabs { display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; gap: 10px;}
.codex-tab { padding: 10px 20px; font-size: 1.2rem; background: var(--hud-bar-bg); border-radius: var(--hud-radius); cursor: pointer; border: var(--hud-border-width) var(--hud-border-style) #555; }
.codex-tab.active { background: var(--hud-primary); color: #1a1a2a; border-color: var(--hud-secondary); box-shadow: var(--hud-shadow); }
.meta-grid {
    flex-grow: 1; overflow-y: auto; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px; padding: 10px;
    width: 100%;
}
.meta-item {
    background: #1f1f2e; border-radius: var(--hud-radius); padding: 15px;
    border: var(--hud-border-width) var(--hud-border-style) #555; text-align: center; display: flex; flex-direction: column; justify-content: space-between;
}
.meta-item.discovered { border-color: var(--hud-primary); box-shadow: var(--hud-shadow); }
.meta-item.locked { filter: grayscale(1) brightness(0.4); }
.meta-item.selected { border-color: var(--hud-accent); box-shadow: 0 0 15px var(--hud-accent); }
.meta-item h3 { font-size: 1.3rem; margin-bottom: 10px; color: var(--hud-primary);}
.meta-item p { font-size: 0.9rem; color: #ccc; flex-grow: 1; }
.meta-item .unlock-condition { font-size: 1rem; color: #ffab40; margin-top: 10px; font-weight: bold; }
.meta-item .cost { margin-top: 10px; color: #c77dff; font-weight: bold; }

.stats-breakdown {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid #4a5568;
    border-bottom: 1px solid #4a5568;
    font-size: 1rem;
    text-align: left;
    color: #a0aec0;
}
.stats-breakdown div {
    display: flex;
    justify-content: space-between;
    padding: 4px 5px;
}
.stats-breakdown span {
    font-weight: bold;
    color: #c77dff;
}


.meta-button {
    background: var(--hud-accent); color: white; padding: 8px 15px; margin-top: 10px;
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-accent); border-radius: var(--hud-radius); cursor: pointer; font-size: 1rem;
    box-shadow: var(--hud-shadow);
    transition: all 0.3s ease;
}
.meta-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--hud-accent);
}
.meta-button.purchasable {
    background: linear-gradient(135deg, #c77dff 0%, #9d4edd 100%) !important;
    border: 2px solid #c77dff !important;
    box-shadow: 0 0 20px rgba(199, 125, 255, 0.6) !important;
    animation: pulse-purchasable 2s ease-in-out infinite;
    cursor: pointer !important;
    color: white !important;
    font-weight: bold;
}
.meta-button.purchasable:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(199, 125, 255, 0.9) !important;
}
@keyframes pulse-purchasable {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(199, 125, 255, 0.6);
        border-color: #c77dff;
    }
    50% { 
        box-shadow: 0 0 35px rgba(199, 125, 255, 1), 0 0 50px rgba(199, 125, 255, 0.5);
        border-color: #e0b3ff;
    }
}
.meta-button:disabled { background: #555; cursor: not-allowed; border-color: #555; box-shadow: none; }
.back-button { 
    position: absolute; 
    top: 20px; 
    left: 20px; 
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; text-align: left; font-size: 1.5rem; padding: 20px; overflow-y: auto; }
.stats-label { color: var(--hud-primary); font-weight: bold; }
.stats-value { color: #fff; text-align: right; }

/* --- Critter Bay --- */
#critterBayContent,
#chassisFoundryContent { 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px;
}
/* Critter Bay Redesign - Spacious Layout */
.bay-archetype-selection { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 150px));
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

@media (max-width: 1200px) {
    .bay-archetype-selection {
        grid-template-columns: repeat(auto-fill, minmax(120px, 140px));
        gap: 10px;
    }
    .tree-node {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .bay-archetype-selection {
        grid-template-columns: repeat(auto-fill, minmax(100px, 120px));
        gap: 8px;
    }
    .tree-container {
        padding: 20px 30px 40px 30px;
    }
    .tree-node {
        width: 160px;
        padding: 12px;
    }
}

.evolution-legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ddd;
    font-size: 1.05rem;
    font-weight: 500;
}

.legend-box {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 2px solid;
}

.legend-box.purchased {
    background: #2d203a;
    border-color: #c77dff;
}

.legend-box.available {
    background: #1f1f2e;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.legend-box.locked {
    background: #1f1f2e;
    border-color: #555;
}

.bay-archetype-button { 
    padding: 14px 12px;
    font-size: 1.05rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(30, 30, 45, 0.9), rgba(20, 20, 35, 0.9));
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid rgba(100, 100, 120, 0.4);
    color: #aaa;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    min-width: 130px;
    max-width: 150px;
    width: 100%;
}
.bay-archetype-button:hover {
    border-color: rgba(0, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(40, 40, 60, 0.9), rgba(30, 30, 50, 0.9));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
}
.bay-archetype-button.active { 
    border-color: var(--hud-primary);
    color: var(--hud-primary);
    background: linear-gradient(135deg, rgba(0, 50, 60, 0.6), rgba(0, 30, 40, 0.6));
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 15px rgba(0, 255, 255, 0.1);
    transform: translateY(-2px);
}

.tree-container { 
    flex-grow: 1;
    position: relative;
    padding: 30px 50px 50px 50px;
    min-height: 600px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(100, 100, 120, 0.2);
    overflow-x: auto;
    overflow-y: auto;
}

.tree-node {
    position: absolute;
    width: 200px;
    background: linear-gradient(135deg, #1a1a2a 0%, #252535 100%);
    border: 2.5px solid #555;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.tree-node h4 { 
    color: #ddd;
    font-size: 1.15rem;
    margin-bottom: 8px;
    font-weight: 600;
}
.tree-node p { 
    color: #999;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 8px;
}
.tree-node .node-cost {
    color: #00ffff;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 8px;
}
.tree-node.available { 
    border-color: var(--hud-primary);
    cursor: pointer;
    background: linear-gradient(135deg, #1a2a3a 0%, #253545 100%);
}
.tree-node.available h4 { color: var(--hud-primary); }
.tree-node.available:hover { 
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 255, 255, 0.4), 0 0 20px rgba(0, 255, 255, 0.3);
    border-color: #00ffff;
}
.tree-node.purchased { 
    border-color: var(--hud-accent);
    background: linear-gradient(135deg, #2d203a 0%, #3a2845 100%);
    box-shadow: 0 4px 12px rgba(197, 125, 255, 0.2);
}
.tree-node.purchased h4 { color: var(--hud-accent); }
.tree-line { 
    position: absolute;
    background-color: #555;
    height: 3px;
    transform-origin: left center;
    z-index: -1;
    transition: background-color 0.3s ease;
}
.tree-line.purchased { 
    background: linear-gradient(90deg, #c77dff, #a855f7);
    box-shadow: 0 0 8px rgba(197, 125, 255, 0.5);
}

/* Game Container - Full Screen */
#gameContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

#ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-container > * {
    pointer-events: all;
}

/* --- Gameplay UI --- */
/* FIX: Ensure HUD stays on top but player can't move behind it by constraining player movement */
.hud { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 800px; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; z-index: 100; /* Increased z-index */ }
.stats-bar { width: 100%; display: flex; justify-content: space-between; background-color: var(--hud-bar-bg); padding: 8px 15px; border-radius: var(--hud-radius); border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary); font-size: 1.1rem; box-shadow: var(--hud-shadow); color: var(--hud-primary); }
#bioCoreIndicator {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: rgba(255, 100, 255, 0.2); border: 2px solid #ff64ff; color: #ffc8ff;
    padding: 10px 20px; border-radius: 8px; font-size: 1.2rem;
    animation: pulse-glow 2s infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px #ff64ff; }
    50% { box-shadow: 0 0 25px #ff64ff; }
}
#dash-indicator { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.6); padding: 8px 15px; border-radius: 8px; border: 2px solid #555; transition: all 0.2s; }
#dash-indicator.ready { border-color: #00ffff; color: #00ffff; }
#xp-bar-container, #shield-bar-container { width: 100%; height: var(--hud-bar-height); background-color: var(--hud-bar-bg); border-radius: var(--hud-radius); border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary); overflow: hidden; box-shadow: var(--hud-shadow); }
#xp-bar { width: 0%; height: 100%; background: var(--hud-bar-fill); transition: width 0.3s ease-in-out; }
#shield-bar-container { border-color: var(--hud-accent); }
#shield-bar { width: 100%; height: 100%; background: var(--hud-accent); transition: width 0.2s ease-in-out; }
#shield-bar.recharging { background: #555; }
/* FIX: Make level-up overlay less opaque so player can see what's happening */
.modal-overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.4); justify-content: center; align-items: center; pointer-events: all; z-index: 100; }
.modal-content { background-color: #1a1a2a; padding: 30px 40px; border-radius: 15px; text-align: center; border: 3px solid #ff4d4d; box-shadow: 0 0 20px rgba(255, 0, 0, 0.5); max-width: 500px; max-height: 85vh; display: flex; flex-direction: column; }
#levelUpTitle, #hatchTitle, #cacheChoiceTitle { flex-shrink: 0; margin-bottom: 20px; }
#upgradeOptions, #hatchOptions, #cacheOptions { overflow-y: auto; max-height: 60vh; padding-right: 10px; flex-grow: 1; }
#upgradeOptions::-webkit-scrollbar, #hatchOptions::-webkit-scrollbar, #cacheOptions::-webkit-scrollbar { width: 8px; }
#upgradeOptions::-webkit-scrollbar-track, #hatchOptions::-webkit-scrollbar-track, #cacheOptions::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); border-radius: 4px; }
#upgradeOptions::-webkit-scrollbar-thumb, #hatchOptions::-webkit-scrollbar-thumb, #cacheOptions::-webkit-scrollbar-thumb { background: #00ffff; border-radius: 4px; }
#upgradeOptions::-webkit-scrollbar-thumb:hover, #hatchOptions::-webkit-scrollbar-thumb:hover, #cacheOptions::-webkit-scrollbar-thumb:hover { background: #00ffff; box-shadow: 0 0 10px #00ffff; }

/* Pause Menu Tabs */
.pause-tab {
    background: rgba(0, 255, 255, 0.1);
    color: #00ffff;
    border: 2px solid #00ffff;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'VT323', monospace;
    transition: all 0.3s ease;
}
.pause-tab:hover {
    background: rgba(0, 255, 255, 0.2);
}
.pause-tab.active {
    background: #00ffff;
    color: #1a1a2a;
    box-shadow: 0 0 10px #00ffff;
}
.pause-tab-content {
    max-height: 500px;
    overflow-y: auto;
}
.pause-tab-content.hidden {
    display: none;
}

/* Chassis Foundry uses Critter Bay styles (bay-selection, bay-archetype-button, tree-container, tree-node) */
.chassis-foundry-currency {
    color: #00ffff;
}

/* Run Stats Display */
#runStatsDisplay {
    text-align: left;
    color: #fff;
    font-size: 1.2rem;
}
.run-stats-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
}
.run-stats-section h3 {
    color: #00ffff;
    margin-bottom: 10px;
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 5px;
}
.run-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.run-stat-label {
    color: #aaa;
}
.run-stat-value {
    color: #00ffff;
    font-weight: bold;
}
.critter-damage-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin-top: 5px;
    overflow: hidden;
    position: relative;
}
.critter-damage-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #c77dff);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 5px;
    font-size: 0.9rem;
}
.modal-content h1 { font-size: 3rem; margin-bottom: 10px; }
.modal-content h2 { font-size: 2.5rem; margin-bottom: 20px; color: #00ffff;}
.modal-content.level-up { border-color: #00ffff; box-shadow: 0 0 20px rgba(0, 255, 255, 0.5); }
.end-notification {
    color: #00ffff;
    font-size: 1.5rem;
    margin-bottom: 20px;
    animation: pulse-glow 2s infinite;
}
/* FIX: Ensure button text is never cropped */
.upgrade-button { width: 100%; padding: 15px; font-size: 1.1rem; text-align: left; background-color: var(--hud-primary); color: #1a1a2a; border: var(--hud-border-width) var(--hud-border-style) var(--hud-secondary); border-radius: var(--hud-radius); cursor: pointer; transition: all 0.2s; margin-top: 15px; position: relative; box-shadow: var(--hud-shadow); word-wrap: break-word; overflow: visible; white-space: normal; line-height: 1.4; }
.upgrade-button:hover { background-color: var(--hud-secondary); transform: scale(1.03); }
.upgrade-button.fuse-button { background-color: #9d4edd; color: white; border: var(--hud-border-width) var(--hud-border-style) var(--hud-accent);}
.upgrade-button.fuse-button:hover { background-color: #b36dff; }
.upgrade-button strong { display: block; font-size: 1.2rem; margin-bottom: 5px; }
.banish-button { position: absolute; top: 10px; right: 10px; background: #ff4d4d; color: white; border: none; border-radius: 50%; width: 30px; height: 30px; font-size: 16px; line-height: 30px; text-align: center; cursor: pointer; z-index: 5; }
.banish-button:hover { background: #ff7070; }
#bossWarning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: #ff4d4d;
    text-shadow: 0 0 20px red;
    z-index: 1000;
    animation: flash 1s infinite;
}
.challenge-timer {
    background: rgba(255, 130, 0, 0.2);
    border: 2px solid #ff8c00;
    color: #ffc994;
    padding: 5px 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-top: 5px;
}
.adrenaline-indicator {
    background: rgba(255, 50, 50, 0.2);
    border: 2px solid #ff4d4d;
    color: #ffc8c8;
    padding: 5px 15px;
    border-radius: 8px;
    font-size: 1.1rem;
}
.boss-timer {
    background: rgba(255, 170, 0, 0.2);
    border: 2px solid #ffaa00;
    color: #ffd994;
    padding: 5px 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-top: 5px;
    animation: boss-timer-pulse 2s infinite;
    margin-top: 5px;
    animation: pulse-glow-red 1.5s infinite;
}

@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulse-glow-red {
    0%, 100% { box-shadow: 0 0 8px #ff4d4d; }
    50% { box-shadow: 0 0 20px #ff4d4d; }
}

/* Gamepad focus indicator */
.focused {
    outline: 3px solid #00ffff !important;
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2) !important;
    animation: focus-pulse 1.5s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

@keyframes focus-pulse {
    0%, 100% {
        outline-color: #00ffff;
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2);
    }
    50% {
        outline-color: #00dddd;
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.9), inset 0 0 30px rgba(0, 255, 255, 0.3);
    }
}

/* Enhanced focus for cards */
.meta-card.focused,
.sanctuary-card.focused,
.mode-card.focused,
.chassis-card.focused,
.archetype-card.focused,
.upgrade-card-wrapper.focused,
.cosmetic-card.focused,
.achievement-card.focused,
.critter-card.focused,
.upgrade-card.focused {
    transform: scale(1.05);
    border-color: #00ffff !important;
}

/* Enhanced focus for tabs */
.codex-tab.focused,
.pause-tab.focused {
    background: rgba(0, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

.tutorial-box {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(26, 26, 42, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    text-align: center;
    z-index: 50;
}
.tutorial-box h3 {
    font-size: 1.8rem;
    color: #00ffff;
    margin-bottom: 10px;
}
.tutorial-box p {
    font-size: 1.2rem;
    color: #f0f0f0;
}
.tutorial-box button {
    margin-top: 15px;
}

/* --- Modal Overlay (for pause menu, level-up, etc) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #1f1f2e 0%, #1a1a2a 100%);
    padding: 40px;
    border-radius: var(--hud-radius);
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary);
    box-shadow: var(--hud-shadow);
    text-align: center;
    min-width: 300px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-content::-webkit-scrollbar {
    width: 10px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--hud-primary);
    border-radius: 5px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--hud-secondary);
}

.modal-content h2 {
    color: var(--hud-primary);
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--hud-primary);
}

.modal-content .menu-button {
    margin: 10px 0;
    width: 80%;
    color: #1a1a2a !important;
    font-family: 'VT323', monospace !important;
    font-size: 1.8rem !important;
    font-weight: 400 !important;
    text-indent: 0 !important;
    overflow: visible !important;
    white-space: normal !important;
    line-height: 1.5 !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Specific styles for game over buttons */
#restartLastRunButton,
#returnToMenuButton {
    color: #000000 !important;
    font-size: 2rem !important;
    font-family: 'VT323', monospace !important;
    font-weight: bold !important;
    text-align: center !important;
    padding: 15px 40px !important;
    flex-shrink: 0 !important;
    margin-top: 15px !important;
    min-height: 60px !important;
}

/* --- Tooltip System --- */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    color: #00ffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 10000;
    border: 1px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.95);
}

[data-tooltip] {
    position: relative;
    cursor: help;
}

/* --- Achievement Notifications --- */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    width: 350px;
    background: linear-gradient(135deg, #1a1a2a 0%, #2a1a3a 100%);
    border: 3px solid #00ffff;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    transition: right 0.5s ease;
    z-index: 10000;
    font-family: 'VT323', monospace;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-icon {
    font-size: 48px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 8px;
}

.achievement-content {
    flex: 1;
}

.achievement-name {
    font-size: 1.2rem;
    color: #00ffff;
    margin-bottom: 5px;
    text-shadow: 0 0 10px #00ffff;
}

.achievement-desc {
    font-size: 1.4rem;
    color: #ffffff;
    font-weight: bold;
}

.achievement-reward {
    font-size: 1.2rem;
    color: #ffaa00;
    margin-top: 5px;
    text-shadow: 0 0 8px #ffaa00;
    font-weight: bold;
}

/* --- Achievements Progress Bar --- */
.achievements-progress {
    width: 100%;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

#achievementsTabContent {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#achievementsGrid {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* --- Milestone Notifications --- */
.milestone-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    width: 500px;
    background: linear-gradient(135deg, #2a1a1a 0%, #3a2a1a 100%);
    border: 4px solid #ffaa00;
    border-radius: 15px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 50px rgba(255, 170, 0, 0.8);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10001;
    font-family: 'VT323', monospace;
}

.milestone-notification.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.milestone-icon {
    font-size: 72px;
    animation: bounce 0.6s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0px); }
    to { transform: translateY(-10px); }
}

.milestone-content {
    text-align: center;
}

.milestone-name {
    font-size: 1.8rem;
    color: #ffaa00;
    margin-bottom: 10px;
    text-shadow: 0 0 15px #ffaa00;
    font-weight: bold;
}

.milestone-desc {
    font-size: 2.5rem;
    color: #ffffff;
    margin-bottom: 10px;
    font-weight: bold;
}

.milestone-reward {
    font-size: 1.5rem;
    color: #00ff88;
    font-weight: bold;
}

/* --- Cosmetic System --- */
.cosmetic-notification {
    position: fixed;
    top: 100px;
    right: -400px;
    width: 350px;
    background: linear-gradient(135deg, #3a1a4a 0%, #2a3a1a 100%);
    border: 3px solid #d4af37;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    transition: right 0.5s ease;
    z-index: 10000;
    font-family: 'VT323', monospace;
}

.cosmetic-notification.show {
    right: 20px;
}

.cosmetic-icon {
    font-size: 48px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 8px;
}

.cosmetic-content {
    flex: 1;
}

.cosmetic-type {
    font-size: 1.2rem;
    color: #d4af37;
    margin-bottom: 5px;
}

.cosmetic-name {
    font-size: 1.6rem;
    color: #ffffff;
    font-weight: bold;
}

/* Cosmetic Grid Items */
.cosmetic-item {
    background: #1f1f2e;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #555;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cosmetic-item.unlocked {
    border-color: var(--hud-primary);
    box-shadow: var(--hud-shadow);
}
.cosmetic-item.selected {
    border-color: var(--hud-accent);
    box-shadow: 0 0 20px var(--hud-accent);
    transform: scale(1.05);
}

.cosmetic-item.locked {
    filter: grayscale(1) brightness(0.4);
    cursor: not-allowed;
}

.cosmetic-item:not(.locked):hover {
    border-color: var(--hud-primary);
    transform: translateY(-5px);
    box-shadow: var(--hud-shadow);
}

.cosmetic-preview {
    width: 100%;
    height: 80px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.cosmetic-unlock {
    font-size: 0.9rem;
    color: #ffab40;
    margin-top: 10px;
    font-style: italic;
}

/* --- Sanctuary Hub --- */
.sanctuary-subtitle {
    text-align: center;
    color: var(--hud-secondary);
    font-size: 1.3rem;
    margin-bottom: 20px;
    margin-top: 0;
    font-style: italic;
    flex-shrink: 0;
}

.sanctuary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 40px;
    flex-shrink: 0;
}

.sanctuary-card {
    background: linear-gradient(135deg, #1f1f2e 0%, #2a2a3e 100%);
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary);
    border-radius: var(--hud-radius);
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: 'VT323', monospace;
    box-shadow: var(--hud-shadow);
}
.sanctuary-card:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: var(--hud-secondary);
    box-shadow: 0 10px 40px var(--hud-primary);
}

.sanctuary-icon {
    font-size: 64px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

.sanctuary-name {
    font-size: 1.8rem;
    color: var(--hud-primary);
    margin-bottom: 10px;
    font-weight: bold;
}

.sanctuary-desc {
    font-size: 1.2rem;
    color: #cccccc;
}

/* Enhanced Codex */
.codex-detail-view {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    max-width: 90vw;
    max-height: 90vh;
    background: linear-gradient(135deg, #1a1a2a 0%, #2a1a3a 100%);
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary);
    border-radius: var(--hud-radius);
    padding: 30px;
    z-index: 10001;
    box-shadow: var(--hud-shadow);
    overflow-y: auto;
    overflow-x: hidden;
}

.codex-detail-view::-webkit-scrollbar {
    width: 10px;
}

.codex-detail-view::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.codex-detail-view::-webkit-scrollbar-thumb {
    background: var(--hud-primary);
    border-radius: 5px;
}
.codex-detail-view::-webkit-scrollbar-thumb:hover {
    background: var(--hud-secondary);
}

.codex-detail-view.active {
    display: block;
}

.codex-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff4444;
    border: 2px solid #ff6666;
    color: white;
    font-size: 1.5rem;
    padding: 5px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'VT323', monospace;
}

.codex-close-btn:hover {
    background: #ff6666;
}

.codex-sprite-viewer {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border: var(--hud-border-width) var(--hud-border-style) var(--hud-primary);
    border-radius: var(--hud-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    background: rgba(0, 0, 0, 0.7);
    box-shadow: var(--hud-shadow);
    overflow: hidden;
}

.codex-sprite-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.codex-detail-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--hud-primary);
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--hud-primary);
}

.codex-detail-type {
    text-align: center;
    font-size: 1.2rem;
    color: #ffaa00;
    margin-bottom: 20px;
}

.codex-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 2px solid #555;
}

.codex-stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
}

.codex-stat-label {
    color: #aaaaaa;
}

.codex-stat-value {
    color: var(--hud-primary);
    font-weight: bold;
}

.codex-description {
    font-size: 1.3rem;
    color: #cccccc;
    line-height: 1.6;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--hud-primary);
    border-radius: 5px;
}

.codex-lore {
    font-size: 1.2rem;
    color: #00ff88;
    font-style: italic;
    line-height: 1.6;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 255, 136, 0.1);
    border-left: 4px solid #00ff88;
    border-radius: 5px;
}

.codex-boss-phases {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 170, 0, 0.1);
    border: 2px solid #ffaa00;
    border-radius: 10px;
}

.codex-phase-item {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #ffaa00;
    border-radius: 5px;
}

.codex-phase-item strong {
    color: #ffaa00;
    font-size: 1.2rem;
}
/* --- HUD Theme Effects --- */
/* Bio-Mechanical Pulse Theme */
@keyframes bio-pulse {
    0%, 100% { 
        box-shadow: 0 0 10px var(--hud-primary), 0 0 20px var(--hud-primary);
        border-color: var(--hud-primary);
    }
    50% { 
        box-shadow: 0 0 20px var(--hud-primary), 0 0 40px var(--hud-primary), 0 0 60px var(--hud-primary);
        border-color: var(--hud-secondary);
    }
}
@keyframes bar-pulse {
    0%, 100% { 
        filter: brightness(1);
    }
    50% { 
        filter: brightness(1.3);
    }
}
.theme-pulse .stats-bar,
.theme-pulse #xp-bar-container,
.theme-pulse #shield-bar-container,
.theme-pulse .boss-health-bar {
    animation: bio-pulse 2s ease-in-out infinite;
}
.theme-pulse #xp-bar,
.theme-pulse #shield-bar {
    animation: bar-pulse 2s ease-in-out infinite;
}
/* Holographic Glitch Theme */
@keyframes glitch-flicker {
    0%, 100% { 
        opacity: 1;
        transform: translate(0);
    }
    10% { 
        opacity: 0.8;
        transform: translate(-2px, 1px);
    }
    20% { 
        opacity: 1;
        transform: translate(2px, -1px);
    }
    30% { 
        opacity: 0.9;
        transform: translate(0);
    }
    40% { 
        opacity: 1;
    }
}
@keyframes glitch-border {
    0%, 100% {
        text-shadow: 0 0 5px var(--hud-primary);
    }
    25% {
        text-shadow: -2px 0 5px var(--hud-accent), 2px 0 5px var(--hud-secondary);
    }
    50% {
        text-shadow: 0 0 5px var(--hud-primary);
    }
    75% {
        text-shadow: 2px 0 5px var(--hud-accent), -2px 0 5px var(--hud-secondary);
    }
}
.theme-glitch .stats-bar,
.theme-glitch .level-info,
.theme-glitch .boss-health-bar {
    animation: glitch-flicker 4s infinite;
}
.theme-glitch .stats-bar {
    text-shadow: 0 0 5px var(--hud-primary);
    animation: glitch-flicker 4s infinite, glitch-border 2s infinite;
}
/* Neon Nightlife Theme */
@keyframes neon-glow {
    0%, 100% { 
        box-shadow: 
            0 0 10px var(--hud-primary),
            0 0 20px var(--hud-primary),
            inset 0 0 10px rgba(255, 0, 255, 0.2);
    }
    33% { 
        box-shadow: 
            0 0 15px var(--hud-secondary),
            0 0 30px var(--hud-secondary),
            0 0 45px var(--hud-secondary),
            inset 0 0 15px rgba(0, 255, 255, 0.2);
    }
    66% { 
        box-shadow: 
            0 0 15px var(--hud-accent),
            0 0 30px var(--hud-accent),
            0 0 45px var(--hud-accent),
            inset 0 0 15px rgba(255, 255, 0, 0.2);
    }
}
@keyframes neon-border {
    0%, 100% { 
        border-color: var(--hud-primary);
    }
    33% { 
        border-color: var(--hud-secondary);
    }
    66% { 
        border-color: var(--hud-accent);
    }
}
.theme-neon .stats-bar,
.theme-neon #xp-bar-container,
.theme-neon #shield-bar-container,
.theme-neon .boss-health-bar {
    animation: neon-glow 3s ease-in-out infinite, neon-border 3s ease-in-out infinite;
}
.theme-neon #xp-bar,
.theme-neon #shield-bar {
    animation: neon-glow 3s ease-in-out infinite;
}
/* Arcane Particles Theme */
@keyframes particle-float-1 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translate(-20px, -100px) rotate(180deg);
        opacity: 0;
    }
}
@keyframes particle-float-2 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translate(30px, -90px) rotate(-180deg);
        opacity: 0;
    }
}
@keyframes particle-float-3 {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translate(-10px, -110px) rotate(90deg);
        opacity: 0;
    }
}
@keyframes arcane-shimmer {
    0%, 100% {
        box-shadow: 0 0 15px var(--hud-primary);
    }
    50% {
        box-shadow: 0 0 25px var(--hud-accent), 0 0 35px var(--hud-secondary);
    }
}
.theme-particles .stats-bar,
.theme-particles #xp-bar-container,
.theme-particles #shield-bar-container,
.theme-particles .boss-health-bar {
    position: relative;
    animation: arcane-shimmer 4s ease-in-out infinite;
}
/* Create particle effect with pseudo-elements */
.theme-particles .stats-bar::before,
.theme-particles .stats-bar::after {
    content: '?';
    position: absolute;
    color: var(--hud-primary);
    font-size: 12px;
    pointer-events: none;
}
.theme-particles .stats-bar::before {
    left: 10%;
    bottom: 0;
    animation: particle-float-1 6s ease-in-out infinite;
}
.theme-particles .stats-bar::after {
    left: 80%;
    bottom: 0;
    animation: particle-float-2 5s ease-in-out infinite 1s;
}
.theme-particles #xp-bar-container::before {
    content: '?';
    position: absolute;
    left: 50%;
    bottom: 0;
    color: var(--hud-secondary);
    font-size: 10px;
    animation: particle-float-3 5.5s ease-in-out infinite 0.5s;
    pointer-events: none;
}

/* Boss Timer Animation */
@keyframes boss-timer-pulse {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
        border-color: #ffaa00;
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 170, 0, 0.6);
        border-color: #ffd700;
    }
}

/* Event Notification Animations */
@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
}

/* --- Run History Graphs --- */
.run-history-item {
    transition: all 0.2s ease;
}

.run-history-item:hover {
    border-color: #00ffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.3);
}

/* --- Mobile and Responsive Adjustments --- */
@media (max-width: 768px) {
    .hud {
        width: 95%;
        top: 10px;
    }
    
    .stats-bar {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    #dash-indicator {
        bottom: 15px;
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    #bioCoreIndicator {
        bottom: 60px;
        padding: 8px 16px;
        font-size: 1rem;
    }
    
    .modal-content {
        padding: 20px;
        max-width: 90vw;
        max-height: 90vh;
    }
    
    #upgradeOptions, #hatchOptions, #cacheOptions {
        max-height: 65vh;
    }
    
    .upgrade-button {
        padding: 12px;
        font-size: 1rem;
    }
    
    .main-menu-title {
        font-size: 4rem;
    }
    
    .menu-button {
        font-size: 1.2rem;
        padding: 12px 30px;
    }
    
    /* Stack graphs vertically on mobile */
    .run-graphs-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 1200px) {
    /* Stack graphs vertically on tablets */
    .run-graphs-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .hud {
        width: 98%;
        top: 5px;
        gap: 5px;
    }
    
    .stats-bar {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    #xp-bar-container,
    #shield-bar-container {
        height: 15px;
    }
    
    #dash-indicator {
        bottom: 10px;
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .main-menu-title {
        font-size: 3rem;
        margin-bottom: 20px;
    }
    
    .menu-button {
        font-size: 1rem;
        padding: 10px 25px;
        margin: 8px;
    }
}

/* Boss Rush transition animation */
@keyframes bossRushPulse {
    0%, 100% {
        box-shadow: 0 0 50px rgba(255, 0, 128, 0.5);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        box-shadow: 0 0 80px rgba(255, 0, 128, 0.8);
        transform: translate(-50%, -50%) scale(1.02);
    }
}


/* Fast Forward Button */
.fast-forward-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #000;
    font-family: "VT323", monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 12px 24px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
}

.fast-forward-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.fast-forward-button.active {
    background: linear-gradient(135deg, #ff6347 0%, #ff4500 100%);
    border-color: #ff6347;
    animation: fastForwardPulse 0.5s infinite;
}

@keyframes fastForwardPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 99, 71, 0.6); }
    50% { box-shadow: 0 6px 25px rgba(255, 99, 71, 0.9); }
}

/* ===== SESSION STATS DASHBOARD ===== */
.session-stats-dashboard {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.05) 0%, rgba(0, 150, 255, 0.05) 100%);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    animation: slideIn 0.5s ease-out;
    flex-shrink: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.session-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(0, 255, 255, 0.2);
}

.session-stats-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.session-duration {
    font-size: 1rem;
    color: #88ffff;
    font-family: 'VT323', monospace;
}

.session-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .session-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.session-stat-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-out backwards;
}

.session-stat-card:nth-child(1) { animation-delay: 0.1s; }
.session-stat-card:nth-child(2) { animation-delay: 0.2s; }
.session-stat-card:nth-child(3) { animation-delay: 0.3s; }
.session-stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.session-stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    margin: 8px 0;
    font-family: 'VT323', monospace;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    color: #aaaaaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.session-progress-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-out 0.5s backwards;
}

.progress-title {
    font-size: 1.1rem;
    color: #00ffff;
    margin-bottom: 8px;
    font-weight: 600;
}

.progress-info {
    font-size: 0.95rem;
    color: #cccccc;
    margin-bottom: 12px;
}

.progress-bar-container {
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff 0%, #00aaff 50%, #0088ff 100%);
    border-radius: 15px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    width: 0; /* Start at 0, will be animated via JavaScript */
}

.progress-bar-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.session-motivation {
    text-align: center;
    font-size: 1.2rem;
    color: #ffaa00;
    font-weight: bold;
    padding: 12px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 8px;
    animation: fadeIn 0.5s ease-out 0.6s backwards, motivationPulse 2s ease-in-out 1s infinite;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

@keyframes motivationPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 170, 0, 0.2);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
    }
}

/* Animated number counter effect */
.stat-value.counting {
    animation: countPulse 0.3s ease-out;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: #00ffff;
    }
}

/* Responsive Sanctuary Grid */
@media (max-width: 900px) {
    .sanctuary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .meta-container {
        padding: 25px;
    }
    
    .meta-title {
        font-size: 2.5rem;
    }
    
    .sanctuary-subtitle {
        font-size: 1.1rem;
    }
}

@media (max-width: 600px) {
    .sanctuary-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }
    
    .sanctuary-card {
        padding: 25px;
    }
    
    .meta-container {
        padding: 20px;
        max-height: 90%;
    }
    
    .meta-title {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .sanctuary-subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .sanctuary-name {
        font-size: 1.5rem;
    }
    
    .sanctuary-desc {
        font-size: 1rem;
    }
    
    .sanctuary-icon {
        font-size: 48px;
    }
}