:root {
    --bg-color: #3b1c34;
    --card-bg: rgba(255, 255, 255, 0.09);
    --card-border: rgba(255, 255, 255, 0.18);
    --accent-pink: #ff4d94;
    --accent-glow: rgba(255, 77, 148, 0.5);
    --text-main: #ffffff;
    --text-muted: #e6cce0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

button {
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    background: linear-gradient(180deg, #57294d 0%, #291124 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Кастомные иконки интерфейса */
.ui-icon,
.title-icon,
.inline-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.coin-icon-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.inline-icon-small {
    width: 15px;
    height: 15px;
}

.panel-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.panel-icon img {
    width: 21px;
    height: 21px;
    object-fit: contain;
}

.nav-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.boost-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

/* Полноэкранный фон */
.app-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url('tap_background_full.png');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
}

.app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 90px;
    position: relative;
}

/* Шапка */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-level {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.rating-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}

/* Счётчик и укороченная полоса опыта */
.score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-value {
    font-size: 40px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.currency-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.level-progress-box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.level-badge {
    background: var(--accent-pink);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.progress-bar-container {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-pink);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Центральная сцена с персонажем и боковыми блоками */
.center-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    margin: 5px 0;
}

.left-panels, .right-panels {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 98px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    pointer-events: none; /* Пропускает тапы сквозь пустой фон */
}

.left-panels .panel-card:first-child {
    margin-top: 11px;
    position: relative;
    left: -11px;
}

.left-panels .panel-card:last-child {
    margin-top: 1px;
    position: relative;
    left: -11px;
}

.panel-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 6px 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    backdrop-filter: blur(5px);
    pointer-events: auto;
}

.panel-icon {
    font-size: 16px;
}

.panel-title {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.panel-value {
    font-size: 14px;
    font-weight: 600;
}

.panel-value-small {
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: break-word;
    word-break: break-word;
}

.energy-bar-mini {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 2px;
    overflow: hidden;
}

.energy-bar-fill {
    height: 100%;
    background: var(--accent-pink);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Зона тапа / Персонаж */
.tap-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    position: relative;
}

.character-card {
    position: absolute;
    left: 50%;
    top: 50%;

    /* Обычное положение персонажа */
    transform: translate(calc(-52% + 10px), -25%);

    width: 330px;
    max-width: 100vw;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
    z-index: 2;
}

.character-card:active .character-img {
    transform: translateY(-1px) scale(0.96);
}

.character-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.4));
}

/* Лента призов внизу */
.prizes-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;

    /* СДВИГ ЛЕНТЫ ВНИЗ */
    transform: translateY(20px); /* Чем больше число (напр. 20px, 30px), тем НИЖЕ лента */
}

.section-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.prizes-track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.prize-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    min-width: 70px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    gap: 4px;
    position: relative;
}

.prize-item.claimed {
    border-color: var(--accent-pink);
}

.prize-img {
    font-size: 20px;
}

.prize-label {
    font-size: 9px;
    text-align: center;
    color: var(--text-muted);
}

.prize-status {
    position: absolute;
    bottom: 4px;
    font-size: 10px;
    color: var(--accent-pink);
    font-weight: bold;
}

/* Нижняя навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(59, 28, 52, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    cursor: pointer;
}

.nav-item.active {
    color: var(--accent-pink);
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal.open {
    display: flex;
}

.modal-content {
    background: #57294d;
    border: 1px solid var(--card-border);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.close-modal {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    font-size: 13px;
}

/* Профиль слева сверху */
.profile-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 100px;
    padding: 6px 12px 6px 6px;
    cursor: pointer;
    color: var(--text-main);
}

.profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff8fc0, var(--accent-pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.profile-level {
    font-size: 11px;
    color: var(--accent-pink);
    font-weight: 700;
}

.profile-name {
    font-size: 10px;
    color: var(--text-muted);
}

/* Экраны / вкладки */
.screen-hidden { display: none !important; }

.screen {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.screen-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 18px;
    font-weight: 700;
    margin-top: 6px;
}

.screen-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -4px;
}

/* Дневной бонус - кликабельная карточка */
.bonus-card {
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    align-self: center;
    text-align: left;
    padding-top: 8px;
    padding-bottom: 8px;

    /* СДВИГ КАРТОЧКИ ВПРАВО */
    position: relative;
    left: 39px; /* Чем больше значение (напр. 30px или 40px), тем правее будет кнопка */
    pointer-events: auto;
}

.bonus-card:disabled { opacity: 0.55; cursor: default; }
.bonus-card.ready {
    border: 1px solid var(--accent-pink);
    box-shadow: 0 0 16px var(--accent-glow);
    animation: bonus-pulse 1.6s ease-in-out infinite;
}
@keyframes bonus-pulse {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
    50% { box-shadow: 0 0 22px var(--accent-glow); }
}

/* Лента призов - реальные иконки */
.prize-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Список достижений */
.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.achievement-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievement-card.locked { opacity: 0.55; }

.achievement-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}
.achievement-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.achievement-avatar .lock-badge {
    position: absolute;
    inset: 0;
    background: rgba(20,5,16,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.achievement-body { flex: 1; }
.achievement-name { font-size: 13px; font-weight: 700; }
.achievement-req { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.achievement-check { color: var(--accent-pink); font-weight: 700; font-size: 16px; }

/* Список усилений */
.boosts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.boost-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.boost-icon { font-size: 26px; width: 40px; text-align: center; flex-shrink: 0; }

.boost-body { flex: 1; }
.boost-name { font-size: 13px; font-weight: 700; }
.boost-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.boost-level { font-size: 11px; color: var(--accent-pink); margin-top: 3px; font-weight: 600; }

.boost-buy-btn {
    background: var(--accent-pink);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 78px;
}
.boost-buy-btn:disabled {
    background: rgba(255,255,255,0.12);
    color: var(--text-muted);
    cursor: default;
}

/* Реферальная система — в стиле существующих элементов Tapalka */
.referral-open-btn {
    width: 100%;
    margin-top: 2px;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}
.referral-open-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.13);
}
.referral-modal-content { gap: 15px; }
.referral-text { color: var(--text-muted); font-size: 13px; line-height: 1.45; }
.referral-link-box {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 11px;
    min-height: 42px;
    display: flex;
    align-items: center;
    font-size: 11px;
    word-break: break-all;
}
.referral-copy-btn, .referral-share-btn {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 12px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.referral-copy-btn { background: var(--accent-pink); }
.referral-share-btn { background: rgba(255, 255, 255, 0.10); }
.referral-stats { display: flex; gap: 10px; }
.referral-stats > div {
    flex: 1;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px;
}
.referral-stats span { display: block; font-size: 20px; font-weight: 800; }
.referral-stats small { color: var(--text-muted); font-size: 10px; }

/* Профиль модалка */
.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-stat-row {
    display: flex;
    justify-content: space-between;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
}
.profile-stat-row b { color: var(--accent-pink); }

/* Тост уведомление */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    background: var(--accent-pink);
    color: white;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 1200;
    transition: transform 0.3s ease;
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Анимация персонажа при тапе */
.character-img.tapped { animation: char-bounce 0.22s ease-out; }
@keyframes char-bounce {
    0% { transform: scale(1) rotate(0deg); }
    40% { transform: scale(1.01) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.floating-plus {
    position: fixed;
    color: #ff5c9f;
    font-weight: 800;
    font-size: 20px;
    pointer-events: none;
    z-index: 500;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

/* Заставка при запуске */
.splash-screen {
    position: fixed;
    inset: 0;
    background: #0d0410;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}
.splash-screen.hide {
    opacity: 0;
    pointer-events: none;
}
.splash-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Аватар профиля */
.profile-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

/* =========================================================
   НОВЫЕ КНОПКИ «КЕЙСЫ / РЕЙТИНГ»
   ========================================================= */
.main-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 10px;
    margin-top: auto;
}

.main-action-btn {
    min-height: 82px;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}

.main-action-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.11);
}

.main-action-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

/* На ПК сохраняем мобильную композицию, но даём ей достаточно места.
   Эти правила НЕ влияют на телефоны. */
@media (min-width: 700px) {
    body {
        align-items: stretch;
        background-color: #291124;
    }

    .app-container {
        width: min(900px, 100vw);
        max-width: 900px;
        min-height: 100vh;
        padding: 20px 28px 96px;
        gap: 14px;
        margin: 0 auto;
    }

    .header {
        min-height: 48px;
    }

    .profile-pill {
        padding: 7px 14px 7px 7px;
    }

    .profile-avatar-img {
        width: 38px;
        height: 38px;
    }

    .profile-level {
        font-size: 14px;
    }

    .profile-name {
        font-size: 12px;
    }

    .score-section {
        gap: 4px;
    }

    .score-value {
        font-size: 54px;
    }

    .currency-label {
        font-size: 18px;
    }

    .center-stage {
        height: 510px;
        min-height: 510px;
        margin: 0;
        align-items: stretch;
    }

    .left-panels,
    .right-panels {
        width: 190px;
        gap: 12px;
        justify-content: center;
        z-index: 10;
    }

    .left-panels .panel-card:first-child,
    .left-panels .panel-card:last-child {
        margin-top: 0;
        left: 0;
    }

    .panel-card {
        border-radius: 18px;
        padding: 14px 13px;
        gap: 7px;
        min-height: 118px;
        backdrop-filter: blur(10px);
    }

    .panel-icon img {
        width: 28px;
        height: 28px;
    }

    .panel-title {
        font-size: 16px;
    }

    .panel-value {
        font-size: 18px;
    }

    .panel-value-small {
        font-size: 16px;
    }

    .energy-bar-mini {
        height: 7px;
        border-radius: 4px;
        margin-top: 3px;
    }

    .tap-zone {
        height: 100%;
        flex: 1;
    }

    .character-card {
        width: min(520px, 55vw);
        max-width: 520px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .bonus-card {
        left: 0;
        width: 100%;
        text-align: left;
    }

    .main-action-buttons {
        margin-top: 0;
        gap: 14px;
        padding: 12px;
        border-radius: 20px;
    }

    .main-action-btn {
        min-height: 120px;
        border-radius: 18px;
        font-size: 20px;
    }

    .main-action-icon {
        width: 40px;
        height: 40px;
    }

    .bottom-nav {
        width: min(900px, 100vw);
        max-width: 900px;
        padding: 12px 0;
    }

    .nav-item {
        font-size: 13px;
        gap: 6px;
    }

    .nav-icon,
    .nav-icon img {
        width: 30px;
        height: 30px;
    }
}
