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

:root {
    --bg-dark: #07070d;
    --bg-panel: rgba(10, 10, 20, 0.88);
    --primary: #00d4ff;
    --secondary: #00ff88;
    --accent: #ff00aa;
    --gold: #ffd700;
    --danger: #ff4444;
    --warning: #ff8800;
    --text: #e0e8f0;
    --text-dim: #6a7a8a;
    --border: rgba(0, 212, 255, 0.2);
    --glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

body {
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

#scene-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

/* HEADER */
#header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(7,7,13,0.95) 0%, rgba(7,7,13,0.7) 80%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text);
}

.title-accent {
    color: var(--primary);
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 300;
}

.points-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 16px;
    backdrop-filter: blur(10px);
}

.points-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 0 6px rgba(0, 212, 255, 0.6));
}

.points-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
    text-align: right;
    transition: transform 0.15s ease;
}

.points-value.pulse {
    transform: scale(1.2);
    text-shadow: 0 0 20px var(--primary);
}

.points-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    font-weight: 600;
}

/* PANEL TOGGLES */
.panel-toggle {
    position: fixed;
    z-index: 110;
    top: 75px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 1px;
    padding: 8px 14px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border-radius: 0;
}

.panel-toggle:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.left-toggle { left: 0; border-radius: 0 8px 8px 0; }
.right-toggle { right: 0; border-radius: 8px 0 0 8px; }

/* SIDE PANELS */
.side-panel {
    position: fixed;
    top: 65px;
    bottom: 130px;
    width: 320px;
    z-index: 105;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.left-panel {
    left: 0;
    border-radius: 0 12px 12px 0;
    transform: translateX(-100%);
}

.left-panel.open { transform: translateX(0); }

.right-panel {
    right: 0;
    border-radius: 12px 0 0 12px;
    transform: translateX(100%);
}

.right-panel.open { transform: translateX(0); }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--primary);
}

.close-panel {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.panel-scroll::-webkit-scrollbar { width: 4px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 2px; }

/* SKILL TREE */
.branch {
    margin-bottom: 16px;
}

.branch-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 8px;
}

.skill-node {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 0;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    background: rgba(255,255,255,0.02);
}

.skill-node::before {
    content: '';
    position: absolute;
    left: 24px;
    top: -5px;
    width: 2px;
    height: 5px;
    background: rgba(255,255,255,0.08);
}

.skill-node:first-of-type::before { display: none; }

.skill-node.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.skill-node.available {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.15), inset 0 0 12px rgba(0, 212, 255, 0.05);
    animation: nodePulse 2s ease-in-out infinite;
}

.skill-node.available:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: translateX(4px);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.skill-node.purchased {
    border-color: var(--secondary);
    background: rgba(0, 255, 136, 0.08);
}

.skill-node.purchased .node-icon {
    background: var(--secondary);
    color: #000;
}

@keyframes nodePulse {
    0%, 100% { box-shadow: 0 0 12px rgba(0, 212, 255, 0.15); }
    50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.35); }
}

.node-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    transition: all 0.3s;
}

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

.node-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.2;
}

.node-cost {
    font-size: 0.7rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

.node-cost.affordable { color: var(--secondary); }

.node-check {
    color: var(--secondary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.node-flavor {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 2px;
    line-height: 1.3;
}

.skill-node.unlock-anim {
    animation: unlockBurst 0.5s ease-out;
}

@keyframes unlockBurst {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); box-shadow: 0 0 40px var(--secondary); }
    100% { transform: scale(1); }
}

/* STATS */
.pc-rating {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    text-align: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 1px;
    flex-shrink: 0;
}

.stat-item {
    margin-bottom: 12px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.stat-name {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.5s;
}

.stat-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background 0.5s;
    box-shadow: 0 0 8px currentColor;
}

.reset-section {
    padding: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.reset-btn {
    width: 100%;
    padding: 8px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: var(--danger);
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: var(--danger);
}

/* CLICKER */
#clicker-area {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.clicker-stats {
    display: flex;
    gap: 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-panel);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.clicker-stats strong {
    color: var(--primary);
}

.click-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: radial-gradient(circle at 40% 40%, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.05));
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), inset 0 0 30px rgba(0, 212, 255, 0.1);
    animation: buttonGlow 3s ease-in-out infinite;
}

@keyframes buttonGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), inset 0 0 30px rgba(0, 212, 255, 0.1); }
    50% { box-shadow: 0 0 50px rgba(0, 212, 255, 0.4), inset 0 0 40px rgba(0, 212, 255, 0.15); }
}

.click-button:hover {
    transform: scale(1.08);
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
}

.click-button:active {
    transform: scale(0.92);
    transition-duration: 0.05s;
}

.click-btn-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    pointer-events: none;
}

.click-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.8));
}

.click-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.55rem;
    letter-spacing: 2px;
    color: var(--primary);
    margin-top: 2px;
}

/* FLOATING NUMBERS */
#floating-numbers {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 150;
}

.float-num {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.6); }
}

/* TOASTS */
#toast-container {
    position: fixed;
    top: 75px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--secondary);
    border-radius: 10px;
    padding: 12px 16px;
    backdrop-filter: blur(16px);
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.15);
}

.toast.dismissing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: var(--secondary);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.toast-flavor {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-style: italic;
    line-height: 1.3;
}

.toast-stats {
    font-size: 0.68rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

/* ACHIEVEMENT OVERLAY */
.achievement-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: achFadeIn 0.3s ease;
}

.achievement-overlay.hidden { display: none; }

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

.achievement-content {
    text-align: center;
    animation: achBounce 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes achBounce {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.ach-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

.ach-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    color: var(--gold);
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.ach-desc {
    font-size: 1rem;
    color: var(--text-dim);
    max-width: 400px;
    font-style: italic;
}

/* FOOTER */
.app-footer {
    position: fixed;
    bottom: 4px;
    right: 12px;
    z-index: 50;
}

.app-footer a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.6rem;
    letter-spacing: 1px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.app-footer a:hover { opacity: 0.8; }

/* MOBILE */
@media (max-width: 768px) {
    .side-panel { width: 280px; bottom: 140px; }
    .title { font-size: 1rem; }
    .points-value { font-size: 1.1rem; }
    .click-button { width: 85px; height: 85px; }
    #header { padding: 8px 12px; }
    .points-display { padding: 6px 10px; }
    .points-label { display: none; }
}

@media (max-width: 480px) {
    .subtitle { display: none; }
    .side-panel { width: 260px; }
}

/* Confetti */
.confetti-piece {
    position: fixed;
    width: 8px;
    height: 8px;
    z-index: 250;
    pointer-events: none;
    animation: confettiFall 2s ease-in forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}