:root {
    /* Futuristic Palette */
    --bg-void: #02040a;
    --hologram-cyan: #00d2ff;
    --hologram-pink: #f40076;
    --energy-gold: #ffc300;
    --glass-panel: rgba(10, 15, 30, 0.85);
    --glass-accent: rgba(255, 255, 255, 0.1);

    --panel-height-base: 45vh;
    --panel-height-dynamic: 45vh;
    --header-height: clamp(100px, 15vh, 125px);

    /* Standard Model Scaling */
    --sm-cell-size: clamp(40px, 11vw, 85px);
    --sm-gap: clamp(2px, 1vw, 10px);
    --sm-label-width: clamp(25px, 5vw, 40px);

    /* Fluid Typography */
    --font-size-base: clamp(0.8rem, 2vw, 1rem);
    --font-size-h1: clamp(1.2rem, 4vw, 1.8rem);
    --font-size-h2: clamp(1rem, 3vw, 1.4rem);

    /* Calculated Layouts */
    --sm-body-width: calc(5 * var(--sm-cell-size) + 4 * var(--sm-gap));
    --sm-total-width: calc(var(--sm-label-width) + var(--sm-gap) + var(--sm-body-width));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-void);
    color: #e6e6e6;
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
}

#boot-splash {
    position: fixed;
    inset: 0;
    background: #010206 url('assets/splash-bg-v2.png') no-repeat center center;
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease, visibility 1s;
    overflow: hidden;
}

/* Gradient overlay to ensure text readability against the nebula */
#boot-splash::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(1, 2, 6, 0.7) 100%);
    z-index: 1;
}

#boot-splash.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-title {
    position: relative;
    z-index: 2;
    font-size: clamp(2rem, 8vw, 3.5rem);
    letter-spacing: 15px;
    color: var(--hologram-cyan);
    margin-bottom: 40px;
    text-shadow: 0 0 30px rgba(0, 210, 255, 0.6);
    font-weight: 600;
    text-align: center;
    padding: 0 20px;
}

.splash-logo {
    position: relative;
    z-index: 2;
    width: clamp(200px, 50vw, 300px);
    height: auto;
    /* Double-Layer Seamless Logic: Masking + Blending + Contrast Hardening */
    -webkit-mask-image: url('assets/boot-atom-v2.png');
    mask-image: url('assets/boot-atom-v2.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    
    mix-blend-mode: screen; 
    background: transparent;
    filter: brightness(1.3) contrast(1.6) drop-shadow(0 0 40px rgba(0, 210, 255, 0.5));
}

/* Add a subtle breathing effect to the background */
@keyframes nebulaBreath {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

#boot-splash {
    animation: nebulaBreath 10s ease-in-out infinite alternate;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Background & Quantum Effects */
#quantum-vacuum {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #050a1b 0%, #010206 100%);
    z-index: -2;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

#quantum-canvas {
    position: absolute;
    inset: 0;
    z-index: -1;
    mix-blend-mode: screen;
    filter: blur(1px);
}

/* Full Size Dark Hub Implementation */
#periodic-table-modal.modal-overlay {
    background: rgba(0, 5, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
}

#periodic-table-modal.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.periodic-card {
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Header: Sleek Stats */
#top-bar {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 clamp(10px, 4vw, 30px);
    background: transparent;
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none; /* Allows brand center to be clickable for flux while protecting corners */
}

.resource-group, .header-right {
    pointer-events: auto; /* SAFE AREA: Clicks here won't trigger flux */
}

.brand-center {
    pointer-events: none; /* Clicking brand name STILL generates flux */
}

#main-interface {
    margin-top: 0;
    height: 100vh;
    display: flex;
    flex-direction: row; /* Force side-by-side fundamentally */
    overflow: hidden;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px 10px 20px 20px; /* Generous hit area for mobile */
    pointer-events: auto;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.menu-toggle:hover {
    opacity: 1;
}

.hamburger-bar {
    width: 20px;
    height: 2px;
    background: var(--hologram-cyan);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--hologram-cyan);
}

.resource-group {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Equal spacing as requested */
    align-items: flex-start;
    justify-content: center;
    position: absolute;
    left: 20px;
    top: 5px; /* Aligned with .brand-center and .header-right top */
}

.stat-block {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
}

.resource-group .label {
    font-size: 0.5rem;
    letter-spacing: 3px;
    color: white;
    opacity: 0.4;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.resource-group .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--hologram-cyan);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
    line-height: 1;
}

.resource-group .rate {
    font-size: 0.65rem;
    color: #00f5a0;
    margin-top: 1px;
}

.resource-group small {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-left: 2px;
}

.brand-center {
    position: absolute;
    left: 50%;
    top: 5px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 5;
    width: clamp(150px, 35vw, 290px);
    pointer-events: none;
}

.brand {
    width: 100%;
    font-weight: 300;
    font-size: 0.95rem;
    color: white;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand span {
    display: inline-block;
}

.discovery-track {
    width: 100%;
    margin-top: 5px; /* Unified spacing */
}

.progress-label {
    font-size: 0.65rem;
    opacity: 0.5;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
    margin-top: 4px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.track-info {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Digital Grid Effect for Segments */
.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(90deg,
            transparent,
            transparent 8px,
            rgba(0, 0, 0, 0.6) 8px,
            rgba(0, 0, 0, 0.6) 10px);
    z-index: 2;
    pointer-events: none;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--hologram-cyan), var(--hologram-pink));
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: white;
    opacity: 0.5;
    text-transform: uppercase;
    text-align: left;
}

.rate {
    font-size: 0.65rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--hologram-cyan);
    font-weight: 800;
    opacity: 0.9;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.rate small {
    margin-left: 1px;
    font-weight: 600;
}


.energy-mini {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.energy-mini .label {
    font-size: 0.55rem;
    letter-spacing: 1px;
    color: var(--energy-gold);
    opacity: 0.8;
}

.energy-mini .value-small {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: white;
    font-weight: 600;
}

.stat {
    font-size: 0.7rem;
    color: var(--hologram-cyan);
    opacity: 0.6;
}

/* Center Clicker Chamber */
#clicker-chamber {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-bottom: 20px;
    cursor: pointer;
    touch-action: none; /* Prevents browser gestures from intercepting taps */
}

#floating-text-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}





/* Bottom Control Deck */
#control-deck {
    height: var(--panel-height-dynamic);
    max-height: 80vh;
    min-height: 100px;
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-accent);
    display: flex;
    flex-direction: column;
}

.drag-handle {
    height: 24px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
}

.drag-handle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.drag-handle:active {
    cursor: grabbing;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: var(--hologram-cyan);
    border-radius: 2px;
    opacity: 0.4;
    box-shadow: 0 0 10px var(--hologram-cyan);
}

.tab-header {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    height: 50px;
    border-bottom: 1px solid var(--glass-accent);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: white;
    opacity: 0.5;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 3px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    height: 100%;
}

.tab-btn:hover {
    opacity: 0.8;
}

.tab-btn.active {
    opacity: 1;
    color: var(--hologram-cyan);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--hologram-cyan);
    box-shadow: 0 0 10px var(--hologram-cyan);
}

.panel-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--glass-accent);
    margin-bottom: 10px;
}

.discovery-hint {
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: white;
    opacity: 0.4;
}

.premium-select {
    background: #0a0f1e;
    color: var(--hologram-cyan);
    border: 1px solid var(--glass-accent);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    min-width: 100px;
}

.premium-select:hover {
    border-color: var(--hologram-cyan);
}

.premium-select option {
    background: #0a0f1e;
    color: white;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.scroll-stack {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.scroll-stack.active {
    display: flex;
}

/* Generator & Upgrade Cards */
.generator-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-accent);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
}

.info-area {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: help;
    padding: 4px;
    transition: background 0.2s;
    border-radius: 6px;
}

.info-area:hover {
    background: rgba(255, 255, 255, 0.05);
}

.item-img-container {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.item-thumb {
    width: 32px;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-name {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.yield-info {
    display: flex;
    gap: 10px;
}

.yield-info small {
    margin-left: 2px;
    opacity: 0.6;
    font-size: 0.6rem;
}

.item-cost {
    font-size: 0.75rem;
    color: var(--hologram-cyan);
    font-family: 'JetBrains Mono', monospace;
}

.item-yield {
    font-size: 0.75rem;
    color: var(--energy-gold);
}

.owned-count {
    font-size: 1.2rem;
    font-weight: 700;
    opacity: 0.3;
    min-width: 30px;
    text-align: right;
}

.buy-btn {
    background: rgba(0, 245, 160, 0.1);
    border: 1px solid rgba(0, 245, 160, 0.3);
    color: #00f5a0;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
}

.buy-btn:hover {
    background: rgba(0, 245, 160, 0.2);
    box-shadow: 0 0 15px rgba(0, 245, 160, 0.1);
}

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

.buy-qty {
    opacity: 0.6;
    font-size: 0.65rem;
}


.milestone-locked {
    opacity: 0.15;
    filter: grayscale(1);
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.01);
    border-style: dashed !important;
    pointer-events: none;
}

.locked .buy-btn,
.milestone-locked .buy-btn {
    opacity: 0.4;
    filter: grayscale(0.7);
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: #888;
}

.can-afford {
    border-color: var(--hologram-cyan);
    background: rgba(0, 210, 255, 0.05);
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-overlay.hidden {
    display: none;
}

.particle-card {
    width: 90vw;
    max-width: 850px; /* Increased for tablet scaling */
    background: var(--glass-panel);
    border: 1px solid var(--hologram-cyan);
    border-radius: 20px;
    padding: 20px 25px 25px;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 210, 255, 0.1);
}

.discovery-badge-container {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 245, 160, 0.2);
    padding: 0 0 25px;
}

.modal-type-header {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 5px;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 245, 160, 0.5);
    background: linear-gradient(90deg, #00f5a0, #00d2ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.spin-in {
    animation: cardSpin 2.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardSpin {
    0% {
        transform: rotateY(-1080deg) scale(0.1);
        opacity: 0;
        filter: blur(20px);
    }
    100% {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes modalPop {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.modal-img-container {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-img-container img {
    width: 60px;
}

.card-titles h2 {
    margin: 0;
    letter-spacing: 2px;
    color: var(--hologram-cyan);
}

.symbol-badge {
    color: var(--energy-gold);
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.6;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.quantum-spec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.standard-model-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-item .label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
}

.spec-item .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #00d2ff;
    font-weight: 600;
}

.card-section label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--hologram-cyan);
    margin-bottom: 8px;
    opacity: 0.7;
}

.card-section p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    opacity: 0.9;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 10px;
}

.info-item label {
    display: block;
    font-size: 0.6rem;
    opacity: 0.5;
    margin-bottom: 4px;
}

.info-item span {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

/* Floating Text */
.floating-text {
    position: absolute;
    color: var(--energy-gold);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    animation: floatRise 0.8s ease-out forwards;
}

@keyframes floatRise {
    0% {
        transform: scale(0.5) translateY(0);
        opacity: 0;
    }

    20% {
        transform: scale(1.2) translateY(-20px);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(-60px);
        opacity: 0;
    }
}

/* Footer: Data Hub */
#data-hub {
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 0.75rem;
    gap: 15px;
    border-top: 1px solid var(--glass-accent);
}

.badge {
    background: var(--hologram-cyan);
    color: black;
    padding: 2px 6px;
    border-radius: 2px;
    font-weight: 700;
    font-size: 0.6rem;
}

.ticker {
    color: #888;
    font-family: 'JetBrains Mono', monospace;
}

/* Menu CSS Extension */
.glass-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: rgba(10, 15, 25, 0.9);
    backdrop-filter: blur(25px);
    border-left: 1px solid rgba(0, 245, 160, 0.3);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.glass-sidebar.hidden {
    transform: translateX(100%);
    pointer-events: none;
}

.menu-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-header h3 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: #00f5a0;
}

.menu-content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 32px;
}

.menu-section h4 {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    letter-spacing: 1.5px;
}

.menu-section p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.version-tag {
    font-size: 0.75rem;
    background: rgba(0, 245, 160, 0.1);
    color: #00f5a0;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 8px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.mini-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.menu-divider {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

.danger-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 50, 50, 0.1);
    border: 1px solid rgba(255, 50, 50, 0.4);
    color: #ff3232;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.danger-btn:hover {
    background: rgba(255, 50, 50, 0.2);
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.3);
}

.warning-text {
    font-size: 0.75rem;
    color: rgba(255, 50, 50, 0.6);
    margin-top: 8px;
}

@media (max-width: 480px) {
    .glass-sidebar {
        width: 100%;
    }
}
.god-mode label {
    color: #ff3232 !important;
    text-shadow: 0 0 10px rgba(255, 50, 50, 0.3);
    font-size: 0.75rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

#time-scale-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

#time-scale-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #ff3232;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.5);
    border: 2px solid white;
}

#time-scale-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #00f5a0;
    min-width: 45px;
}

/* --- Level Up / Prestige Modal --- */
.level-card {
    width: 90vw;
    max-width: 900px; /* Increased for tablet scaling */
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(0, 245, 160, 0.3);
    box-shadow: 0 0 50px rgba(0, 245, 160, 0.1);
}

.prestige-glow {
    background: radial-gradient(circle at center, rgba(0, 245, 160, 0.05) 0%, transparent 70%);
}

.prestige-header h1 {
    font-size: 2rem;
    color: #00f5a0;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.epoch-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #00d2ff;
    letter-spacing: 4px;
    margin-bottom: 30px;
}

.recap-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin: 25px 0;
    text-align: left;
}

.recap-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.recap-item .check {
    color: #00f5a0;
    font-weight: bold;
}

.reset-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
}

.action-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(90deg, #00f5a0, #00d2ff);
    border: none;
    border-radius: 8px;
    color: #0a0a0c;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 245, 160, 0.4);
}

/* --- Nuclei Centering --- */
#hadrons-list.active {
    display: flex;
    flex-direction: column;
    width: 100%;
}

#hadrons-list .generator-item {
    width: 100%;
}

.group-header {
    width: 100%;
    padding: 12px 16px;
    margin: 20px 0 10px;
    background: linear-gradient(90deg, rgba(0, 210, 255, 0.1), transparent);
    border-left: 3px solid #00d2ff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #00d2ff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

#generators-list {
    padding-bottom: 50px;
}





/* --- Centered System Rank --- */







.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    position: absolute;
    right: 20px;
    top: 5px; /* Aligned with .brand-center top */
    pointer-events: auto; /* Ensure whole block is safer */
}

.level-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 5px;
}

.level-indicator .level-title {
    font-size: 0.5rem;
    letter-spacing: 3px;
    color: white;
    opacity: 0.4;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.level-indicator #level-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--hologram-cyan);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
    line-height: 1;
}

.menu-toggle {
    margin-top: 5px;
}

/* Style for available but unaffordable or undiscovered items */
.generator-item.locked {
    opacity: 0.6;
    filter: saturate(0.5);
    background: rgba(255, 255, 255, 0.03);
}

.generator-item.locked .item-thumb {
    opacity: 0.3;
}

/* Specific style for ??? items to make them look more 'greyed out' */
.generator-item.milestone-locked {
    opacity: 0.15;
    filter: grayscale(1) brightness(0.7);
}



/* Periodic Table Styles v0.0.7 */
.periodic-card {
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    background: var(--glass-panel);
    border: 1px solid var(--hologram-cyan);
    border-radius: 16px;
    padding: 16px 16px 10px 16px;
    overflow-y: auto;
}

.periodic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 210, 255, 0.2);
}

.periodic-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.particle-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 210, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-align: center;
}

.particle-cell:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: var(--hologram-cyan);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.2);
    transform: translateY(-5px);
}

.particle-cell .sym {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    color: var(--hologram-cyan);
    margin-bottom: 4px;
}

.particle-cell .name {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* Color Coding */
.quark { border-left: 4px solid #d199ff; }
.lepton { border-left: 4px solid #78e08f; }
.boson { border-left: 4px solid #ff6b6b; }
.higgs { border-left: 4px solid #feca57; grid-column: span 1; }

.periodic-footer .legend {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    justify-content: center;
}

.l-item { display: flex; align-items: center; gap: 6px; }
.l-item::before { content: ''; width: 12px; height: 12px; border-radius: 2px; }
.l-item.q::before { background: #d199ff; }
.l-item.l::before { background: #78e08f; }
.l-item.b::before { background: #ff6b6b; }
.l-item.h::before { background: #feca57; }

.premium-menu-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.1), rgba(0, 245, 160, 0.1));
    border: 1px solid var(--hologram-cyan);
    color: var(--hologram-cyan);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.premium-menu-btn:hover {
    background: rgba(0, 210, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
    transform: translateY(-2px);
}

.menu-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    margin-top: -8px;
    margin-bottom: 20px;
}

/* Periodic Hub Navigation & Elements v0.0.4 */
.periodic-hub-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.hub-tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.hub-tab-btn.active {
    background: rgba(0, 210, 255, 0.1);
    color: var(--hologram-cyan);
    box-shadow: inset 0 0 10px rgba(0, 210, 255, 0.2);
}

.hub-view {
    display: none;
}

.hub-view.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

.element { border-left: 4px solid #00f5a0; }
.l-item.e-legend::before { background: #00f5a0; }

.particle-cell.locked-hub {
    filter: brightness(0.2) grayscale(1);
    cursor: not-allowed;
    opacity: 0.3;
    pointer-events: none;
}

.particle-cell.locked-hub .sym,
.particle-cell.locked-hub .name {
    visibility: hidden;
}



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

/* Floating Hub Navigation v0.0.6 */
#floating-hub-container {
    position: fixed;
    top: clamp(130px, 18vh, 160px);
    right: clamp(10px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 90;
}

@media (max-width: 600px) {
    #floating-hub-container {
        top: auto;
        bottom: 20px;
        right: 50%;
        transform: translateX(50%);
        flex-direction: row;
        background: none;
        padding: 0;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
    }
}

.hub-floating-btn {
    width: clamp(50px, 12vw, 65px);
    height: clamp(50px, 12vw, 65px);
    background: var(--glass-panel);
    border: 1px solid var(--hologram-cyan);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 12px; /* SAFE AREA padding */
    pointer-events: auto;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hub-floating-btn img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.5));
    transition: all 0.3s ease;
}

.hub-floating-btn:hover {
    transform: scale(1.1) translateY(-2px);
    border-color: var(--hologram-cyan);
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.3), 0 8px 25px rgba(0, 0, 0, 0.5);
}

.hub-floating-btn:hover img {
    filter: drop-shadow(0 0 8px rgba(0, 210, 255, 0.8));
    transform: rotate(15deg);
}

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

/* Adjusting the header hamburger position if needed */
#menu-btn {
    /* Existing styles should be fine, but let's ensure it's above the container */
    z-index: 100;
}

/* --- STANDARD MODEL HUB (SMEP) --- */
.standard-model-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sm-header-row, .sm-subheading-row {
    display: grid;
    grid-template-columns: var(--sm-label-width) repeat(5, var(--sm-cell-size));
    gap: var(--sm-gap);
    width: var(--sm-total-width);
    margin: 0 auto;
    text-align: center;
}

.sm-header-body {
    display: grid;
    grid-template-columns: repeat(5, var(--sm-cell-size));
    gap: var(--sm-gap);
    width: var(--sm-body-width);
}

.sm-label-col { width: var(--sm-label-width); }

.sm-gen-header {
    background: rgba(0, 210, 255, 0.1);
    border: 1px solid rgba(0, 210, 255, 0.2);
    padding: 4px 0;
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--hologram-cyan);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-sub {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-grid {
    display: grid;
    grid-template-columns: var(--sm-label-width) var(--sm-body-width);
    gap: var(--sm-gap);
    width: var(--sm-total-width);
    margin: 0 auto;
}

.sm-side-labels {
    width: var(--sm-label-width);
    flex-shrink: 0;
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    gap: var(--sm-gap);
}

.sm-side-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    opacity: 0.5;
}

.sm-side-label.quarks { color: #d199ff; grid-row: 1 / span 2; }
.sm-side-label.leptons { color: #78e08f; grid-row: 3 / span 2; }

.sm-grid-body {
    display: grid;
    grid-template-columns: repeat(5, var(--sm-cell-size));
    grid-template-rows: repeat(4, var(--sm-cell-size));
    gap: var(--sm-gap);
    width: var(--sm-body-width);
}

/* Particle Cell System */
.particle-cell {
    aspect-ratio: 1;
    background: rgba(10, 20, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    transition: all 0.2s ease;
}

.particle-cell:hover:not(.locked-hub) {
    background: rgba(0, 210, 255, 0.15);
    border-color: var(--hologram-cyan);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 210, 255, 0.3);
}

.particle-cell.locked-hub {
    filter: grayscale(1) opacity(0.5);
    cursor: default;
}

/* Cell Technical Display - Restricted to info cards */
.pc-img-container {
    width: 70%;
    height: 70%;
    padding: 2px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.pc-name {
    font-size: 0.85rem;
    font-weight: 800;
    opacity: 0.8;
    text-align: center;
}

/* Group Neon Borders */
.quark { border-color: rgba(209, 153, 255, 0.4); }
.lepton { border-color: rgba(120, 224, 143, 0.4); }
.boson { border-color: rgba(255, 107, 107, 0.4); }
.higgs { border-color: rgba(254, 202, 87, 0.4); }

.sm-empty-cell { background: transparent; border: none; }

/* --- Consolidated Responsive System v0.0.3 --- */

@media (max-width: 1200px) {
    :root {
        --sm-cell-size: 70px;
    }
}

@media (max-width: 900px) {
    .premium-header { 
        gap: 10px;
        height: var(--header-height);
    }
    
    .brand-center { 
        width: clamp(120px, 45vw, 200px);
        margin: 0;
    }

    #resources-panel {
        width: 120px;
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    :root {
        --font-size-base: 0.65rem;
        --header-height: 120px;
        --sm-cell-size: 55px;
    }

    .brand { 
        font-size: 0.75rem;
        /* Inheriting display: flex and justify from global */
    }
    
    .discovery-track { 
        width: 100% !important;
    }

    .resource-group .label { font-size: 0.4rem !important; }
    .resource-group .value { font-size: 0.75rem !important; }

    #floating-hub-container {
        top: 130px; /* Lowered to clear expanded header */
        right: 15px;
        bottom: auto;
        transform: none;
        flex-direction: column;
        z-index: 1100;
        background: none;
        border: none;
        padding: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    #resources-panel {
        width: 90px;
    }
    
    .buy-btn {
        min-width: 80px;
        padding: 6px 8px;
        font-size: 0.7rem;
    }
}

@media (min-width: 1600px) {
    :root {
        --sm-cell-size: 90px;
        --font-size-base: 1rem;
    }
}

@media (min-width: 768px) {
    :root {
        --font-size-base: 1.1rem;
        --font-size-h1: 2.2rem;
        --font-size-h2: 1.6rem;
    }
    #app {
        max-width: 100%;
    }
    .item-img-container {
        width: 60px;
        height: 60px;
    }
    .generator-item {
        padding: 20px;
    }
    .item-name {
        font-size: 1.1rem;
    }
}

@media (min-width: 1200px) {
    #app {
        max-width: 800px;
    }
}

/* Ambient Quantum Fluctuations */
.ambient-flash {
    position: absolute;
    width: var(--flash-size, 2px);
    height: var(--flash-size, 2px);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 calc(var(--flash-size, 2px) * 5) 2px var(--flash-color, var(--hologram-cyan));
    pointer-events: none;
    z-index: 1;
    animation: flashFade 1.5s ease-out forwards;
}

@keyframes flashFade {
    0% { transform: scale(0); opacity: 0; }
    30% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

.ambient-streak {
    position: absolute;
    width: 1px;
    height: 40px;
    background: linear-gradient(to top, transparent, var(--hologram-cyan), #fff);
    pointer-events: none;
    z-index: 1;
    --angle: 0deg;
    transform: rotate(var(--angle));
    animation: streakMove 1.2s ease-in forwards;
}

@keyframes streakMove {
    0% { transform: rotate(var(--angle)) translateY(0) scaleY(0.5); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: rotate(var(--angle)) translateY(-400px) scaleY(2); opacity: 0; }
}
