/* === Upgrades Panel Buttons === */
.upgrades-toggle-btn {
    background: rgba(255, 152, 0, 0.14);
    color: var(--accent-amber);
    border: 1px solid rgba(255, 152, 0, 0.55);
    padding: 8px 15px;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 8px rgba(255, 183, 77, 0.5);
}
.upgrades-toggle-btn:hover {
    background: rgba(255, 152, 0, 0.26);
    border-color: rgba(255, 152, 0, 0.8);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.35);
}
.upgrades-close-btn {
    background: rgba(0, 188, 212, 0.14);
    color: var(--accent-cyan-bright);
    border: 1px solid rgba(0, 188, 212, 0.55);
    padding: 5px 10px;
    border-radius: var(--radius-md);
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.5);
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1rem;
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
.upgrades-close-btn:hover {
    background: rgba(0, 188, 212, 0.26);
    border-color: rgba(0, 229, 255, 0.8);
    box-shadow: 0 0 16px rgba(0, 188, 212, 0.35);
}
.upgrades-close-btn:active {
    transform: translateY(1px);
}

/* === Upgrade Cards & Buttons === */
.upgrade-card {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(var(--glass-8));
    -webkit-backdrop-filter: blur(var(--glass-8));
    transition: box-shadow var(--speed-med) ease;
}
.upgrade-card-energy {
    background: rgba(255, 152, 0, 0.06);
    border: 1px solid rgba(255, 152, 0, 0.25);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3), 0 0 8px rgba(255, 152, 0, 0.06);
}
.upgrade-card-prestige {
    background: rgba(156, 39, 176, 0.08);
    border: 1px solid rgba(156, 39, 176, 0.35);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3), 0 0 10px rgba(156, 39, 176, 0.1);
}

.upgrade-btn {
    border: 1px solid;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
.upgrade-btn:active { transform: translateY(1px); }
.upgrade-btn-energy {
    background: rgba(76, 175, 80, 0.14);
    color: var(--accent-green-bright);
    border-color: rgba(76, 175, 80, 0.55);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.15), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 8px rgba(105, 240, 174, 0.5);
}
.upgrade-btn-energy:hover {
    background: rgba(76, 175, 80, 0.26);
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.35);
}
.upgrade-btn-prestige {
    background: rgba(156, 39, 176, 0.16);
    color: var(--accent-purple-light);
    border-color: rgba(156, 39, 176, 0.6);
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 8px rgba(206, 147, 216, 0.55);
}
.upgrade-btn-prestige:hover {
    background: rgba(156, 39, 176, 0.3);
    border-color: rgba(206, 147, 216, 0.8);
    box-shadow: 0 0 20px rgba(156, 39, 176, 0.4);
}

/* === Intro Screen === */
#intro-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(8, 10, 18, 0.82);
    backdrop-filter: blur(var(--glass-18));
    -webkit-backdrop-filter: blur(var(--glass-18));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    overflow-y: auto;
}
#intro-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}
#intro-screen h1 {
    font-size: 3.5rem;
    font-weight: bold;
    letter-spacing: 4px;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
#intro-screen .subtitle {
    font-size: 1.1rem;
    color: var(--text-dim);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-bottom: 40px;
}
.intro-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 800px;
    margin-bottom: 40px;
}
.intro-feature {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 188, 212, 0.2);
    border-radius: var(--radius-xl);
    padding: 24px 16px;
    backdrop-filter: blur(var(--glass-8));
    -webkit-backdrop-filter: blur(var(--glass-8));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255,255,255,0.05) inset;
    transition: transform var(--speed-med), box-shadow var(--speed-med);
}
.intro-feature .icon {
    font-size: 2.4rem;
    margin-bottom: 12px;
    display: block;
}
.intro-feature h3 {
    color: var(--accent-cyan);
    font-size: 1rem;
    margin: 0 0 8px 0;
}
.intro-feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 188, 212, 0.15), 0 1px 0 rgba(255,255,255,0.08) inset;
    border-color: rgba(0, 188, 212, 0.4);
}
.intro-feature p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}
.intro-overview {
    max-width: 640px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 36px;
}
#start-game-btn {
    font-size: 1.2rem;
    padding: 14px 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-cyan), #0097a7);
    color: #000;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    border: none;
    font-family: var(--font-mono);
    transition: transform var(--speed-fast), box-shadow var(--speed-fast);
}
#start-game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(0, 188, 212, 0.4);
}

/* === Help Button === */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 5px 15px;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.15), rgba(0, 150, 200, 0.1));
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: var(--radius-sm);
    color: rgba(0, 188, 212, 0.9);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed-fast) ease;
    user-select: none;
}
.help-btn:hover {
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.25), rgba(0, 150, 200, 0.2));
    border-color: rgba(0, 188, 212, 0.6);
    color: var(--accent-cyan-bright);
}

/* Details toggle for Atomizer/Condenser breakdowns (B1) — subtler than help-btn */
.details-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.55);
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed-fast) ease;
    user-select: none;
}
.details-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.9);
}

/* Collapsed by default; shown when the toggle adds .open (B1) */
.panel-details { display: none; }
.panel-details.open { display: block; }

/* === Help Modal === */
.help-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.help-modal.show {
    display: flex;
}
.help-modal-content {
    background: rgba(14, 18, 30, 0.88);
    backdrop-filter: blur(var(--glass-20));
    -webkit-backdrop-filter: blur(var(--glass-20));
    border: 1px solid rgba(0, 188, 212, 0.35);
    border-radius: 14px;
    padding: 30px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 188, 212, 0.2), 0 16px 64px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255,255,255,0.05) inset;
    position: relative;
}
.help-modal-content h2 {
    margin-top: 0;
    color: var(--accent-cyan);
    border-bottom: 2px solid var(--accent-cyan);
    padding-bottom: 10px;
}
.help-modal-content h4 {
    color: var(--accent-green);
    margin-top: 20px;
    margin-bottom: 8px;
}
.help-modal-content p, .help-modal-content ul {
    line-height: 1.6;
    color: var(--text-secondary);
}
.help-modal-content ul {
    margin: 8px 0;
    padding-left: 20px;
}
.help-modal-content li {
    margin: 4px 0;
}

/* === B3: collapsible guide sections with icons + highlighted key values === */
.help-modal-content details.guide-section {
    margin-top: 14px;
    border: 1px solid rgba(0, 229, 255, 0.16);
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.03);
    overflow: hidden;
}
.help-modal-content details.guide-section > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--accent-cyan);
    font-weight: bold;
    font-size: 1.02rem;
    letter-spacing: 0.03em;
    background: rgba(0, 229, 255, 0.07);
    transition: background 0.18s ease, color 0.18s ease;
    user-select: none;
}
.help-modal-content details.guide-section > summary::-webkit-details-marker {
    display: none;
}
.help-modal-content details.guide-section > summary::before {
    content: '▸';
    display: inline-block;
    transition: transform var(--speed-med) ease;
    color: rgba(0, 229, 255, 0.65);
    font-size: 0.9em;
}
.help-modal-content details.guide-section[open] > summary::before {
    transform: rotate(90deg);
}
.help-modal-content details.guide-section > summary:hover {
    background: rgba(0, 229, 255, 0.14);
    color: var(--accent-cyan-bright);
}
.help-modal-content details.guide-section > summary .guide-icon {
    font-size: 1.2em;
    line-height: 1;
}
.help-modal-content details.guide-section > .guide-body {
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(0, 229, 255, 0.10);
}
/* Highlight key values as subtle cyan chips */
.help-modal-content strong {
    color: var(--accent-cyan-bright);
    background: rgba(0, 229, 255, 0.10);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
}
.help-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.5);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--speed-fast);
    padding: 0;
}
.help-modal-close:hover {
    background: rgba(255,255,255,0.08) !important;
    box-shadow: none !important;
    color: var(--text-primary);
    transform: none;
}

/* === Transcend Button Animation === */
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(33, 150, 243, 0); }
    100% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}
@keyframes pulse-purple {
    0% { box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(156, 39, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(156, 39, 176, 0); }
}
#transcend-btn.ready {
    animation: pulse-purple 2s infinite;
    opacity: 1;
}
#transcend-btn:not(.ready) {
    opacity: 0.5;
    cursor: default;
}
.transcend-confirm:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* === Transcend Modal === */
.transcend-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.transcend-modal.show {
    display: flex;
}
.transcend-modal-content {
    background: rgba(14, 8, 24, 0.88);
    backdrop-filter: blur(var(--glass-20));
    -webkit-backdrop-filter: blur(var(--glass-20));
    border: 1px solid rgba(156, 39, 176, 0.4);
    border-radius: 14px;
    padding: 30px;
    max-width: 500px;
    box-shadow: 0 0 40px rgba(156, 39, 176, 0.2), 0 16px 64px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255,255,255,0.04) inset;
    position: relative;
}
.transcend-modal-content h2 {
    margin-top: 0;
    color: var(--accent-purple);
    border-bottom: 2px solid var(--accent-purple);
    padding-bottom: 10px;
}
.transcend-modal-content p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 15px;
}
.transcend-modal-content .dark-matter-reward {
    font-size: 1em;
    color: var(--accent-purple);
    font-weight: bold;
    margin: 20px 0;
}
.transcend-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82em;
    font-weight: normal;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.transcend-progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 5px;
    overflow: hidden;
}
.transcend-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.transcend-progress-fill.dm-fill {
    background: linear-gradient(90deg, #7B1FA2, var(--accent-purple-light));
    box-shadow: 0 0 6px rgba(156, 39, 176, 0.6);
}
.transcend-progress-fill.coolant-fill {
    background: linear-gradient(90deg, #00838F, #4FC3F7);
    box-shadow: 0 0 6px rgba(0, 188, 212, 0.6);
}
.transcend-award-row {
    margin-top: 14px;
    text-align: center;
    font-size: 1.1em;
}
.transcend-award-detail {
    font-size: 0.78em;
    font-weight: normal;
    color: var(--accent-purple-light);
    margin-top: 2px;
}
.transcend-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}
.transcend-confirm {
    background: rgba(156, 39, 176, 0.18);
    color: var(--accent-purple-light);
    border: 1px solid rgba(156, 39, 176, 0.6);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    font-family: var(--font-mono);
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 8px rgba(206, 147, 216, 0.6);
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
    letter-spacing: 0.04em;
}
.transcend-confirm:hover {
    background: rgba(156, 39, 176, 0.32);
    border-color: rgba(206, 147, 216, 0.8);
    box-shadow: 0 0 22px rgba(156, 39, 176, 0.4);
}
.transcend-confirm:active { transform: translateY(1px); }
.transcend-cancel {
    background: rgba(80, 80, 80, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(150, 150, 150, 0.3);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    font-family: var(--font-mono);
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
    letter-spacing: 0.04em;
}
.transcend-cancel:hover {
    background: rgba(100, 100, 100, 0.3);
    border-color: rgba(180, 180, 180, 0.5);
    color: var(--text-secondary);
}
.transcend-cancel:active { transform: translateY(1px); }

/* === Reset Confirmation Modal === */
.reset-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.reset-modal.show {
    display: flex;
}
.reset-modal-content {
    background: rgba(24, 8, 8, 0.92);
    backdrop-filter: blur(var(--glass-20));
    -webkit-backdrop-filter: blur(var(--glass-20));
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 14px;
    padding: 30px;
    max-width: 460px;
    box-shadow: 0 0 40px rgba(244, 67, 54, 0.2), 0 16px 64px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255,255,255,0.04) inset;
}
.reset-modal-content h2 {
    margin-top: 0;
    color: var(--accent-red);
    border-bottom: 2px solid var(--accent-red);
    padding-bottom: 10px;
}
.reset-modal-content p {
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 15px;
}
.reset-modal-content .reset-warning {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    color: var(--accent-red-light);
    font-size: 0.9rem;
    margin-bottom: 20px;
}
.reset-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}
.reset-confirm {
    background: rgba(244, 67, 54, 0.16);
    color: var(--accent-red-light);
    border: 1px solid rgba(244, 67, 54, 0.6);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    font-family: var(--font-mono);
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    text-shadow: 0 0 8px rgba(255, 138, 128, 0.6);
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
    letter-spacing: 0.04em;
}
.reset-confirm:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(255, 138, 128, 0.8);
    box-shadow: 0 0 22px rgba(244, 67, 54, 0.4);
}
.reset-confirm:active { transform: translateY(1px); }
.reset-cancel {
    background: rgba(80, 80, 80, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(150, 150, 150, 0.3);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    font-family: var(--font-mono);
    backdrop-filter: blur(var(--glass-6));
    -webkit-backdrop-filter: blur(var(--glass-6));
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
    letter-spacing: 0.04em;
}
.reset-cancel:hover {
    background: rgba(100, 100, 100, 0.3);
    border-color: rgba(180, 180, 180, 0.5);
    color: var(--text-secondary);
}
.reset-cancel:active { transform: translateY(1px); }

/* === Save Manager Menu (top-left) === */
#save-menu {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    font-family: var(--font-mono);
}
.save-menu-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-lg);
    background: rgba(0, 188, 212, 0.18);
    color: var(--accent-cyan-light);
    border: 1px solid rgba(0, 188, 212, 0.5);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(var(--glass-8));
    -webkit-backdrop-filter: blur(var(--glass-8));
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
.save-menu-toggle:hover {
    background: rgba(0, 188, 212, 0.3);
    box-shadow: 0 0 20px rgba(0, 188, 212, 0.45);
}
.save-menu-toggle:active { transform: translateY(1px); }
.save-menu-dropdown {
    display: none;
    margin-top: 8px;
    background: rgba(14, 18, 30, 0.94);
    backdrop-filter: blur(var(--glass-16));
    -webkit-backdrop-filter: blur(var(--glass-16));
    border: 1px solid rgba(0, 188, 212, 0.35);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 0 18px rgba(0, 188, 212, 0.18);
    min-width: 180px;
}
.save-menu-dropdown.show { display: block; }
.save-menu-item {
    display: block;
    width: 100%;
    background: transparent;
    color: #b3e5fc;
    border: none;
    text-align: left;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    transition: background var(--speed-fast) ease, color var(--speed-fast) ease;
}
.save-menu-item:hover {
    background: rgba(0, 188, 212, 0.18);
    color: var(--accent-cyan-pale);
}

/* === Settings Menu (top-right) === */
#settings-menu {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1100;
    font-family: var(--font-mono);
}
.settings-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(var(--glass-8));
    -webkit-backdrop-filter: blur(var(--glass-8));
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.13);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.14);
}
.settings-toggle:active { transform: translateY(1px); }
.settings-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;               /* anchor to the gear's right edge so it opens leftward, staying on-screen */
    margin-top: 8px;
    background: rgba(14, 18, 30, 0.94);
    backdrop-filter: blur(var(--glass-16));
    -webkit-backdrop-filter: blur(var(--glass-16));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    min-width: 190px;
}
.settings-dropdown.show { display: block; }
.settings-item {
    display: block;
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    text-align: left;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    transition: background var(--speed-fast) ease, color var(--speed-fast) ease;
}
.settings-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
/* danger variant: keeps destructive actions clearly marked without shouting */
.settings-item.danger { color: var(--accent-red-light); }
.settings-item.danger:hover {
    background: rgba(244, 67, 54, 0.15);
    color: var(--accent-red-light);
}

/* === Save Modal === */
.save-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.save-modal.show { display: flex; }
.save-modal-content {
    background: rgba(8, 16, 24, 0.94);
    backdrop-filter: blur(var(--glass-20));
    -webkit-backdrop-filter: blur(var(--glass-20));
    border: 1px solid rgba(0, 188, 212, 0.4);
    border-radius: 14px;
    padding: 26px 30px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 0 40px rgba(0, 188, 212, 0.15), 0 16px 64px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255,255,255,0.04) inset;
}
.save-modal-content h2 {
    margin-top: 0;
    color: var(--accent-cyan);
    border-bottom: 2px solid rgba(0, 188, 212, 0.6);
    padding-bottom: 10px;
}
.save-modal-content p {
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.95rem;
}
#save-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.45);
    color: #b3e5fc;
    border: 1px solid rgba(0, 188, 212, 0.35);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: vertical;
    outline: none;
    min-height: 140px;
    word-break: break-all;
}
#save-modal-textarea:focus {
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.25);
}
.save-modal-feedback {
    min-height: 1.2em;
    font-size: 0.9rem;
    margin: 10px 0 0 0;
}
.save-modal-feedback.success { color: var(--accent-green-bright); }
.save-modal-feedback.error { color: var(--accent-red-light); }
.save-modal-buttons {
    display: flex;
    gap: 14px;
    justify-content: flex-end;
    margin-top: 18px;
}
.save-modal-confirm {
    background: rgba(0, 188, 212, 0.2);
    color: var(--accent-cyan-light);
    border: 1px solid rgba(0, 188, 212, 0.65);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: var(--font-mono);
    box-shadow: 0 0 12px rgba(0, 188, 212, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
.save-modal-confirm:hover {
    background: rgba(0, 188, 212, 0.34);
    box-shadow: 0 0 22px rgba(0, 188, 212, 0.42);
}
.save-modal-confirm:active { transform: translateY(1px); }
.save-modal-cancel {
    background: rgba(80, 80, 80, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(150, 150, 150, 0.3);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: var(--font-mono);
    transition: background var(--speed-med) ease, color var(--speed-med) ease, transform 0.1s ease;
}
.save-modal-cancel:hover {
    background: rgba(100, 100, 100, 0.3);
    color: var(--text-secondary);
}
.save-modal-cancel:active { transform: translateY(1px); }

/* === Interactive Guide Panel (bottom-right slide-in) === */
#guide-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1300;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: rgba(10, 16, 28, 0.94);
    backdrop-filter: blur(var(--glass-20));
    -webkit-backdrop-filter: blur(var(--glass-20));
    border: 1px solid rgba(0, 188, 212, 0.45);
    border-radius: var(--radius-xl);
    padding: 20px 22px 16px;
    box-shadow: 0 0 30px rgba(0, 188, 212, 0.15), 0 12px 48px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255,255,255,0.04) inset;
    transform: translateY(120%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity var(--speed-slow) ease;
}
#guide-panel.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
#guide-panel-title {
    margin: 0 0 10px 0;
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--accent-cyan);
    letter-spacing: 0.02em;
}
#guide-panel-body {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 14px;
}
#guide-panel-body strong {
    color: var(--text-primary);
}
#guide-panel-dismiss {
    display: block;
    margin-left: auto;
    padding: 6px 16px;
    background: rgba(0, 188, 212, 0.14);
    color: var(--accent-cyan-light);
    border: 1px solid rgba(0, 188, 212, 0.5);
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.15), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: background var(--speed-med) ease, box-shadow var(--speed-med) ease, transform 0.1s ease;
}
#guide-panel-dismiss:hover {
    background: rgba(0, 188, 212, 0.28);
    box-shadow: 0 0 16px rgba(0, 188, 212, 0.35);
}
#guide-panel-dismiss:active { transform: translateY(1px); }
