/* === CSS Variables === */
:root {
    --color-primary: #667eea;
    --color-primary-dark: #764ba2;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --white-95: rgba(255, 255, 255, 0.95);
}

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

/* Захист від зміни системного розміру шрифта на мобільних пристроях */
html {
    font-size: 16px !important; /* Фіксуємо базовий розмір шрифта */
    -webkit-text-size-adjust: 100% !important; /* iOS Safari - забороняє автоматичне масштабування */
    -moz-text-size-adjust: 100% !important; /* Firefox */
    -ms-text-size-adjust: 100% !important; /* IE/Edge */
    text-size-adjust: 100% !important; /* Стандартна властивість */
}

/* Блокування десктопів - приховати на великих екранах */
@media (min-width: 1024px) {
    body::before {
        content: 'Ця гра призначена тільки для мобільних пристроїв. Будь ласка, відкрийте на телефоні або планшеті.';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--gradient-primary);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 40px;
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        z-index: 99999;
    }
    
    body > * {
        display: none !important;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px !important; /* Фіксуємо розмір шрифта для body */
    background: var(--gradient-primary);
    min-height: 100vh;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    color: #333;
    -webkit-text-size-adjust: 100% !important; /* Додатковий захист для iOS */
    text-size-adjust: 100% !important;
}

/* ========== АВТОРИЗАЦІЯ ========== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    overflow-y: auto;
}

.auth-box {
    background: var(--white-95);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.auth-box h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.auth-box h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 25px;
    color: #333;
}

.error-messages {
    margin-bottom: 20px;
}

.error {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 14px;
}

.auth-links a:hover {
    text-decoration: underline;
}

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: white;
    text-align: center;
    padding: 20px;
}

.error-page h1 {
    font-size: 72px;
    margin-bottom: 20px;
}

.error-page p {
    font-size: 24px;
    margin-bottom: 30px;
}

/* ========== НИЖНІЙ ТАББАР ========== */
/* Нижнє меню навігації - фіксоване позиціонування */
.bottom-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgb(31, 41, 55);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.05) inset,
                0 -1px 2px rgba(0, 0, 0, 0.2);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 1000; /* Достатньо високий для меню навігації */
    height: 70px;
    pointer-events: auto;
    isolation: isolate;
    contain: layout style paint;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
}
.bottom-tabbar,
.bottom-tabbar * {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    flex: 1;
    padding: 6px 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 54px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    outline: none !important;
    background: transparent !important;
}
.tabbar-item:focus,
.tabbar-item:focus:hover,
.tabbar-item:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    background: transparent !important;
}

.tabbar-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 40px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tabbar-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.tabbar-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(0.3) brightness(1.2);
    display: inline-block;
    color: rgba(255, 255, 255, 0.7);
}

.tabbar-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    filter: grayscale(0.3) brightness(1.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tabbar-item.active .tabbar-icon img {
    filter: grayscale(0);
}

.tabbar-item.active .tabbar-icon {
    transform: scale(1.15);
    filter: grayscale(0) brightness(1.2);
    color: var(--white-95);
}

.tabbar-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    color: rgba(255, 255, 255, 0.7);
}

.tabbar-item.active .tabbar-label {
    color: var(--white-95);
    opacity: 1;
    font-weight: 700;
}

.tabbar-item:active {
    transform: scale(0.98);
    background: transparent !important;
}
.tabbar-item:active .tabbar-icon {
    transform: scale(1.02);
}

/* Зарезервований пункт меню */
.tabbar-item--reserved {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.4);
    flex: 1;
    padding: 6px 4px;
    position: relative;
    min-height: 54px;
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.tabbar-item--reserved .tabbar-icon {
    filter: grayscale(1) brightness(0.7);
    opacity: 0.5;
}

.tabbar-item--reserved .tabbar-label {
    opacity: 0.5;
    color: rgba(255, 255, 255, 0.4);
}

/* ========== ІГРА ========== */
.game-container {
    width: 100%;
    /*padding-bottom: calc(70px + env(safe-area-inset-bottom)); Відступ для таббара + safe area */
    height: calc(100vh - 70px - env(safe-area-inset-bottom));
    min-height: calc(100vh - 70px - env(safe-area-inset-bottom));
    max-height: calc(100vh - 70px - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
    background: var(--gradient-primary);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    z-index: 1; /* Нижче за нижнє меню (z-index: 1000) */
    box-sizing: border-box;
    contain: layout style paint;
}

/* Модифікатор для головної сторінки - повна висота viewport */
/* Progressive enhancement: vh для старих браузерів, dvh для нових (враховує динамічну висоту на мобільних) */
.game-container--page {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
}

.top-bar {
    background: rgba(10, 15, 28, 0.9);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset,
                0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    flex-wrap: nowrap;
    z-index: 10;
    top: 0;
    transform: none;
}

.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 16px !important;
    gap: 10px !important;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.coins-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    flex-shrink: 1;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.coin-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 12px !important;
    border-radius: 8px;
    background: rgba(31, 41, 55, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    position: relative;
    margin: 0;
    line-height: 1;
}

.coin-item:hover {
    background: rgba(31, 41, 55, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.coin-item:active {
    transform: scale(0.97);
    background: rgba(31, 41, 55, 0.5);
}

.coin-item-clicker {
    opacity: 0.9;
}

.coins-display .coin-icon {
    width: 18px;
    height: 18px;
    opacity: 1;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(1.1);
    margin: 0;
    padding: 0;
    font-size: larger;
}

.coin-item:hover .coin-icon {
    transform: scale(1.05);
}

.coins-value {
    color: var(--white-95);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    transition: color 0.2s ease;
    margin: 0;
    padding: 0;
}

.coin-item:hover .coins-value {
    color: rgba(255, 255, 255, 1);
}

.coins-display span:not(.coins-value) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* Базові стилі для іконок монет - застосовуються до всіх типів (img, i, span) */
.coin-icon {
    font-size: 25px;
    display: inline-block;
    width: 25px;
    height: 25px;
    line-height: 25px;
    text-align: center;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}

/* Зображення монет */
.coin-icon img,
img.coin-icon {
    width: 25px;
    height: 25px;
    max-width: 25px;
    max-height: 25px;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
}

/* Font Awesome іконки монет */
.coin-icon i {
    display: inline-block;
}

/* Емодзі іконки монет */
.coin-icon span {
    display: inline-block;
}

.level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
    min-width: 50px;
}

.level-display span:last-child {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    border: none;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
    position: relative;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    transition: none;
    cursor: default;
}

.user-name {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.05px;
    line-height: 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    transition: color 0.2s ease;
    margin: 0;
    padding: 0;
}

.user-name-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.user-name-link:hover {
    opacity: 1;
}

.user-name-link:hover .user-name {
    color: rgba(255, 255, 255, 1);
}

.user-name-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.user-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 8px;
    line-height: 1;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.badge-premium {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9) 0%, rgba(124, 58, 237, 0.9) 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.user-name-link:hover .badge-premium {
    background: linear-gradient(135deg, rgba(139, 92, 246, 1) 0%, rgba(124, 58, 237, 1) 100%);
    box-shadow: 0 3px 8px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.badge-standard {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-info:hover .user-name {
    color: rgba(255, 255, 255, 1);
}

.user-info span:not(.user-name) {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
}

.logout-btn {
    color: #dc2626;
    text-decoration: none;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(220, 38, 38, 0.1);
}

.back-btn, .minigames-btn {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
    background: rgba(102, 126, 234, 0.1);
    margin-right: 10px;
}

/* Меню міні-ігор */
.games-menu {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.games-menu-title {
    text-align: center;
    color: white;
    font-size: 24px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.game-card {
    background: var(--white-95);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.game-card:active {
    transform: scale(0.95);
}

.game-card .game-icon {
    font-size: 50px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 15px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    overflow: hidden;
}

.game-card .game-icon img {
    max-width: 70%;
    max-height: 70%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.game-card .game-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
}

/* Сітка міні-ігор */
.minigames-grid-container {
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
    padding: 0 20px;
}

.minigames-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
}

/* Якщо гра тільки одна - розмістити зліва */
.minigames-grid[data-count="1"] {
    grid-template-columns: auto;
    justify-content: start;
}

/* Якщо ігор 2-5 - один ряд по 5 */
.minigames-grid[data-count="2"],
.minigames-grid[data-count="3"],
.minigames-grid[data-count="4"],
.minigames-grid[data-count="5"] {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr;
}

/* Якщо ігор 6-10 - два ряди по 5 */
.minigames-grid[data-count="6"],
.minigames-grid[data-count="7"],
.minigames-grid[data-count="8"],
.minigames-grid[data-count="9"],
.minigames-grid[data-count="10"] {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.minigame-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
    padding: 10px 6px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--white-95) 0%, rgba(255, 255, 255, 0.85) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 
                0 2px 4px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 80px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.minigame-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.minigame-icon:hover::before {
    left: 100%;
}

.minigame-icon:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25), 
                0 4px 8px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    /* background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, var(--white-95) 100%);  */
}

.minigame-icon:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2), 
                0 2px 4px rgba(0, 0, 0, 0.08);
}

.minigame-icon-wrapper {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 50%, #f093fb 100%);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4),
                0 2px 4px rgba(118, 75, 162, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    margin-bottom: 8px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    padding: 6px;
    box-sizing: border-box;
}

.minigame-icon-wrapper img {
    max-width: 40px !important;
    max-height: 40px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    flex-shrink: 0;
}

.minigame-icon-wrapper::before {
    content: none !important;
    display: none !important;
}

.minigame-icon:hover .minigame-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
                0 3px 6px rgba(118, 75, 162, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.minigame-icon:hover .minigame-icon-wrapper::before {
    display: none !important;
    opacity: 0 !important;
}

.minigame-icon-emoji {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    display: inline-block;
}

.minigame-icon-emoji.fas,
.minigame-icon-emoji.far {
    display: inline-block;
}

.minigame-icon-emoji img {
    max-width: 40px !important;
    max-height: 40px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    flex-shrink: 0;
}

.minigame-icon:hover .minigame-icon-emoji {
    transform: scale(1.15);
}

.minigame-icon-name {
    font-size: 11px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.minigame-icon:hover .minigame-icon-name {
    color: var(--color-primary);
}

.profit-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: bold;
    color: #10b981;
}

.main-game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 15px;
    position: relative;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    z-index: 1; /* Нижче за нижнє меню */
    /* Обмежити висоту, щоб не перекривати меню */
    max-height: calc(100vh - 70px - env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
}

/* Таймер контейнер */
.timer-container {
    width: 100%;
    max-width: 400px;
    background: var(--white-95);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.timer-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.timer-title {
    font-size: 24px;
    color: var(--color-primary);
    margin-bottom: 20px;
    font-weight: bold;
}

.timer-status {
    margin-bottom: 20px;
}

.timer-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 600;
}

.timer-display {
    font-size: 48px;
    font-weight: bold;
    color: var(--color-primary);
    font-family: 'Courier New', monospace;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.timer-reward {
    font-size: 20px;
    color: #f59e0b;
    font-weight: bold;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Іконки монет в timer-reward використовують базові розміри з .coin-icon (рядки 524-569) */

.timer-progress {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
}

.timer-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 10px;
    transition: width 1s linear;
    width: 0%;
}

.timer-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-timer {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-timer:active {
    transform: scale(0.98);
}

.btn-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-start:hover {
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-collect {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    animation: pulse 2s infinite;
}

.btn-collect:hover {
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

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

.hamster-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamster {
    width: 200px;
    height: 200px;
    position: relative;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.1s;
}

.hamster:active {
    transform: scale(0.95);
}

.hamster-face {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 4px solid #d97706;
}

.hamster-ear {
    position: absolute;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50% 50% 50% 0;
    border: 3px solid #d97706;
    top: -10px;
}

.hamster-ear.left {
    left: 30px;
    transform: rotate(-20deg);
}

.hamster-ear.right {
    right: 30px;
    transform: rotate(20deg);
}

.hamster-eye {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    top: 60px;
}

.hamster-eye.left {
    left: 60px;
}

.hamster-eye.right {
    right: 60px;
}

.hamster-nose {
    position: absolute;
    width: 15px;
    height: 12px;
    background: #d97706;
    border-radius: 50% 50% 50% 0;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
}

.hamster-mouth {
    position: absolute;
    width: 40px;
    height: 20px;
    border: 3px solid #d97706;
    border-top: none;
    border-radius: 0 0 40px 40px;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
}

.tap-hint {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* Додаткові анімації для таймера та міні-ігор */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.4), 0 0 40px rgba(118, 75, 162, 0.3); }
    50% { box-shadow: 0 0 30px rgba(102, 126, 234, 0.6), 0 0 60px rgba(118, 75, 162, 0.5); }
}

.coin-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #f59e0b;
    pointer-events: none;
    opacity: 0;
    z-index: 100;
}

.coin-popup.show {
    animation: coinPop 0.6s ease-out;
}

@keyframes coinPop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.8);
    }
}

.tap-stats {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #666;
}

.stat-item span:last-child {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
}

.bottom-panel {
    background: var(--white-95);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    max-height: 40vh;
    display: flex;
    flex-direction: column;
    margin-bottom: 70px; /* Відступ для таббара */
    padding: 15px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

/* Для сторінки клікера - стилі перекриваються inline стилями */

.tabs {
    display: flex;
    border-bottom: none;
    padding: 0;
    gap: 0;
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    touch-action: manipulation;
    letter-spacing: -0.2px;
}

.tab-button.active {
    color: var(--white-95);
    border-bottom-color: #ffd700;
}

.tab-button:not(.active):hover {
    color: rgba(255, 255, 255, 0.8);
}

.tab-content {
    display: none;
    overflow-y: auto;
    padding: 0;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

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

.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upgrade-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.upgrade-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.upgrade-item:active {
    transform: translateY(0) scale(0.98);
}

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

.upgrade-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--white-95);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}

.upgrade-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.upgrade-price {
    font-size: 15px;
    font-weight: 700;
    color: #ffd700;
    margin-left: 12px;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

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

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.task-info {
    flex: 1;
}

.task-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.task-progress {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.task-reward {
    font-size: 18px;
    font-weight: bold;
    color: #10b981;
    margin-left: 10px;
}

.task-item.completed {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.task-item.completed .task-reward {
    color: #059669;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 14px;
}

.stat-row span:last-child {
    font-weight: bold;
    color: var(--color-primary);
}

@media (max-width: 480px) {
    .timer-container {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .timer-icon {
        font-size: 45px;
        margin-bottom: 10px;
    }
    
    .timer-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .timer-display {
        font-size: 32px;
    }
    
    .timer-message {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .timer-reward {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .btn-timer {
        padding: 14px;
        font-size: 15px;
    }
    
    .top-bar-content {
        padding: 6px 16px !important;
        gap: 10px !important;
    }
    
    .coins-display {
        gap: 8px;
    }
    
    .coin-item {
        gap: 6px !important;
        padding: 4px 12px !important;
    }
    
    .coins-display .coin-icon {
        width: 18px;
        height: 18px;
    }
    
    /* .user-info padding вже є 0 в базових стилях (рядок 557) */
    
    .coins-value {
        font-size: 15px;
        max-width: 80px;
    }
    
    .user-name {
        font-size: 15px;
    }
    
    .user-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    .logout-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .main-game-area {
        padding: 10px;
    }
    
    /* Стилі .coin-icon вже визначені в базових стилях (рядки 524-569) з тими самими розмірами */
    
    .bottom-panel {
        max-height: 35vh;
        padding: 12px;
        margin-bottom: 70px;
    }
    
    .stat-row {
        padding: 10px;
        font-size: 13px;
    }
    
    .stat-row span:first-child {
        font-size: 12px;
    }
    
    .minigames-grid-container {
        padding: 0 10px;
    }
    
    .minigame-icon {
        padding: 8px 4px;
        min-height: 70px;
        border-radius: 14px;
    }
    
    .minigame-icon-wrapper {
        width: 45px;
        height: 45px;
        border-radius: 12px;
        padding: 5px;
        box-sizing: border-box;
    }
    
    .minigame-icon-emoji {
        font-size: 24px;
    }
    
    .minigame-icon-emoji img,
    .minigame-icon-wrapper img {
        max-width: 32px !important;
        max-height: 32px !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        object-fit: contain !important;
    }
    
    .minigame-icon-name {
        font-size: 10px;
    }
}

/* Для дуже маленьких екранів (менше 360px) */
@media (max-width: 360px) {
    .top-bar-content {
        padding: 5px 14px !important;
        gap: 10px !important;
    }
    
    .coin-item {
        gap: 5px;
        padding: 6px 10px;
    }
    
    .coins-display {
        gap: 8px;
    }
    
    .coins-display .coin-icon {
        width: 18px;
        height: 18px;
    }
    
    .user-info {
        padding: 6px 10px;
    }
    
    .coins-value {
        font-size: 14px;
        max-width: 70px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-badge {
        font-size: 8px;
        padding: 2px 5px;
    }
    
    .logout-btn {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .timer-container {
        padding: 15px 10px;
    }
    
    .timer-icon {
        font-size: 40px;
    }
    
    .timer-title {
        font-size: 16px;
    }
    
    .timer-display {
        font-size: 28px;
    }
    
    .timer-message {
        font-size: 14px;
    }
    
    .timer-reward {
        font-size: 16px;
    }
    
    .btn-timer {
        padding: 12px;
        font-size: 14px;
    }
    
    .minigame-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .minigame-icon-emoji {
        font-size: 20px;
    }
    
    .minigame-icon-emoji img,
    .minigame-icon-wrapper img {
        max-width: 28px !important;
        max-height: 28px !important;
    }
    
    .minigame-icon-name {
        font-size: 9px;
    }
    
    .stat-row {
        padding: 8px;
        font-size: 12px;
    }
    
    .stat-row span:first-child {
        font-size: 11px;
    }
}

@media (orientation: landscape) {
    .main-game-area {
        padding: 10px;
        justify-content: flex-start;
    }
    
    .timer-container {
        padding: 20px 15px;
        margin-bottom: 10px;
    }
    
    .timer-icon {
        font-size: 40px;
        margin-bottom: 8px;
    }
    
    .timer-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .timer-display {
        font-size: 28px;
    }
    
    .timer-message {
        font-size: 14px;
    }
    
    .timer-reward {
        font-size: 16px;
    }
    
    .btn-timer {
        padding: 12px;
        font-size: 14px;
    }
    
    .top-bar {
        padding: 0;
        min-height: auto !important;
    }
    
    .top-bar-content {
        padding: 5px 12px !important;
        gap: 10px !important;
        line-height: 1;
    }
    
    .coins-display {
        font-size: 14px;
        gap: 8px;
    }
    
    .coin-item {
        padding: 4px 10px !important;
        gap: 6px !important;
        line-height: 1;
    }
    
    /* .user-info padding вже є 0 в базових стилях */
    .user-info {
        line-height: 1;
    }
    
    /* .coins-display gap: 8px вже визначено вище (рядок 1747) */
    
    .coins-display .coin-icon {
        width: 22px;
        height: 22px;
    }
    
    .coins-value {
        font-size: 16px;
        max-width: 85px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-badge {
        font-size: 8px;
        padding: 2px 5px;
    }
    
    .minigames-grid-container {
        padding: 0 10px;
        margin-top: 10px;
    }
    
    .minigame-icon {
        padding: 6px 3px;
        min-height: 60px;
    }
    
    .minigame-icon-wrapper {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        padding: 4px;
        box-sizing: border-box;
    }
    
    .minigame-icon-emoji {
        font-size: 20px;
    }
    
    .minigame-icon-emoji img,
    .minigame-icon-wrapper img {
        max-width: 28px !important;
        max-height: 28px !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        object-fit: contain !important;
    }
    
    .minigame-icon-name {
        font-size: 9px;
    }
    
    /* Зменшена висота меню для landscape орієнтації */
    .bottom-tabbar {
        height: 55px;
        padding: 5px 0 calc(5px + env(safe-area-inset-bottom));
    }
    
    .tabbar-icon {
        font-size: 18px;
    }
    
    .tabbar-label {
        font-size: 9px;
    }
    
    .hamster {
        width: 100px;
        height: 100px;
    }
    
    .bottom-panel {
        max-height: 40vh;
        padding: 10px;
    }
    
    .stat-row {
        padding: 8px;
        font-size: 12px;
    }
}

.tab-content::-webkit-scrollbar {
    width: 4px;
}

.tab-content::-webkit-scrollbar-track {
    background: transparent;
}

.tab-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* ========== СТИЛІ ДЛЯ СТОРІНОК TASKS ТА SHOP ========== */
.main-game-area--page {
    padding: 20px;
}

/* Календар: відступ знизу під таббар (~70px) + невеликий запас */
.game-container .main-game-area.calendar-page,
body .game-container .main-game-area.calendar-page {
    padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
}
@media (max-width: 480px) {
    .game-container .main-game-area.calendar-page,
    body .game-container .main-game-area.calendar-page {
        padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    }
}
@media (max-width: 360px) {
    .game-container .main-game-area.calendar-page,
    body .game-container .main-game-area.calendar-page {
        padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
    }
}

.page-title {
    color: white;
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
}

.page-content-box {
    background: var(--white-95);
    border-radius: 20px;
    padding: 20px;
}

.page-content-text {
    text-align: center;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

