/* --- GAME STYLES --- */
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background-color: #0f172a; overflow: hidden;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#hexCanvas {
    display: block; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    border-radius: 8px; background-color: #1e293b; cursor: crosshair;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
#ui-layer {
    position: absolute; top: 1rem; left: 1rem; color: #94a3b8; pointer-events: none;
}
.meter-bar {
    transition: width 0.3s ease-out, background-color 0.3s ease-out;
}

/* --- TREE MODAL STYLES --- */
:root { --node-size: 80px; }
#tree-transform-layer {
    transform-origin: 0 0; will-change: transform; position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}
#lines-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; 
}
.node {
    position: absolute; width: var(--node-size); height: var(--node-size);
    transform: translate(-50%, -50%); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    cursor: pointer; user-select: none; transition: all 0.2s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.3); z-index: 10;
}

/* Node States */
.node-hidden { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.5); }
.node-unaffordable { background-color: #7f1d1d; border: 3px solid #ef4444; color: #fecaca; cursor: not-allowed; }
.node-affordable { background-color: #854d0e; border: 3px solid #eab308; color: #fef08a; animation: pulse-yellow 2s infinite; }
.node-affordable:hover { transform: translate(-50%, -50%) scale(1.1); background-color: #a16207; }
.node-owned-locked { background-color: #1e3a8a; border: 3px solid #ef4444; color: #bfdbfe; }
.node-upgradable { background-color: #1e3a8a; border: 3px solid #eab308; color: #bfdbfe; animation: pulse-yellow 2s infinite; }
.node-upgradable:hover { transform: translate(-50%, -50%) scale(1.05); }
.node-maxed { background-color: #064e3b; border: 3px solid #10b981; color: #a7f3d0; box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.node-maxed:hover { transform: translate(-50%, -50%) scale(1.05); }

/* Designer Node Types (Legend) */
.type-neutral { background-color: #475569; border: 3px solid #94a3b8; color: #f8fafc; }
.type-active { background-color: #991b1b; border: 3px solid #f87171; color: #fef2f2; }
.type-passive { background-color: #1e3a8a; border: 3px solid #60a5fa; color: #eff6ff; }
.type-victory { background-color: #fbbf24; border: 4px solid #fef08a; color: #713f12; box-shadow: 0 0 40px rgba(251, 191, 36, 0.8); transform: translate(-50%, -50%) scale(1.4); z-index: 50; animation: victoryPulse 2s infinite; }
.type-victory:hover { transform: translate(-50%, -50%) scale(1.5); }
@keyframes victoryPulse { 0% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.6); } 50% { box-shadow: 0 0 60px rgba(251, 191, 36, 1); } 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.6); } }

.bridge-marker { position: absolute; transform: translate(-50%, -50%); background-color: #0f172a; border-width: 3px; border-style: solid; padding: 10px 20px; border-radius: 9999px; color: #f8fafc; font-weight: 900; font-size: 20px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.8); z-index: 40; pointer-events: none; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }

/* Fog of War Styles */
.node-gatekept {
    opacity: 0.35; filter: grayscale(90%); border-style: dashed !important;
    cursor: not-allowed; box-shadow: none !important;
}
.line-gatekept {
    stroke: #334155 !important; stroke-dasharray: 2, 6 !important; opacity: 0.4 !important;
}
.line-dev-standard {
    stroke: #64748b !important; stroke-dasharray: 5, 5 !important; opacity: 0.8 !important;
}

.node-title { font-size: 0.75rem; font-weight: bold; line-height: 1.1; margin-bottom: 2px; pointer-events: none; }
.node-cost { font-size: 0.65rem; background: rgba(0,0,0,0.5); padding: 1px 6px; border-radius: 10px; pointer-events: none; }

.float-text-anim {
    position: absolute; pointer-events: none; font-weight: 900; font-family: monospace; color: #ef4444; font-size: 24px; z-index: 100;
    animation: floatUpFade 1s ease-out forwards; transform: translateX(-50%); text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@keyframes floatUpFade {
    0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -60px) scale(1.5); }
}

.flash-spend { animation: flashRed 0.5s ease-out; }
@keyframes flashRed {
    0% { color: #ef4444; transform: scale(1.3); }
    100% { color: #4ade80; transform: scale(1); }
}

@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

.tree-line { stroke-width: 4; fill: none; transition: stroke 0.3s ease, opacity 0.3s ease; }
.line-hidden { opacity: 0; }
.line-unaffordable { stroke: #ef4444; stroke-dasharray: 5, 5; opacity: 0.5; }
.line-affordable { stroke: #eab308; stroke-dasharray: 5, 5; animation: dash 1s linear infinite;}
.line-owned { stroke: #3b82f6; }
.line-maxed { stroke: #10b981; }

@keyframes dash { to { stroke-dashoffset: -10; } }

#tree-viewport {
    background-image: 
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 40px 40px; background-position: center center;
}

.dev-mode-hide { display: none !important; }

/* --- STORE GLOW ANIMATION --- */
@keyframes storeGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(52, 211, 153, 0.5); border-color: rgba(52, 211, 153, 0.5); }
    50% { box-shadow: 0 0 30px rgba(52, 211, 153, 1), 0 0 60px rgba(52, 211, 153, 0.6); border-color: rgba(52, 211, 153, 1); }
}
.store-pulse-glow {
    animation: storeGlow 2s infinite alternate ease-in-out;
}

/* --- ASCENSION ANIMATION (FIXED FOR IMAGES) --- */
@keyframes heaven {
    0% { transform: translateY(0); opacity: 1; filter: drop-shadow(0 0 0px white); }
    100% { transform: translateY(-100px); opacity: 0; filter: drop-shadow(0 0 20px white); }
}
.ascend-to-heaven {
    animation: heaven 1.5s forwards ease-in !important;
    pointer-events: none !important;
    z-index: 100;
}
.wing-left, .wing-right {
    position: absolute; top: 50%; 
    width: 30px; height: 30px; object-fit: contain; 
    animation: flap 0.4s infinite alternate ease-in-out; pointer-events: none;
}

.wing-left { left: -30px; --sx: -1; } 
.wing-right { right: -30px; --sx: 1; animation-delay: 0.1s; } 

@keyframes flap {
    0% { transform: translateY(-50%) rotate(0deg) scaleX(var(--sx, 1)); }
    100% { transform: translateY(-50%) rotate(-20deg) scaleX(var(--sx, 1)); }
}

/* --- SPEND ANIMATION --- */
@keyframes floatUpSpend {
    0% { transform: translate(-50%, 0) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50px) scale(1.5); opacity: 0; }
}
.spend-anim {
    position: fixed;
    pointer-events: none;
    color: #ef4444;
    font-weight: 900;
    font-family: monospace;
    font-size: 24px;
    z-index: 9999;
    animation: floatUpSpend 1s ease-out forwards;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* --- THE MACHINERY HOUSING --- */
.machinery-plate {
    background: #2a2d34; border-radius: 12px; padding: 20px;
    border: 4px solid #1a1b1e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 2px 3px rgba(255,255,255,0.1), inset 0 -2px 5px rgba(0,0,0,0.5);
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px;
    background-image: linear-gradient(45deg, #1f2127 25%, transparent 25%, transparent 75%, #1f2127 75%, #1f2127), linear-gradient(45deg, #1f2127 25%, transparent 25%, transparent 75%, #1f2127 75%, #1f2127);
    background-size: 8px 8px; background-position: 0 0, 4px 4px;
    transform-style: preserve-3d; margin-top: 10px;
}
.screw {
    position: absolute; width: 10px; height: 10px; background: linear-gradient(135deg, #666, #333);
    border-radius: 50%; box-shadow: inset 0 1px 2px rgba(255,255,255,0.4), inset 0 -1px 2px rgba(0,0,0,0.8), 0 1px 1px rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
}
.screw::after { content: ''; width: 70%; height: 2px; background: #1a1a1a; box-shadow: 0 1px 0 rgba(255,255,255,0.2); transform: rotate(45deg); }
.screw.tl { top: 10px; left: 10px; transform: rotate(12deg); }
.screw.tr { top: 10px; right: 10px; transform: rotate(-35deg); }
.screw.bl { bottom: 10px; left: 10px; transform: rotate(88deg); }
.screw.br { bottom: 10px; right: 10px; transform: rotate(-14deg); }

/* --- THE BUTTON ASSEMBLY --- */
.button-bezel {
    background: linear-gradient(135deg, #b8b8b8 0%, #4a4a4a 100%); border-radius: 50%; padding: 12px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), inset 0 -3px 6px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.7);
}
.button-well {
    background: #050505; border-radius: 50%; padding: 6px; box-shadow: inset 0 8px 15px rgba(0,0,0,1);
}

.big-red-button {
    --btn-color-1: #ff5252; --btn-color-2: #cc0000; --btn-color-3: #660000; --btn-side: #730000;
    width: 100px; height: 100px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--btn-color-1) 0%, var(--btn-color-2) 45%, var(--btn-color-3) 100%);
    border: none; outline: none; cursor: pointer; position: relative; top: -12px; 
    box-shadow: inset 0 4px 8px rgba(255,255,255,0.4), inset 0 -10px 20px rgba(0,0,0,0.5), 0 12px 0 var(--btn-side), 0 15px 15px rgba(0,0,0,0.8); 
    transition: top 0.08s cubic-bezier(0.1, 0.7, 0.1, 1), box-shadow 0.08s cubic-bezier(0.1, 0.7, 0.1, 1), background 0.2s ease;
    display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 900;
    color: rgba(255,255,255,0.75); text-shadow: 0 -2px 2px rgba(0,0,0,0.5); letter-spacing: 2px;
    user-select: none; -webkit-tap-highlight-color: transparent;
}
.big-red-button:hover { color: rgba(255,255,255,0.9); }
.big-red-button:active, .big-red-button.is-pressed {
    top: -2px; box-shadow: inset 0 4px 8px rgba(255,255,255,0.3), inset 0 -5px 15px rgba(0,0,0,0.7), 0 2px 0 var(--btn-side), 0 5px 10px rgba(0,0,0,0.9);
}
.btn-locked { --btn-color-1: #4a4a4a; --btn-color-2: #2a2a2a; --btn-color-3: #111; --btn-side: #000; }
.btn-ready { --btn-color-1: #4ade80; --btn-color-2: #16a34a; --btn-color-3: #064e3b; --btn-side: #022c22; }
.btn-running { --btn-color-1: #ff5252; --btn-color-2: #cc0000; --btn-color-3: #660000; --btn-side: #730000; }

/* --- THE ENGINE RUMBLE --- */
@keyframes engine-rumble {
    0%   { transform: translate(0px, 0px) rotate(0deg); }
    25%  { transform: translate(-1px, 1px) rotate(-0.2deg); }
    50%  { transform: translate(1px, -1px) rotate(0.2deg); }
    75%  { transform: translate(-1px, -1px) rotate(-0.2deg); }
    100% { transform: translate(0px, 0px) rotate(0deg); }
}
.is-rumbling { animation: engine-rumble 0.08s infinite; }
.is-rumbling::before {
    content: ''; position: absolute; top: -10px; left: -10px; right: -10px; bottom: -10px;
    background: radial-gradient(circle, rgba(255,0,0,0.1) 0%, transparent 70%);
    z-index: -1; pointer-events: none; border-radius: 20px;
}
.status-panel { background: #111; border: 2px solid #333; border-radius: 4px; padding: 6px 12px; width: 100%; text-align: center; box-shadow: inset 0 2px 10px rgba(0,0,0,0.8); }
.status-text { font-family: monospace; font-size: 0.9rem; font-weight: bold; margin: 0; transition: color 0.3s, text-shadow 0.3s; }
.status-text.running { animation: pulse-glow 2s infinite; }

/* --- INDUSTRIAL CAR GAUGE --- */
.dial-container { width: 340px; height: 200px; background: #1a1b1e; border-radius: 170px 170px 24px 24px; border: 8px solid #2a2d34; position: relative; box-shadow: inset 0 5px 25px rgba(0,0,0,0.9), 0 10px 20px rgba(0,0,0,0.5); display: flex; justify-content: center; overflow: hidden; transition: background 0.3s; }
.dial-arc { position: absolute; bottom: 25px; width: 260px; height: 260px; border-radius: 50%; background: conic-gradient(from 270deg, #ef4444 0deg, #eab308 90deg, #10b981 180deg, transparent 180deg); -webkit-mask-image: radial-gradient(circle, transparent 65%, black 66%); mask-image: radial-gradient(circle, transparent 65%, black 66%); transition: filter 0.3s; }
.dial-ticks { position: absolute; bottom: 25px; width: 260px; height: 130px; pointer-events: none; z-index: 4; }
.tick { position: absolute; bottom: 0; left: calc(50% - 1px); width: 2px; height: 130px; transform-origin: bottom center; transform: rotate(var(--rot)); }
.tick::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 10px; background: rgba(255, 255, 255, 0.7); border-radius: 2px; }
.tick.major { width: 4px; left: calc(50% - 2px); }
.tick.major::after { height: 16px; background: #ffffff; }
.tick.red::after { background: #ef4444; }
.tick.yellow::after { background: #eab308; }
.dial-numbers { position: absolute; bottom: 25px; width: 260px; height: 130px; pointer-events: none; z-index: 5; }
.number { position: absolute; bottom: 0; left: calc(50% - 15px); width: 30px; height: 105px; transform-origin: bottom center; transform: rotate(var(--rot)); display: flex; align-items: flex-start; justify-content: center; }
.number span { transform: rotate(calc(-1 * var(--rot))); font-family: monospace; font-size: 1rem; font-weight: bold; color: #94a3b8; }
.number.large span { font-size: 1.5rem; font-weight: 900; }
.number.e span { color: #ef4444; text-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
.number.f span { color: #10b981; text-shadow: 0 0 5px rgba(16, 185, 129, 0.5); }
.lcd-readout { position: absolute; bottom: 65px; left: 50%; transform: translateX(-50%); background: #050505; border: 2px solid #334155; border-radius: 6px; padding: 4px 10px; font-family: monospace; font-size: 1.1rem; font-weight: bold; color: #10b981; box-shadow: inset 0 2px 5px rgba(0,0,0,1), 0 2px 4px rgba(0,0,0,0.5); z-index: 8; transition: color 0.3s; text-align: center; min-width: 80px; }
.warning-light { position: absolute; bottom: 30px; left: 60px; width: 16px; height: 16px; border-radius: 50%; background: #333; border: 2px solid #111; box-shadow: inset 0 2px 4px rgba(0,0,0,0.8); z-index: 4; transition: all 0.3s; }
.warning-text { position: absolute; bottom: 31px; left: 85px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.7rem; font-weight: 900; letter-spacing: 1px; color: #333; opacity: 0; transition: opacity 0.3s; z-index: 4; text-shadow: 0 1px 1px rgba(0,0,0,0.8); }
.needle-pivot { position: absolute; bottom: -10px; width: 44px; height: 44px; background: radial-gradient(circle, #64748b, #334155); border-radius: 50%; border: 4px solid #0f172a; box-shadow: 0 0 15px rgba(0,0,0,0.9); z-index: 10; }
.needle { position: absolute; bottom: 25px; left: 50%; width: 8px; height: 120px; background: #ef4444; transform-origin: bottom center; transform: translateX(-50%) rotate(var(--angle, -90deg)); border-radius: 4px 4px 0 0; box-shadow: 3px 0 6px rgba(0,0,0,0.6); transition: transform 0.4s cubic-bezier(0.4, 1.5, 0.6, 1); z-index: 9; }
.needle::after { content: ''; position: absolute; top: 0; left: 1px; width: 4px; height: 100%; background: linear-gradient(to right, rgba(255,255,255,0.4), transparent); }
.needle.igniting { transition: transform 1s ease-in-out !important; }

.dial-container.warning .warning-light { background: #eab308; box-shadow: 0 0 10px #eab308, inset 0 2px 4px rgba(255,255,255,0.4); animation: pulse-light 1s infinite alternate; }
.dial-container.warning .lcd-readout { color: #eab308; }
.dial-container.critical { animation: bg-flash 0.5s infinite alternate; }
.dial-container.critical .dial-arc { background: conic-gradient(from 270deg, #ff0000 0deg, #ff0000 90deg, #990000 180deg, transparent 180deg); filter: drop-shadow(0 0 10px red); }
.dial-container.critical .warning-light { background: #ff0000; box-shadow: 0 0 15px #ff0000, inset 0 2px 4px rgba(255,255,255,0.6); animation: strobe-light 0.2s infinite alternate; }
.dial-container.critical .warning-text { color: #ff0000; opacity: 1; text-shadow: 0 0 5px red; animation: strobe-light 0.2s infinite alternate; }
.dial-container.critical .lcd-readout { color: #ff0000; }
.dial-container.critical .needle { transition: none; animation: shake-needle 0.1s infinite; }
@keyframes pulse-light { 0% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes strobe-light { 0% { opacity: 0.2; } 100% { opacity: 1; } }
@keyframes bg-flash { 0% { background: #1a1b1e; } 100% { background: #2a1111; } }
@keyframes shake-needle { 0% { transform: translateX(-50%) rotate(calc(var(--angle) - 2deg)); } 50% { transform: translateX(-50%) rotate(calc(var(--angle) + 2deg)); } 100% { transform: translateX(-50%) rotate(calc(var(--angle) - 2deg)); } }

/* --- VINTAGE FUEL TOOLS --- */
.vintage-tools-panel {
    display: flex; gap: 15px; justify-content: center; align-items: center; width: 100%;
}
.vintage-tool-container {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.vintage-label {
    color: #ffffff; font-weight: 800; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
    background: rgba(0,0,0,0.4); padding: 3px 8px; border-radius: 3px; border-top: 1px solid rgba(0,0,0,0.8); border-bottom: 1px solid rgba(255,255,255,0.2);
    text-shadow: 0 1px 2px #000;
}

/* Plunger Button */
:root { --btn-cap-center: #f4ebd8; --btn-cap-edge: #d8c39b; --btn-side-light: #c2a77a; --btn-side-dark: #8b714a; --btn-text: #3a332a; --jewel-glow: rgba(16, 185, 129, 0.7); }
.arcade-bezel {
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, var(--btn-cap-center) 25%, var(--btn-side-light) 65%, var(--btn-side-dark) 100%);
    box-shadow: 0 5px 10px rgba(0,0,0,0.6), inset 0 4px 5px -1px rgba(255,255,255,0.9), inset 0 -4px 5px -1px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.5), 0 0 0 1px var(--btn-side-dark);
    display: flex; justify-content: center; align-items: center; position: relative;
}
.arcade-well {
    width: 48px; height: 48px; border-radius: 50%; background: #0a0a0a; box-shadow: inset 0 4px 8px rgba(0,0,0,1); position: relative;
}
.plunger {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; cursor: pointer;
    transform: translateY(-4px); transition: transform 0.08s, box-shadow 0.08s;
    box-shadow: 0 4px 0 var(--btn-side-dark), 0 5px 4px rgba(0,0,0,0.7), inset 0 1px 2px rgba(255,255,255,0.8), inset 0 0 0 4px var(--btn-cap-center), inset 2px 4px 6px 4px rgba(0,0,0,0.35), inset -2px -4px 6px 4px rgba(255,255,255,0.7);
    background: radial-gradient(circle at 50% 50%, var(--btn-cap-edge) 0%, var(--btn-cap-center) 80%);
    display: flex; justify-content: center; align-items: center;
}
.plunger-text {
    color: var(--btn-text); font-family: 'Arial Black', Impact, sans-serif; font-size: 10px; font-weight: 900;
    transform: scaleY(0.9) translateY(1px); opacity: 0.85; text-shadow: 0 1px 1px rgba(255,255,255,0.3), 0 -1px 0px rgba(0,0,0,0.1); z-index: 2;
}
.plunger.is-pressed {
    transform: translateY(1px);
    box-shadow: 0 0px 0 var(--btn-side-dark), 0 1px 2px rgba(0,0,0,0.9), inset 0 1px 1px rgba(255,255,255,0.6), inset 0 0 0 4px var(--btn-cap-center), inset 2px 4px 6px 4px rgba(0,0,0,0.4), inset -2px -4px 6px 4px rgba(255,255,255,0.6);
}
.plunger.is-disabled { filter: grayscale(100%) brightness(0.7); cursor: not-allowed; }

/* Jewel Light */
.jewel-bezel {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #f0f0f0 0%, #a0a0a0 25%, #606060 50%, #c0c0c0 75%, #e0e0e0 100%);
    box-shadow: 0 5px 8px rgba(0,0,0,0.5), inset 0 1px 3px rgba(255,255,255,0.9), inset 0 -1px 3px rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center; border: 1px solid #555; position: relative; z-index: 10;
}
.jewel {
    width: 26px; height: 26px; border-radius: 50%; position: relative;
    background: radial-gradient(circle at 35% 35%, #4a0000 0%, #1a0000 60%, #000000 100%);
    box-shadow: inset 0 0 8px #000; border: 1px solid #222; overflow: hidden; transition: background 0.15s, box-shadow 0.15s;
}
.jewel-facets {
    position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg at 50% 50%, rgba(0,0,0,0.6) 0deg, rgba(255,255,255,0.3) 22.5deg, rgba(0,0,0,0.6) 45deg, rgba(255,255,255,0.15) 67.5deg, rgba(0,0,0,0.6) 90deg, rgba(255,255,255,0.3) 112.5deg, rgba(0,0,0,0.6) 135deg, rgba(255,255,255,0.15) 157.5deg, rgba(0,0,0,0.6) 180deg, rgba(255,255,255,0.3) 202.5deg, rgba(0,0,0,0.6) 225deg, rgba(255,255,255,0.15) 247.5deg, rgba(0,0,0,0.6) 270deg, rgba(255,255,255,0.3) 292.5deg, rgba(0,0,0,0.6) 315deg, rgba(255,255,255,0.15) 337.5deg, rgba(0,0,0,0.6) 360deg);
    mix-blend-mode: overlay; z-index: 2; transition: opacity 0.2s;
}
.jewel-glass {
    position: absolute; top: 5%; left: 10%; width: 80%; height: 80%; border-radius: 50%;
    background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.6) 0%, transparent 40%); pointer-events: none; z-index: 4;
}
.jewel-filament {
    position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; background: #fff; border-radius: 50%;
    transform: translate(-50%, -50%); box-shadow: 0 0 5px #fff, 0 0 10px #aaffaa; filter: blur(1px); opacity: 0; z-index: 1; transition: opacity 0.15s;
}
.jewel-assembly.is-on .jewel {
    background: radial-gradient(circle at 45% 45%, #ffffff 0%, #10b981 40%, #064e3b 100%); border-color: #ccffcc;
    box-shadow: inset 0 0 5px rgba(255,255,255,0.8), 0 0 10px var(--jewel-glow), 0 0 20px var(--jewel-glow);
}
.jewel-assembly.is-on .jewel-bezel {
    box-shadow: 0 5px 8px rgba(0,0,0,0.5), inset 0 1px 3px rgba(255,255,255,0.9), inset 0 -1px 3px rgba(0,0,0,0.5), 0 0 20px var(--jewel-glow);
}
.jewel-assembly.is-on .jewel-filament { opacity: 1; }
.jewel-assembly.is-on .jewel-facets { opacity: 0.8; mix-blend-mode: soft-light; }

/* Vintage Toggle Switch */
.toggle-bezel {
    width: 40px; height: 60px; border-radius: 8px;
    background: linear-gradient(180deg, #333, #111);
    border: 2px solid #444; box-shadow: inset 0 2px 5px rgba(0,0,0,1);
    display: flex; justify-content: center; align-items: center; position: relative;
}
.toggle-bat {
    width: 12px; height: 35px; border-radius: 6px;
    background: linear-gradient(90deg, #ccc, #fff 30%, #aaa 70%, #666);
    box-shadow: 0 5px 10px rgba(0,0,0,0.8);
    transform-origin: bottom center;
    transform: translateY(10px) rotateX(45deg);
    transition: transform 0.1s cubic-bezier(0.4, 0.0, 0.2, 1); cursor: pointer;
}
.toggle-assembly.is-on .toggle-bat {
    transform: translateY(-10px) rotateX(-45deg);
    box-shadow: 0 10px 15px rgba(0,0,0,0.6);
}

/* --- TENSION COUNTDOWN ANIMATION --- */
@keyframes slam-down {
    0% { transform: scale(2); opacity: 0; }
    20% { transform: scale(1); opacity: 0.6; }
    80% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(0.8); opacity: 0; }
}
.countdown-slam {
    animation: slam-down 1s ease-in-out forwards;
}

/* --- FULL-SCREEN LOW FUEL WARNINGS --- */
@keyframes fuelPulseSlow {
    0% { 
        box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.15); 
        background-color: rgba(239, 68, 68, 0.02); 
    }
    100% { 
        box-shadow: inset 0 0 120px rgba(239, 68, 68, 0.45); 
        background-color: rgba(239, 68, 68, 0.08); 
    }
}

@keyframes fuelPulseMedium {
    0% { 
        box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.3); 
        background-color: rgba(239, 68, 68, 0.05); 
    }
    100% { 
        box-shadow: inset 0 0 160px rgba(239, 68, 68, 0.65); 
        background-color: rgba(239, 68, 68, 0.15); 
    }
}

@keyframes fuelPulseViolent {
    0% { 
        box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.45); 
        background-color: rgba(239, 68, 68, 0.08); 
    }
    100% { 
        box-shadow: inset 0 0 200px rgba(239, 68, 68, 0.9); 
        background-color: rgba(239, 68, 68, 0.25); 
    }
}

.fuel-warning-slow {
    animation: fuelPulseSlow 2.0s infinite alternate ease-in-out;
    opacity: 1 !important;
}

.fuel-warning-medium {
    animation: fuelPulseMedium 1.0s infinite alternate ease-in-out;
    opacity: 1 !important;
}

.fuel-warning-violent {
    animation: fuelPulseViolent 0.4s infinite alternate ease-in-out;
    opacity: 1 !important;
}

/* --- COMPACT COM NODES --- */
.com-strip-container { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(0,0,0,0.3); padding: 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.05); width: 100%; box-sizing: border-box;}
.com-strip-label { color: #a0a3ab; font-size: 8px; font-weight: 900; letter-spacing: 0.5px; text-shadow: 0 -1px 0 #000; display: flex; align-items: center; gap: 4px;}
.com-led { width: 8px; height: 8px; border-radius: 50%; background: #331010; box-shadow: inset 0 1px 3px rgba(0,0,0,0.8); transition: all 0.2s; margin-bottom: 2px;}
.com-strip-container.is-calling .com-led { background: #ff9d00; box-shadow: 0 0 5px #ff9d00; animation: blink 0.5s infinite alternate; }
.com-strip-container.on-cooldown .com-led { background: #ef4444; }
.com-btn { appearance: none; border: none; width: 100%; height: 26px; border-radius: 4px; position: relative; cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.com-btn-cap { position: absolute; inset: 0; border-radius: 4px; display: flex; justify-content: center; align-items: center; font-weight: 900; font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.com-btn:active { transform: translateY(2px); }

/* Distinct Colors */
.com-demand .com-btn { background: #450a0a; box-shadow: 0 3px 0 #000, 0 4px 6px rgba(0,0,0,0.5); }
.com-demand .com-btn-cap { background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 100%); border: 1px solid #f87171; border-bottom-color: #450a0a; }
.com-demand:active .com-btn, .com-demand.is-pressed .com-btn { box-shadow: 0 1px 0 #000; }

.com-production .com-btn { background: #172554; box-shadow: 0 3px 0 #000, 0 4px 6px rgba(0,0,0,0.5); }
.com-production .com-btn-cap { background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%); border: 1px solid #60a5fa; border-bottom-color: #172554; }
.com-production:active .com-btn, .com-production.is-pressed .com-btn { box-shadow: 0 1px 0 #000; }

.com-btn.is-disabled { filter: grayscale(100%) brightness(0.6); cursor: not-allowed; pointer-events: none; }

/* --- HUD SCROLLBAR FIX --- */
#incremental-hud {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: #555 #1a1a1c;
}

#incremental-hud::-webkit-scrollbar { width: 8px; }
#incremental-hud::-webkit-scrollbar-track { background: #1a1a1c; border-radius: 4px; border: 1px solid #333; }
#incremental-hud::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; border: 1px solid #777; }
#incremental-hud::-webkit-scrollbar-thumb:hover { background: #777; }