:root {
    --bg-color: #0B0F14;
    --text-color: #E0E0E0;
    --neon-cyan: #00FFFF;
    --neon-purple: #BC13FE;
    --neon-orange: #FF8C00;
    --card-bg: #1A1F26;
    --border-color: #333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none; /* Prevent text selection for app-like feel */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* Globally prevent double-tap zoom */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Prevent scrolling on body, handle in sections */
    display: flex;
    flex-direction: column;
    touch-action: none; /* Disable default touch actions like pan/zoom on body */
    overscroll-behavior: none; /* Prevent pull-to-refresh */
}

/* Utilities */
.hidden { display: none !important; }

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

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(-45deg, #0b0f14, #1a1f26, #000000, #13001e);
    background-size: 400% 400%;
    animation: bgPulse 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.splash-content { text-align: center; }
.splash-content h1 {
    font-size: 3rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
    margin-bottom: 0.5rem;
    animation: glow 2s ease-in-out infinite alternate;
}
@keyframes glow {
    from { text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan); }
    to { text-shadow: 0 0 20px var(--neon-cyan), 0 0 30px var(--neon-cyan), 0 0 40px var(--neon-cyan); }
}

.splash-content p { color: var(--neon-purple); letter-spacing: 2px; }

/* Auth Screen */
#auth-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.auth-box {
    background: var(--card-bg);
    padding: 2rem;
    border: 1px solid var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 255, 255, 0.05);
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.auth-box input {
    padding: 1rem;
    background: #000;
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 5px;
    transition: border-color 0.3s;
}
.auth-box input:focus {
    border-color: var(--neon-purple);
    outline: none;
    box-shadow: 0 0 10px rgba(188, 19, 254, 0.3);
}

/* Buttons */
.neon-btn {
    padding: 1rem;
    background: transparent;
    border: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.neon-btn:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}
.neon-btn:active:after {
    width: 200px;
    height: 200px;
}
.neon-btn:active {
    background: var(--neon-cyan);
    color: #000;
    transform: scale(0.98);
}
.neon-btn.secondary {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

/* Game Header */
.game-header {
    height: 80px;
    background: rgba(11, 15, 20, 0.95);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}
.currency-display {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan);
    letter-spacing: 1px;
}
.cps-display {
    font-size: 0.9rem;
    color: #888;
}

/* Main Game Area */
#game-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Permanent Stage (Top 35%) */
#permanent-stage {
    flex: 0 0 35%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #1a1f26 0%, #0b0f14 100%);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    overflow: hidden;
}

/* Scrollable Tab Container (Bottom 65% - Header - Nav) */
#tab-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: #0b0f14;
}

.tab-content {
    padding: 1rem;
    display: none;
    /* Removed background from here as it's now on container/stage */
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Core Button Container */
.clicker-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.core-button {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: #000;
    border: 2px solid #333;
    position: relative;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(188, 19, 254, 0.3), 0 0 60px rgba(188, 19, 254, 0.1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
    z-index: 10;
    touch-action: manipulation; /* Prevent double-tap zoom on clicker */
}
.core-inner {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--neon-purple), #2a0038);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 30px #000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.core-inner::after {
    content: 'HACK';
    color: rgba(255,255,255,0.8);
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
}
.core-button:active {
    transform: scale(0.95);
}
/* Pulse Animation for Core Button */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(188, 19, 254, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(188, 19, 254, 0); }
    100% { box-shadow: 0 0 0 0 rgba(188, 19, 254, 0); }
}
.core-button {
    animation: pulse 2s infinite;
}

/* Floating Text */
.floating-text {
    position: absolute;
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    text-shadow: 0 0 5px var(--neon-cyan);
    z-index: 20;
}
@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.2); }
}

/* Particles */
.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--neon-cyan);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFade 0.6s ease-out forwards;
}
@keyframes particleFade {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0); }
}

/* Operations List */
.operation-card {
    background: rgba(26, 31, 38, 0.8);
    margin-bottom: 12px;
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--neon-orange);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(5px);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.operation-card:hover {
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.2);
}
.op-info h3 { color: var(--neon-orange); font-size: 1.1rem; margin-bottom: 4px; }
.op-info p { font-size: 0.85rem; color: #aaa; }
.buy-btn {
    background: linear-gradient(to bottom, #333, #222);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    min-width: 100px;
    text-align: center;
    transition: all 0.2s;
}
.buy-btn span {
    font-size: 1.1rem;
    font-weight: bold;
}
.buy-btn.can-afford {
    background: linear-gradient(to bottom, #003300, #002200);
    border-color: #0f0;
    color: #0f0;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}
.buy-btn.can-afford:active {
    transform: scale(0.95);
}

/* Bottom Nav */
.bottom-nav {
    height: calc(70px + env(safe-area-inset-bottom)); /* Adjust for iPhone Home Bar */
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(17, 17, 17, 0.95);
    display: flex;
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative; /* Ensure z-index works */
    z-index: 100;
}
.nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #666;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    touch-action: manipulation; /* Prevent double-tap zoom */
}
.nav-btn.active {
    color: var(--neon-cyan);
    background: linear-gradient(to bottom, rgba(0,255,255,0.05), transparent);
    text-shadow: 0 0 5px rgba(0,255,255,0.5);
}
