/* ============================================================
   ОСНОВА
   ============================================================ */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0b0d0e;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    overscroll-behavior: none;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* ============================================================
   ОБЁРТКА И КОНТЕНТ
   ============================================================ */

#app {
    flex: 1;
    padding: 16px 16px 96px 16px;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.screen {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ЗАГРУЗКА И ОШИБКИ
   ============================================================ */

.loading-screen,
.error-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 24px;
}

.loading-screen .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #1f2426;
    border-top-color: #00d97e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-screen {
    flex-direction: column;
    color: #ff6b6b;
}

.error-screen button {
    margin-top: 16px;
    padding: 12px 24px;
    background: #00d97e;
    color: #000;
    font-weight: 600;
    border-radius: 12px;
}

/* ============================================================
   БАННЕРЫ СТАТУСА
   ============================================================ */

.status-banner {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.status-banner.grace {
    background: linear-gradient(135deg, rgba(0,217,126,0.15), rgba(0,217,126,0.05));
    border: 1px solid rgba(0,217,126,0.3);
}

.status-banner.warning {
    background: linear-gradient(135deg, rgba(255,193,7,0.12), rgba(255,193,7,0.04));
    border: 1px solid rgba(255,193,7,0.3);
}

.status-banner.danger {
    background: linear-gradient(135deg, rgba(255,107,107,0.12), rgba(255,107,107,0.04));
    border: 1px solid rgba(255,107,107,0.3);
}

.status-banner-title {
    font-weight: 600;
    margin-bottom: 4px;
}

/* ============================================================
   ЗАГОЛОВКИ СЕКЦИЙ
   ============================================================ */

.section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #6b7378;
    text-transform: uppercase;
    margin: 22px 0 10px;
}

.section-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 18px;
    letter-spacing: -0.02em;
}

/* ============================================================
   ПЛИТКИ ГЛАВНОЙ
   ============================================================ */

.tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tile {
    background: #15181a;
    border-radius: 16px;
    padding: 16px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    transition: transform 0.1s ease, background 0.15s ease;
    overflow: hidden;
}

.tile:active {
    transform: scale(0.97);
}

.tile.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.tile-icon {
    font-size: 28px;
    line-height: 1;
}

.tile-title {
    font-size: 15px;
    font-weight: 600;
    margin-top: auto;
}

.tile-subtitle {
    font-size: 12px;
    color: #6b7378;
    margin-top: 4px;
}

.tile-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #00d97e;
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}

.tile-badge.gray {
    background: #2a2f31;
    color: #6b7378;
}

/* ============================================================
   ПРОФИЛЬ
   ============================================================ */

.profile-card {
    background: #15181a;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row-label {
    color: #6b7378;
    font-size: 13px;
}

.profile-row-value {
    font-weight: 600;
    text-align: right;
}

.profile-row-value.big {
    font-size: 18px;
    color: #00d97e;
}

.profile-row-value.copyable {
    cursor: pointer;
    user-select: all;
}

.profile-row-value.copyable:active {
    color: #00d97e;
}

/* Прогрессбар */

.progress-block {
    background: #15181a;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: #6b7378;
}

.progress-header strong {
    color: #fff;
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: #1f2426;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d97e, #00b06b);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-footer {
    font-size: 12px;
    color: #6b7378;
    margin-top: 10px;
    text-align: right;
}

/* Кнопка обновить */

.refresh-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: #1f2426;
    color: #fff;
    font-weight: 600;
    margin-top: 12px;
    transition: background 0.15s ease;
}

.refresh-button:active {
    background: #2a2f31;
}

.refresh-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.refresh-hint {
    text-align: center;
    color: #6b7378;
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================================
   CTA КНОПКА (Большая кнопка призыва к действию)
   ============================================================ */

.cta-block {
    text-align: center;
    padding: 40px 24px;
}

.cta-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.cta-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.cta-text {
    color: #6b7378;
    margin-bottom: 24px;
}

.cta-button {
    display: inline-block;
    padding: 14px 28px;
    background: #00d97e;
    color: #000;
    font-weight: 700;
    border-radius: 12px;
    transition: transform 0.1s ease;
}

.cta-button:active {
    transform: scale(0.96);
}

/* ============================================================
   НИЖНЕЕ МЕНЮ (ТАБЫ)
   ============================================================ */

#tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f1213;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    color: #6b7378;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.15s ease;
}

.tab.active {
    color: #00d97e;
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 2px;
    line-height: 1;
}

/* ============================================================
   ВСПОМОГАТЕЛЬНОЕ
   ============================================================ */

.muted {
    color: #6b7378;
    font-size: 12px;
}

.debug-badge {
    display: inline-block;
    background: rgba(255,193,7,0.15);
    color: #ffc107;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================================
   ПРИЗЫ
   ============================================================ */

.prize-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prize-card {
    background: #15181a;
    border-radius: 16px;
    padding: 16px;
    position: relative;
    border: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.prize-card.unlocked {
    border-color: rgba(0, 217, 126, 0.35);
    background: linear-gradient(135deg, rgba(0,217,126,0.08), #15181a 60%);
}

.prize-card.claimed {
    opacity: 0.85;
}

.prize-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.prize-info {
    flex: 1;
    min-width: 0;
}

.prize-name {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
}

.prize-desc {
    font-size: 12px;
    color: #6b7378;
    line-height: 1.35;
}

.prize-threshold {
    font-size: 13px;
    font-weight: 700;
    color: #00d97e;
    white-space: nowrap;
    background: rgba(0,217,126,0.12);
    border-radius: 8px;
    padding: 4px 10px;
}

.prize-card.locked .prize-threshold {
    color: #6b7378;
    background: rgba(255,255,255,0.04);
}

.prize-state {
    margin-top: 12px;
}

.prize-mini-progress {
    height: 6px;
    background: #1f2426;
    border-radius: 999px;
    overflow: hidden;
}

.prize-mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d97e, #00b06b);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.prize-mini-progress-text {
    font-size: 11px;
    color: #6b7378;
    margin-top: 6px;
    text-align: right;
}

.prize-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.prize-btn {
    flex: 1;
    padding: 11px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.1s ease, background 0.15s ease;
}

.prize-btn:active {
    transform: scale(0.97);
}

.prize-btn.primary {
    background: #00d97e;
    color: #000;
}

.prize-btn.primary:active {
    background: #00b06b;
}

.prize-btn.secondary {
    background: #1f2426;
    color: #fff;
}

.prize-btn.secondary:active {
    background: #2a2f31;
}

.prize-btn.locked {
    background: #1f2426;
    color: #6b7378;
}

.prize-claim-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    font-size: 13px;
}

.prize-claim-status .claim-icon {
    font-size: 18px;
}

/* Notice бар, когда не VIP */
.vip-notice {
    background: rgba(255,193,7,0.08);
    border: 1px solid rgba(255,193,7,0.25);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #ffc107;
}

/* ============================================================
   ЗАКАЗЫ
   ============================================================ */

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-card {
    background: #15181a;
    border-radius: 14px;
    padding: 14px 16px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-name {
    font-size: 15px;
    font-weight: 700;
}

.order-status {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.order-status.pending {
    background: rgba(255,255,255,0.08);
    color: #b5bcc0;
}
.order-status.processing {
    background: rgba(83,156,255,0.18);
    color: #6fb1ff;
}
.order-status.sent {
    background: rgba(157,109,255,0.18);
    color: #b598ff;
}
.order-status.completed {
    background: rgba(0,217,126,0.18);
    color: #00d97e;
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #6b7378;
}

.order-meta span strong {
    color: #fff;
    font-weight: 600;
}

.order-notes {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 12px;
    color: #b5bcc0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #6b7378;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.4;
    margin-bottom: 12px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
