@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-primary: #0a0e27; --bg-secondary: #141b3d;
    --glass-bg: rgba(255, 255, 255, 0.05); --glass-border: rgba(255, 255, 255, 0.1);
    --accent-primary: #00d4ff; --accent-secondary: #7b2cbf; --accent-tertiary: #ff006e;
    --text-primary: #ffffff; --text-secondary: #b8c5d6;
    --success: #00ff88; --warning: #ffb800; --danger: #ff4757;
}
body { font-family: 'Space Grotesk', sans-serif; background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary)); background-attachment: fixed; color: var(--text-primary); min-height: 100vh; }
body::before { content: ''; position: fixed; width: 200%; height: 200%; top: -50%; left: -50%; z-index: 0; background: radial-gradient(circle at 20% 50%, rgba(123, 44, 191, 0.15), transparent 50%), radial-gradient(circle at 80% 80%, rgba(0, 212, 255, 0.15), transparent 50%); animation: bgMove 20s ease-in-out infinite; }
@keyframes bgMove { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-50px, 50px); } }
header { position: relative; z-index: 100; backdrop-filter: blur(20px); background: rgba(20, 27, 61, 0.7); border-bottom: 1px solid var(--glass-border); padding: 1.5rem 2rem; }
.header-content { max-width: 1600px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 2px; text-transform: uppercase; }
.money-display { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; color: var(--success); text-shadow: 0 0 20px rgba(0, 255, 136, 0.5); display: flex; align-items: center; gap: 0.5rem; }
.money-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--success), var(--accent-primary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.income-display { font-size: 1.2rem; color: var(--text-secondary); }
.income-value { color: var(--accent-primary); font-weight: 600; }

.combo-display { 
    font-size: 1rem; color: var(--warning); font-weight: 700; 
    margin-top: 0.25rem; display: none; 
    animation: bounce 0.5s ease infinite; 
}
.combo-display.active { display: block; }

.btn-control { padding: 0.75rem 1.5rem; border: none; border-radius: 12px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; font-family: inherit; position: relative; }
.controls { display: flex; gap: 1rem; flex-wrap: wrap; }
.notification-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 0.7rem; display: flex; align-items: center; justify-content: center; font-weight: 700; animation: bounce 0.5s ease infinite; }
@keyframes bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.game-wrapper { position: relative; z-index: 1; padding: 2rem; }
.top-bar { max-width: 1600px; margin: 0 auto 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.view-toggle, .buy-mode-selector { backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 0.5rem; display: flex; gap: 0.5rem; }
.toggle-btn { padding: 0.5rem 1rem; border: none; background: transparent; color: var(--text-secondary); border-radius: 8px; cursor: pointer; transition: all 0.3s ease; font-family: inherit; font-weight: 500; }
.toggle-btn.active { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.event-banner { max-width: 1600px; margin: 0 auto 1rem; backdrop-filter: blur(20px); background: linear-gradient(135deg, rgba(255, 184, 0, 0.2), rgba(255, 0, 110, 0.2)); border: 2px solid var(--warning); border-radius: 12px; padding: 1rem 1.5rem; display: none; align-items: center; gap: 1rem; animation: pulse 2s ease-in-out infinite; }
.event-banner.active { display: flex; }
.event-icon { font-size: 2rem; }
.event-text { flex: 1; }
.event-title { font-size: 1.2rem; font-weight: 700; color: var(--warning); margin-bottom: 0.25rem; }
.event-desc { color: var(--text-secondary); font-size: 0.9rem; }
.event-timer { font-size: 1.5rem; font-weight: 700; color: var(--warning); background: rgba(0,0,0,0.2); padding: 0.25rem 0.75rem; border-radius: 8px; }

.grid { max-width: 1600px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; padding-bottom: 2rem; }
.business-card { position: relative; backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 20px; padding: 1.5rem; transition: all 0.4s ease; }
.business-card.affordable { border-color: var(--success); box-shadow: 0 0 30px rgba(0, 255, 136, 0.3); animation: glow 2s ease-in-out infinite; }

.new-badge { 
    position: absolute; top: 15px; right: 15px; 
    background: var(--danger); color: white; 
    padding: 0.3rem 0.6rem; border-radius: 8px; 
    font-size: 0.75rem; font-weight: 700; 
    animation: badgeBounce 0.5s ease infinite; 
    z-index: 10; 
}
@keyframes badgeBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.business-card.new-unlock { animation: newUnlock 1s ease-out; }
@keyframes newUnlock { 
    0% { transform: scale(0.8); opacity: 0; } 
    50% { transform: scale(1.1); } 
    100% { transform: scale(1); opacity: 1; } 
}

@keyframes glow { 0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.3); } 50% { box-shadow: 0 0 40px rgba(0, 255, 136, 0.6); } }
.business-card.hidden { display: none; }
.business-card:hover { transform: translateY(-8px); border-color: var(--accent-primary); }
.card-header { display: flex; justify-content: space-between; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.business-name { font-size: 1.25rem; font-weight: 600; }
.business-count { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; padding: 0.4rem 0.9rem; border-radius: 20px; font-size: 0.9rem; font-weight: 700; }
.business-level { font-size: 0.85rem; color: var(--warning); font-weight: 600; margin-top: 0.25rem; }
.card-stats { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.95rem; }
.stat-label { color: var(--text-secondary); }
.stat-income { color: var(--accent-primary); font-weight: 700; }
.stat-total { color: var(--success); font-weight: 700; }

.multiplier-badge { 
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.2), rgba(255, 0, 110, 0.2)); 
    border: 1px solid var(--warning); color: var(--warning); 
    padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.85rem; font-weight: 700; 
    margin-top: 0.5rem; display: inline-block; cursor: help; position: relative; 
}
.multiplier-badge:hover .multiplier-tooltip { display: block; }
.multiplier-tooltip { 
    display: none; position: absolute; 
    bottom: 100%; left: 50%; 
    transform: translateX(-50%); 
    background: var(--bg-secondary); 
    border: 1px solid var(--glass-border); 
    border-radius: 8px; padding: 0.75rem; 
    font-size: 0.8rem; white-space: nowrap; 
    z-index: 1000; margin-bottom: 0.5rem; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); 
    text-align: left;
}

.milestone-badge { background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 212, 255, 0.2)); border: 1px solid var(--success); color: var(--success); padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.75rem; font-weight: 700; margin-top: 0.25rem; display: inline-block; }
.affordability-bar { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; }
.affordability-progress { height: 100%; background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary)); transition: width 0.3s ease; }
.buy-controls { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }

/* OPTIMIZED BUTTON STYLES (Fix 1: CSS) */
.buy-button, .buy-max-button { 
    padding: 1rem; 
    border: none; 
    border-radius: 12px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.1s ease; 
    font-family: inherit;
    user-select: none;  /* PREVENTS TEXT SELECTION */
    touch-action: manipulation; /* IMPROVES MOBILE TAP */
    -webkit-tap-highlight-color: transparent;
}
.buy-button:active, .buy-max-button:active {
    transform: scale(0.96);
}

.buy-button { flex: 1; font-size: 1rem; background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.buy-button:disabled { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); cursor: not-allowed; opacity: 0.6; }
.buy-button:not(:disabled):hover { transform: scale(1.02); }
.buy-max-button { font-size: 0.9rem; background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 212, 255, 0.2)); border: 1px solid var(--success); color: var(--success); }
.buy-max-button:disabled { opacity: 0.4; cursor: not-allowed; }

.toast { position: fixed; bottom: 2rem; right: 2rem; backdrop-filter: blur(20px); background: rgba(0, 255, 136, 0.15); border: 1px solid var(--success); color: var(--success); padding: 1rem 1.5rem; border-radius: 12px; font-weight: 600; transform: translateX(400px); transition: transform 0.4s ease; z-index: 1000; }
.toast.show { transform: translateX(0); }
.floating-text { position: fixed; font-size: 1.5rem; font-weight: 700; color: var(--success); pointer-events: none; z-index: 9999; animation: floatUp 2s ease-out forwards; text-shadow: 0 0 10px rgba(0, 255, 136, 0.8); }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-100px); opacity: 0; } }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(10px); z-index: 2000; align-items: center; justify-content: center; padding: 1rem; }
.modal.active { display: flex; }
.modal-content { backdrop-filter: blur(20px); background: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: 20px; padding: 2rem; max-width: 900px; max-height: 90vh; overflow-y: auto; width: 100%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--glass-border); }
.modal-title { font-size: 2rem; font-weight: 700; background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.modal-close { background: none; border: none; font-size: 2rem; color: var(--text-secondary); cursor: pointer; width: 40px; height: 40px; border-radius: 50%; }
.modal-close:hover { background: rgba(255, 255, 255, 0.1); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1.5rem; text-align: center; }
.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--accent-primary); margin-bottom: 0.5rem; }
.stat-card-label { color: var(--text-secondary); font-size: 0.9rem; }
.upgrade-item { backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; }
.upgrade-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.upgrade-name { font-size: 1.1rem; font-weight: 600; }
.upgrade-level { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; padding: 0.3rem 0.8rem; border-radius: 15px; font-size: 0.85rem; font-weight: 700; }
.upgrade-description { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.upgrade-button { width: 100%; padding: 0.75rem; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; font-family: inherit; background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.upgrade-button:disabled { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); cursor: not-allowed; }
.bulk-btn { width: 100%; padding: 1rem; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: 700; cursor: pointer; font-family: inherit; background: linear-gradient(135deg, var(--success), var(--accent-primary)); color: white; margin-bottom: 1.5rem; }
.bulk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tier-indicator { position: absolute; top: 10px; left: 10px; width: 6px; height: 6px; border-radius: 50%; }
.tier-1 { background: #4ade80; box-shadow: 0 0 10px #4ade80; }
.tier-2 { background: #60a5fa; box-shadow: 0 0 10px #60a5fa; }
.tier-3 { background: #a78bfa; box-shadow: 0 0 10px #a78bfa; }
.tier-4 { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }
.tier-5 { background: #ec4899; box-shadow: 0 0 10px #ec4899; }
.tier-6 { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.achievement-item { backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; display: flex; gap: 1rem; align-items: center; transition: all 0.3s ease; }
.achievement-item.unlocked { border-color: var(--success); background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 212, 255, 0.1)); }
.achievement-icon { font-size: 3rem; opacity: 0.3; }
.achievement-item.unlocked .achievement-icon { opacity: 1; }
.achievement-info { flex: 1; }
.achievement-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.achievement-desc { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }
.achievement-progress { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; overflow: hidden; }
.achievement-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--success)); transition: width 0.3s ease; }
.achievement-reward { background: var(--success); color: white; padding: 0.3rem 0.8rem; border-radius: 15px; font-size: 0.85rem; font-weight: 700; }
.save-controls { display: flex; gap: 1rem; margin-top: 1.5rem; }
.save-controls button { flex: 1; padding: 1rem; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.export-btn { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: white; }
.import-btn { background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 212, 255, 0.2)); border: 1px solid var(--success); color: var(--success); }
textarea { width: 100%; min-height: 150px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 1rem; color: var(--text-primary); font-family: 'Courier New', monospace; font-size: 0.85rem; margin: 1rem 0; resize: vertical; }
.prestige-info-box { backdrop-filter: blur(20px); background: linear-gradient(135deg, rgba(255, 184, 0, 0.1), rgba(255, 0, 110, 0.1)); border: 1px solid var(--warning); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; }
@keyframes prestigePulse { 0%, 100% { box-shadow: 0 0 0 rgba(255, 184, 0, 0.4); } 50% { box-shadow: 0 0 20px rgba(255, 184, 0, 0.8); } }
.sound-toggle-btn { backdrop-filter: blur(20px); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 0.5rem 1rem; cursor: pointer; font-size: 1.5rem; }
@media (max-width: 768px) {
    .grid { grid-template-columns: 1fr; }
    .header-content { flex-direction: column; }
    .controls { width: 100%; }
    .btn-control { flex: 1; font-size: 0.85rem; padding: 0.6rem 1rem; }
    .event-banner { flex-direction: column; text-align: center; }
}

/* Add this to style.css to fix the Prestige Text alignment */
#prestige-display {
    display: none; /* Controlled by JS, but defaults to hidden */
    align-items: center; /* Vertically centers the text and numbers */
    gap: 0.4rem; /* Adds proper spacing between elements */
    
    font-size: 1rem;
    font-weight: 700;
    color: var(--warning); /* Makes it Gold */
    margin-top: 0.5rem;
    
    /* This ensures the number sits on the same baseline as the text */
    vertical-align: middle; 
}

/* Ensures the number specifically matches the line height */
#prestige-level, #prestige-bonus {
    font-variant-numeric: lining-nums; /* Forces numbers to align with text */
    vertical-align: baseline;
}

/* VISUAL POLISH A: Sticky Header */
header { 
    position: sticky; 
    top: 0; 
    z-index: 1000; /* Ensure it stays above everything */
    /* Keep existing styles below */
    backdrop-filter: blur(20px); 
    background: rgba(20, 27, 61, 0.85); /* Slightly more opaque */
    border-bottom: 1px solid var(--glass-border); 
    padding: 1rem 2rem; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* TIER 2: Mystery Drop */
.mystery-drop {
    position: fixed;
    font-size: 3rem;
    cursor: pointer;
    z-index: 9999;
    animation: dropFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px gold);
    transition: transform 0.2s;
}
.mystery-drop:hover { transform: scale(1.2); }
@keyframes dropFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Ensure body doesn't clip sticky header */
body { overflow-x: hidden; }