/* =============================================
   RevolutionLife — Bio-Neon Theme
   Bioluminescence-inspired dark game UI
   ============================================= */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* =============================================
   CSS Custom Properties
   ============================================= */
:root {
    /* Core Colors */
    --bg-deep:        #030712;
    --bg-surface:     #0a1628;
    --bg-card:        rgba(10, 22, 40, 0.7);
    --bg-glass:       rgba(255, 255, 255, 0.03);

    /* Bio-Neon Palette */
    --neon-green:     #10b981;
    --neon-cyan:      #06b6d4;
    --neon-blue:      #3b82f6;
    --neon-purple:    #a855f7;
    --neon-red:       #ef4444;
    --neon-amber:     #f59e0b;
    --neon-gold:      #fbbf24;
    --neon-pink:      #ec4899;

    /* Path Colors */
    --color-autotroph:   #22c55e;
    --color-heterotroph: #ef4444;
    --color-decomposer:  #a855f7;

    /* Text */
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;

    /* Glow Intensities */
    --glow-sm: 0 0 8px;
    --glow-md: 0 0 15px;
    --glow-lg: 0 0 30px;
    --glow-xl: 0 0 50px;

    /* Fonts */
    --font-thai:    'Prompt', sans-serif;
    --font-number:  'Orbitron', sans-serif;
    --font-body:    'Inter', sans-serif;

    /* Spacing */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* =============================================
   Base Reset & Body
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    overflow: hidden;
    height: 100%;
}

body {
    font-family: var(--font-thai);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* =============================================
   Animated Background — Deep Sea Particles
   ============================================= */
#bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: floatParticle var(--duration) var(--delay) infinite ease-in-out;
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0.3);
    }
    20% {
        opacity: var(--opacity, 0.4);
    }
    80% {
        opacity: var(--opacity, 0.4);
    }
    100% {
        opacity: 0;
        transform: translateY(-20vh) scale(1);
    }
}

/* =============================================
   Loading Screen
   ============================================= */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dna-helix {
    width: 60px;
    height: 120px;
    position: relative;
    margin-bottom: 2rem;
}

.dna-strand {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: dnaRotate 2s infinite ease-in-out;
}

.dna-strand:nth-child(odd) {
    background: var(--neon-green);
    box-shadow: var(--glow-md) var(--neon-green);
}

.dna-strand:nth-child(even) {
    background: var(--neon-cyan);
    box-shadow: var(--glow-md) var(--neon-cyan);
    animation-direction: reverse;
}

@keyframes dnaRotate {
    0%, 100% { transform: translateX(-15px) scale(0.6); opacity: 0.5; }
    50% { transform: translateX(15px) scale(1); opacity: 1; }
}

.loading-text {
    font-family: var(--font-number);
    font-size: 0.75rem;
    color: var(--neon-green);
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: pulse 1.5s infinite ease-in-out;
}

.loading-title {
    font-family: var(--font-number);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: var(--glow-md) var(--neon-green);
}

/* =============================================
   Offline Progress Popup
   ============================================= */
#offline-popup {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.4s ease;
}

#offline-popup.show {
    display: flex;
}

.offline-card {
    background: var(--bg-surface);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: var(--glow-lg) rgba(16, 185, 129, 0.2);
    animation: scaleIn 0.4s ease;
}

/* =============================================
   Daily Bonus Popup
   ============================================= */
#daily-popup {
    position: fixed;
    inset: 0;
    z-index: 8500;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

#daily-popup.show {
    display: flex;
}

.daily-card {
    background: linear-gradient(135deg, var(--bg-surface), rgba(251, 191, 36, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: var(--glow-lg) rgba(251, 191, 36, 0.2);
    animation: scaleIn 0.4s ease;
}

/* =============================================
   Top Bar
   ============================================= */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(180deg, var(--bg-deep) 0%, rgba(3, 7, 18, 0.9) 80%, transparent 100%);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(10px);
}

.avatar-wrapper {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.avatar-img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--neon-green);
    box-shadow: var(--glow-sm) var(--neon-green);
}

.avatar-level {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: var(--neon-green);
    color: var(--bg-deep);
    font-family: var(--font-number);
    font-size: 0.6rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-deep);
}

.stats-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lp-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lp-icon {
    font-size: 1rem;
}

.lp-amount {
    font-family: var(--font-number);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon-gold);
    text-shadow: var(--glow-sm) var(--neon-gold);
    line-height: 1;
}

.lp-rate {
    font-family: var(--font-number);
    font-size: 0.6rem;
    color: var(--neon-green);
    opacity: 0.8;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
}

.mini-stat-bar {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.mini-stat-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.fill-hp { background: var(--neon-red); box-shadow: var(--glow-sm) var(--neon-red); }
.fill-energy { background: var(--neon-amber); box-shadow: var(--glow-sm) var(--neon-amber); }
.fill-attack { background: var(--neon-red); }
.fill-defense { background: var(--neon-blue); }
.fill-speed { background: var(--neon-cyan); }

.stage-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 0.5rem;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--neon-green);
    white-space: nowrap;
}

/* =============================================
   Main Content Area
   ============================================= */
#game-container {
    position: fixed;
    top: 75px;
    left: 0;
    right: 0;
    bottom: calc(70px + var(--safe-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1;
    -webkit-overflow-scrolling: touch;
}

.tab-content {
    display: none;
    padding: 1rem;
    min-height: 100%;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* =============================================
   Bottom Navigation
   ============================================= */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(0deg, var(--bg-deep) 0%, rgba(3, 7, 18, 0.95) 90%, transparent 100%);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + var(--safe-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item .nav-icon {
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.nav-item .nav-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.2);
    filter: drop-shadow(var(--glow-md) var(--neon-green));
}

.nav-item.active .nav-label {
    color: var(--neon-green);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--neon-green);
    border-radius: 0 0 3px 3px;
    box-shadow: var(--glow-sm) var(--neon-green);
}

/* =============================================
   Glass Card Component
   ============================================= */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: var(--glow-sm) rgba(16, 185, 129, 0.1);
}

.glass-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* =============================================
   Status Tab — Organism Display
   ============================================= */
.organism-showcase {
    width: 100%;
    aspect-ratio: 1;
    max-width: 280px;
    margin: 0 auto 1rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.organism-container {
    width: 200px;
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Organism CSS Art — Single Cell */
.organism-cell {
    width: 80px;
    height: 80px;
    border-radius: 45% 55% 50% 50% / 55% 45% 55% 45%;
    background: radial-gradient(circle at 35% 35%, rgba(16, 185, 129, 0.6), rgba(6, 182, 212, 0.3));
    border: 2px solid var(--neon-green);
    box-shadow: var(--glow-lg) var(--neon-green), inset 0 0 20px rgba(16, 185, 129, 0.3);
    animation: cellPulse 3s infinite ease-in-out, cellFloat 5s infinite ease-in-out;
    position: relative;
}

.organism-cell::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.8), transparent);
    border-radius: 50%;
    top: 25%;
    left: 30%;
    animation: nucleusPulse 2s infinite ease-in-out;
}

.organism-cell.ciliates {
    border-radius: 40% 60% 45% 55% / 50% 50% 50% 50%;
}

.organism-cell.ciliates::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: inherit;
    border: 1px dashed rgba(16, 185, 129, 0.3);
    animation: ciliaSpin 4s linear infinite;
}

.organism-cell.predator {
    border-color: var(--neon-red);
    box-shadow: var(--glow-lg) var(--neon-red);
    background: radial-gradient(circle at 35% 35%, rgba(239, 68, 68, 0.5), rgba(168, 85, 247, 0.3));
}

/* Path-specific organism styles */
.organism-cell.path-autotroph {
    border-color: var(--color-autotroph);
    box-shadow: var(--glow-lg) var(--color-autotroph);
    background: radial-gradient(circle at 35% 35%, rgba(34, 197, 94, 0.6), rgba(16, 185, 129, 0.3));
    border-radius: 35% 65% 40% 60% / 55% 45% 55% 45%;
}

.organism-cell.path-heterotroph {
    border-color: var(--color-heterotroph);
    box-shadow: var(--glow-lg) var(--color-heterotroph);
    background: radial-gradient(circle at 35% 35%, rgba(239, 68, 68, 0.5), rgba(249, 115, 22, 0.3));
    border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%;
}

.organism-cell.path-decomposer {
    border-color: var(--color-decomposer);
    box-shadow: var(--glow-lg) var(--color-decomposer);
    background: radial-gradient(circle at 35% 35%, rgba(168, 85, 247, 0.5), rgba(139, 92, 246, 0.3));
    border-radius: 50% 50% 40% 60% / 45% 55% 50% 50%;
}

@keyframes cellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes cellFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes nucleusPulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes ciliaSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Orbit rings around organism */
.orbit-ring {
    position: absolute;
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 50%;
    animation: orbitPulse 4s infinite ease-in-out;
}

.orbit-ring:nth-child(1) { width: 130px; height: 130px; animation-delay: 0s; }
.orbit-ring:nth-child(2) { width: 170px; height: 170px; animation-delay: 1s; }
.orbit-ring:nth-child(3) { width: 210px; height: 210px; animation-delay: 2s; }

@keyframes orbitPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

/* =============================================
   Stats Grid
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.stat-item {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 0.75rem;
    text-align: center;
}

.stat-icon {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-number);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =============================================
   Progress Bar Component
   ============================================= */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.progress-green  .progress-fill { background: linear-gradient(90deg, #059669, var(--neon-green)); box-shadow: var(--glow-sm) var(--neon-green); }
.progress-cyan   .progress-fill { background: linear-gradient(90deg, #0891b2, var(--neon-cyan)); box-shadow: var(--glow-sm) var(--neon-cyan); }
.progress-amber  .progress-fill { background: linear-gradient(90deg, #d97706, var(--neon-amber)); box-shadow: var(--glow-sm) var(--neon-amber); }
.progress-red    .progress-fill { background: linear-gradient(90deg, #dc2626, var(--neon-red)); box-shadow: var(--glow-sm) var(--neon-red); }
.progress-purple .progress-fill { background: linear-gradient(90deg, #7c3aed, var(--neon-purple)); box-shadow: var(--glow-sm) var(--neon-purple); }
.progress-gold   .progress-fill { background: linear-gradient(90deg, #b45309, var(--neon-gold)); box-shadow: var(--glow-sm) var(--neon-gold); }

/* =============================================
   Explore Tab — Canvas
   ============================================= */
#explore-canvas {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(16, 185, 129, 0.15);
    touch-action: none;
    background: #020617;
}

.explore-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.explore-env-name {
    color: var(--neon-cyan);
    font-weight: 600;
}

.explore-coords {
    font-family: var(--font-number);
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Explore Skills Grid */
.explore-skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.skill-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.05));
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-thai);
    color: #10b981;
}

.skill-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.1));
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.skill-btn:active:not(:disabled) {
    transform: translateY(0);
}

.skill-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.skill-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.skill-name {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

.skill-cost {
    font-size: 0.65rem;
    color: rgba(16, 185, 129, 0.7);
    font-family: var(--font-number);
}

/* =============================================
   Evolution Tab — Tree
   ============================================= */
.evo-tree {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.evo-node {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.evo-node.unlocked {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

.evo-node.current {
    border-color: var(--neon-green);
    box-shadow: var(--glow-md) rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
}

.evo-node.locked {
    opacity: 0.5;
}

.evo-node.next {
    border-color: rgba(251, 191, 36, 0.4);
    animation: nextLevelPulse 2s infinite ease-in-out;
}

@keyframes nextLevelPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
    50% { box-shadow: var(--glow-md) rgba(251, 191, 36, 0.3); }
}

.evo-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.evo-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.evo-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.evo-cost {
    font-family: var(--font-number);
    font-size: 0.7rem;
    color: var(--neon-gold);
}

.evo-connector {
    width: 2px;
    height: 20px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.4), rgba(16, 185, 129, 0.1));
    margin: 0 auto;
}

/* Path Selection Cards */
.path-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.path-card {
    border-radius: 1rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.path-card.autotroph {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.02));
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.path-card.heterotroph {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.02));
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.path-card.decomposer {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(168, 85, 247, 0.02));
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.path-card:active {
    transform: scale(0.98);
}

.path-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.path-card-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.path-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =============================================
   Skill Cards
   ============================================= */
.skill-card {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.skill-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.skill-icon-box.passive { background: rgba(6, 182, 212, 0.15); border: 1px solid rgba(6, 182, 212, 0.3); }
.skill-icon-box.active  { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }
.skill-icon-box.ultimate { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3); }

.skill-info { flex: 1; }
.skill-name { font-size: 0.85rem; font-weight: 600; }
.skill-type { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.skill-type.passive { color: var(--neon-cyan); }
.skill-type.active { color: var(--neon-red); }
.skill-type.ultimate { color: var(--neon-purple); }
.skill-desc { font-size: 0.7rem; color: var(--text-secondary); line-height: 1.4; }

/* =============================================
   Buttons
   ============================================= */
.btn-neon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-family: var(--font-thai);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-neon-green {
    background: linear-gradient(135deg, var(--neon-green), #059669);
    color: white;
    box-shadow: var(--glow-sm) rgba(16, 185, 129, 0.4);
}

.btn-neon-green:hover {
    box-shadow: var(--glow-md) rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.btn-neon-green:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-neon-gold {
    background: linear-gradient(135deg, var(--neon-gold), #d97706);
    color: #1c1917;
    box-shadow: var(--glow-sm) rgba(251, 191, 36, 0.4);
}

.btn-neon-outline {
    background: transparent;
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--neon-green);
}

.btn-neon-outline:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* =============================================
   Achievement Items
   ============================================= */
.achievement-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
}

.achievement-item.unlocked {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.05);
}

.achievement-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.achievement-info { flex: 1; }
.achievement-name { font-size: 0.8rem; font-weight: 600; }
.achievement-desc { font-size: 0.65rem; color: var(--text-secondary); }

/* =============================================
   Utility Animations
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease; }
.animate-scale-in { animation: scaleIn 0.4s ease; }
.animate-slide-up { animation: slideUp 0.5s ease; }

/* LP floating number */
.lp-float {
    position: fixed;
    font-family: var(--font-number);
    font-weight: 700;
    color: var(--neon-gold);
    text-shadow: var(--glow-sm) var(--neon-gold);
    pointer-events: none;
    animation: lpFloat 1.5s ease-out forwards;
    z-index: 200;
}

@keyframes lpFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.5); }
}

/* =============================================
   Scrollbar
   ============================================= */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(16, 185, 129, 0.3); border-radius: 3px; }

/* =============================================
   Section Headers
   ============================================= */
.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.3), transparent);
}

/* =============================================
   Responsive
   ============================================= */
@media (min-width: 640px) {
    #game-container {
        max-width: 480px;
        margin: 0 auto;
    }
    #bottom-nav {
        max-width: 480px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 1rem 1rem 0 0;
    }
    #top-bar {
        max-width: 480px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* =============================================
   Sprite-based Organism Display
   ============================================= */
.organism-sprite {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-image-rendering: pixelated;
    animation: cellFloat 5s infinite ease-in-out;
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.5));
    z-index: 2;
    display: block;
    /* Inline styles override: width, height, background-* properties */
}

/* =============================================
   Equipment Grid
   ============================================= */
.equipment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.equip-slot {
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    padding: 0.6rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.equip-slot:active {
    transform: scale(0.95);
}

.equip-slot.filled {
    border-width: 1.5px;
}

.equip-slot.filled:hover {
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}

.equip-slot-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.equip-slot-name {
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equip-slot-label {
    font-size: 0.5rem;
    color: var(--text-muted);
}

/* Equipment Bonus Badge */
.eq-bonus {
    font-size: 0.6rem;
    color: var(--neon-purple);
    margin-left: 2px;
    font-weight: 400;
}

/* =============================================
   Equipment Popup / Inventory
   ============================================= */
.equip-popup {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.equip-popup.show {
    opacity: 1;
}

.equip-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.equip-popup-content {
    position: relative;
    z-index: 1;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.equip-popup-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
}

.equip-popup-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inv-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-glass);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inv-item:active {
    transform: scale(0.98);
}

.inv-item.equipped {
    border-width: 2px;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.inv-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

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

.inv-item-stats {
    font-size: 0.6rem;
    font-family: var(--font-number);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.inv-item-action {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* =============================================
   Loot Drop Notification
   ============================================= */
.loot-popup {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    z-index: 8000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.loot-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loot-popup-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-radius: 1rem;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    min-width: 250px;
    max-width: 360px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.loot-icon {
    flex-shrink: 0;
}

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

.loot-name {
    font-size: 0.85rem;
    font-weight: 700;
}

.loot-rarity {
    font-size: 0.6rem;
    opacity: 0.8;
    margin-top: 1px;
}

.loot-stats {
    font-family: var(--font-number);
    font-size: 0.55rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}

.loot-stat.positive { color: var(--neon-green); }
.loot-stat.negative { color: var(--neon-red); }
