/* =========================================
   1. ПЕРЕМЕННЫЕ И БАЗОВЫЕ НАСТРОЙКИ
   ========================================= */
:root {
    /* Размеры и отступы */
    --main-padding: 16px;
    --border-radius: 14px;
    --card-radius: 12px;

    /* По умолчанию — Telegram переменные с fallback на светлую тему */
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --text-color: var(--tg-theme-text-color, #1a1a2e);
    --hint-color: var(--tg-theme-hint-color, #8e8e93);
    --link-color: var(--tg-theme-link-color, #3390ec);
    --button-color: var(--tg-theme-button-color, #3390ec);
    --button-text-color: var(--tg-theme-button-text-color, #ffffff);
    --secondary-bg-color: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

/* ===== СВЕТЛАЯ ТЕМА (принудительная) ===== */
body.light-theme {
    --bg-color: #ffffff;
    --text-color: #1a1a2e;
    --hint-color: #8e8e93;
    --link-color: #3390ec;
    --button-color: #3390ec;
    --button-text-color: #ffffff;
    --secondary-bg-color: #f2f2f7;
}

/* ===== ТЁМНАЯ ТЕМА ===== */
body.dark-theme {
    --bg-color: #1c1c1e;
    --text-color: #f2f2f7;
    --hint-color: #8e8e93;
    --link-color: #64d2ff;
    --button-color: #0a84ff;
    --button-text-color: #ffffff;
    --secondary-bg-color: #2c2c2e;
}

/* ===== КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ ===== */
.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--secondary-bg-color);
    color: var(--text-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.3s ease, background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:active {
    transform: scale(0.85);
}

.theme-toggle i {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark-theme .theme-toggle i {
    transform: rotate(360deg);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    /* Скролл происходит внутри .view, а не в body */
    width: 100vw;
    height: 100vh;
    -webkit-user-select: none;
    user-select: none;
    /* Запрет выделения интерфейса */
    -webkit-text-size-adjust: 100%;
}

/* Разрешаем выделять текст в полях ввода и в ответе решения */
input,
textarea,
#res-response-content,
#res-request-content,
.quote-box {
    user-select: text;
    -webkit-user-select: text;
}

/* Ссылки без стандартного подчеркивания */
a {
    text-decoration: none;
    color: var(--link-color);
}

/* =========================================
   2. SPA АНИМАЦИИ И СТРУКТУРА
   ========================================= */
#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    /* Скролл внутри view */
    overflow-x: hidden;
    background-color: var(--bg-color);
    padding: var(--main-padding);
    padding-bottom: 80px;
    /* Отступ снизу, чтобы контент не перекрывался баром iPhone */
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1;
}

/* Активное окно */
.view.active {
    display: block;
    opacity: 1;
    z-index: 10;
}

/* =========================================
   3. ОБЩИЕ КОМПОНЕНТЫ UI
   ========================================= */

/* Карточки */
.card {
    background-color: var(--secondary-bg-color);
    border-radius: var(--card-radius);
    padding: var(--main-padding);
    margin-bottom: 15px;
}

.card-header {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--hint-color);
    margin-bottom: 10px;
    font-weight: 500;
}

/* Строки внутри карточек */
.card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-color);
    text-decoration: none;
    color: inherit;
}

.card-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.card-row:first-child {
    padding-top: 0;
}

.card-row-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Эффект нажатия */
.clickable {
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.clickable:active {
    opacity: 0.7;
    transform: scale(0.97);
}

/* Иконки */
.icon {
    width: 22px;
    height: 22px;
    color: var(--hint-color);
}

.icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.mini-icon {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

.prize-big-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}

/* Тексты */
.label {
    font-size: 16px;
}

.label.strong {
    font-weight: 600;
}

.name-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

.value {
    font-size: 16px;
    color: var(--hint-color);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.arrow {
    color: var(--hint-color);
    font-weight: bold;
}

/* Кнопки */
.main-button {
    background-color: var(--button-color);
    color: var(--button-text-color);
    border: none;
    padding: 12px 20px;
    width: 100%;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.15s ease, opacity 0.2s ease;
    line-height: 1;
}

.main-button:active {
    opacity: 0.8;
    transform: scale(0.97);
}

.main-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.secondary-button {
    background-color: transparent;
    color: var(--button-color);
    border: 1px solid var(--button-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.secondary-button:active {
    transform: scale(0.97);
    opacity: 0.8;
}

.button-outline {
    background-color: transparent;
    color: var(--button-color);
    border: 1px solid var(--button-color);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 8px;
}

.button {
    /* Маленькая залитая кнопка */
    background-color: var(--button-color);
    color: var(--button-text-color);
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.link-btn {
    color: var(--button-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-block;
    margin-top: 5px;
}

.link-btn-block {
    display: block;
    width: 100%;
    background-color: var(--button-color);
    color: var(--button-text-color);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: none;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.actions-wrapper {
    display: flex;
    align-items: center;
}

/* Заголовки */
.header-simple h1 {
    font-size: 24px;
    margin: 0 0 20px 0;
    font-weight: 700;
}

.header-centered {
    text-align: center;
    margin-bottom: 20px;
}

.header-centered h1 {
    font-size: 22px;
    margin: 10px 0 5px 0;
    font-weight: 700;
}

/* Лоадеры и пустые состояния */
.loader {
    text-align: center;
    padding: 20px;
    color: var(--hint-color);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    margin-top: 40px;
    color: var(--hint-color);
    font-size: 15px;
}


/* =========================================
   4. ПРОФИЛЬ (PROFILE VIEW)
   ========================================= */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
}

.user-info {
    min-width: 0;
    overflow: hidden;
}

.user-photo-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--secondary-bg-color);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 14px;
    color: var(--hint-color);
    margin-top: 4px;
}

/* Уровень и прогресс-бар */
.level-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.level-title {
    font-size: 16px;
    font-weight: 600;
}

.level-number {
    font-size: 14px;
    color: var(--hint-color);
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3390ec, #0078d7);
    width: 0%;
    transition: width 0.5s ease-out;
    border-radius: 4px;
}

.progress-fill {
    height: 100%;
    /* Возвращаем золотой градиент, как было в старой версии */
    background: linear-gradient(90deg, #fcd34d, #f59e0b);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.xp-text {
    font-size: 12px;
    color: var(--hint-color);
    text-align: right;
    margin-top: 6px;
}

.referral-hint {
    font-size: 10px;
    color: var(--hint-color);
    background: rgba(0, 0, 0, 0.03);
    padding: 8px;
    border-radius: 6px;
    margin: 10px 0;
    text-align: center;
}


/* =========================================
   5. РЕЗУЛЬТАТ (RESULT VIEW)
   ========================================= */
.content-block {
    background-color: var(--secondary-bg-color);
    border-radius: var(--card-radius);
    padding: var(--main-padding);
    margin-bottom: 15px;
}

/* ===== КАРТОЧКА ОЦЕНКИ ===== */
.fb-card {
    background: var(--secondary-bg-color);
    border-radius: var(--card-radius);
    padding: 14px;
    margin-bottom: 15px;
}

/* Управление видимостью через data-state */
.fb-card .fb-ask,
.fb-card .fb-form,
.fb-card .fb-done {
    display: none;
}

.fb-card[data-state="ask"] .fb-ask {
    display: block;
}

.fb-card[data-state="form"] .fb-ask,
.fb-card[data-state="form"] .fb-form {
    display: block;
}

.fb-card[data-state="sending"] .fb-ask {
    display: block;
}

.fb-card[data-state="done"] .fb-done {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Заголовок */
.fb-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--hint-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Кнопки выбора */
.fb-btns {
    display: flex;
    gap: 8px;
}

.fb-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

.fb-emoji {
    font-size: 24px;
    line-height: 1;
}

.fb-btn-label {
    font-size: 11px;
    color: var(--hint-color);
    font-weight: 500;
}

.fb-btn:active {
    transform: scale(0.93);
}

.fb-btn.active {
    border-color: var(--button-color);
    background: var(--button-color);
}

.fb-btn.active .fb-btn-label {
    color: var(--button-text-color);
}

/* В состоянии form — неактивные приглушены, можно переключить */
.fb-card[data-state="form"] .fb-btn:not(.active) {
    opacity: 0.4;
}

/* В состоянии sending — скрыть неактивные */
.fb-card[data-state="sending"] .fb-btn:not(.active) {
    display: none;
}

.fb-card[data-state="sending"] .fb-btn.active {
    flex: 0 0 auto;
    padding: 6px 16px;
    flex-direction: row;
    gap: 6px;
    cursor: default;
}

.fb-card[data-state="sending"] .fb-btns {
    justify-content: flex-start;
}


/* Textarea */
.fb-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, var(--hint-color) 40%, transparent);
    background: var(--bg-color);
    color: var(--text-color);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-top: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.fb-textarea:focus {
    border-color: var(--button-color);
}

/* Кнопка отправки */
.fb-submit {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: var(--button-color);
    color: var(--button-text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.fb-submit:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.fb-submit:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

/* Состояние «Готово» */
.fb-done-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fb-done-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--hint-color);
}

.fb-done-emoji {
    font-size: 22px;
}

.fb-done-comment {
    font-size: 13px;
    color: var(--hint-color);
    font-style: italic;
    display: none;
}

.fb-done-comment:not(:empty) {
    display: block;
}

.fb-done-thanks {
    font-size: 13px;
    color: var(--button-color);
    text-align: center;
    display: none;
}

.fb-done-thanks.visible {
    display: block;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.block-title {
    font-weight: 600;
    font-size: 16px;
}

.block-date {
    font-size: 13px;
    color: var(--hint-color);
}

/* Markdown Content */
#res-response-content,
#res-request-content {
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
}

#res-response-content img,
#res-request-content img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin: 10px 0;
    cursor: zoom-in;
}

/* Блоки кода и формулы */
#res-response-content pre {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    color: var(--text-color);
}

#res-response-content code {
    background: var(--bg-color);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

/* Feedback (Отзывы) */
.feedback-container {
    text-align: center;
}

.rating-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.rate-btn {
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--hint-color);
    background: transparent;
    cursor: pointer;
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rate-btn:active {
    transform: scale(0.9);
}

/* Цвета оценок при выборе */
.rate-btn.selected[data-val="1"] {
    background-color: #ff4d4d;
    border-color: #ff4d4d;
    color: white;
}

.rate-btn.selected[data-val="2"] {
    background-color: #ffcc00;
    border-color: #ffcc00;
    color: white;
}

.rate-btn.selected[data-val="3"] {
    background-color: #4cd964;
    border-color: #4cd964;
    color: white;
}

#feedback-comment {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--hint-color);
    background: var(--bg-color);
    color: var(--text-color);
    margin-bottom: 10px;
    font-family: inherit;
    resize: none;
}


/* =========================================
   6. РОЗЫГРЫШ (GIVEAWAY VIEW)
   ========================================= */
.info-text {
    font-size: 13px;
    color: var(--hint-color);
    background: var(--secondary-bg-color);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.progress-card {
    background: var(--secondary-bg-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
}

.tickets-info {
    font-size: 14px;
    color: var(--hint-color);
    margin-bottom: 5px;
}

.my-tickets {
    font-weight: 600;
    margin-top: 8px;
    font-size: 15px;
}

/* Grid билетов */
.grid-title {
    font-weight: 600;
    margin: 20px 0 10px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    padding-bottom: 20px;
}

.ticket-slot {
    aspect-ratio: 1;
    background: var(--secondary-bg-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--hint-color);
    position: relative;
    overflow: hidden;
}

.ticket-slot.taken {
    border-color: var(--tg-theme-hint-color);
}

.ticket-slot.free {
    color: var(--tg-theme-link-color);
    cursor: default;
}

.ticket-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* =========================================
   7. ТУРНИР (TOURNAMENT VIEW)
   ========================================= */
.timer-block {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: 0 4px 15px rgba(37, 117, 252, 0.3);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.timer-title {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.timer-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

.tournament-id {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    opacity: 0.7;
}

.info-block {
    background-color: var(--secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.info-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 10px;
}

.leaderboard-list {
    background-color: var(--secondary-bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Строки таблицы лидеров */
.lb-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--bg-color);
    min-width: 0;
}

.lb-row:last-child {
    border-bottom: none;
}

.lb-row.is-me {
    background-color: rgba(51, 144, 236, 0.1);
}

.lb-rank {
    width: 30px;
    font-weight: 600;
    color: var(--hint-color);
    flex-shrink: 0;
}

.lb-rank.top-1 {
    color: #FFD700;
    font-size: 18px;
}

.lb-rank.top-2 {
    color: #C0C0C0;
    font-size: 18px;
}

.lb-rank.top-3 {
    color: #CD7F32;
    font-size: 18px;
}

.lb-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.lb-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-score {
    font-size: 12px;
    color: var(--hint-color);
    flex-shrink: 0;
    white-space: nowrap;
}

.my-stats {
    text-align: center;
    margin-top: 15px;
    color: var(--hint-color);
    font-size: 13px;
}


/* =========================================
   8. REFERRAL GUIDE
   ========================================= */
.quote-box {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    font-style: italic;
    font-size: 14px;
    border-left: 3px solid var(--button-color);
}

/* =========================================
   9. СТИЛИ ДЛЯ ИСТОРИИ РОЗЫГРЫШЕЙ (КАК В СТАРОЙ ВЕРСИИ)
   ========================================= */
.history-card {
    background-color: var(--secondary-bg-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
}

.h-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    border-bottom: 1px solid var(--bg-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.h-date {
    font-size: 13px;
    color: var(--hint-color);
    font-weight: normal;
}

.winner-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 6px;
    align-items: center;
}

.winner-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.ticket-badge {
    background: var(--button-color);
    color: var(--button-text-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Стиль для слова "формула" в истории */
.math-tag {
    font-style: normal;
    color: var(--tg-theme-link-color);
}

/* =========================================
   10. SKELETON LOADING
   ========================================= */
@keyframes skeleton-loading {
    0% {
        background-color: var(--secondary-bg-color);
        opacity: 0.6;
    }

    50% {
        background-color: var(--hint-color);
        opacity: 0.2;
    }

    100% {
        background-color: var(--secondary-bg-color);
        opacity: 0.6;
    }
}

.skeleton {
    animation: skeleton-loading 1.5s infinite ease-in-out;
    border-radius: 6px;
    color: transparent !important;
    overflow: hidden;
    position: relative;
    user-select: none;
    pointer-events: none;
}

.skeleton * {
    visibility: hidden;
}

.skeleton-text {
    height: 1.2em;
    width: 60%;
    margin-bottom: 4px;
    display: inline-block;
}

.skeleton-text-short {
    width: 30%;
}

.skeleton-text-long {
    width: 90%;
}

.skeleton-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.skeleton-card {
    height: 80px;
    width: 100%;
}

/* =========================================
   11. ANIMATIONS
   ========================================= */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated-item {
    animation: slideInUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Stagger delays for list items */
.animated-item:nth-child(1) {
    animation-delay: 0.05s;
}

.animated-item:nth-child(2) {
    animation-delay: 0.10s;
}

.animated-item:nth-child(3) {
    animation-delay: 0.15s;
}

.animated-item:nth-child(4) {
    animation-delay: 0.20s;
}

.animated-item:nth-child(5) {
    animation-delay: 0.25s;
}

.animated-item:nth-child(6) {
    animation-delay: 0.30s;
}

.animated-item:nth-child(7) {
    animation-delay: 0.35s;
}

.animated-item:nth-child(8) {
    animation-delay: 0.40s;
}

.animated-item:nth-child(9) {
    animation-delay: 0.45s;
}

.animated-item:nth-child(10) {
    animation-delay: 0.50s;
}

.animated-item:nth-child(11) {
    animation-delay: 0.55s;
}

.animated-item:nth-child(12) {
    animation-delay: 0.60s;
}


/* =========================================
   11. ПРЕМИУМ МАГАЗИН (PREMIUM VIEW)
   ========================================= */

/* Карточка на профиле */
.premium-profile-card {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.08) 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

body.dark-theme .premium-profile-card {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 165, 0, 0.05) 100%);
    border-color: rgba(255, 215, 0, 0.15);
}

/* Корона */
.premium-crown-icon {
    font-size: 56px;
    margin-bottom: 4px;
    animation: crown-bounce 2s ease-in-out infinite;
}

@keyframes crown-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.premium-subtitle {
    color: var(--hint-color);
    font-size: 15px;
    margin: 0;
}

/* Баннер скидки */
.premium-discount-banner {
    background: linear-gradient(135deg, #FF6B35, #FF3D00);
    color: white;
    border-radius: var(--card-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: discount-pulse 2s ease-in-out infinite;
}

@keyframes discount-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 61, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 16px 4px rgba(255, 61, 0, 0.2);
    }
}

.discount-badge {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.discount-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

/* Преимущества */
.premium-benefits {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.benefit-item {
    flex: 1;
    background: var(--secondary-bg-color);
    border-radius: 10px;
    padding: 10px 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.benefit-item i {
    font-size: 20px;
    color: #FFD700;
}

/* Карточки тарифов */
.premium-plans {
    margin-bottom: 16px;
}

.plan-card {
    background: var(--secondary-bg-color);
    border-radius: var(--card-radius);
    padding: 16px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.plan-card-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.plan-card:active {
    transform: scale(0.98);
}

.plan-card.highlighted {
    border: 2px solid #FFD700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
}

.plan-card-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: linear-gradient(135deg, #FFD700, #FF8C00);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-bottom-left-radius: 8px;
    letter-spacing: 0.5px;
}

.plan-emoji {
    font-size: 32px;
    margin-right: 14px;
    flex-shrink: 0;
}

.plan-details {
    flex: 1;
    min-width: 0;
}

.plan-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.plan-desc {
    font-size: 12px;
    color: var(--hint-color);
}

.plan-per-day {
    font-size: 11px;
    color: var(--hint-color);
    margin-top: 2px;
}

.plan-price {
    text-align: right;
    flex-shrink: 0;
    margin-left: 12px;
}

.plan-price-current {
    font-size: 22px;
    font-weight: 800;
    color: var(--button-color);
}

.plan-price-original {
    font-size: 13px;
    color: var(--hint-color);
    text-decoration: line-through;
}

.plan-buy-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--button-color);
    color: var(--button-text-color);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.plan-buy-btn:active {
    transform: scale(0.97);
    opacity: 0.85;
}

/* Активная подписка */
.premium-active-sub {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(0, 200, 83, 0.08));
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: var(--card-radius);
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.active-sub-icon {
    font-size: 28px;
}

.active-sub-title {
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
}

.active-sub-expires {
    font-size: 13px;
    color: var(--hint-color);
    margin-top: 2px;
}

/* Футер */
.premium-footer {
    text-align: center;
    padding: 10px 0;
    margin-top: 8px;
}

.premium-footer p {
    font-size: 12px;
    color: var(--hint-color);
    margin: 2px 0;
}