/* style.css — BitSec UI с поддержкой темы Telegram */

:root {
    /* Базовые цвета (переопределяются через JS под тему Telegram) */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-success: #00d68f;
    --accent-warning: #ffb84d;
    --accent-danger: #ff4d6a;

    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Telegram theme variables (fallback) */
    --tg-bg-color: var(--bg-primary);
    --tg-text-color: var(--text-primary);
    --tg-hint-color: var(--text-muted);
    --tg-button-color: var(--accent-primary);
    --tg-button-text: #ffffff;
}

/* === Базовые стили === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

body {
    padding: 0;
    min-height: 100dvh;
}

#app {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: 16px 14px 24px;
}

/* === Экраны === */
.screen {
    display: none;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Hero секция === */
.hero {
    text-align: center;
    padding: 24px 0 32px;
    animation: slideUp 0.6s ease;
}

.hero-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

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

    50% {
        transform: translateY(-10px);
    }
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

/* === Карточки фич === */
.features {
    display: grid;
    gap: 12px;
    margin: 24px 0 32px;
    animation: slideUp 0.6s ease 0.1s backwards;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 15px;
    font-weight: 500;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-primary);
}

.feature-icon {
    font-size: 24px;
}

/* === CTA секция === */
.cta-section {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    animation: slideUp 0.6s ease 0.2s backwards;
}

.cta-text {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.cta-text b {
    color: var(--text-primary);
}

.hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

/* === Кнопки === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 17px;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 14px;
    width: auto;
}

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

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.6);
}

.btn-glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }

    to {
        box-shadow: 0 4px 30px rgba(118, 75, 162, 0.7);
    }
}

.btn-success {
    background: linear-gradient(135deg, #00d68f 0%, #00b87a 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 214, 143, 0.4);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 6px 28px rgba(0, 214, 143, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(102, 126, 234, 0.1);
}

.btn-icon-inner {
    font-size: 20px;
}

/* === Дашборд === */
.dashboard-header {
    text-align: center;
    padding: 16px 0 24px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(0, 214, 143, 0.15);
    border: 1px solid rgba(0, 214, 143, 0.3);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-success);
    margin-bottom: 16px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.dashboard-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* === Карточка пользователя === */
.user-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.balance-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.balance-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.balance-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

.promo-card {
    padding: 14px 18px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.promo-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.promo-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.promo-row input,
.referral-form-input,
.referral-form-textarea {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input, var(--bg-card));
    color: var(--text-primary);
    font-size: 14px;
}

.referral-form-textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 96px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.45;
}

.referral-form-panel {
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.referral-form-panel.hidden {
    display: none !important;
}

.referral-form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    line-height: 1.45;
}

.referral-form-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin: 10px 0 6px 0;
}

.referral-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.referral-form-actions .btn-sm {
    flex: 1;
    min-width: 100px;
}

.referral-form-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.promo-row .btn-sm {
    padding: 10px 14px;
    white-space: nowrap;
    font-size: 13px;
}

.devices-extra-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.devices-extra-row.hidden {
    display: none;
}

.devices-extra-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
}

.user-username {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-subtype {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 500;
    text-transform: capitalize;
}

.user-tgid {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.user-tgid.user-tgid-copyable {
    cursor: pointer;
    transition: color 0.15s ease, opacity 0.15s ease;
}

.user-tgid.user-tgid-copyable:hover {
    color: var(--accent-primary);
}

.user-tgid.user-tgid-copyable:active {
    opacity: 0.75;
}

.gift-modal-lead {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.gift-anon-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 14px;
    font-size: 14px;
    color: var(--text-primary);
}

.gift-periods-label {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.gift-period-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.gift-period-btn {
    flex: 1 1 calc(33% - 8px);
    min-width: 88px;
    padding: 10px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.gift-period-btn.active {
    border-color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent-primary);
}

.gift-price-hint {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.tile-gift::before {
    background: linear-gradient(135deg, rgba(255, 184, 77, 0.2), rgba(255, 120, 180, 0.15));
}

.tile-history::before {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(129, 140, 248, 0.18));
}

.tx-history-modal {
    max-width: 420px;
    max-height: min(88vh, 640px);
    display: flex;
    flex-direction: column;
}

.tx-history-lead {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.tx-history-loading,
.tx-history-empty {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    padding: 20px 8px;
}

.tx-history-list {
    flex: 1;
    min-height: 120px;
    max-height: 52vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.tx-history-item {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.tx-history-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.tx-history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.tx-history-item-amount {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.tx-history-item-amount.positive {
    color: var(--accent-success);
}

.tx-history-item-amount.negative {
    color: var(--accent-danger);
}

.tx-history-item-meta,
.tx-history-item-date {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tx-history-item-balance {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted, var(--text-secondary));
}

/* === Таймер === */
.timer-card {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
    margin-bottom: 24px;
}

.timer-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.timer-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.timer-value {
    font-size: 32px;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-unit-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: lowercase;
    margin-top: 4px;
}

.timer-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--bg-gradient);
    border-radius: 2px;
    transition: width 1s linear;
}

/* === Devices === */
.devices-card {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 18px;
    overflow: hidden;
}

.devices-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 4px 8px;
}

.devices-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.devices-counter {
    font-size: 14px;
    color: var(--accent-primary);
    font-weight: 500;
}

.devices-toggle-btn {
    border: 1px solid rgba(102, 126, 234, 0.45);
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.devices-toggle-btn:hover {
    background: rgba(102, 126, 234, 0.2);
}

.devices-chevron {
    font-size: 18px;
    color: var(--text-primary);
    transition: transform 0.2s ease;
}

.devices-toggle-btn[aria-expanded="true"] .devices-chevron {
    transform: rotate(180deg);
}

.devices-panel {
    margin-top: 10px;
    max-height: 420px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}

.devices-panel.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.devices-table {
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.01);
    width: 100%;
}

.devices-row {
    display: grid;
    grid-template-columns: 36px 1fr 40px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.devices-row:last-child {
    border-bottom: none;
}

.devices-row-head {
    font-size: 12px;
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.15);
    font-weight: 600;
}

.devices-row-empty {
    color: var(--text-muted);
}

.devices-row span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-remove-btn {
    border: none;
    background: transparent;
    color: var(--accent-danger);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.device-remove-btn:hover {
    opacity: 1;
}

.device-remove-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.device-cooldown {
    font-size: 12px;
    color: var(--accent-warning);
    font-weight: 600;
    white-space: nowrap;
}

/* === Actions === */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* === Tiles Grid (secondary actions) === */
.tiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-family: inherit;
    min-height: 88px;
    position: relative;
    overflow: hidden;
}

.tile-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tile-btn:hover::before {
    opacity: 1;
}

.tile-btn:active {
    transform: scale(0.96);
}

.tile-icon {
    font-size: 26px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.tile-btn:hover .tile-icon {
    transform: scale(1.15);
}

.tile-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* Акцент: Купить подписку */
.tile-btn.tile-premium {
    border-color: rgba(102, 126, 234, 0.4);
    background: rgba(102, 126, 234, 0.07);
}

.tile-btn.tile-premium:hover {
    border-color: rgba(102, 126, 234, 0.7);
    background: rgba(102, 126, 234, 0.14);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.tile-btn.tile-premium .tile-label {
    color: #a5b4fc;
}

/* Акцент: Реферальная программа */
.tile-btn.tile-referral {
    border-color: rgba(0, 214, 143, 0.35);
    background: rgba(0, 214, 143, 0.06);
}

.tile-btn.tile-referral:hover {
    border-color: rgba(0, 214, 143, 0.65);
    background: rgba(0, 214, 143, 0.12);
    box-shadow: 0 4px 16px rgba(0, 214, 143, 0.2);
}

.tile-btn.tile-referral .tile-label {
    color: #6ee7b7;
}

/* Акцент: Инструкции (Telegraph) */
.tile-btn.tile-instructions {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.06);
}

.tile-btn.tile-instructions:hover {
    border-color: rgba(56, 189, 248, 0.65);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.22);
}

.tile-btn.tile-instructions .tile-label {
    color: #7dd3fc;
}

/* Акцент: Помощь */
.tile-btn.tile-help {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.05);
}

.tile-btn.tile-help:hover {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.1);
    box-shadow: 0 4px 16px rgba(248, 113, 113, 0.18);
}

.tile-btn.tile-help .tile-label {
    color: #fca5a5;
}

/* === Info box === */
.info-box {
    padding: 16px 20px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-secondary);
}

.info-box p {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.info-box ol {
    padding-left: 20px;
    line-height: 1.6;
}

.info-box li {
    margin-bottom: 4px;
}

/* === Экран ошибки === */
.error-card {
    text-align: center;
    padding: 32px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.error-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.error-card h3 {
    font-size: 22px;
    margin-bottom: 12px;
}

.error-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.error-actions .btn {
    width: 100%;
}

.status-badge.status-expired {
    background: rgba(255, 77, 106, 0.12);
    border-color: rgba(255, 77, 106, 0.35);
    color: var(--accent-danger);
}

.status-badge.status-expired .status-dot {
    background: var(--accent-danger);
    animation: none;
}

/* === Лоадер === */
.loader-container {
    text-align: center;
    padding: 40px 20px;
}

.loader {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.loader-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

/* === Toast уведомления === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-width: 90%;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        visibility 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.toast.hidden {
    display: none !important;
}

.toast.success {
    border-color: var(--accent-success);
    background: rgba(0, 214, 143, 0.15);
    color: var(--accent-success);
}

.toast.error {
    border-color: var(--accent-danger);
    background: rgba(255, 77, 106, 0.15);
    color: var(--accent-danger);
}

/* === Адаптив === */
@media (max-height: 700px) {
    #app {
        padding-top: 10px;
    }

    .hero {
        padding: 16px 0 24px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .hero-icon {
        font-size: 52px;
    }

    .timer-value {
        font-size: 26px;
    }
}

@media (max-width: 360px) {
    .timer-display {
        gap: 6px;
    }

    .timer-unit {
        min-width: 56px;
    }

    .timer-value {
        font-size: 24px;
    }
}

/* === Поддержка светлой темы Telegram === */
body.telegram-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-card: #ffffff;
    --text-primary: #000000;
    --text-secondary: #555555;
    --text-muted: #999999;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
}

body.telegram-light .feature-card,
body.telegram-light .user-card,
body.telegram-light .timer-card,
body.telegram-light .error-card {
    box-shadow: var(--shadow-sm);
}

/* === Модальное окно === */
.modal {
    position: fixed !important;
    /* Принудительно fixed */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    /* Чуть темнее */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 9999 !important;
    /* Очень высокий z-index */
    animation: modalSlideUp 0.3s ease;
    backdrop-filter: blur(4px);
    /* Размытие фона */
}

@media (min-width: 768px) {
    .modal {
        align-items: center;
    }
}

.modal.hidden {
    display: none !important;
}

/* === Модалка выбора приложений (Улучшенная) === */
.modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 20px 40px;
    position: relative;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
    }
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

/* Шапка модалки выбора ОС: заголовок по центру, крестик справа */
#appSelectModal .modal-header-app-select {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

#appSelectModal .modal-header-app-select h3 {
    margin: 0;
    padding: 0 40px;
    text-align: center;
}

#appSelectModal .modal-header-app-select .btn-close {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.btn-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Сетка приложений плиточками */
.app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.app-card:active {
    transform: scale(0.95);
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--accent-primary);
}

.app-card.hidden {
    display: none !important;
}

.app-card .app-icon {
    font-size: 32px;
    margin-bottom: 12px;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.app-card .app-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.app-card:hover .app-icon {
    transform: scale(1.1) rotate(5deg);
}

.app-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.app-card p {
    font-size: 11px;
    color: var(--text-muted);
}

.app-card .app-arrow {
    display: none;
    /* Прячем стрелку в плиточном режиме */
}

/* Определение устройства */
.device-detect-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.device-detect-info .device-icon {
    font-size: 20px;
}

.device-detect-info b {
    color: var(--accent-primary);
}

/* Экран подключения */
#connectScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 100;
    padding: 20px;
    overflow-y: auto;
}

#connectScreen.active {
    display: block;
}

#connectScreen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-content {
    background: var(--bg-secondary, #1e1e2e);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-content {
        border-radius: 20px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #333);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.modal-close:hover {
    background: var(--hover-bg, #333);
}

/* Информация об устройстве */
.device-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card-bg, #2a2a3e);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.device-icon {
    font-size: 1.4rem;
}

/* Список приложений */
.apps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--card-bg, #2a2a3e);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.app-card:hover,
.app-card:active {
    background: var(--hover-bg, #333);
    border-color: var(--accent-color, #6366f1);
    transform: translateY(-2px);
}

.app-icon {
    font-size: 1.8rem;
    width: 40px;
    text-align: center;
}

.app-info {
    flex: 1;
}

.app-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
}

.app-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.app-arrow {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.modal-hint {
    margin-top: 16px;
    padding: 12px;
    background: var(--info-bg, #1e3a5f);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === Экран подключения === */
.connect-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    column-gap: 8px;
    padding: 44px 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.connect-header > .btn-back {
    grid-column: 1;
    justify-self: start;
    align-self: center;
}

.connect-header-inner {
    grid-column: 2;
    text-align: center;
    min-width: 0;
}

.connect-header-inner h2 {
    margin: 0;
    font-size: 1.3rem;
}

.btn-back {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--accent-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
}

.btn-back:hover {
    background: var(--hover-bg);
}

/* Стили для предупреждения о лимите */
.warning-modal {
    text-align: center;
    padding: 32px 24px;
}

.warning-body {
    margin-bottom: 24px;
}

.warning-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.warning-body p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.connect-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--card-bg);
    border-radius: 14px;
    font-weight: 500;
}

.selected-app-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.selected-app-icon-img {
    display: block;
    border-radius: 8px;
}

/* Ссылки на магазины */
.store-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.store-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.store-btn-icon {
    flex-shrink: 0;
    border-radius: 6px;
    object-fit: contain;
}

.store-btn:hover {
    border-color: var(--accent-color);
    background: var(--hover-bg);
}

.store-btn img {
    height: 20px;
    width: auto;
}

/* Поле подписки */
.subscription-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subscription-copy-link {
    margin-top: 2px;
    align-self: center;
    font-size: 13px;
    padding: 8px 14px;
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
}

.subscription-copy-link:hover {
    border-color: rgba(251, 191, 36, 0.45);
    color: #fcd34d;
}

.subscription-label {
    margin: 0;
    font-size: 0.95rem;
}

.subscription-box {
    display: flex;
    gap: 8px;
    background: var(--code-bg, #1a1a2e);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.subscription-box code {
    flex: 1;
    padding: 12px;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--accent-color);
    background: none;
    border: none;
}

.btn-copy {
    background: var(--accent-color);
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: opacity 0.2s;
}

.btn-copy:hover {
    opacity: 0.9;
}

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

.subscription-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Шаги подключения */
.steps-guide {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 14px;
}

.steps-guide ol {
    margin: 8px 0 0 20px;
    padding: 0;
}

.steps-guide li {
    margin: 6px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.btn-modal-back {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0 10px;
}

.btn-modal-back.hidden {
    display: none;
}

.section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-section,
.subscription-section,
.action-section {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.action-section {
    border-color: var(--accent-primary);
}

.instructions-modal-lead {
    margin: 0 0 14px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.45;
}

#instructionsModal .modal-content.instructions-modal {
    max-height: min(78vh, 560px);
    overflow-y: auto;
}

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

.instruction-guide-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(102, 126, 234, 0.06);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.instruction-guide-row:hover {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.1);
}

.instruction-guide-row .instruction-guide-chev {
    flex-shrink: 0;
    font-size: 18px;
    color: var(--text-muted, #888);
}

.bug-report-bar {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.bug-report-open-btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.08);
    color: #fca5a5;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.bug-report-open-btn:hover {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(248, 113, 113, 0.14);
}

#bugReportModal .modal-content.bug-report-modal {
    max-height: min(85vh, 620px);
    overflow-y: auto;
}

.bug-report-lead {
    margin: 0 0 14px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.bug-report-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bug-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bug-field > span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.bug-field input,
.bug-field select,
.bug-field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card, #151822);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}

.bug-field textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.45;
}

.bug-field input:focus,
.bug-field select:focus,
.bug-field textarea:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.55);
}

.bug-report-hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted, #888);
}

.hidden {
    display: none !important;
}

/* === Экран тарифов === */
.tariffs-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    column-gap: 8px;
    padding: 16px 12px 24px;
}

.tariffs-header > .btn-back {
    grid-column: 1;
    justify-self: start;
    align-self: center;
}

.tariffs-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.tariffs-header-inner {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    min-width: 0;
}

.tariffs-balance-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.tariffs-balance-hint strong {
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 120px;
}

.tariff-card .period-btn.purchase-btn {
    cursor: pointer;
}

.tariff-card .period-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.tariff-card .period-btn.soft-disabled {
    opacity: 0.75;
    border-style: dashed;
}

.tariff-pay-hint {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.auto-renew-card {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.auto-renew-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.auto-renew-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.auto-renew-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.auto-renew-periods {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.auto-renew-periods.hidden {
    display: none;
}

.auto-renew-periods-label {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auto-renew-period-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auto-renew-period-btn {
    flex: 1 1 calc(33% - 8px);
    min-width: 88px;
    padding: 10px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.auto-renew-period-btn.active {
    border-color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    transition: 0.2s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.tariffs-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.tariff-card {
    position: relative;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, border-color 0.2s;
    overflow: hidden;
}

.tariff-card:hover {
    border-color: var(--accent-primary);
}

.tariff-card.hit {
    border: 2px solid var(--accent-warning);
    box-shadow: 0 0 25px rgba(255, 184, 77, 0.35);
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(255, 184, 77, 0.05) 100%);
}

.hit-badge {
    position: absolute;
    top: 10px;
    right: -35px;
    background: linear-gradient(90deg, #ffb84d 0%, #ff8c00 100%);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 40px;
    transform: rotate(45deg);
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.tariff-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tariff-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.tariff-limits {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.limit-item {
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.tariff-periods {
    display: grid;
    gap: 10px;
}

.period-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--accent-primary);
}

.period-price {
    font-weight: 700;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.price-strike {
    text-decoration: line-through;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9em;
}

.price-with-discount {
    font-weight: 700;
    color: var(--accent-primary);
}

.devices-extra-hint .price-strike {
    margin-right: 4px;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === Реферальный экран === */
.referral-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
}

.referral-stat-icon {
    font-size: 22px;
}

.referral-stat-value {
    font-size: 20px;
    font-weight: 700;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.referral-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.referral-link-card {
    padding: 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.referral-link-box {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent-primary);
    word-break: break-all;
    font-family: monospace;
    border: 1px solid rgba(102, 126, 234, 0.2);
    user-select: all;
}

.referral-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.ref-tab-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ref-tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.withdrawal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.withdrawal-amount {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.withdrawal-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
}

.status-approved,
.status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.withdrawal-date {
    font-size: 12px;
    color: var(--text-muted);
}

.withdrawal-tx {
    margin-top: 8px;
    font-size: 13px;
}

.withdrawal-tx a {
    color: #60a5fa;
    text-decoration: underline;
}

/* === BitSecurity brand refresh (mini-app only) === */
:root {
    --bg-primary: #f7f9ff;
    --bg-secondary: #eef3ff;
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-input: #ffffff;
    --bg-gradient: linear-gradient(135deg, #0b2ba8 0%, #1237c5 48%, #4f7cff 100%);
    --brand-blue: #1237c5;
    --brand-blue-deep: #0b2ba8;
    --brand-blue-soft: #eef3ff;
    --brand-ink: #10162f;
    --card-bg: rgba(255, 255, 255, 0.88);
    --hover-bg: #eef3ff;
    --accent-color: #1237c5;
    --code-bg: #eef3ff;
    --text-primary: #10162f;
    --text-secondary: #46516f;
    --text-muted: #8190b1;
    --accent-primary: #1237c5;
    --accent-secondary: #4f7cff;
    --accent-success: #14b8a6;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --border-color: rgba(18, 55, 197, 0.14);
    --shadow-sm: 0 8px 24px rgba(18, 55, 197, 0.08);
    --shadow-lg: 0 18px 54px rgba(18, 55, 197, 0.16);
}

html,
body {
    background:
        radial-gradient(circle at 10% -10%, rgba(79, 124, 255, 0.24), transparent 36%),
        radial-gradient(circle at 98% 8%, rgba(18, 55, 197, 0.13), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #f7f9ff 42%, #eef3ff 100%);
    color: var(--text-primary);
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

body::before {
    width: 280px;
    height: 280px;
    top: -120px;
    left: -96px;
    border: 2px solid rgba(18, 55, 197, 0.13);
    border-radius: 50%;
}

body::after {
    width: 220px;
    height: 70px;
    right: -92px;
    top: 92px;
    border: 7px solid rgba(18, 55, 197, 0.12);
    border-left-color: transparent;
    border-radius: 50%;
    transform: rotate(-22deg);
}

#app {
    position: relative;
    z-index: 1;
    padding: 18px 16px 28px;
}

.screen {
    position: relative;
}

.screen::before {
    content: '';
    position: absolute;
    right: 10px;
    top: 10px;
    width: 14px;
    height: 14px;
    background: var(--bg-gradient);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0.26;
    pointer-events: none;
}

.hero {
    padding: 20px 0 28px;
}

.hero-logo-wrap {
    position: relative;
    width: 164px;
    height: 164px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
}

.hero-logo {
    position: relative;
    z-index: 2;
    width: 144px;
    height: 144px;
    border-radius: 40px;
    box-shadow: 0 20px 52px rgba(18, 55, 197, 0.22);
    animation: float 4s ease-in-out infinite;
}

.brand-orbit {
    position: absolute;
    inset: 18px 0;
    border: 3px solid rgba(18, 55, 197, 0.18);
    border-left-color: transparent;
    border-radius: 50%;
    transform: rotate(-18deg);
}

.brand-orbit-two {
    inset: 44px -6px;
    border-width: 2px;
    opacity: 0.7;
    transform: rotate(18deg);
}

.brand-kicker {
    color: var(--brand-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.hero h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
}

.features {
    gap: 10px;
    margin: 18px 0 22px;
}

.feature-card,
.user-card,
.balance-card,
.promo-card,
.timer-card,
.devices-card,
.info-box,
.store-section,
.subscription-section,
.action-section,
.tariff-card,
.referral-stat-card,
.referral-link-card,
.referral-form-panel,
.withdrawal-card,
.error-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
}

.feature-card {
    min-height: 64px;
    border-radius: 22px;
}

.feature-icon,
.tile-icon,
.btn-icon-inner,
.warning-icon,
.error-icon,
.referral-stat-icon {
    filter: saturate(0.85);
}

.cta-section,
.timer-card,
.devices-card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(238, 243, 255, 0.88)),
        radial-gradient(circle at 90% 10%, rgba(79, 124, 255, 0.14), transparent 38%);
    box-shadow: var(--shadow-lg);
}

.cta-section {
    border-color: rgba(18, 55, 197, 0.18);
}

.cta-text {
    color: var(--text-secondary);
}

.cta-text b,
.info-box p,
.timer-label,
.devices-title {
    color: var(--text-primary);
}

.btn {
    border-radius: 18px;
    box-shadow: none;
}

.btn-primary,
.btn-success {
    background: var(--bg-gradient);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(18, 55, 197, 0.22);
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    box-shadow: 0 16px 34px rgba(18, 55, 197, 0.28);
}

@keyframes glow {
    from {
        box-shadow: 0 12px 26px rgba(18, 55, 197, 0.18);
    }
    to {
        box-shadow: 0 18px 42px rgba(79, 124, 255, 0.34);
    }
}

.btn-secondary {
    background: #ffffff;
    color: var(--brand-blue);
    border: 1px solid rgba(18, 55, 197, 0.22);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--brand-blue-soft);
}

.btn-ghost,
.subscription-copy-link {
    background: transparent;
    border: 1px dashed rgba(18, 55, 197, 0.24);
    color: var(--text-secondary);
}

.dashboard-header {
    padding: 6px 0 20px;
}

.screen-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(18, 55, 197, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-blue);
    font-size: 13px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.screen-brand img,
.loader-logo {
    border-radius: 12px;
}

.status-badge {
    background: rgba(20, 184, 166, 0.12);
    border-color: rgba(20, 184, 166, 0.24);
    color: #0f9488;
}

.user-avatar {
    background: #ffffff;
    border: 1px solid rgba(18, 55, 197, 0.14);
    box-shadow: 0 10px 24px rgba(18, 55, 197, 0.12);
}

.user-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: block;
    object-fit: cover;
}

.user-avatar.has-photo {
    padding: 0;
    overflow: hidden;
    background: var(--brand-blue-soft);
}

.user-avatar.has-photo img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.balance-value,
.user-subtype,
.devices-counter,
.period-price,
.price-with-discount {
    color: var(--brand-blue);
}

.promo-row input,
.referral-form-input,
.referral-form-textarea,
.bug-field input,
.bug-field select,
.bug-field textarea {
    background: #ffffff;
    border-color: rgba(18, 55, 197, 0.16);
    color: var(--text-primary);
}

.promo-row input:focus,
.referral-form-input:focus,
.referral-form-textarea:focus,
.bug-field input:focus,
.bug-field select:focus,
.bug-field textarea:focus {
    outline: none;
    border-color: rgba(18, 55, 197, 0.42);
    box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.timer-value,
.tariff-name,
.referral-stat-value {
    background: var(--bg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-progress {
    height: 6px;
    background: rgba(18, 55, 197, 0.1);
}

.devices-toggle-btn,
.btn-back,
.btn-close {
    background: rgba(18, 55, 197, 0.08);
    border: 1px solid rgba(18, 55, 197, 0.14);
    color: var(--brand-blue);
}

.devices-chevron {
    color: var(--brand-blue);
}

.devices-table {
    background: #ffffff;
    border-color: rgba(18, 55, 197, 0.12);
}

.devices-row-head {
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
}

.tiles-grid {
    gap: 12px;
}

.tile-btn {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(18, 55, 197, 0.14);
    border-radius: 24px;
    box-shadow: var(--shadow-sm);
}

.tile-btn::before {
    background:
        radial-gradient(circle at 28% 20%, rgba(79, 124, 255, 0.16), transparent 38%),
        linear-gradient(135deg, rgba(18, 55, 197, 0.08), rgba(255, 255, 255, 0));
}

.tile-btn:hover,
.tile-btn:active,
.tile-btn.tile-premium:hover,
.tile-btn.tile-referral:hover,
.tile-btn.tile-instructions:hover,
.tile-btn.tile-help:hover {
    border-color: rgba(18, 55, 197, 0.28);
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(18, 55, 197, 0.14);
}

.tile-btn.tile-premium,
.tile-btn.tile-referral,
.tile-btn.tile-instructions,
.tile-btn.tile-help {
    border-color: rgba(18, 55, 197, 0.14);
    background: rgba(255, 255, 255, 0.82);
}

.tile-btn.tile-premium .tile-label,
.tile-btn.tile-referral .tile-label,
.tile-btn.tile-instructions .tile-label,
.tile-btn.tile-help .tile-label {
    color: var(--text-secondary);
}

.tile-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
}

.info-box {
    background:
        linear-gradient(145deg, rgba(238, 243, 255, 0.82), rgba(255, 255, 255, 0.9));
}

.bug-report-bar {
    border-top-color: rgba(18, 55, 197, 0.12);
}

.bug-report-open-btn {
    border-color: rgba(239, 68, 68, 0.18);
    background: rgba(255, 255, 255, 0.72);
    color: #b91c1c;
    box-shadow: var(--shadow-sm);
}

.bug-report-open-btn:hover {
    border-color: rgba(239, 68, 68, 0.34);
    background: #fff6f6;
}

.loader-container {
    min-height: 70dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loader-logo {
    margin-bottom: 18px;
    box-shadow: var(--shadow-lg);
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(18, 55, 197, 0.1);
    border-top-color: var(--brand-blue);
}

.toast {
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-primary);
    border-color: rgba(18, 55, 197, 0.14);
    box-shadow: var(--shadow-lg);
}

.modal {
    background: rgba(6, 16, 56, 0.42);
}

.modal-content {
    background:
        radial-gradient(circle at 100% 0%, rgba(79, 124, 255, 0.12), transparent 34%),
        #ffffff;
    border: 1px solid rgba(18, 55, 197, 0.12);
    box-shadow: 0 -18px 58px rgba(18, 55, 197, 0.22);
}

.modal-header {
    border-bottom-color: rgba(18, 55, 197, 0.12);
}

.app-card {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(18, 55, 197, 0.13);
    box-shadow: var(--shadow-sm);
}

.app-card:hover,
.app-card:active {
    background: var(--brand-blue-soft);
    border-color: rgba(18, 55, 197, 0.34);
}

.app-card .app-icon {
    background: var(--brand-blue-soft);
}

#connectScreen {
    background:
        radial-gradient(circle at 0% 0%, rgba(79, 124, 255, 0.18), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
}

.connect-header,
.tariffs-header {
    border-bottom-color: rgba(18, 55, 197, 0.1);
}

.app-badge,
.store-btn,
.period-btn,
.referral-tabs {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(18, 55, 197, 0.14);
    box-shadow: var(--shadow-sm);
}

.section-label {
    color: var(--brand-blue);
}

.action-section {
    border-color: rgba(18, 55, 197, 0.22);
}

.instruction-guide-row {
    background: rgba(238, 243, 255, 0.72);
    border-color: rgba(18, 55, 197, 0.13);
}

.instruction-guide-row:hover {
    background: #ffffff;
    border-color: rgba(18, 55, 197, 0.32);
}

.tariff-card.hit {
    border-color: rgba(18, 55, 197, 0.42);
    box-shadow: 0 18px 46px rgba(18, 55, 197, 0.18);
    background:
        radial-gradient(circle at 92% 8%, rgba(79, 124, 255, 0.14), transparent 36%),
        #ffffff;
}

.hit-badge {
    background: var(--bg-gradient);
    color: #ffffff;
}

.limit-item {
    background: var(--brand-blue-soft);
    color: var(--text-secondary);
}

.ref-tab-btn.active {
    background: var(--bg-gradient);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(18, 55, 197, 0.2);
}

.referral-link-box {
    background: #ffffff;
    border-color: rgba(18, 55, 197, 0.16);
    color: var(--brand-blue);
}

@media (max-height: 700px) {
    .hero-logo-wrap {
        width: 132px;
        height: 132px;
    }

    .hero-logo {
        width: 116px;
        height: 116px;
        border-radius: 32px;
    }
}