/* Hamster Clicker: Evolution - Design System */

:root {
    --bg-primary: #0a0d14;
    --bg-card: rgba(20, 24, 37, 0.6);
    --bg-card-hover: rgba(30, 36, 56, 0.8);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-active: rgba(139, 92, 246, 0.4);
    
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    
    --neon-purple: #8b5cf6;
    --neon-pink: #ec4899;
    --neon-gold: #f59e0b;
    --neon-green: #10b981;
    --neon-blue: #06b6d4;
    
    --font-primary: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-primary);
    color: var(--color-text);
    font-family: var(--font-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Контейнер приложения */
.app-container {
    width: 100%;
    max-width: 480px; /* Имитация экрана смартфона */
    height: 100%;
    background: radial-gradient(circle at 50% 0%, #161a29 0%, #080a0f 100%);
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Декоративное свечение на фоне */
.bg-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-1 {
    background-color: var(--neon-purple);
    top: 15%;
    left: -10%;
}

.bg-glow-2 {
    background-color: var(--neon-blue);
    bottom: 20%;
    right: -10%;
}

/* Шапка приложения */
.app-header {
    padding: 1.5rem 1.25rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(10, 13, 20, 0.8) 0%, rgba(10, 13, 20, 0) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Контейнер ранга */
.rank-container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--border-glass);
}

.rank-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.rank-icon {
    font-size: 0.95rem;
}

.level-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.level-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink));
    border-radius: 9999px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.level-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Отображение монет */
.balance-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0;
}

.coin-icon-wrapper {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.4));
}

.coin-svg {
    width: 100%;
    height: 100%;
}

.balance-amount {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Основная область контента */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.25rem 1.5rem 1.25rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Кастомный скроллбар для магазина */
.app-content::-webkit-scrollbar {
    width: 4px;
}
.app-content::-webkit-scrollbar-track {
    background: transparent;
}
.app-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Вкладки */
.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.2s ease-out;
}

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

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

/* --- ВКЛАДКА ИГРЫ --- */
#game-tab {
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.clicker-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.effects-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.hamster-wrapper {
    position: relative;
    width: 70%;
    max-width: 250px;
    aspect-ratio: 1;
    cursor: pointer;
    z-index: 2;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hamster-glow {
    position: absolute;
    width: 110%;
    height: 110%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0) 70%);
    filter: blur(15px);
    z-index: -1;
    animation: pulseGlow 4s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0.5; }
}

.hamster-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
    transition: filter 0.2s ease;
}

/* Эффект нажатия */
.hamster-wrapper:active {
    transform: scale(0.92) translateY(2px);
}

.hamster-wrapper:active .hamster-img {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

/* Пассивный доход */
.passive-income-display {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 0.65rem 1.25rem;
    border-radius: 9999px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.income-label {
    color: var(--color-text-muted);
}

.income-value {
    color: var(--neon-gold);
    font-weight: 700;
}

/* Энергия */
.energy-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.energy-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.energy-label {
    color: var(--color-text-muted);
}

.energy-value {
    color: var(--color-text);
}

.energy-bar-wrapper {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    border: 1px solid var(--border-glass);
    padding: 2px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.energy-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, var(--neon-blue) 100%);
    border-radius: 9999px;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* --- ВКЛАДКА МАГАЗИНА --- */
.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    color: var(--color-text);
    border-left: 3px solid var(--neon-purple);
    padding-left: 0.5rem;
}

.shop-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.shop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
}

.card-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.2;
}

.card-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-current {
    font-weight: 600;
    color: var(--neon-purple);
}

.stat-effect {
    font-weight: 600;
    color: var(--neon-green);
}

.buy-button {
    background: linear-gradient(135deg, var(--neon-purple) 0%, #6d28d9 100%);
    border: none;
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    color: #fff;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.buy-button.disabled {
    background: #1f2937 !important;
    color: #4b5563 !important;
    box-shadow: none !important;
    border-color: transparent !important;
    cursor: not-allowed;
}

/* --- ВКЛАДКА СТАТИСТИКИ --- */
.stats-container {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 0.5rem;
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-label {
    color: var(--color-text-muted);
}

.stat-val {
    font-weight: 700;
    font-family: var(--font-display);
}

/* Дорожная карта эволюции */
.evolution-roadmap {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.roadmap-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s;
}

.roadmap-item.current {
    background: rgba(139, 92, 246, 0.05);
    border-color: var(--border-active);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

.roadmap-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.road-num {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    border: 1px solid var(--border-glass);
}

.roadmap-item.current .road-num {
    background: var(--neon-purple);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.road-info {
    flex: 1;
}

.road-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.roadmap-item.current .road-title {
    color: var(--neon-purple);
}

.road-desc {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* --- НИЖНЯЯ НАВИГАЦИЯ --- */
.app-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(10, 13, 20, 0.9);
    border-top: 1px solid var(--border-glass);
    padding: 0.75rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 0.5rem;
    z-index: 20;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-icon {
    font-size: 1.35rem;
    transition: transform 0.2s;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
}

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

.nav-item.active .nav-icon {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    width: 0;
    height: 2px;
    background-color: var(--neon-purple);
    border-radius: 9999px;
    transition: width 0.2s;
}

.nav-item.active::after {
    width: 24px;
}

/* --- СПЕЦЭФФЕКТЫ --- */
/* Вылетающие числа */
.floating-num {
    position: absolute;
    pointer-events: none;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.65rem;
    color: #fff;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: floatText 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes floatText {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.6) translateY(0);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) translateY(-50px) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) translateY(-100px) rotate(5deg);
    }
}
