        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: #000000;
            color: #8ab4cc;
            font-family: 'Courier New', monospace;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            padding: 20px;
            overflow-y: auto;
            overflow-x: hidden;
        }

        /* Subtle background effect - digital void */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(ellipse at center, #050812 0%, #000000 70%);
            opacity: 0.6;
            z-index: -1;
        }

        /* Subtle scan line effect */
        body::after {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: repeating-linear-gradient(
                0deg,
                rgba(10, 30, 50, 0.03) 0px,
                rgba(10, 30, 50, 0.03) 1px,
                transparent 1px,
                transparent 2px
            );
            pointer-events: none;
            z-index: 1000;
            opacity: 0.3;
        }

        .title {
            font-size: 18px;
            color: #7ab8d8;
            text-align: center;
            margin-bottom: 60px;
            text-shadow: 0 0 8px #4a8aaa, 0 0 16px #2a6a8a;
            letter-spacing: 4px;
            opacity: 1;
            font-weight: normal;
            position: relative;
            z-index: 10;
        }

        .factory-container {
            background: transparent;
            border: none;
            padding: 40px;
            margin-bottom: 40px;
            position: relative;
            z-index: 10;
            display: flex;
            justify-content: center;
        }

        .factory-display {
            font-size: 15px;
            line-height: 1.5;
            white-space: pre;
            letter-spacing: 0;
            text-align: left;
            font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
            font-kerning: none;
            font-variant-ligatures: none;
            display: inline-block;
        }

        /* ═══════════════════════════════════════════════════════════════
           GLOW SYSTEM - Layered text-shadow for luminous effect
           ═══════════════════════════════════════════════════════════════ */

        /* Glow intensity levels */
        .glow-dim {
            text-shadow: 0 0 4px currentColor;
            opacity: 0.4;
        }

        .glow-soft {
            text-shadow: 0 0 6px currentColor, 0 0 10px currentColor;
            opacity: 0.6;
        }

        .glow-medium {
            text-shadow: 0 0 8px currentColor, 0 0 14px currentColor, 0 0 20px currentColor;
            opacity: 0.8;
        }

        .glow-bright {
            text-shadow: 0 0 10px currentColor, 0 0 20px currentColor,
                         0 0 30px currentColor, 0 0 40px currentColor;
            opacity: 1;
        }

        .glow-intense {
            text-shadow: 0 0 12px currentColor, 0 0 24px currentColor,
                         0 0 36px currentColor, 0 0 48px currentColor,
                         0 0 60px currentColor;
            opacity: 1;
            animation: pulse-glow 2s ease-in-out infinite;
        }

        /* Pulse animation for active states */
        @keyframes pulse-glow {
            0%, 100% {
                opacity: 0.9;
                text-shadow: 0 0 12px currentColor, 0 0 24px currentColor,
                             0 0 36px currentColor, 0 0 48px currentColor;
            }
            50% {
                opacity: 1;
                text-shadow: 0 0 16px currentColor, 0 0 32px currentColor,
                             0 0 48px currentColor, 0 0 64px currentColor,
                             0 0 80px currentColor;
            }
        }

        /* Flicker animation for flowing elements */
        @keyframes flicker {
            0%, 100% { opacity: 0.8; }
            50% { opacity: 1; }
        }

        /* Subtle drift animation for the whole factory */
        @keyframes drift {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-3px); }
        }

        .factory-container {
            animation: drift 8s ease-in-out infinite;
        }

        /* Add slight random variance to different element types */
        .ore-item:nth-child(2n) {
            animation-delay: 0.3s;
        }

        .credit-item:nth-child(2n) {
            animation-delay: 0.5s;
        }

        .conveyor:nth-child(3n) {
            animation-delay: 0.7s;
        }

        .conveyor:nth-child(5n) {
            animation-delay: 1.2s;
        }

        /* ═══════════════════════════════════════════════════════════════
           MACHINE STATES - Abstract luminous representations
           ═══════════════════════════════════════════════════════════════ */

        .mine {
            color: #5abcca;
            text-shadow: 0 0 6px #5abcca, 0 0 12px #3a9caa;
            opacity: 0.8;
        }

        .mine.active {
            color: #4affff;
            text-shadow: 0 0 10px #4affff, 0 0 20px #4affff,
                         0 0 30px #2ac8d8, 0 0 40px #1aa8c8;
            opacity: 1;
        }

        .smelter {
            color: #cc8855;
            text-shadow: 0 0 6px #cc8855, 0 0 12px #aa6633;
            opacity: 0.8;
        }

        .smelter.active {
            color: #ffaa44;
            text-shadow: 0 0 10px #ffaa44, 0 0 20px #ff9a34,
                         0 0 30px #ff8a24, 0 0 40px #ff7a14;
            opacity: 1;
        }

        .vault {
            color: #baba66;
            text-shadow: 0 0 6px #baba66, 0 0 12px #9a9a44;
            opacity: 0.8;
        }

        .vault.active {
            color: #ffff44;
            text-shadow: 0 0 10px #ffff44, 0 0 20px #ffff44,
                         0 0 30px #eeee34, 0 0 40px #dddd24;
            opacity: 1;
        }

        /* ═══════════════════════════════════════════════════════════════
           CONVEYOR & ITEMS - Flowing energy aesthetic
           ═══════════════════════════════════════════════════════════════ */

        .conveyor {
            color: #5a8ab8;
            text-shadow: 0 0 4px #5a8ab8, 0 0 8px #3a6a98;
            opacity: 0.85;
            animation: flicker 3s ease-in-out infinite;
        }

        .ore-item {
            color: #44ddff;
            text-shadow: 0 0 8px #44ddff, 0 0 16px #34cdff,
                         0 0 24px #24bdff;
            font-weight: normal;
            animation: flicker 1.5s ease-in-out infinite;
        }

        .credit-item {
            color: #ffff44;
            text-shadow: 0 0 8px #ffff44, 0 0 16px #ffff44,
                         0 0 24px #eeee34;
            font-weight: normal;
            animation: flicker 1.5s ease-in-out infinite;
        }

        .conveyor,
        .ore-item,
        .credit-item,
        .mine,
        .smelter,
        .vault,
        .dot {
            display: inline-block;
            width: 1ch;
            text-align: center;
        }

        .label {
            color: #6a9ab8;
            text-shadow: 0 0 4px #4a7a98;
            opacity: 0.85;
            font-size: 0.8em;
            letter-spacing: 2px;
        }

        /* ═══════════════════════════════════════════════════════════════
           CONTROLS - Minimalist diegetic UI
           ═══════════════════════════════════════════════════════════════ */

        .controls {
            background: transparent;
            border: 1px solid #1a3a5a;
            border-radius: 0;
            padding: 30px;
            text-align: center;
            min-width: 500px;
            box-shadow: 0 0 20px rgba(30, 70, 110, 0.4);
            position: relative;
            z-index: 10;
        }

        .stats {
            display: flex;
            justify-content: center;
            gap: 60px;
            margin-bottom: 30px;
            font-size: 14px;
        }

        .stat {
            padding: 0;
            background: transparent;
            border: none;
        }

        .stat-label {
            color: #6a9abb;
            font-size: 10px;
            letter-spacing: 3px;
            text-shadow: 0 0 4px #4a7a9a;
            opacity: 1;
            margin-bottom: 8px;
        }

        .stat-value {
            color: #6adaee;
            font-size: 28px;
            font-weight: normal;
            text-shadow: 0 0 8px #6adaee, 0 0 16px #4abace;
            letter-spacing: 2px;
        }

        .buttons {
            display: flex;
            gap: 20px;
            justify-content: center;
            flex-wrap: wrap;
        }

        button {
            background: transparent;
            color: #6aaac8;
            border: 1px solid #2a5a7a;
            padding: 14px 28px;
            font-family: 'Courier New', monospace;
            font-size: 11px;
            cursor: pointer;
            border-radius: 0;
            transition: all 0.3s ease;
            letter-spacing: 2px;
            text-shadow: 0 0 4px #2a5a7a;
        }

        button:hover:not(:disabled) {
            background: transparent;
            border-color: #4a8ab8;
            color: #7abcd8;
            text-shadow: 0 0 8px #7abcd8, 0 0 16px #5a9ab8;
        }

        button:active:not(:disabled) {
            transform: scale(0.98);
        }

        button:focus-visible {
            outline: 2px solid #4affff;
            outline-offset: 3px;
        }

        button:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

        button.primary {
            background: transparent;
            border-color: #3a7aaa;
            color: #6acadd;
            text-shadow: 0 0 6px #6acadd;
        }

        button.primary:hover:not(:disabled) {
            border-color: #5a9acc;
            color: #8adaee;
            text-shadow: 0 0 10px #8adaee, 0 0 20px #6abace;
        }

        button.success {
            background: transparent;
            border-color: #2a6a5a;
            color: #4aaa9a;
            text-shadow: 0 0 6px #4aaa9a;
        }

        .footer {
            margin-top: 40px;
            color: #4a7a8a;
            font-size: 10px;
            letter-spacing: 2px;
            text-shadow: 0 0 4px #2a5a6a;
            opacity: 0.8;
            position: relative;
            z-index: 10;
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .reset-btn {
            background: transparent;
            border: none;
            color: #3a5a6a;
            font-family: 'Courier New', monospace;
            font-size: 10px;
            letter-spacing: 2px;
            cursor: pointer;
            padding: 0;
            text-shadow: 0 0 4px #2a4a5a;
            opacity: 0.6;
            transition: opacity 0.2s ease, color 0.2s ease;
        }

        .reset-btn:hover {
            opacity: 1;
            color: #cc4444;
            text-shadow: 0 0 6px #aa2222;
        }

        .status-message {
            margin-top: 20px;
            padding: 12px;
            border-radius: 0;
            font-size: 11px;
            height: 36px;
            overflow: hidden;
            background: transparent;
            border: none;
            letter-spacing: 1px;
        }

        .status-message.info {
            color: #7abccc;
            text-shadow: 0 0 6px #7abccc;
        }

        .status-message.success {
            color: #4aaa8a;
            text-shadow: 0 0 6px #4aaa8a, 0 0 12px #3a9a7a;
        }

        /* Automation status glow */
        .auto-online {
            color: #4aaa8a;
            text-shadow: 0 0 8px #4aaa8a, 0 0 16px #3a9a7a;
            animation: pulse-glow 3s ease-in-out infinite;
        }

        .auto-offline {
            color: #3a4a5a;
            text-shadow: 0 0 4px #2a3a4a;
            opacity: 0.5;
        }

        /* ═══════════════════════════════════════════════════════════════
           CONVEYOR SATURATION — belt-full flash
           ═══════════════════════════════════════════════════════════════ */

        .conveyor-saturated {
            color: #ff6622;
            text-shadow: 0 0 8px #ff6622, 0 0 16px #dd4400;
            opacity: 1;
            animation: flicker 0.15s ease-in-out infinite;
        }

        /* ═══════════════════════════════════════════════════════════════
           VAULT FLASH — dramatic gold burst on credit collect
           ═══════════════════════════════════════════════════════════════ */

        @keyframes vault-flash-anim {
            0%   { color: #ffffff; text-shadow: 0 0 24px #ffffff, 0 0 44px #ffff00, 0 0 70px #ffcc00; opacity: 1; }
            100% { color: #ffff44; text-shadow: 0 0 10px #ffff44, 0 0 20px #ffff44, 0 0 30px #eeee34; opacity: 1; }
        }

        .vault.flash {
            animation: vault-flash-anim 0.4s ease-out forwards;
        }

        /* ═══════════════════════════════════════════════════════════════
           AUTO BADGE — blinking green indicator next to extractor
           ═══════════════════════════════════════════════════════════════ */

        .auto-badge {
            color: #44ff88;
            text-shadow: 0 0 8px #44ff88, 0 0 16px #22dd66;
            font-size: 0.75em;
            letter-spacing: 1px;
            animation: auto-blink 1.2s ease-in-out infinite;
        }

        @keyframes auto-blink {
            0%, 100% { opacity: 1; }
            50%       { opacity: 0.2; }
        }

        /* ═══════════════════════════════════════════════════════════════
           IDLE HINT — pulsing prompt when player is inactive
           ═══════════════════════════════════════════════════════════════ */

        .idle-hint {
            color: #4a6878;
            text-shadow: 0 0 6px #2a4858;
            font-size: 10px;
            letter-spacing: 3px;
            margin-top: 12px;
            animation: idle-pulse 2.5s ease-in-out infinite;
        }

        @keyframes idle-pulse {
            0%, 100% { opacity: 0.25; }
            50%       { opacity: 0.7; }
        }

        /* ═══════════════════════════════════════════════════════════════
           CPS DISPLAY — credits-per-second counter
           ═══════════════════════════════════════════════════════════════ */

        .cps-display {
            color: #4a8a9a;
            font-size: 10px;
            letter-spacing: 3px;
            text-shadow: 0 0 4px #2a6a7a;
            margin-top: 6px;
            opacity: 0.65;
        }

        /* ═══════════════════════════════════════════════════════════════
           MILESTONE SYSTEM
           ═══════════════════════════════════════════════════════════════ */

        .milestone-message {
            margin-top: 10px;
            padding: 10px;
            min-height: 32px;
            background: transparent;
            border: none;
            font-size: 11px;
            letter-spacing: 1px;
            text-align: center;
            color: #cc88ff;
            text-shadow: 0 0 8px #cc88ff, 0 0 18px #aa44ee, 0 0 30px #8822cc;
            transition: opacity 0.5s ease;
            animation: pulse-glow 2s ease-in-out infinite;
        }

        .milestone-log {
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid #0e2030;
            text-align: center;
        }

        .milestone-log-label {
            font-size: 9px;
            letter-spacing: 3px;
            color: #3a4a5e;
            text-shadow: 0 0 4px #2a3a50;
            margin-bottom: 8px;
            opacity: 0.7;
        }

        .milestone-log-entry {
            font-size: 9px;
            letter-spacing: 1px;
            color: #3a4a62;
            text-shadow: 0 0 4px #2a3a55;
            opacity: 0.55;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .milestone-log-entry.latest {
            color: #6a5a88;
            text-shadow: 0 0 6px #4a3a66;
            opacity: 0.8;
        }

        .milestone-bonus-stats {
            margin-top: 10px;
            padding: 6px 10px;
            border-top: 1px solid #0e2030;
            font-size: 9px;
            letter-spacing: 1px;
            text-align: center;
            color: #88aacc;
            text-shadow: 0 0 6px #4a6a88;
            opacity: 0.75;
        }

        .milestone-bonus-stats-label {
            font-size: 8px;
            letter-spacing: 3px;
            color: #3a4a5e;
            text-shadow: 0 0 4px #2a3a50;
            margin-bottom: 5px;
            opacity: 0.7;
        }

        .milestone-bonus-row {
            color: #7ab8d8;
            text-shadow: 0 0 6px #3a6a88, 0 0 14px #2a5a78;
            margin-bottom: 3px;
        }

        /* ═══════════════════════════════════════════════════════════════
           GAME LAYOUT — factory + shop side-by-side
           ═══════════════════════════════════════════════════════════════ */

        .game-layout {
            display: flex;
            flex-direction: row;
            align-items: flex-start;
            gap: 30px;
            flex-wrap: wrap;
            justify-content: center;
            position: relative;
            z-index: 10;
        }

        .game-main {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        /* ═══════════════════════════════════════════════════════════════
           SHOP PANEL — upgrade terminal
           ═══════════════════════════════════════════════════════════════ */

        .shop-panel {
            background: transparent;
            border: 1px solid #1a3a5a;
            padding: 28px 30px;
            min-width: 380px;
            max-width: 420px;
            box-shadow: 0 0 20px rgba(30, 70, 110, 0.4);
            font-family: 'Courier New', monospace;
        }

        .shop-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 1px solid #1a3550;
            font-size: 10px;
            letter-spacing: 3px;
            color: #6a9ab8;
            text-shadow: 0 0 4px #4a7a98;
        }

        .shop-balance {
            color: #6a9ab8;
            letter-spacing: 2px;
            font-size: 10px;
        }

        .shop-credits {
            color: #ffff44;
            text-shadow: 0 0 8px #ffff44, 0 0 16px #eeee34;
            letter-spacing: 2px;
        }

        .upgrade-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            min-height: 44px;
            border-bottom: 1px solid #0e2030;
            cursor: pointer;
            transition: background 0.2s ease, opacity 0.2s ease;
            gap: 12px;
        }

        .upgrade-item:last-child {
            border-bottom: none;
        }

        /* Affordable — cyan glow, interactive */
        .upgrade-item.affordable {
            color: #44ddff;
        }

        .upgrade-item.affordable:hover {
            background: rgba(68, 221, 255, 0.04);
        }

        .upgrade-item.affordable .upgrade-name {
            color: #44ddff;
            text-shadow: 0 0 8px #44ddff, 0 0 16px #34bdff;
        }

        .upgrade-item.affordable .upgrade-cost {
            color: #ffff44;
            text-shadow: 0 0 8px #ffff44, 0 0 16px #eeee34;
        }

        /* Locked — dim, not yet affordable */
        .upgrade-item.locked {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .upgrade-item.locked .upgrade-name {
            color: #4a7a9a;
        }

        .upgrade-item.locked .upgrade-cost {
            color: #4a7a9a;
        }

        /* Close to affordable — amber glow, ≥60% of cost */
        .upgrade-item.close {
            cursor: not-allowed;
        }

        .upgrade-item.close .upgrade-name {
            color: #cc9933;
            text-shadow: 0 0 8px #cc9933, 0 0 16px #aa7722;
        }

        .upgrade-item.close .upgrade-cost {
            color: #cc9933;
            text-shadow: 0 0 6px #aa7722;
        }

        /* Purchased — green confirm, non-interactive */
        .upgrade-item.purchased {
            opacity: 0.45;
            cursor: default;
        }

        .upgrade-item.purchased .upgrade-name {
            color: #4aaa8a;
            text-shadow: 0 0 6px #3a9a7a;
        }

        .upgrade-item.purchased .upgrade-cost {
            color: #4aaa8a;
            text-shadow: 0 0 6px #3a9a7a;
            font-size: 9px;
            letter-spacing: 2px;
        }

        .upgrade-info {
            flex: 1;
            min-width: 0;
        }

        .upgrade-name {
            font-size: 11px;
            letter-spacing: 2px;
            margin-bottom: 4px;
            color: #6a9ab8;
        }

        .upgrade-desc {
            font-size: 9px;
            letter-spacing: 1px;
            color: #5a8a9a;
            opacity: 1;
        }

        .upgrade-cost {
            font-size: 12px;
            letter-spacing: 2px;
            white-space: nowrap;
            color: #6a9ab8;
        }

        /* Special glow for the final upgrade */
        .upgrade-item.affordable[data-id="infinite_loop"] .upgrade-name {
            color: #ff6aff;
            text-shadow: 0 0 10px #ff6aff, 0 0 20px #ee44ee, 0 0 30px #cc22cc;
            animation: pulse-glow 1.5s ease-in-out infinite;
        }

        .upgrade-item.affordable[data-id="infinite_loop"] .upgrade-cost {
            color: #ff6aff;
            text-shadow: 0 0 8px #ff6aff, 0 0 16px #ee44ee;
        }

        /* ═══════════════════════════════════════════════════════════════
           LOOP CONFIRMATION OVERLAY
           ═══════════════════════════════════════════════════════════════ */

        #loopConfirmOverlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.82);
            z-index: 9990;
            align-items: center;
            justify-content: center;
        }

        #loopConfirmOverlay.active {
            display: flex;
        }

        .loop-confirm-box {
            border: 1px solid #440055;
            padding: 36px 44px;
            text-align: center;
            max-width: 420px;
            width: 90%;
            background: #000000;
            box-shadow: 0 0 40px rgba(200, 0, 255, 0.12), 0 0 80px rgba(200, 0, 255, 0.05);
            font-family: 'Courier New', monospace;
        }

        .loop-confirm-title {
            font-size: 13px;
            letter-spacing: 3px;
            color: #ff6aff;
            text-shadow: 0 0 10px #ff6aff, 0 0 20px #ee44ee, 0 0 30px #cc22cc;
            margin-bottom: 20px;
            animation: pulse-glow 1.5s ease-in-out infinite;
        }

        .loop-confirm-desc {
            font-size: 10px;
            letter-spacing: 2px;
            color: #aa6abb;
            text-shadow: 0 0 6px #884a99;
            margin-bottom: 28px;
            line-height: 2;
        }

        .loop-confirm-buttons {
            display: flex;
            justify-content: center;
            gap: 16px;
            flex-wrap: wrap;
        }

        .loop-confirm-btn {
            background: transparent;
            border: 1px solid #440055;
            color: #cc44ff;
            padding: 10px 22px;
            font-family: 'Courier New', monospace;
            font-size: 10px;
            letter-spacing: 2px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-shadow: 0 0 6px #cc44ff;
        }

        .loop-confirm-btn:hover {
            border-color: #aa22dd;
            color: #ff88ff;
            text-shadow: 0 0 10px #ff88ff, 0 0 20px #ee66ee;
            box-shadow: 0 0 20px rgba(200, 0, 255, 0.1);
        }

        .loop-confirm-btn.cancel {
            border-color: #1a3040;
            color: #4a7a9a;
            text-shadow: none;
        }

        .loop-confirm-btn.cancel:hover {
            border-color: #2a5070;
            color: #6a9ab8;
            box-shadow: none;
            text-shadow: none;
        }

        /* ═══════════════════════════════════════════════════════════════
           WIN / PRESTIGE OVERLAY
           ═══════════════════════════════════════════════════════════════ */

        .win-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.92);
            z-index: 9999;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.6s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to   { opacity: 1; }
        }

        .win-box {
            border: 1px solid #330044;
            padding: 50px 60px;
            text-align: center;
            max-width: 500px;
            box-shadow: 0 0 40px rgba(200, 0, 255, 0.15), 0 0 80px rgba(200, 0, 255, 0.05);
            font-family: 'Courier New', monospace;
        }

        .win-title {
            font-size: 16px;
            letter-spacing: 4px;
            color: #ff6aff;
            text-shadow: 0 0 12px #ff6aff, 0 0 24px #ee44ee, 0 0 40px #cc22cc;
            margin-bottom: 14px;
            animation: pulse-glow 2s ease-in-out infinite;
        }

        .win-subtitle {
            font-size: 10px;
            letter-spacing: 3px;
            color: #aa6abb;
            text-shadow: 0 0 6px #884a99;
            margin-bottom: 36px;
            opacity: 0.9;
        }

        .win-stat {
            font-size: 13px;
            letter-spacing: 3px;
            color: #ffff44;
            text-shadow: 0 0 10px #ffff44, 0 0 20px #eeee34;
            margin-bottom: 12px;
        }

        .win-stat span {
            font-size: 20px;
            color: #ffff44;
        }

        .win-desc {
            font-size: 9px;
            letter-spacing: 2px;
            color: #7a7a9a;
            margin-bottom: 40px;
            opacity: 0.9;
        }

        .win-btn {
            background: transparent;
            border: 1px solid #440055;
            color: #cc44ff;
            padding: 14px 32px;
            font-family: 'Courier New', monospace;
            font-size: 11px;
            letter-spacing: 3px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-shadow: 0 0 6px #cc44ff;
        }

        .win-btn:hover {
            border-color: #aa22dd;
            color: #ff88ff;
            text-shadow: 0 0 10px #ff88ff, 0 0 20px #ee66ee;
            box-shadow: 0 0 20px rgba(200, 0, 255, 0.1);
        }

        /* ═══════════════════════════════════════════════════════════════
           LOOP TOKEN DISPLAY
           ═══════════════════════════════════════════════════════════════ */

        .loop-display {
            font-size: 11px;
            letter-spacing: 3px;
            color: #7a2a99;
            text-shadow: 0 0 6px #550077, 0 0 14px #330055;
            opacity: 0.8;
            margin-top: 10px;
        }

        /* ═══════════════════════════════════════════════════════════════
           SYSTEM RESET / PRESTIGE OVERLAY
           ═══════════════════════════════════════════════════════════════ */

        .prestige-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #000000;
            z-index: 10000;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            font-family: 'Courier New', monospace;
        }

        .prestige-overlay.active {
            display: flex;
        }

        @keyframes prestige-fadeout {
            0%   { opacity: 1; }
            100% { opacity: 0; }
        }

        @keyframes glitch-flicker {
            0%   { opacity: 1;    text-shadow: 0 0 10px #cc44ff, 0 0 20px #aa22ee, 0 0 35px #8800cc; }
            18%  { opacity: 0.82; text-shadow: 3px 0 14px #ff00ff, -3px 0 8px #00ffff, 0 0 30px #cc44ff; }
            36%  { opacity: 0.95; text-shadow: 0 0 10px #cc44ff, 0 0 20px #aa22ee; }
            54%  { opacity: 0.78; text-shadow: -3px 0 14px #ff00ff, 3px 0 8px #ff44ff, 0 0 40px #9900cc; }
            72%  { opacity: 1;    text-shadow: 0 0 12px #dd55ff, 0 0 24px #bb33ee; }
            90%  { opacity: 0.88; text-shadow: 2px 0 10px #ff00ff, -2px 0 6px #00ffff; }
            100% { opacity: 1;    text-shadow: 0 0 10px #cc44ff, 0 0 20px #aa22ee, 0 0 35px #8800cc; }
        }

        .prestige-ascii {
            color: #cc44ff;
            white-space: pre;
            font-size: 13px;
            line-height: 1.5;
            text-align: center;
            letter-spacing: 1px;
            animation: glitch-flicker 0.09s steps(1) infinite;
        }

        .prestige-countdown {
            margin-top: 44px;
            font-size: 52px;
            color: #ff44ff;
            text-shadow: 0 0 20px #ff44ff, 0 0 40px #ee22ee, 0 0 70px #cc00cc;
            letter-spacing: 10px;
            animation: pulse-glow 0.4s ease-in-out infinite;
            font-family: 'Courier New', monospace;
        }

        .prestige-subtext {
            margin-top: 22px;
            font-size: 10px;
            letter-spacing: 4px;
            color: #7a3399;
            text-shadow: 0 0 6px #551177;
            opacity: 0.85;
        }

        .prestige-loop-grant {
            margin-top: 12px;
            font-size: 11px;
            letter-spacing: 3px;
            color: #aa44cc;
            text-shadow: 0 0 8px #882299, 0 0 16px #660088;
            opacity: 0.9;
        }

        /* ═══════════════════════════════════════════════════════════════
           TUTORIAL OVERLAY
           ═══════════════════════════════════════════════════════════════ */

        .tutorial-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.93);
            z-index: 10002;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.5s ease;
        }

        .tutorial-overlay.active {
            display: flex;
        }

        @keyframes tutorial-fadeout {
            from { opacity: 1; }
            to   { opacity: 0; }
        }

        .tutorial-box {
            border: 1px solid #1a3a4a;
            padding: 50px 60px;
            text-align: center;
            max-width: 540px;
            width: 90%;
            box-shadow: 0 0 40px rgba(74, 138, 170, 0.12), 0 0 80px rgba(74, 138, 170, 0.05);
            font-family: 'Courier New', monospace;
        }

        .tutorial-step-label {
            font-size: 9px;
            letter-spacing: 4px;
            color: #2a5a7a;
            margin-bottom: 32px;
            opacity: 0.75;
        }

        .tutorial-text {
            font-size: 12px;
            letter-spacing: 2px;
            color: #7ab8d8;
            text-shadow: 0 0 8px #4a8aaa, 0 0 16px #2a5a7a;
            line-height: 2.1;
            margin-bottom: 40px;
            white-space: pre-line;
        }

        .tutorial-btn {
            background: transparent;
            border: 1px solid #1a4a5a;
            color: #5a9ab8;
            padding: 12px 30px;
            font-family: 'Courier New', monospace;
            font-size: 11px;
            letter-spacing: 3px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-shadow: 0 0 6px #4a8aaa;
        }

        .tutorial-btn:hover {
            border-color: #4a8aaa;
            color: #9ad4f0;
            text-shadow: 0 0 10px #7ab8d8, 0 0 20px #5a98b8;
            box-shadow: 0 0 18px rgba(74, 138, 170, 0.12);
        }

        .tutorial-dots {
            margin-top: 30px;
            letter-spacing: 8px;
            font-size: 10px;
            color: #1e3e50;
        }

        .tutorial-dots .dot-active {
            color: #7ab8d8;
            text-shadow: 0 0 8px #4a8aaa;
        }

        .sfx-btn {
            background: transparent;
            border: none;
            color: #3a5a6a;
            font-family: 'Courier New', monospace;
            font-size: 10px;
            letter-spacing: 2px;
            cursor: pointer;
            padding: 4px 0;
            text-shadow: 0 0 4px #2a4a5a;
            opacity: 0.6;
            transition: opacity 0.2s ease, color 0.2s ease;
            display: block;
            margin: 6px auto 0;
        }

        .sfx-btn:hover {
            opacity: 1;
            color: #6acadd;
            text-shadow: 0 0 6px #4aaccc;
        }

        .volume-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-top: 4px;
        }

        .volume-label {
            color: #3a5a6a;
            font-family: 'Courier New', monospace;
            font-size: 9px;
            letter-spacing: 2px;
            opacity: 0.6;
            user-select: none;
        }

        /* Terminal-style range input */
        .volume-slider {
            -webkit-appearance: none;
            appearance: none;
            width: 80px;
            height: 2px;
            background: linear-gradient(to right, #2acce0 var(--vol-pct, 50%), #1a3a4a var(--vol-pct, 50%));
            outline: none;
            border: none;
            cursor: pointer;
            opacity: 0.6;
            transition: opacity 0.2s ease;
        }

        .volume-slider:hover {
            opacity: 1;
        }

        .volume-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 8px;
            height: 8px;
            background: #2acce0;
            border: none;
            cursor: pointer;
            box-shadow: 0 0 4px #2acce0;
            border-radius: 0;
        }

        .volume-slider::-moz-range-thumb {
            width: 8px;
            height: 8px;
            background: #2acce0;
            border: none;
            cursor: pointer;
            box-shadow: 0 0 4px #2acce0;
            border-radius: 0;
        }

        .volume-slider::-moz-range-track {
            background: #1a3a4a;
            height: 2px;
        }

        .volume-slider::-moz-range-progress {
            background: #2acce0;
            height: 2px;
        }

        /* ═══════════════════════════════════════════════════════════════
           STATS PANEL — collapsible factory statistics
           ═══════════════════════════════════════════════════════════════ */

        .stats-toggle-btn {
            background: transparent;
            border: 1px solid #1a3550;
            color: #4a7a9a;
            font-family: 'Courier New', monospace;
            font-size: 9px;
            letter-spacing: 2px;
            cursor: pointer;
            padding: 3px 8px;
            text-shadow: 0 0 4px #2a5a7a;
            transition: all 0.2s ease;
        }

        .stats-toggle-btn:hover {
            border-color: #3a6a8a;
            color: #6acadd;
            text-shadow: 0 0 6px #4aaccc;
        }

        .stats-panel-wrap {
            overflow: hidden;
            max-height: 0;
            opacity: 0;
            transition: max-height 0.35s ease, opacity 0.3s ease;
        }

        .stats-panel-wrap.expanded {
            max-height: 520px;
            opacity: 1;
        }

        .stats-panel {
            padding-top: 16px;
            border-top: 1px solid #1a3550;
            margin-top: 20px;
        }

        .stats-panel-header {
            font-size: 10px;
            letter-spacing: 4px;
            color: #6a9ab8;
            text-shadow: 0 0 4px #4a7a98;
            text-align: center;
            margin-bottom: 14px;
        }

        .stats-panel-row {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            padding: 6px 0;
            border-bottom: 1px solid #0e2030;
            font-size: 10px;
            gap: 12px;
        }

        .stats-panel-row:last-child {
            border-bottom: none;
        }

        .stats-panel-label {
            color: #4a7a9a;
            letter-spacing: 1px;
            text-shadow: 0 0 4px #2a5a7a;
            white-space: nowrap;
        }

        .stats-panel-value {
            color: #7ab8d8;
            letter-spacing: 2px;
            text-shadow: 0 0 6px #4a8aaa;
            text-align: right;
            white-space: nowrap;
        }

        /* ═══════════════════════════════════════════════════════════════
           MOBILE — viewport < 600px
           ═══════════════════════════════════════════════════════════════ */

        @media (max-width: 599px) {
            .factory-container {
                font-size: clamp(10px, 2.5vw, 14px);
                padding: 20px 10px;
            }

            .factory-display {
                font-size: clamp(10px, 2.5vw, 14px);
            }

            body {
                padding-bottom: 90px; /* room for fixed button bar */
                justify-content: flex-start;
                padding-top: 20px;
            }

            .controls {
                min-width: unset;
                width: 100%;
            }

            .buttons {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 100;
                background: #000000;
                border-top: 1px solid #1a3a5a;
                padding: 12px 16px;
                gap: 12px;
                flex-wrap: nowrap;
                box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
            }

            #mineBtn,
            #automationBtn {
                min-height: 48px;
                flex: 1;
            }

            .game-layout {
                flex-direction: column;
                align-items: center;
            }

            .shop-panel {
                min-width: unset;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           LANDSCAPE MOBILE — short viewport, side-by-side layout
           ═══════════════════════════════════════════════════════════════ */

        @media (orientation: landscape) and (max-height: 500px) {
            body {
                padding-bottom: 72px;
                justify-content: flex-start;
                padding-top: 10px;
            }

            .title {
                font-size: 12px;
                margin-bottom: 6px;
                letter-spacing: 2px;
            }

            .loop-display {
                font-size: 9px;
            }

            .factory-container {
                font-size: clamp(9px, 1.8vw, 12px);
                padding: 10px 6px;
                margin-bottom: 0;
            }

            .factory-display {
                font-size: clamp(9px, 1.8vw, 12px);
            }

            .game-layout {
                flex-direction: row;
                align-items: flex-start;
                flex-wrap: nowrap;
                gap: 16px;
                width: 100%;
            }

            .game-main {
                flex: 0 0 auto;
            }

            .controls {
                min-width: unset;
                width: 100%;
                padding: 10px 14px;
            }

            .stats {
                gap: 24px;
                margin-bottom: 10px;
                font-size: 11px;
            }

            .stat-value {
                font-size: clamp(16px, 3vw, 22px);
            }

            .shop-panel {
                flex: 1 1 auto;
                min-width: unset;
                max-width: 50%;
                padding: 12px 14px;
            }

            /* Hide milestone log to save vertical space */
            .milestone-log,
            .milestone-bonus-stats {
                display: none !important;
            }

            .milestone-message {
                font-size: 9px;
                margin-top: 4px;
            }

            /* Keep EXTRACT button fixed & prominent */
            .buttons {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 100;
                background: #000000;
                border-top: 1px solid #1a3a5a;
                padding: 10px 14px;
                gap: 10px;
                flex-wrap: nowrap;
                box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
            }

            #mineBtn,
            #automationBtn {
                min-height: 44px;
                flex: 1;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           REDUCED MOTION — disable drift & flicker, keep glow effects
           ═══════════════════════════════════════════════════════════════ */

        @media (prefers-reduced-motion: reduce) {
            .factory-container {
                animation: none;
            }

            .conveyor,
            .ore-item,
            .credit-item {
                animation: none;
            }

            .auto-badge {
                animation: none;
                opacity: 1;
            }

            .conveyor-saturated {
                animation: none;
            }

            .glow-intense {
                animation: none;
            }

            .auto-online {
                animation: none;
            }

            .milestone-message {
                animation: none;
            }

            .idle-hint {
                opacity: 0.5;
                animation: none;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           SHOP COLUMN — vertical stack for shop + void market
           ═══════════════════════════════════════════════════════════════ */

        .shop-column {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-items: stretch;
        }

        /* ═══════════════════════════════════════════════════════════════
           VOID MARKET — secondary magenta-accented upgrade terminal
           ═══════════════════════════════════════════════════════════════ */

        .void-market-panel {
            background: transparent;
            border: 1px solid #3a1a4a;
            padding: 28px 30px;
            min-width: 380px;
            max-width: 420px;
            box-shadow: 0 0 20px rgba(150, 30, 180, 0.2);
            font-family: 'Courier New', monospace;
        }

        .void-market-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 1px solid #2a1040;
            font-size: 10px;
            letter-spacing: 3px;
            color: #cc44cc;
            text-shadow: 0 0 8px #aa22aa, 0 0 16px #880088;
        }

        .void-market-balance {
            color: #cc44cc;
            letter-spacing: 2px;
            font-size: 10px;
        }

        .void-tokens {
            color: #ff88ff;
            text-shadow: 0 0 8px #cc44cc, 0 0 16px #aa22aa;
            letter-spacing: 2px;
        }

        .void-upgrade-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            min-height: 44px;
            border-bottom: 1px solid #1a0828;
            cursor: pointer;
            transition: background 0.2s ease, opacity 0.2s ease;
            gap: 12px;
        }

        .void-upgrade-item:last-child {
            border-bottom: none;
        }

        .void-upgrade-item.affordable {
            color: #cc44cc;
        }

        .void-upgrade-item.affordable:hover {
            background: rgba(204, 68, 204, 0.04);
        }

        .void-upgrade-item.affordable .upgrade-name {
            color: #ff88ff;
            text-shadow: 0 0 8px #cc44cc, 0 0 16px #aa22aa;
        }

        .void-upgrade-item.affordable .upgrade-cost {
            color: #ff88ff;
            text-shadow: 0 0 8px #cc44cc;
        }

        .void-upgrade-item.locked {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .void-upgrade-item.locked .upgrade-name {
            color: #6a3a7a;
        }

        .void-upgrade-item.locked .upgrade-cost {
            color: #6a3a7a;
        }

        .void-upgrade-item.close {
            cursor: not-allowed;
        }

        .void-upgrade-item.close .upgrade-name {
            color: #9944aa;
            text-shadow: 0 0 8px #7722aa, 0 0 16px #551188;
        }

        .void-upgrade-item.close .upgrade-cost {
            color: #9944aa;
            text-shadow: 0 0 6px #7722aa;
        }

        .void-upgrade-item.purchased {
            opacity: 0.45;
            cursor: default;
        }

        .void-upgrade-item.purchased .upgrade-name {
            color: #aa44aa;
            text-shadow: 0 0 6px #882288;
        }

        .void-upgrade-item.purchased .upgrade-cost {
            color: #aa44aa;
            text-shadow: 0 0 6px #882288;
            font-size: 9px;
            letter-spacing: 2px;
        }

        /* Refinery machine in factory display */
        .refinery {
            color: #cc44cc;
            text-shadow: 0 0 6px #cc44cc, 0 0 12px #aa22aa;
            opacity: 0.8;
        }

        .refinery.active {
            color: #ff88ff;
            text-shadow: 0 0 10px #ff88ff, 0 0 20px #cc44cc,
                         0 0 30px #aa22aa, 0 0 40px #880088;
            opacity: 1;
            animation: pulse-glow 0.6s ease-in-out infinite;
        }

        @media (max-width: 599px) {
            .void-market-panel {
                min-width: unset;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
        }

        /* ═══════════════════════════════════════════════════════════════
           SCREEN READER ONLY — visually hidden but accessible
           ═══════════════════════════════════════════════════════════════ */

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
