:root {
    --bg-color: #050510;
    --panel-bg: rgba(20, 20, 30, 0.8);
    --primary-cyan: #00f3ff;
    --primary-pink: #ff00aa;
    --primary-yellow: #fcee0a;
    --text-main: #e0e6ed;
    --text-dim: #94a3b8;
    
    /* Ball Colors (Neon Versions) */
    --ball-yellow: #fcee0a;
    --ball-blue: #00f3ff;
    --ball-red: #ff00aa;
    --ball-gray: #b0b0b0;
    --ball-green: #0aff0a;
    
    --neon-glow: 0 0 10px rgba(0, 243, 255, 0.5), 0 0 20px rgba(0, 243, 255, 0.3);
    --pink-glow: 0 0 10px rgba(255, 0, 170, 0.5), 0 0 20px rgba(255, 0, 170, 0.3);
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

/* Header */
.main-header {
    background-color: rgba(5, 5, 16, 0.9);
    border-bottom: 1px solid var(--primary-cyan);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

.logo {
    color: var(--primary-cyan);
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: var(--neon-glow);
}

.main-header nav a {
    color: var(--text-dim);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.main-header nav a:hover, .main-header nav a.active {
    color: var(--primary-pink);
    text-shadow: var(--pink-glow);
    border-bottom: 2px solid var(--primary-pink);
}

.container {
    text-align: center;
    width: 100%;
    max-width: 600px;
    padding: 20px;
    padding-top: 120px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

.title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: white;
    text-shadow: 2px 2px 0px var(--primary-pink), -2px -2px 0px var(--primary-cyan);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.subtitle {
    color: var(--primary-cyan);
    margin-bottom: 30px;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* Machine Visuals - Cyberpunk */
.machine-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 30px;
}

.glass-dome {
    width: 250px;
    height: 250px;
    background: rgba(0, 243, 255, 0.05);
    border: 2px solid var(--primary-cyan);
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.2), 0 0 20px rgba(0, 243, 255, 0.3);
    z-index: 2;
}

.glass-dome::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    width: 60px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: rotate(-45deg);
}

.machine-base {
    width: 220px;
    height: 60px;
    background: #111;
    border: 2px solid var(--primary-pink);
    border-radius: 10px 10px 30px 30px;
    margin: -30px auto 0;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 15px rgba(255, 0, 170, 0.4);
}

.output-chute {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: black;
    border-radius: 50%;
    border: 2px solid var(--primary-yellow);
    z-index: 0;
    box-shadow: inset 0 0 10px var(--primary-yellow);
}

/* Balls */
.ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: black; /* Dark core */
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    border: 2px solid white;
    box-shadow: 0 0 10px currentColor;
}

.ball.yellow { border-color: var(--ball-yellow); color: var(--ball-yellow); box-shadow: 0 0 10px var(--ball-yellow); }
.ball.blue { border-color: var(--ball-blue); color: var(--ball-blue); box-shadow: 0 0 10px var(--ball-blue); }
.ball.red { border-color: var(--ball-red); color: var(--ball-red); box-shadow: 0 0 10px var(--ball-red); }
.ball.gray { border-color: var(--ball-gray); color: var(--ball-gray); box-shadow: 0 0 10px var(--ball-gray); }
.ball.green { border-color: var(--ball-green); color: var(--ball-green); box-shadow: 0 0 10px var(--ball-green); }

/* Animation Elements inside Dome */
.mixing-ball {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    border: 1px solid currentColor;
    background: rgba(0,0,0,0.5);
}

/* Results Tray */
.results-tray {
    display: flex;
    justify-content: center;
    gap: 15px;
    min-height: 60px;
    margin-bottom: 40px;
    perspective: 1000px;
    height: 60px; 
}

/* Button - Cyberpunk Style */
.gold-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: black;
    border: 3px solid var(--primary-yellow);
    cursor: pointer;
    box-shadow: 0 0 20px var(--primary-yellow), inset 0 0 20px var(--primary-yellow);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.gold-button:hover {
    box-shadow: 0 0 40px var(--primary-yellow), inset 0 0 30px var(--primary-yellow);
    transform: scale(1.05);
}

.gold-button:active {
    transform: scale(0.95);
}

.gold-button:disabled {
    filter: grayscale(1);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.currency-symbol {
    font-size: 50px;
    color: var(--primary-yellow);
    text-shadow: 0 0 10px var(--primary-yellow);
    font-family: 'Courier New', Courier, monospace;
}

/* Content Sections */
.info-section {
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid var(--primary-cyan);
    color: var(--text-main);
    padding: 40px 20px;
    margin-top: 50px;
    line-height: 1.8;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.info-section h2 {
    color: var(--primary-pink);
    border-bottom: 1px solid var(--primary-pink);
    padding-bottom: 10px;
    text-transform: uppercase;
    text-shadow: 0 0 5px var(--primary-pink);
}

/* Footer */
.main-footer {
    background-color: #020205;
    border-top: 1px solid #222;
    color: #666;
    padding: 40px 20px;
    text-align: center;
    font-size: 0.8rem;
    margin-top: auto;
}

.footer-links a {
    color: var(--text-dim);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-cyan);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
}
th, td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #333;
}
th {
    background-color: rgba(255, 0, 170, 0.2);
    color: var(--primary-pink);
    text-transform: uppercase;
}
tr:hover {
    background-color: rgba(0, 243, 255, 0.05);
}

/* Shake Animation */
.shake {
    animation: shake 0.5s infinite;
}
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Flying Ball Animation */
.active-ball {
    position: absolute;
    z-index: 100;
    transition: all 0.5s ease-in-out;
}
.blink-anim {
    animation: blinkEffect 0.2s infinite alternate;
}
@keyframes blinkEffect {
    from { filter: brightness(1); box-shadow: 0 0 20px currentColor; }
    to { filter: brightness(2); box-shadow: 0 0 50px currentColor; }
}
.ball-placeholder {
    width: 40px; height: 40px; visibility: hidden;
}

.ball-small {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    border-radius: 50%;
    text-align: center;
    color: white; /* Default for logic, overridden by css classes */
    font-weight: bold;
    font-size: 12px;
    margin: 0 2px;
    background: black;
    border: 1px solid white;
}
.ball-small.yellow { border-color: var(--ball-yellow); color: var(--ball-yellow); }
.ball-small.blue { border-color: var(--ball-blue); color: var(--ball-blue); }
.ball-small.red { border-color: var(--ball-red); color: var(--ball-red); }
.ball-small.gray { border-color: var(--ball-gray); color: var(--ball-gray); }
.ball-small.green { border-color: var(--ball-green); color: var(--ball-green); }

/* Light Mode Overrides */
[data-theme='light'] {
    --bg-color: #f0f2f5;
    --panel-bg: white;
    --primary-cyan: #007bff; /* Blue */
    --primary-pink: #dc3545; /* Red */
    --text-main: #333;
    --text-dim: #666;
    --neon-glow: none;
    --pink-glow: none;
}

[data-theme='light'] body {
    background-image: none;
}

[data-theme='light'] .main-header {
    background-color: white;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

[data-theme='light'] .glass-dome {
    background: rgba(255, 255, 255, 0.5);
    border: 5px solid #ddd;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

[data-theme='light'] .machine-base {
    background: #eee;
    border: 1px solid #ccc;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

[data-theme='light'] .info-section {
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Nav Font Size Increase */
.main-header nav a {
    font-size: 1.1rem !important; /* Force override */
    font-weight: bold;
}

/* Button Pulse Animation */
@keyframes pulseGold {
    0% { transform: scale(1); box-shadow: 0 0 20px var(--primary-yellow); }
    50% { transform: scale(1.05); box-shadow: 0 0 40px var(--primary-yellow), 0 0 20px white; }
    100% { transform: scale(1); box-shadow: 0 0 20px var(--primary-yellow); }
}

.pulse-active {
    animation: pulseGold 2s infinite;
}

/* Toggles Container */
.settings-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.toggle-btn {
    background: none;
    border: 1px solid var(--text-dim);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.toggle-btn:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}


/* --- Fixes for User Feedback --- */

/* 1. Golden Button Tweaks */
.gold-button {
    background: radial-gradient(circle, #b8860b 0%, #8b6508 100%); /* Dark Gold */
    border: 3px solid #ffd700;
}

.currency-symbol {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* 2 & 3. Light Mode Visibility Fixes */
.formula-box {
    background: #222;
    padding: 15px;
    border-radius: 5px;
    font-family: monospace;
    text-align: center;
    margin: 20px 0;
    color: #eee;
}

[data-theme='light'] .formula-box {
    background: #e9ecef;
    color: #333;
    border: 1px solid #ccc;
}

.stats-panel {
    margin-top: 20px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    padding: 20px;
}

[data-theme='light'] .stats-panel {
    background: white;
    color: #333;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

[data-theme='light'] table {
    color: #333;
}
[data-theme='light'] th {
    background-color: #e9ecef;
    color: #333;
    border-bottom: 2px solid #ccc;
}
[data-theme='light'] td {
    border-bottom: 1px solid #eee;
}

/* Chart text visibility in light mode */
/* Note: Chart.js canvas colors are set in JS. We might need JS logic update. */

