:root {
    --text-color: #2c3e50;
    --accent: #00b09b;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    font-family: 'Nunito', sans-serif;
    color: var(--text-color);
    overflow: hidden;
    background: url('assets/background.png') no-repeat center center fixed;
    background-size: cover;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Верхня панель */
.header {
    height: 65px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.coin-box {
    background: linear-gradient(135deg, #ffd700, #ffb300);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4);
    color: #5d4037;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.title {
    font-size: 20px;
    font-weight: 900;
    color: #004d40;
    text-shadow: 0 2px 5px rgba(255, 255, 255, 0.5);
}

/* Бокові вкладки */
.side-tabs {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 900;
}

.side-tab {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-right: none;
    border-radius: 25px 0 0 25px;
    padding: 12px 10px 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: -4px 4px 15px rgba(0, 0, 0, 0.05);
    font-size: 24px;
    transition: transform 0.2s, padding 0.2s;
}

.side-tab:active {
    background: rgba(255, 255, 255, 0.95);
    padding-right: 18px;
}

.tab-arrow {
    font-size: 14px;
    color: #888;
}

/* Центральна частина */
.main-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-bottom: 20px;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1.04) translateY(-8px);
    }
}

.pet-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: breathe 3.5s ease-in-out infinite;
    z-index: 5;
    margin-bottom: 30px;
}

.pet-wrapper::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    width: 140px;
    height: 15px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    z-index: -1;
    animation: shadow-breathe 3.5s ease-in-out infinite;
}

@keyframes shadow-breathe {

    0%,
    100% {
        transform: translateX(-50%) scale(1) translateY(0);
        opacity: 0.8;
    }

    50% {
        transform: translateX(-50%) scale(0.85) translateY(8px);
        opacity: 0.4;
    }
}

.pet-wrapper.is-grabbed,
.pet-wrapper.is-grabbed .sprite-layer,
.pet-wrapper.is-grabbed::after {
    animation-play-state: paused !important;
}

.pet-avatar {
    position: relative;
    width: 294px;
    height: 294px;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    touch-action: none;
}

.sprite-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    /* Let komiWrapper catch clicks */
    animation: slime-breathe 2.5s infinite ease-in-out;
    transform-origin: bottom center;
    transform: translateZ(0);
}

.clothes-layer {
    z-index: 10;
}

@keyframes slime-breathe {

    0%,
    100% {
        transform: scale(1, 1);
    }

    50% {
        transform: scale(1.08, 0.92) translateY(5px);
    }
}



.level-badge {
    position: absolute;
    top: -25px;
    background: linear-gradient(135deg, #ffd700, #ffb300);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 14px;
    color: #5d4037;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
    z-index: 10;
    letter-spacing: 1px;
}



/* Блок статистики */
.stats-section {
    width: 90%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-radius: 24px;
    padding: 20px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.label {
    font-size: 13px;
    font-weight: 900;
    width: 68px;
    flex-shrink: 0;
    color: #004d40;
}

.status-bar-container {
    flex-grow: 1;
    height: 22px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

@keyframes shimmer {
    0% {
        left: -150px;
    }

    100% {
        left: 100%;
    }
}

.status-bar {
    height: 100%;
    width: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.status-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 150px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
    animation: shimmer 2.5s infinite linear;
}

.hunger-color {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
}

.happiness-color {
    background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%);
}

.xp-color {
    background: linear-gradient(90deg, #f6d365 0%, #fda085 100%);
}

/* Нижня панель інвентаря */
.inventory-panel {
    height: 130px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 25px 25px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
}

.inventory-label {
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 11px;
    color: #444;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.inventory-items {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    width: 100%;
    justify-content: flex-start;
    padding: 10px 15px;
}

.inventory-items::-webkit-scrollbar {
    display: none;
}

.food-item {
    font-size: 40px;
    cursor: grab;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.food-item:active {
    cursor: grabbing;
    transform: scale(0.9);
}

/* Магазин (Бічна панель) */
.shop-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.shop-sidebar.active {
    transform: translateX(0);
}

.shop-header {
    background: linear-gradient(135deg, var(--accent), #00897b);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 900;
    border-bottom-left-radius: 20px;
}

.closeShopBtn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.closeShopBtn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.wardrobe-header {
    background: linear-gradient(135deg, #ff7eb3, #ff758c) !important;
}

.tasks-header {
    background: linear-gradient(135deg, #4facfe, #00f2fe) !important;
}

/* Внутрішні вкладки Магазину */
.shop-inner-tabs {
    display: flex;
    justify-content: flex-start;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    overflow-x: auto;
    gap: 8px;
}

.shop-inner-tabs::-webkit-scrollbar {
    display: none;
}

.inner-tab {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 800;
    color: #888;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    font-family: inherit;
    flex-shrink: 0;
}

.inner-tab.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.shop-content {
    flex: 1;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    width: 33.3333%;
    flex: none;
    overflow-y: auto;
    display: flex !important;
    flex-direction: column;
}

.shop-content-overflow {
    overflow: hidden;
    position: relative;
    padding: 0;
}

.shop-content-slider {
    display: flex;
    width: 300%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.empty-state {
    text-align: center;
    color: #888;
    padding: 30px 20px;
    font-size: 15px;
    font-weight: 700;
}

.shop-list {
    padding: 15px;
    gap: 12px;
}

/* Щоденні Завдання */
.task-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.task-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-name {
    font-weight: 900;
    font-size: 15px;
    color: var(--text-color);
}

.task-reward {
    font-weight: 900;
    font-size: 14px;
    color: #ff9800;
}

.task-progress-container {
    height: 12px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.task-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    width: 0%;
    transition: width 0.3s;
}

.task-claim-btn {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: #004d40;
    border: none;
    padding: 8px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 10px rgba(67, 233, 123, 0.4);
    transition: transform 0.2s;
    margin-top: 5px;
}

.task-claim-btn:active {
    transform: scale(0.95);
}

.task-completed {
    background: rgba(0, 0, 0, 0.03);
    opacity: 0.6;
}

.task-completed .task-claim-btn {
    display: none;
}

.task-completed .task-name {
    text-decoration: line-through;
}

/* Адаптація для мобільних пристроїв */
@media (max-width: 480px) {
    .stats-section {
        max-width: 260px;
        padding: 15px;
        gap: 12px;
    }

    .side-tab {
        padding: 10px 8px 10px 12px;
        font-size: 20px;
        border-radius: 20px 0 0 20px;
    }

    .side-tabs {
        top: 42%;
    }

    .label {
        width: 60px;
        font-size: 11px;
    }
}

.shop-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.shop-item:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.9);
}

.item-icon {
    font-size: 35px;
    background: rgba(255, 255, 255, 0.8);
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 800;
    font-size: 16px;
    color: var(--text-color);
}

.item-effect {
    font-size: 12px;
    color: #00796b;
    font-weight: 700;
}

.item-price {
    background: #ffd700;
    padding: 5px 10px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 14px;
    color: #5d4037;
    box-shadow: 0 2px 5px rgba(255, 215, 0, 0.3);
}

@keyframes flyUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.6) rotate(15deg);
    }
}

.floating-heart {
    position: absolute;
    font-size: 35px;
    pointer-events: none;
    animation: flyUp 1.2s ease-out forwards;
    z-index: 50;
    filter: drop-shadow(0 2px 4px rgba(255, 0, 0, 0.3));
}

/* Фізика Слайму - Анімації Стрибків */
@keyframes slime-jump-1 {
    0% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1);
    }

    15% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 15px)) scale(1.3, 0.7);
    }

    /* Стиснення перед стрибком */
    35% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 60px)) scale(0.8, 1.2);
    }

    /* Витягування вгору */
    55% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 80px)) scale(1, 1);
    }

    /* Пік */
    70% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 10px)) scale(0.9, 1.1);
    }

    /* Витягування вниз - падіння */
    85% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 15px)) scale(1.3, 0.7);
    }

    /* Стиснення при приземленні */
    100% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1);
    }

    /* Відновлення форми */
}

@keyframes slime-jump-2 {
    0% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1);
    }

    15% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 25px)) scale(1.4, 0.6);
    }

    /* Сильніше стиснення */
    35% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 100px)) scale(0.7, 1.3);
    }

    /* Високий стрибок */
    50% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 120px)) scale(1, 1) rotate(10deg);
    }

    65% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 30px)) scale(0.8, 1.2) rotate(-5deg);
    }

    85% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 20px)) scale(1.4, 0.6);
    }

    /* Важке приземлення */
    100% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1);
    }
}

@keyframes slime-jump-3 {
    0% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1) rotate(0);
    }

    15% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 15px)) scale(1.3, 0.7) rotate(0);
    }

    /* Стиснення */
    45% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 80px)) scale(0.9, 1.1) rotate(180deg);
    }

    /* Сальто */
    70% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) - 10px)) scale(1, 1) rotate(360deg);
    }

    /* Завершення сальто */
    85% {
        transform: translate(var(--tx, 0px), calc(var(--ty, 0px) + 15px)) scale(1.3, 0.7) rotate(360deg);
    }

    /* Стиснення при приземленні */
    100% {
        transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1, 1) rotate(360deg);
    }
}

.anim-jump-1 {
    animation: slime-jump-1 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.anim-jump-2 {
    animation: slime-jump-2 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.anim-jump-3 {
    animation: slime-jump-3 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ═══════════════════════════════════════════════════════════════
   DANGER / WARNING BAR PULSING
═══════════════════════════════════════════════════════════════ */
@keyframes dangerPulse {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.5;
        filter: brightness(1.4);
    }
}

@keyframes warningPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.status-bar.danger {
    animation: dangerPulse 0.8s infinite ease-in-out;
    background: linear-gradient(90deg, #ff416c, #ff4b2b) !important;
}

.status-bar.warning {
    animation: warningPulse 1.4s infinite ease-in-out;
    background: linear-gradient(90deg, #f7971e, #ffd200) !important;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER — TAP FRENZY BUTTON
═══════════════════════════════════════════════════════════════ */
.tap-frenzy-btn {
    background: linear-gradient(135deg, #f7971e, #ffd200);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(247, 151, 30, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tap-frenzy-btn:active {
    transform: scale(0.9);
    box-shadow: 0 2px 6px rgba(247, 151, 30, 0.4);
}

@keyframes frenzyBtnPulse {

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(247, 151, 30, 0.5);
    }

    50% {
        box-shadow: 0 4px 24px rgba(247, 151, 30, 0.9);
    }
}

.tap-frenzy-btn {
    animation: frenzyBtnPulse 2s infinite ease-in-out;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
.komi-toast {
    position: fixed;
    bottom: 145px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 30, 40, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.komi-toast.toast-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
}

.toast-emoji {
    font-size: 20px;
}

.toast-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════
   EMOTION BUBBLES
═══════════════════════════════════════════════════════════════ */
@keyframes bubbleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.8) rotate(-5deg);
    }

    20% {
        transform: translateY(-10px) scale(1.1) rotate(3deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-75px) scale(1.2) rotate(8deg);
    }
}

.emotion-bubble {
    position: fixed;
    font-size: 34px;
    pointer-events: none;
    animation: bubbleFloat 1.6s ease-out forwards;
    z-index: 9000;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
}

/* ═══════════════════════════════════════════════════════════════
   EMOTION STATES — PET WRAPPER CLASSES
═══════════════════════════════════════════════════════════════ */

/* Sad: blue tint, slow droop */
@keyframes sadBreathe {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(0.97) translateY(6px);
    }
}

.emotion-sad .pet-avatar {
    filter: hue-rotate(180deg) saturate(0.7) brightness(0.85);
}

.emotion-sad {
    animation: sadBreathe 5s ease-in-out infinite !important;
}

/* Happy: warm glow */
@keyframes happyGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(255, 220, 0, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 220, 0, 0.7));
    }
}

.emotion-happy .pet-avatar {
    animation: happyGlow 1.5s ease-in-out infinite;
}

/* Sleepy: slow, droopy animation */
@keyframes sleepyBreathe {

    0%,
    100% {
        transform: scale(1) translateY(0) rotate(0deg);
    }

    30% {
        transform: scale(1.02) translateY(-3px) rotate(-1deg);
    }

    80% {
        transform: scale(0.99) translateY(4px) rotate(1deg);
    }
}

.emotion-sleepy {
    animation: sleepyBreathe 6s ease-in-out infinite !important;
}

.emotion-sleepy .pet-avatar img {
    filter: brightness(0.85) saturate(0.6);
}

/* Sick: grey, shaking */
@keyframes sickShake {

    0%,
    100% {
        transform: translateX(0) translateY(0);
    }

    20% {
        transform: translateX(-3px) translateY(1px);
    }

    40% {
        transform: translateX(3px) translateY(-1px);
    }

    60% {
        transform: translateX(-2px) translateY(2px);
    }

    80% {
        transform: translateX(2px) translateY(-2px);
    }
}

.pet-sick .pet-avatar {
    filter: saturate(0.2) brightness(0.8) !important;
}

.pet-sick {
    animation: sickShake 3s ease-in-out infinite !important;
}

/* ─── Sick Overlay Emoji ────────────────────────────────────────────────── */
.sick-overlay {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 26px;
    display: none;
    z-index: 20;
    animation: sickBounce 2s infinite ease-in-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes sickBounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-5px) rotate(5deg);
    }
}

.pet-sick .sick-overlay {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════
   TAP FRENZY OVERLAY
═══════════════════════════════════════════════════════════════ */
@keyframes frenzyIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes frenzyOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(1.1);
    }
}

.frenzy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: frenzyIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: none;
    /* Let clicks pass through to Komi */
}

.frenzy-overlay.frenzy-exit {
    animation: frenzyOut 0.4s ease-out forwards;
}

.frenzy-inner {
    text-align: center;
    color: white;
    pointer-events: none;
}

.frenzy-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 28px;
    text-shadow: 0 0 20px rgba(247, 151, 30, 0.8);
    letter-spacing: 2px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f7971e, #ffd200);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.frenzy-timer {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 80px;
    line-height: 1;
    color: white;
    text-shadow: 0 0 30px rgba(255, 100, 0, 0.6);
    transition: transform 0.1s;
}

.frenzy-pulse {
    transform: scale(1.3) !important;
}

.frenzy-taps {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #ffd200;
    margin-top: 8px;
}

.frenzy-hint {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENTS PANEL
═══════════════════════════════════════════════════════════════ */
.achievements-header {
    background: linear-gradient(135deg, #f7971e, #ffd200) !important;
    color: #3e2200 !important;
}

.achievement-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.achievement-item.achievement-locked {
    opacity: 0.45;
    filter: grayscale(1);
}

.achievement-item.achievement-claimed {
    background: rgba(67, 233, 123, 0.12);
    border-color: rgba(67, 233, 123, 0.4);
}

.achievement-item.achievement-unlocked:not(.achievement-claimed) {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

.achievement-icon {
    font-size: 30px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-weight: 900;
    font-size: 15px;
    color: #2c3e50;
}

.achievement-desc {
    font-size: 12px;
    color: #666;
    font-weight: 700;
    margin-top: 2px;
}

.achievement-badge {
    font-size: 20px;
}

.achievement-reward {
    background: #ffd700;
    padding: 4px 8px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 13px;
    color: #5d4037;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   SKIN PREVIEW IN SHOP
═══════════════════════════════════════════════════════════════ */
.item-icon.skin-preview {
    font-size: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.5);
}

.item-icon.skin-preview img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════════
   NIGHT / EVENING MODE
═══════════════════════════════════════════════════════════════ */
body.night-mode {
    background: linear-gradient(rgba(0, 20, 60, 0.6), rgba(0, 20, 60, 0.6)), url('assets/background.png') no-repeat center center fixed;
    background-size: cover;
}

body.evening-mode {
    background: linear-gradient(rgba(255, 100, 0, 0.25), rgba(255, 100, 0, 0.25)), url('assets/background.png') no-repeat center center fixed;
    background-size: cover;
}

/* ═══════════════════════════════════════════════════════════════
   STAT VALUE TOOLTIP (inside the bar, appears on hover/tap)
═══════════════════════════════════════════════════════════════ */
.status-bar-container {
    position: relative;
}

.stat-value-tooltip {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.stat-value-tooltip.xp-tooltip {
    font-size: 10px;
    right: 6px;
}

/* Desktop: show on hover */
@media (hover: hover) {
    .status-bar-container:hover .stat-value-tooltip {
        opacity: 1;
    }
}

/* Mobile: show via JS-toggled class (touchstart → auto-hide) */
.status-bar-container.showing-value .stat-value-tooltip {
    opacity: 1;
}

/* ─── Loading Screen ─────────────────────────────────────────────────────── */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f8f9fa;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-pet {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce-loader 1.2s infinite ease-in-out;
    display: inline-block;
}

@keyframes bounce-loader {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.1, 0.9); }
}

.loader-text {
    font-weight: 900;
    font-size: 14px;
    color: #00b09b;
    letter-spacing: 3px;
    margin-bottom: 20px;
}

.loader-bar-container {
    width: 200px;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #00b09b, #96c93d);
    border-radius: 3px;
    animation: loader-progress 2s infinite ease-in-out;
}

@keyframes loader-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* ─── Name Selection Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 340px;
    padding: 30px;
    border-radius: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: 20px;
    font-weight: 900;
    color: #004d40;
}

.modal-input {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 18px;
    font-family: inherit;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    outline: none;
}

.modal-price-tag {
    font-weight: 800;
    color: #ff9800;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: 15px;
    border: none;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.modal-btn:active {
    transform: scale(0.95);
}

.btn-confirm {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: #004d40;
    box-shadow: 0 4px 15px rgba(67, 233, 123, 0.3);
}

.btn-cancel {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

#petNameDisplay {
    cursor: pointer;
    transition: opacity 0.2s;
}

#petNameDisplay:hover {
    opacity: 0.8;
}