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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Верхняя панель */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.stats, .perks {
    display: flex;
    gap: 30px;
}

.stats span, .perks span {
    font-size: 1.2em;
    font-weight: bold;
}

.currency {
    color: #ffd700;
}

.per-coins {
    color: #00bfff;
}

/* Основная область кликера */
.clicker-area {
    text-align: center;
    padding: 40px 0;
}

.pepe-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
}

#pepe-emoji {
    font-size: 150px;
    line-height: 1;
    user-select: none;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 10px 30px rgba(34, 134, 48, 0.5));
    cursor: pointer;
}

#pepe-emoji:hover {
    transform: scale(1.1);
}

#pepe-emoji:active {
    transform: scale(0.9);
}

.click-text {
    margin-top: 20px;
    font-size: 1.5em;
    color: #228630;
    text-shadow: 0 0 10px rgba(34, 134, 48, 0.5);
}

/* Панели */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel h2 {
    margin-bottom: 15px;
    font-size: 1.5em;
    text-align: center;
}

/* Улучшения */
.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: scroll;
    padding-right: 8px;
}

/* Фиксируем скроллбар чтобы не скакал */
.upgrades-list::-webkit-scrollbar {
    width: 8px;
}

.upgrades-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.upgrades-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.upgrades-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.upgrade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.upgrade-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.upgrade-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-info h3 {
    font-size: 1.1em;
    margin-bottom: 5px;
}

.upgrade-info p {
    font-size: 0.9em;
    color: #aaa;
}

.upgrade-btn {
    background: linear-gradient(135deg, #228630, #2ea043);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2ea043, #3fb950);
    box-shadow: 0 5px 15px rgba(34, 134, 48, 0.4);
}

.upgrade-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Перерождения */
.rebirth-panel {
    text-align: center;
}

.rebirth-stats {
    margin-bottom: 20px;
}

.rebirth-stats p {
    margin: 8px 0;
    font-size: 1.1em;
}

.rebirth-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-rebirth {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border: none;
    border-radius: 10px;
    padding: 15px 40px;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-rebirth:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(155, 89, 182, 0.5);
}

.btn-do-rebirth {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    border-radius: 10px;
    padding: 15px 40px;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-do-rebirth:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.5);
}

.btn-do-rebirth:disabled {
    background: #555;
    cursor: not-allowed;
}

.rebirth-hint {
    font-size: 0.9em;
    color: #aaa;
    margin-top: 10px;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(155, 89, 182, 0.3);
}

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

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
}

.btn-close:hover {
    color: #e74c3c;
}

.rebirth-info {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2em;
}

/* Дерево перерождений */
.rebirth-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.tree-row {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.tree-node {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    width: 150px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.tree-node.available {
    border-color: #228630;
    cursor: pointer;
}

.tree-node.available:hover {
    background: rgba(34, 134, 48, 0.2);
    transform: scale(1.05);
}

.tree-node.unlocked {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.2);
}

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

.tree-node h4 {
    margin-bottom: 8px;
    font-size: 1em;
}

.tree-node p {
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 5px;
}

.tree-node .cost {
    color: #00bfff;
    font-weight: bold;
}

.tree-node.purchased {
    position: relative;
}

.tree-node.purchased::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 10px;
    color: #228630;
    font-size: 1.2em;
}

/* Всплывающие числа */
#floating-numbers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.floating-number {
    position: absolute;
    font-size: 1.5em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px);
    }
}

/* Анимация клика */
.click-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.6), transparent);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    opacity: 0;
}

.click-effect.active {
    animation: ripple 0.5s ease-out;
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .panels {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 10px;
    }

    .stats, .perks {
        flex-wrap: wrap;
        justify-content: center;
    }
}
