/* === Themed Scrollbars === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 14, 26, 0.6);
    border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 188, 212, 0.35);
    border-radius: var(--radius-xs);
    transition: background var(--speed-med);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.6);
}
::-webkit-scrollbar-corner {
    background: transparent;
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 188, 212, 0.35) rgba(10, 14, 26, 0.6);
}

/* === Phase 4: Game-State Reactive CSS Variables === */
:root {
    --pressure-r: 0;
    --pressure-g: 0;
    --pressure-b: 0;
    --pressure-alpha: 0;
    --excited-intensity: 0;
}

/* ============================================================================
   DESIGN TOKENS — single source of truth for visual style
   Value-preserving refactor: each token holds the value the code already used,
   so wiring these in changes nothing visually. Theme swaps = edit tokens, not
   every component rule. Do NOT rename tokens without updating their usages.
   ==========================================================================*/
:root {
    /* --- Text --- */
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #aaaaaa;
    --text-dim: #888888;
    --text-faint: #555555;

    /* --- Accent: Cyan (primary / energy / fusion) --- */
    --accent-cyan: #00bcd4;
    --accent-cyan-bright: #00e5ff;
    --accent-cyan-light: #80deea;
    --accent-cyan-pale: #e0f7fa;
    --accent-blue: #64b5f6;                 /* Atomizer */

    /* --- Accent: Green (money / sell / success) --- */
    --accent-green: #4caf50;
    --accent-green-light: #a5d6a7;
    --accent-green-bright: #69f0ae;

    /* --- Accent: Amber / Orange (upgrades / bonuses / warning) --- */
    --accent-gold: #ffd700;
    --accent-amber: #ffb74d;
    --accent-orange: #ff9800;

    /* --- Accent: Red (danger / reset / critical) --- */
    --accent-red: #f44336;
    --accent-red-light: #ff8a80;

    /* --- Accent: Purple (prestige) --- */
    --accent-purple: #9c27b0;
    --accent-purple-light: #ce93d8;

    /* --- Surfaces --- */
    --bg-base: #0a0a1a;
    --bg-surface: rgba(20, 24, 36, 0.75);
    --bg-elevated: rgba(255, 255, 255, 0.06);

    /* --- Glass blur scale (glassmorphism; value = px so --glass-8 means 8px) --- */
    --glass-2: 2px;
    --glass-3: 3px;
    --glass-6: 6px;
    --glass-8: 8px;
    --glass-12: 12px;
    --glass-14: 14px;
    --glass-16: 16px;
    --glass-18: 18px;
    --glass-20: 20px;

    /* --- Radius scale --- */
    --radius-xs: 3px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* --- Motion --- */
    --speed-fast: 0.15s;
    --speed-med: 0.2s;
    --speed-slow: 0.3s;
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* --- Type --- */
    --font-mono: monospace;
}

/* ============================================================================
   RESOURCE FILL BARS (C1) — animated capacity meters (energy / coolant / storage)
   The fill width is driven from JS; the transition gives it life.
   ==========================================================================*/
.resource-bar {
    height: 7px;
    margin: 3px 0 6px 0;
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5) inset;
}
.resource-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-sm);
    transition: width 0.4s var(--ease-out), filter var(--speed-slow);
    position: relative;
    overflow: hidden;
}
/* moving sheen sweep for subtle life */
.resource-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(-100%);
    animation: resource-bar-sheen 2.6s ease-in-out infinite;
}
@keyframes resource-bar-sheen {
    0% { transform: translateX(-100%); }
    55%, 100% { transform: translateX(100%); }
}
.resource-bar-fill--energy {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-cyan-bright));
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}
.resource-bar-fill--coolant {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan-light));
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}
/* near-full warning: pulse to signal the tank is capped */
.resource-bar-fill.is-near-full {
    animation: resource-bar-critical 1.1s ease-in-out infinite;
}
@keyframes resource-bar-critical {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.7); }
}

/* C2 — number-change juice */
.juice-flash {
    display: inline-block;
    animation: juice-flash-pulse 0.5s ease-out;
}
@keyframes juice-flash-pulse {
    0%   { transform: scale(1);    text-shadow: 0 0 0 transparent; }
    35%  { transform: scale(1.18); text-shadow: 0 0 12px var(--accent-green-bright); }
    100% { transform: scale(1);    text-shadow: 0 0 0 transparent; }
}
.floating-gain {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
    color: var(--accent-green-bright);
    text-shadow: 0 0 8px rgba(105, 240, 174, 0.55);
    animation: floating-gain-rise 1.1s ease-out forwards;
}
@keyframes floating-gain-rise {
    0%   { opacity: 0;   transform: translateY(0); }
    15%  { opacity: 1; }
    100% { opacity: 0;   transform: translateY(-40px); }
}
/* Element storage bars (compact, inside periodic-table flip cards) */
.element-storage-bar {
    height: 4px;
    margin-top: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}
.element-storage-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-green-bright));
    border-radius: 2px;
    transition: width 0.4s var(--ease-out);
}

/* Pressure tint overlay — full-screen colour wash behind particles and UI */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: rgba(var(--pressure-r), var(--pressure-g), var(--pressure-b), var(--pressure-alpha));
    transition: background 0.4s ease;
}

/* Pressure vignette — screen-edge glow that intensifies with pressure */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    box-shadow: inset 0 0 120px rgba(var(--pressure-r), var(--pressure-g), var(--pressure-b), calc(var(--pressure-alpha) * 1.8));
    transition: box-shadow 0.4s ease;
}

/* Fuser panel border reacts to pressure */
#atomic-fuser-container {
    border-left-color: rgba(var(--pressure-r), var(--pressure-g), var(--pressure-b), calc(0.14 + var(--pressure-alpha)));
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.35),
                inset 0 0 60px rgba(var(--pressure-r), var(--pressure-g), var(--pressure-b), calc(var(--pressure-alpha) * 0.6));
    transition: border-left-color 0.4s ease, box-shadow 0.4s ease;
}

/* Excited State — dashboard glow pulse */
@keyframes excited-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 rgba(255, 200, 50, 0); }
    50%       { box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 40px rgba(255, 200, 50, calc(var(--excited-intensity) * 0.6)); }
}
body.excited-state #dashboard {
    animation: excited-pulse 1.5s ease-in-out infinite;
}

/* Excited State — energy value highlight */
body.excited-state #ui-energy {
    color: #ffd54f;
    text-shadow: 0 0 12px rgba(255, 213, 79, calc(var(--excited-intensity) * 0.9));
}
body.excited-state #ui-buff-state {
    color: #ffd54f;
    text-shadow: 0 0 8px rgba(255, 213, 79, 0.7);
}

/* C4: screen shake (applied via JS inline animation on <body>) */
@keyframes screen-shake-hard {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-8px, 4px); }
    30% { transform: translate(7px, -5px); }
    45% { transform: translate(-6px, 5px); }
    60% { transform: translate(6px, -3px); }
    75% { transform: translate(-4px, 3px); }
    90% { transform: translate(3px, -2px); }
}
@keyframes screen-shake-soft {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-4px, 2px); }
    50% { transform: translate(4px, -2px); }
    75% { transform: translate(-3px, 1px); }
}

/* C4: full-screen flash overlay (meltdown / dramatic events) */
#screen-flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
}

/* === Background Animation === */
@keyframes bg-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* === Layout === */
body {
    background: linear-gradient(-45deg, #0a0a1a, #0d1a12, #1a0d12, #0d0d1a, #0a1a1a);
    background-size: 400% 400%;
    animation: bg-shift 25s ease infinite;
    color: var(--text-primary);
    font-family: var(--font-mono);
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* CRT scanline overlay — very subtle terminal authenticity (kept faint on purpose) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.14) 0px,
        rgba(0, 0, 0, 0.14) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.35;
    mix-blend-mode: multiply;
}

/* Reduce Motion (settings): stop looping CSS animations + heavy effects (accessibility/perf) */
.reduce-motion body::before { display: none; }                 /* scanlines off */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}
/* settings separator */
.settings-separator {
    height: 1px;
    margin: 3px 0;
    background: rgba(0, 188, 212, 0.2);
}
.reduce-motion .rc-fire-btn.affordable,   /* keep these readable states but stop their pulsing */
.reduce-motion .node.next-unlock .node-front { animation: none !important; }
/* === Background Canvas === */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Ensure all UI layers sit above the canvas */
#intro-screen,
#dashboard,
#main-view,
#upgrades-modal,
.help-modal,
.transcend-modal { position: relative; z-index: 1; }

#dashboard {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-12));
    -webkit-backdrop-filter: blur(var(--glass-12));
    padding: 15px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.18);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255,255,255,0.04) inset;
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
}
#main-view { display: flex; flex: 1; overflow: hidden; }
#web-container {
    flex: 2;
    padding: 20px;
    border-right: 1px solid rgba(0, 188, 212, 0.12);
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    background: rgba(10, 12, 20, 0.25);
    backdrop-filter: blur(var(--glass-2));
    -webkit-backdrop-filter: blur(var(--glass-2));
    display: flex;
    flex-direction: column;
}
#atomic-fuser-container {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 18, 28, 0.72);
    backdrop-filter: blur(var(--glass-14));
    -webkit-backdrop-filter: blur(var(--glass-14));
    border-left: 1px solid rgba(0, 188, 212, 0.14);
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    height: 100%;
}

/* === Periodic Table Zoom/Pan Container === */
#periodic-table-wrapper {
    width: 100%;
    overflow: auto;
    position: relative;
    flex: 1;
    min-height: 0;
    border: 1px solid rgba(0, 188, 212, 0.2);
    border-radius: var(--radius-lg);
    background: rgba(10, 14, 26, 0.3);
    cursor: grab;
}

#periodic-table-wrapper.is-dragging {
    cursor: grabbing;
    user-select: none;
}

/* Zoom controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 188, 212, 0.3);
}

.zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 188, 212, 0.15);
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all var(--speed-fast) ease;
    padding: 0;
}

.zoom-btn:hover {
    background: rgba(0, 229, 255, 0.25);
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.3);
}

.zoom-btn:active {
    transform: scale(0.95);
}

.zoom-reset {
    font-size: 0.9em;
}

.zoom-level {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    min-width: 45px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* === Periodic Table Grid Layout === */
#nodes-list {
    width: fit-content;
    min-width: 100%;   /* fill the wrapper when the grid is small; grow past it so the wrapper scrolls when large (A2) */
    overflow: visible;
}

/* Periodic table grid container - columns set dynamically by JS */
.periodic-table-grid {
    display: grid;
    gap: 4px;
    padding: 8px;
    width: fit-content;
}

/* Individual grid cell */
.periodic-table-cell {
    position: relative;
    overflow: hidden;
}

/* Staggered entrance reveal (on load / load-save): cells cascade in by atomic number */
.cell-reveal {
    animation: cell-reveal-in 0.45s ease-out backwards;
}
@keyframes cell-reveal-in {
    from { opacity: 0; transform: scale(0.7) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* One-shot "pop" on a freshly-unlocked card (scale + cyan flash) */
.unlock-reveal {
    animation: unlock-reveal-pop 0.6s ease-out;
}
@keyframes unlock-reveal-pop {
    0%   { transform: scale(0.6); }
    45%  { transform: scale(1.14); box-shadow: 0 0 24px rgba(0, 229, 255, 0.85); }
    100% { transform: scale(1);    box-shadow: 0 0 0 rgba(0, 229, 255, 0); }
}

/* Series placeholder (* and ** for Lanthanides/Actinides) */
.series-placeholder {
    background: rgba(0, 188, 212, 0.1);
    border: 1px dashed rgba(0, 188, 212, 0.4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--speed-med) ease;
}

.series-placeholder:hover {
    background: rgba(0, 188, 212, 0.2);
    border-color: rgba(0, 229, 255, 0.6);
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.3);
}

.series-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.series-symbol {
    font-size: 1.1em;
    font-weight: bold;
    color: rgba(0, 229, 255, 0.9);
}

.series-label {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
/* === Card flip wrapper === */
.node {
    background: transparent;
    border: none;
    padding: 0;
    cursor: default;
    height: 100%;
    width: 100%;
    position: absolute;
    inset: 0;
    perspective: 700px;
    transform-style: preserve-3d;
    transition: box-shadow var(--speed-med);
    box-shadow: none;
    text-align: center;
}

/* Front and back share the same physical space */
.node-front,
.node-back {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 8px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.45s cubic-bezier(0.4, 0.2, 0.2, 1), box-shadow var(--speed-med), border-color var(--speed-med), background var(--speed-med);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
    text-align: center;
}

.node-front {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    transform: rotateY(0deg);
    cursor: pointer;
    position: relative;
}
/* Subtle inset neon glow on hover — complements the JS 3D tilt; additive via ::before so it
   never fights the completion/overcharge/unstable box-shadows or group borders. */
.node-front::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 14px rgba(0, 229, 255, 0.45);
    opacity: 0;
    transition: opacity var(--speed-fast) ease;
    pointer-events: none;
    z-index: 2;
}
.node:hover .node-front::before {
    opacity: 1;
}

.node-back {
    background: rgba(10, 14, 26, 0.92);
    border: 1px solid rgba(0, 188, 212, 0.35);
    transform: rotateY(180deg);
    cursor: default;
    font-family: var(--font-mono);
    font-size: 0.97em;
    overflow: hidden;
    pointer-events: none;
}

/* Flipped state */
.node.is-flipped .node-front { transform: rotateY(-180deg); pointer-events: none; }
.node.is-flipped .node-back  { transform: rotateY(0deg); pointer-events: auto; }

/* Keep node height driven by inner content */
.node::after { content: none; }
.node::before { display: none; }
.node-front::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(var(--glass-8));
    -webkit-backdrop-filter: blur(var(--glass-8));
    z-index: -1;
    pointer-events: none;
}
.node.unlocked .node-front {
    border-color: rgba(76, 175, 80, 0.55);
    background: rgba(76, 175, 80, 0.07);
    box-shadow: 0 0 14px rgba(76, 175, 80, 0.2), 0 2px 12px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
}

/* C3 — per-element identity: bold state-colored tint (face + border + glow),
   so gases/liquids/solids read as distinct elements at a glance. */
.node.unlocked[data-physical-state="gas"] .node-front {
    border-color: rgba(255,107,107,0.65);
    background: rgba(255,107,107,0.12);
    box-shadow: 0 0 18px rgba(255,107,107,0.4), inset 0 0 24px rgba(255,107,107,0.28), 0 2px 12px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
}
.node.unlocked[data-physical-state="liquid"] .node-front {
    border-color: rgba(80,120,240,0.7);
    background: rgba(80,120,240,0.14);
    box-shadow: 0 0 18px rgba(80,120,240,0.45), inset 0 0 24px rgba(80,120,240,0.3), 0 2px 12px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
}
.node.unlocked[data-physical-state="solid"] .node-front {
    border-color: rgba(214,158,74,0.6);
    background: rgba(214,158,74,0.11);
    box-shadow: 0 0 18px rgba(214,158,74,0.42), inset 0 0 24px rgba(214,158,74,0.28), 0 2px 12px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
}

/* C3 — noble gases: rare-element treatment (prominent slow violet shimmer) */
.node.unlocked.noble-gas .node-front {
    border-color: rgba(180,135,255,0.75);
    background: rgba(180,135,255,0.12);
    animation: noble-gas-shimmer 3.2s ease-in-out infinite;
}
@keyframes noble-gas-shimmer {
    0%, 100% { box-shadow: 0 0 15px rgba(180,135,255,0.32), inset 0 0 18px rgba(180,135,255,0.20), 0 2px 12px rgba(0,0,0,0.3); }
    50%      { box-shadow: 0 0 28px rgba(180,135,255,0.65), inset 0 0 30px rgba(180,135,255,0.38), 0 2px 12px rgba(0,0,0,0.3); }
}

/* B2: next unlock target — breathing cyan = "this is your next goal".
   Uses INSET glow + background tint (not outer box-shadow) because
   .periodic-table-cell { overflow:hidden } clips outer glows. */
/* Subtle "next objective" indicator: a calm cyan breathe draws the eye to the
   next unlockable element without cluttering the table. (No outer box-shadow —
   it'd be clipped by .periodic-table-cell { overflow:hidden }; inset + tint work.) */
@keyframes next-unlock-pulse {
    0%, 100% {
        background: rgba(0, 229, 255, 0.04);
        border-color: rgba(0, 229, 255, 0.25);
        box-shadow: inset 0 0 8px rgba(0, 229, 255, 0.08);
    }
    50% {
        background: rgba(0, 229, 255, 0.08);
        border-color: rgba(0, 229, 255, 0.65);
        box-shadow: inset 0 0 14px rgba(0, 229, 255, 0.22);
    }
}
.node.next-unlock .node-front {
    animation: next-unlock-pulse 2s ease-in-out infinite;
}
.node.bypassed .node-front {
    border-color: rgba(255, 152, 0, 0.7);
    border-style: dashed;
    background: rgba(255, 152, 0, 0.08);
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.15), 0 2px 12px rgba(0,0,0,0.3);
    opacity: 0.72;
}
.node {
    --shine-x: 50%;
    --shine-y: 50%;
    --shine-alpha: 0;
}
.node-front::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: radial-gradient(
        circle at var(--shine-x) var(--shine-y),
        rgba(255, 255, 255, var(--shine-alpha)) 0%,
        transparent 65%
    );
    pointer-events: none;
}
.node:not(.is-flipped):hover .node-front {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255,255,255,0.08) inset;
    border-color: rgba(255, 255, 255, 0.2);
}
.node.unlocked:not(.is-flipped):hover .node-front {
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3), 0 2px 12px rgba(0,0,0,0.4);
}
.node .amount { font-size: 1.1em; font-weight: bold; }
.node .name { font-size: 1.1em; margin: 2px 0; }
.node .state { font-size: 1.1em; margin: 0 0 2px 4px; }
.node .desc { display: none; }
.node .production { font-size: 1.1em; margin-top: 2px; }
.node .fusion-fuel { font-size: 1.1em; }
.node .header { display: flex; justify-content: space-between; align-items: center; position: relative; gap: 4px; }
.node .rates { display: flex; justify-content: space-between; align-items: center; }
.node .node-info-icon {
    cursor: default;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-size: 1.25em;
    color: rgba(0, 188, 212, 0.55);
    transition: color var(--speed-fast);
    flex-shrink: 0;
}
.node .node-info-icon:hover { color: rgba(0, 229, 255, 0.95); }
.node .menu-dots { cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 1.4em; font-weight: bold; }
.node .menu-dots:hover { background: rgba(255,255,255,0.1); }

/* === Period & Group Completion Bonuses === */
/* One-shot celebratory flash when a period/group just completes (JS adds .completion-flash) */
@keyframes completion-flash-anim {
    0%   { box-shadow: inset 0 0 0 rgba(255, 215, 0, 0); background-color: transparent; }
    35%  { box-shadow: inset 0 0 26px rgba(255, 215, 0, 0.75), 0 0 20px rgba(255, 215, 0, 0.5); background-color: rgba(255, 215, 0, 0.22); }
    100% { box-shadow: inset 0 0 0 rgba(255, 215, 0, 0); background-color: transparent; }
}
.node.completion-flash .node-front {
    animation: completion-flash-anim 1s ease-out;
}

/* Period completion: faint golden glow behind element name */
.node.period-complete .name {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5), 0 0 16px rgba(255, 215, 0, 0.3);
}

/* Group completion: different accent colors by group (left border on card) */
.node.group-1-complete .node-front { border-left: 3px solid rgba(255, 100, 100, 0.8); }  /* Alkali - red */
.node.group-2-complete .node-front { border-left: 3px solid rgba(255, 180, 100, 0.8); } /* Alkaline Earth - orange */
.node.group-17-complete .node-front { border-left: 3px solid rgba(100, 200, 255, 0.8); } /* Halogens - cyan */
.node.group-18-complete .node-front { border-left: 3px solid rgba(180, 100, 255, 0.8); } /* Noble Gases - purple */
.node.group-complete:not(.group-1-complete):not(.group-2-complete):not(.group-17-complete):not(.group-18-complete) .node-front {
    border-left: 3px solid rgba(100, 255, 150, 0.6);  /* Other groups - green */
}

/* === Isotope Instability === */
@keyframes unstable-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(255, 160, 0, 0.3); }
    50%       { box-shadow: 0 0 14px rgba(255, 160, 0, 0.7), 0 0 24px rgba(255, 100, 0, 0.3); }
}
.node.unstable .node-front {
    animation: unstable-pulse 2s ease-in-out infinite;
}
.node.stabilized .node-front {
    box-shadow: 0 0 10px rgba(0, 180, 255, 0.5), 0 0 20px rgba(0, 120, 220, 0.25);
}

.stabilize-btn {
    background: transparent !important;
    border: 1px solid rgba(255, 160, 0, 0.5) !important;
    border-radius: var(--radius-xs);
    color: rgba(255, 160, 0, 0.85);
    font-size: 0.7em;
    padding: 1px 4px;
    cursor: pointer;
    transition: all var(--speed-fast);
    box-shadow: none !important;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1;
}
.stabilize-btn:hover {
    border-color: rgba(255, 160, 0, 0.9) !important;
    color: #ffa000;
    background: rgba(255, 160, 0, 0.1) !important;
}
.stabilize-btn.stabilized-active {
    border-color: rgba(0, 180, 255, 0.8) !important;
    color: #00b4ff;
    background: rgba(0, 180, 255, 0.15) !important;
}

.overcharge-btn {
    background: transparent !important;
    border: 1px solid rgba(255, 235, 59, 0.5) !important;
    border-radius: var(--radius-xs);
    color: rgba(255, 235, 59, 0.85);
    font-size: 1.05em;
    padding: 1.5px 6px;
    cursor: pointer;
    transition: all var(--speed-fast);
    box-shadow: none !important;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1;
}
.overcharge-btn:hover {
    border-color: rgba(255, 235, 59, 0.9) !important;
    color: #ffeb3b;
    background: rgba(255, 235, 59, 0.1) !important;
}
.overcharge-btn.overcharge-active {
    border-color: rgba(255, 152, 0, 0.9) !important;
    color: var(--accent-orange);
    background: rgba(255, 152, 0, 0.2) !important;
}
.node.overcharged .node-front {
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5), 0 0 20px rgba(255, 87, 0, 0.25);
}

/* Rotating "energy ring" around overcharged (5x) elements — signature conic sweep */
@property --rc-ring-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
.node.overcharged .node-front {
    position: relative;
}
.node.overcharged .node-front::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 5px;
    padding: 1.5px; /* ring thickness */
    background: conic-gradient(
        from var(--rc-ring-angle),
        transparent 0deg,
        rgba(255, 152, 0, 0.95) 70deg,
        #ffeb3b 130deg,
        transparent 210deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: rc-ring-spin 2.4s linear infinite;
    pointer-events: none;
}
@keyframes rc-ring-spin {
    to { --rc-ring-angle: 360deg; }
}
/* Graceful fallback: if @property is unsupported the ring stays a static sweep */
@supports not (background: conic-gradient(from 0deg, red, blue)) {
    .node.overcharged .node-front::after { display: none; }
}

/* === Chain Crisis Mode === */
@keyframes crisis-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 50, 50, 0.4), 0 0 16px rgba(255, 100, 0, 0.2); }
    50%       { box-shadow: 0 0 16px rgba(255, 50, 50, 0.8), 0 0 32px rgba(255, 100, 0, 0.4); }
}
.node.crisis-active .node-front {
    animation: crisis-pulse 0.8s ease-in-out infinite;
    border: 2px solid rgba(255, 50, 50, 0.6);
}

.crisis-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.crisis-countdown {
    font-size: 0.9em;
    font-weight: bold;
    color: #ff3232;
    text-shadow: 0 0 6px rgba(255, 50, 50, 0.8);
}

.emergency-inject-btn {
    background: rgba(255, 200, 0, 0.2) !important;
    border: 1px solid rgba(255, 200, 0, 0.6) !important;
    border-radius: var(--radius-xs);
    color: #ffc800;
    font-size: 0.75em;
    padding: 2px 6px;
    cursor: pointer;
    transition: all var(--speed-fast);
    box-shadow: none !important;
    letter-spacing: normal;
    text-transform: none;
    line-height: 1;
}
.emergency-inject-btn:hover {
    background: rgba(255, 200, 0, 0.4) !important;
    border-color: rgba(255, 200, 0, 0.9) !important;
    color: #ffe033;
}

.crisis-burst-indicator {
    font-size: 0.8em;
    font-weight: bold;
    color: #00e676;
    text-shadow: 0 0 8px rgba(0, 230, 118, 0.8);
    margin-left: 6px;
}

.node.crisis-burst .node-front {
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.6), 0 0 24px rgba(0, 230, 118, 0.3);
}

/* === Compact Mode (zoomed out view) === */
/* Applied when zoom level < 80% to show only critical information */

/* Hide less critical elements in compact mode */
.periodic-table-grid.compact-mode .node-info-icon,
.periodic-table-grid.compact-mode .upgrade-indicator,
.periodic-table-grid.compact-mode .stabilize-btn,
.periodic-table-grid.compact-mode .menu-dots,
.periodic-table-grid.compact-mode .sell-controls {
    display: none !important;
}

/* Simplify header layout in compact mode */
.periodic-table-grid.compact-mode .node .header {
    gap: 4px;
}

.periodic-table-grid.compact-mode .node .name {
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make amount more prominent */
.periodic-table-grid.compact-mode .node .amount {
    font-size: 1em;
    font-weight: bold;
}

/* Reduce padding and margins */
.periodic-table-grid.compact-mode .node-front {
    padding: 4px 6px;
    gap: 3px;
}

/* Hide storage bar in compact mode */
.periodic-table-grid.compact-mode .element-storage-bar {
    height: 2px;
    min-height: 2px;
}

/* Keep overcharge button visible but smaller */
.periodic-table-grid.compact-mode .overcharge-btn {
    font-size: 0.7em;
    padding: 1px 3px;
    min-width: auto;
}

/* Adjust node flip for compact mode */
.periodic-table-grid.compact-mode .node {
    perspective: 600px;
}

/* Smaller node dimensions hint */
.periodic-table-grid.compact-mode .periodic-table-cell {
    overflow: hidden;
}

/* === Middle Compact Mode (zoom 75% - 104%) === */
/* Hide auto-sell bar in the middle range */
.periodic-table-grid.compact-mode-middle .sell-auto-row {
    display: none !important;
}

/* === Element Milestone Levels === */
.milestone-badge {
    font-size: 0.75em;
    font-weight: bold;
    color: var(--accent-gold);
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
    margin-left: 6px;
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    cursor: help;
}

.milestone-badge .milestone-text {
    display: inline-block;
}

.milestone-badge .milestone-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 14, 28, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 1.275em;
    color: var(--accent-gold);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--speed-med) ease, visibility var(--speed-med) ease;
    z-index: 1000;
    pointer-events: none;
    margin-top: 4px;
}

.milestone-badge:hover .milestone-tooltip {
    opacity: 1;
    visibility: visible;
}

.node.has-milestone .node-front {
    border-bottom: 2px solid rgba(255, 215, 0, 0.4);
}

.stabilize-picker {
    position: fixed;
    z-index: 9999;
    background: rgba(10, 14, 28, 0.97);
    border: 1px solid rgba(255, 160, 0, 0.45);
    border-radius: 5px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
    min-width: 170px;
}

.stabilize-tier-btn {
    background: transparent;
    border: 1px solid rgba(255, 160, 0, 0.25);
    border-radius: var(--radius-xs);
    color: rgba(255, 200, 80, 0.9);
    font-size: 0.72em;
    padding: 4px 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.stabilize-tier-btn:hover {
    background: rgba(255, 160, 0, 0.12);
    border-color: rgba(255, 160, 0, 0.7);
    color: #ffa000;
}
.stabilize-tier-btn.cannot-afford {
    color: rgba(180, 120, 50, 0.45);
    cursor: not-allowed;
}
.stabilize-tier-btn.cannot-afford:hover {
    background: transparent;
    border-color: rgba(255, 160, 0, 0.15);
    color: rgba(180, 120, 50, 0.45);
}

/* === Upgrade Overlay === */
.upgrade-overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.3);
    display: none;
}
.upgrade-overlay-backdrop.show { display: block; }

.upgrade-overlay {
    position: fixed;
    z-index: 999;
    width: 340px;
    background: rgba(18, 22, 36, 0.96);
    backdrop-filter: blur(var(--glass-16));
    -webkit-backdrop-filter: blur(var(--glass-16));
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 188, 212, 0.15);
    display: none;
    overflow: hidden;
}
.upgrade-overlay.show { display: block; }

.upgrade-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.25);
    background: rgba(0, 0, 0, 0.2);
}

.upgrade-overlay-title {
    font-size: 1.1em;
    font-weight: bold;
    letter-spacing: 0.03em;
}

.upgrade-overlay-close {
    width: 24px;
    height: 24px;
    background: rgba(0, 188, 212, 0.15);
    border: 1px solid rgba(0, 188, 212, 0.5);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan-bright);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--speed-fast) ease;
}
.upgrade-overlay-close:hover {
    background: rgba(0, 229, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}

.upgrade-overlay-buy-all {
    height: 24px;
    padding: 0 10px;
    background: rgba(76, 175, 80, 0.18);
    border: 1px solid rgba(76, 175, 80, 0.55);
    border-radius: var(--radius-sm);
    color: var(--accent-green-light);
    font-size: 0.8em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--speed-fast) ease;
    white-space: nowrap;
}
.upgrade-overlay-buy-all:hover {
    background: rgba(76, 175, 80, 0.32);
    border-color: rgba(76, 175, 80, 0.85);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.35);
    color: #c8e6c9;
}
.upgrade-overlay-buy-all:active {
    transform: translateY(1px);
}

.upgrade-overlay-auto {
    height: 24px;
    padding: 0 10px;
    background: var(--bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75em;
    cursor: pointer;
    transition: all var(--speed-fast) ease;
    white-space: nowrap;
}
.upgrade-overlay-auto:hover {
    background: rgba(255, 193, 7, 0.18);
    border-color: rgba(255, 193, 7, 0.55);
    color: #ffe082;
}
.upgrade-overlay-auto.active {
    background: rgba(255, 193, 7, 0.22);
    border-color: rgba(255, 193, 7, 0.75);
    color: #ffe082;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.3);
}
.upgrade-overlay-auto:active {
    transform: translateY(1px);
}

.upgrade-overlay-levels {
    display: flex;
    justify-content: space-around;
    padding: 8px 16px;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--bg-elevated);
}

.upgrade-overlay-section {
    padding: 8px 16px 4px;
    font-size: 0.85em;
    font-weight: bold;
    color: var(--accent-cyan);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.upgrade-overlay-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.upgrade-overlay-item:hover {
    background: rgba(0, 188, 212, 0.12);
}
.upgrade-overlay-item.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.upgrade-overlay-item.disabled:hover {
    background: none;
}
/* "You can afford this now" affordance: affordable items get a subtle green edge glow */
.upgrade-overlay-item:not(.disabled) {
    box-shadow: inset 3px 0 0 rgba(105, 240, 174, 0.55), inset 0 0 12px rgba(105, 240, 174, 0.06);
}
.upgrade-overlay-item:not(.disabled):hover {
    box-shadow: inset 3px 0 0 rgba(105, 240, 174, 0.85), inset 0 0 16px rgba(105, 240, 174, 0.12);
}

.upgrade-overlay-item-label {
    font-size: 0.95em;
    color: var(--text-primary);
}

.upgrade-overlay-item-cost {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.55);
    text-align: right;
}
/* === General Button — glass + cyan glow base === */
button {
    background: rgba(0, 188, 212, 0.12);
    border: 1px solid rgba(0, 188, 212, 0.5);
    padding: 10px 20px;
    color: var(--accent-cyan-bright);
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 1rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.15), inset 0 1px 0 rgba(255,255,255,0.07);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
    letter-spacing: 0.04em;
}
button:hover {
    background: rgba(0, 188, 212, 0.22);
    box-shadow: 0 0 18px rgba(0, 188, 212, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    border-color: rgba(0, 229, 255, 0.75);
}
button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.2);
}

/* ==============================================================
   C5 — Micro-interactions (tactile feedback)
   ==============================================================
   Glowing cyan thumbs on the main instrument sliders (Atomizer + Condenser).
   Scoped to those IDs so the small in-card sell sliders keep their native look. */
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider) {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    height: 10px;
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider)::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-xs);
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider)::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #b3f2ff, #00e5ff 60%, #0097a7);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
    transition: box-shadow var(--speed-fast) ease, transform 0.12s ease;
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider):hover::-webkit-slider-thumb {
    box-shadow: 0 0 16px rgba(0, 229, 255, 1);
    transform: scale(1.12);
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider):active::-webkit-slider-thumb {
    box-shadow: 0 0 20px rgba(0, 229, 255, 1);
    transform: scale(1.18);
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider)::-moz-range-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-xs);
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider)::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #b3f2ff, #00e5ff 60%, #0097a7);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
    transition: box-shadow var(--speed-fast) ease, transform 0.12s ease;
}
:is(#atomizer-slider, #atomizer-slider-2, #condenser-slider, #condenser-reloop-slider, #rc-pump-rate-slider):hover::-moz-range-thumb {
    box-shadow: 0 0 16px rgba(0, 229, 255, 1);
    transform: scale(1.12);
}

/* Subtle slide-in for expanding Details panels */
.panel-details.open {
    animation: panel-details-in 0.25s ease-out;
}
@keyframes panel-details-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* === Animations === */
@keyframes flash-green {
    0%, 50% { color: var(--accent-green); }
    25%, 75% { color: var(--text-primary); }
}
@keyframes flash-coral {
    0%, 50% { color: #FF6B6B; }
    25%, 75% { color: var(--text-primary); }
}
@keyframes flash-blue {
    0%, 50% { color: #4169E1; }
    25%, 75% { color: var(--text-primary); }
}

@keyframes pulse-green-border {
    0%, 100% { box-shadow: 0 0 10px rgba(76, 175, 80, 0.25), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(76, 175, 80, 0.55); }
    50%       { box-shadow: 0 0 22px rgba(76, 175, 80, 0.7), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(111, 191, 115, 0.85); }
}
@keyframes pulse-coral-border {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 107, 107, 0.25), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(255, 107, 107, 0.55); }
    50%       { box-shadow: 0 0 22px rgba(255, 107, 107, 0.7), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(255, 150, 150, 0.85); }
}
@keyframes pulse-blue-border {
    0%, 100% { box-shadow: 0 0 10px rgba(65, 105, 225, 0.25), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(65, 105, 225, 0.55); }
    50%       { box-shadow: 0 0 22px rgba(65, 105, 225, 0.7), 0 2px 12px rgba(0,0,0,0.3); border-color: rgba(100, 140, 255, 0.85); }
}

/* Default (solid = green) */
.menu-dots.upgrade-available {
    animation: flash-green 2s infinite;
}
.node.unlocked.upgrade-available .node-front {
    animation: pulse-green-border 2s infinite;
}

/* Gas (coral) */
.node[data-physical-state="gas"] .menu-dots.upgrade-available {
    animation: flash-coral 2s infinite;
}
.node.unlocked.upgrade-available[data-physical-state="gas"] .node-front {
    animation: pulse-coral-border 2s infinite;
}

/* Liquid (blue) */
.node[data-physical-state="liquid"] .menu-dots.upgrade-available {
    animation: flash-blue 2s infinite;
}
.node.unlocked.upgrade-available[data-physical-state="liquid"] .node-front {
    animation: pulse-blue-border 2s infinite;
}

/* Hidden data cache for node stats (written by ui-manager, read by card back) */
.node-tooltip { display: none !important; }

/* === Node Back Face Content === */
.node-back-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 188, 212, 0.2);
    margin-bottom: 4px;
}
.node-back-title {
    flex: 1;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--accent-cyan);
    letter-spacing: 0.05em;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.node-back-btn {
    background: rgba(0, 188, 212, 0.12);
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan-bright);
    font-size: 1em;
    width: 22px;
    height: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--speed-fast), box-shadow var(--speed-fast);
    line-height: 1;
}
.node-back-btn:hover {
    background: rgba(0, 188, 212, 0.28);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}
.node-back-stats {
    flex: 1;
    overflow: hidden;
    columns: 2;
    column-gap: 8px;
    align-content: center;
}
.node-back-stats .tip-row {
    font-size: 1.05em;
    line-height: 1.45;
    white-space: nowrap;
    break-inside: avoid;
    gap: 4px;
}

/* Fuser particle trail overlay canvas */
.trail-overlay-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 8000;
}
.tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    line-height: 1.7;
}
.tip-label { color: var(--text-dim); }
.tip-val   { color: var(--accent-cyan-pale); font-weight: bold; font-variant-numeric: tabular-nums; }

/* === Unlock Cost Display (locked/bypassed cards) === */
.unlock-cost-display {
    font-size: 0.82em;
    line-height: 1.5;
    color: var(--text-muted);
}
.unlock-cost-display .cost-energy {
    color: #7ec8e3;
    font-size: 0.93em;
}

/* === Sell Controls (unlocked element cards) === */
.sell-controls {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
    width: 100%;
}
.sell-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78em;
}
.sell-row input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 4px;
    cursor: pointer;
}
.sell-manual-label,
.sell-auto-label {
    min-width: 32px;
    text-align: right;
    color: var(--text-secondary);
}
.sell-manual-btn {
    background: rgba(76, 175, 80, 0.18);
    border: 1px solid rgba(76, 175, 80, 0.55);
    color: var(--accent-green-light);
    border-radius: var(--radius-sm);
    padding: 1px 8px;
    font-size: 0.9em;
    cursor: pointer;
    line-height: 1.5;
}
.sell-manual-btn:hover {
    background: rgba(76, 175, 80, 0.32);
}
.sell-auto-icon {
    font-size: 0.95em;
}
.sell-manual-value-row {
    justify-content: flex-end;
}
.sell-manual-value {
    color: #81c784;
    font-weight: bold;
}

/* === Dark Matter Display === */
#dark-matter-display {
    color: var(--accent-purple);
    font-weight: bold;
    font-size: 0.95em;
    margin-top: 5px;
}

/* === Fuser Progression Gate === */
@keyframes fuser-reveal {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
#atomic-fuser-container.revealed {
    animation: fuser-reveal 0.6s ease-out forwards;
}

/* === Fuser Locked State === */
#atomic-fuser-container.locked {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.9), rgba(30, 30, 45, 0.95));
    border: 2px solid rgba(100, 100, 120, 0.3);
    border-radius: var(--radius-xl);
}

#fuser-locked-overlay {
    text-align: center;
    padding: 30px;
    max-width: 320px;
}

.locked-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.locked-icon {
    font-size: 2rem;
    opacity: 0.7;
    animation: locked-pulse 2s ease-in-out infinite;
}

@keyframes locked-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.05); }
}

.locked-header h3 {
    margin: 0;
    color: var(--text-dim);
    font-size: 1.3rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.locked-hint {
    color: #666;
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.locked-requirements {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: left;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: #666;
    font-size: 0.9rem;
    transition: color var(--speed-slow) ease;
}

.requirement.met {
    color: var(--accent-green);
}

.requirement.met .req-status {
    color: var(--accent-green);
}

.req-status {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: all var(--speed-slow) ease;
}

.req-text {
    opacity: 0.8;
}

.unlock-button {
    background: linear-gradient(135deg, var(--accent-green), #45a049);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--speed-slow) ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.unlock-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.unlock-button:disabled {
    background: linear-gradient(135deg, #444, var(--text-faint));
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.unlock-button.ready {
    animation: button-glow 1.5s ease-in-out infinite;
}

@keyframes button-glow {
    0%, 100% { box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(76, 175, 80, 0.6); }
}

/* === Cryogenic Condenser === */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes spinReverse {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1.0; }
}

.cryo-ring-wrap {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cryo-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--accent-cyan);
    border-right-color: rgba(0, 188, 212, 0.4);
    animation: spin 4s linear infinite paused;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
}
.cryo-ring.active {
    animation-play-state: running;
}
.cryo-ring-inner {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: #4fc3f7;
    border-left-color: rgba(79, 195, 247, 0.4);
    animation: spinReverse 2.5s linear infinite paused;
}
.cryo-ring-inner.active {
    animation-play-state: running;
}
.cryo-ring-core {
    position: relative;
    font-size: 1.4em;
    color: var(--accent-cyan-light);
    animation: pulse 2s ease-in-out infinite paused;
    user-select: none;
}
.cryo-ring-core.active {
    animation-play-state: running;
    color: var(--accent-cyan-bright);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
}

/* Atomizer spin ring — mirrors cryo-ring, blue theme (B1) */
.atomizer-ring-wrap {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.atomizer-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #64b5f6;
    border-right-color: rgba(100, 181, 246, 0.4);
    animation: spin 4s linear infinite paused;
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.3);
}
.atomizer-ring.active {
    animation-play-state: running;
}
.atomizer-ring-inner {
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: #4fc3f7;
    border-left-color: rgba(79, 195, 247, 0.4);
    animation: spinReverse 2.5s linear infinite paused;
}
.atomizer-ring-inner.active {
    animation-play-state: running;
}
.atomizer-ring-core {
    position: relative;
    font-size: 1.4em;
    color: #64b5f6;
    animation: pulse 2s ease-in-out infinite paused;
    user-select: none;
}
.atomizer-ring-core.active {
    animation-play-state: running;
    color: #90caf9;
    text-shadow: 0 0 12px rgba(100, 181, 246, 0.7);
}

/* === Phase 6: Polish === */

/* Tabular numbers — prevents layout shift as values tick up */
.node .amount,
.node .prod-rate,
.node .fuel-rate,
#ui-energy, #ui-coolant, #ui-maxCoolant,
#ui-energy-rate, #ui-coolant-rate {
    font-variant-numeric: tabular-nums;
}

/* Node appear animation */
@keyframes node-appear {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.node {
    animation: node-appear var(--speed-slow) ease-out backwards;
}

/* Note: physical-state tints + glows live in the C3 block above (~line 546).
   Do NOT re-add base state tints here — a later duplicate rule with identical
   specificity will override the C3 glow. Hover feedback comes from .node.unlocked
   hover rules (~line 622). */

/* Scan-line overlay on the element web */
#web-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.06) 3px,
        rgba(0, 0, 0, 0.06) 4px
    );
    pointer-events: none;
    z-index: 0;
}

/* Dashboard resource numbers — subtle glow */
#ui-energy, #ui-coolant {
    color: var(--accent-cyan-pale);
    text-shadow: 0 0 8px rgba(0, 188, 212, 0.4);
}

/* Smooth fuser result text transitions */
#atomic-fuser-result {
    transition: opacity var(--speed-slow) ease;
}

/* === Bunsen Burner === */
@keyframes flameFlicker {
    0%   { transform: scaleX(1)    scaleY(1)    skewX(0deg);  opacity: 1; }
    20%  { transform: scaleX(0.93) scaleY(1.06) skewX(-2deg); opacity: 0.92; }
    40%  { transform: scaleX(1.05) scaleY(0.97) skewX(1deg);  opacity: 0.97; }
    60%  { transform: scaleX(0.96) scaleY(1.04) skewX(2deg);  opacity: 0.94; }
    80%  { transform: scaleX(1.03) scaleY(0.98) skewX(-1deg); opacity: 0.98; }
    100% { transform: scaleX(1)    scaleY(1)    skewX(0deg);  opacity: 1; }
}
@keyframes innerFlicker {
    0%   { transform: scaleX(1)    scaleY(1);    opacity: 0.9; }
    33%  { transform: scaleX(0.88) scaleY(1.08); opacity: 0.75; }
    66%  { transform: scaleX(1.08) scaleY(0.95); opacity: 0.85; }
    100% { transform: scaleX(1)    scaleY(1);    opacity: 0.9; }
}
.bunsen-burner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    width: 60px;
    user-select: none;
}
.bunsen-flame-wrap {
    position: relative;
    width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: bottom center;
}
.bunsen-flame-outer {
    width: 44px;
    border-radius: 50% 50% 20% 20% / 60% 60% 20% 20%;
    background: linear-gradient(to top, #ff4400, #ff8c00 40%, var(--accent-gold) 75%, rgba(255,220,80,0));
    transform-origin: bottom center;
    transition: height var(--speed-slow) ease, opacity var(--speed-slow) ease, box-shadow var(--speed-slow) ease;
    opacity: 0.25;
}
.bunsen-flame-outer.active {
    animation: flameFlicker 0.45s ease-in-out infinite alternate;
}
.bunsen-flame-inner {
    position: absolute;
    bottom: 4px;
    width: 22px;
    border-radius: 50% 50% 20% 20% / 60% 60% 20% 20%;
    background: linear-gradient(to top, #00cfff, #80e8ff 50%, rgba(180,240,255,0));
    transform-origin: bottom center;
    transition: height var(--speed-slow) ease, opacity var(--speed-slow) ease;
    opacity: 0;
}
.bunsen-flame-inner.active {
    opacity: 0.85;
    animation: innerFlicker 0.35s ease-in-out infinite alternate;
}
.bunsen-tube {
    width: 14px;
    height: 32px;
    background: linear-gradient(to right, var(--text-faint), var(--text-dim), var(--text-faint));
    border-radius: 2px 2px 0 0;
    border: 1px solid #666;
    flex-shrink: 0;
}
.bunsen-base {
    width: 44px;
    height: 10px;
    background: linear-gradient(to bottom, #666, #444);
    border-radius: var(--radius-xs);
    border: 1px solid var(--text-faint);
}

/* === Help, Bonuses Buttons & Modals === */
.bonuses-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 5px 15px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 180, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: var(--radius-sm);
    color: rgba(255, 215, 0, 0.9);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed-fast) ease;
    box-shadow: none;
    letter-spacing: normal;
    text-transform: none;
    transform: none;
}
.bonuses-btn:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 180, 0, 0.2));
    border-color: rgba(255, 215, 0, 0.6);
    color: var(--accent-gold);
    box-shadow: none;
}

.bonuses-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(var(--glass-3));
}
.bonuses-modal.show { display: flex; }

.bonuses-modal-content {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius-xl);
    padding: 24px;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(255, 215, 0, 0.1);
    position: relative;
}

.bonuses-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: rgba(255,255,255,0.5);
    font-size: 1.5em;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--speed-fast);
    padding: 0;
}
.bonuses-modal-close:hover {
    background: rgba(255,255,255,0.08) !important;
    box-shadow: none !important;
    color: var(--text-primary);
    transform: none;
}

.bonuses-modal h2 {
    margin: 0 0 8px 0;
    color: var(--accent-gold);
    font-size: 1.4em;
}
.bonuses-modal h3 {
    margin: 20px 0 12px 0;
    color: rgba(255,255,255,0.9);
    font-size: 1.1em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 6px;
}
.bonuses-modal h4 {
    margin: 16px 0 8px 0;
    color: rgba(255,255,255,0.7);
    font-size: 0.95em;
}

.bonuses-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bonus-item {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.05);
}
.bonus-item.complete {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.2);
}

.bonus-name {
    font-size: 0.9em;
    color: rgba(255,255,255,0.85);
}

.bonus-progress {
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
.bonus-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(100,200,255,0.6), rgba(100,255,200,0.6));
    border-radius: var(--radius-xs);
    transition: width var(--speed-slow) ease;
}
.bonus-item.complete .bonus-progress-bar {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.8), rgba(255, 180, 0, 0.8));
}

.bonus-status {
    font-size: 0.85em;
    text-align: right;
    color: rgba(255,255,255,0.6);
}

.bonuses-legend {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.bonuses-legend ul {
    margin: 8px 0;
    padding-left: 20px;
}
.bonuses-legend li {
    margin: 4px 0;
    color: rgba(255,255,255,0.7);
    font-size: 0.9em;
}

