/* ═══════════════════════════════════════════════════
   Nova One — Mini App Styles  (v2)
   Фиолетово-чёрная тема · Розовая бабочка · Белые иконки
   ═══════════════════════════════════════════════════ */

:root {
    --bg-deep: #0a0612;
    --bg-card: #140e24;
    --bg-card-hover: #1c1435;
    --bg-surface: #1a1230;

    --purple-dark: #2d1b69;
    --purple: #6c3ce0;
    --purple-light: #9b6dff;
    --purple-glow: rgba(108, 60, 224, 0.3);

    --pink: #f472b6;
    --pink-light: #f9a8d4;
    --pink-glow: rgba(244, 114, 182, 0.4);

    --gold: #b57aff;
    --gold-light: #d4b5ff;

    --text: #f3f0ff;
    --text-dim: #a899cc;
    --text-muted: #6b5e8a;
    /* aliases used by some components */
    --text-main: #f3f0ff;
    --text-sub: #c8bce0;

    /* unified surfaces */
    --surface-1: linear-gradient(160deg, rgba(28,20,53,.85) 0%, rgba(20,14,36,.85) 100%);
    --surface-1-hover: linear-gradient(160deg, rgba(36,26,68,.92) 0%, rgba(26,18,46,.92) 100%);
    --surface-border: rgba(155,109,255,.14);
    --surface-border-strong: rgba(155,109,255,.28);
    --hairline: rgba(255,255,255,.06);

    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--purple-glow);
}

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

html {
    height: -webkit-fill-available;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-top: env(safe-area-inset-top, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    /* fixed gradient layer eliminates visible seams while scrolling */
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(108,60,224,.22) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 100% 100%, rgba(244,114,182,.10) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 0% 60%, rgba(155,109,255,.06) 0%, transparent 60%),
        linear-gradient(180deg, #0a0612 0%, #100822 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.hidden { display: none !important; }

/* ═══ Загрузка ═══ */
.loader {
    position: fixed; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bg-deep); z-index: 9999;
    transition: opacity .5s ease;
}
.loader.fade-out { opacity: 0; pointer-events: none; }
.loader-butterfly {
    animation: float 2s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
    filter: drop-shadow(0 0 16px var(--pink-glow));
}
.loader-text {
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 8px var(--pink-glow)); }
    50% { filter: drop-shadow(0 0 24px var(--pink-glow)); }
}

/* ═══ App ═══ */
.app {
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ═══ Хедер ═══ */
.header {
    position: sticky; top: 0; z-index: 100;
    padding: 14px 20px;
    background: linear-gradient(180deg, rgba(10,6,18,.85) 0%, rgba(10,6,18,.55) 60%, rgba(10,6,18,0) 100%);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    /* feather the bottom edge so it blends into the page */
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
}
.header-glow {
    position: absolute; top: -50px; left: 50%; transform: translateX(-50%);
    width: 280px; height: 100px;
    background: radial-gradient(ellipse, var(--purple-glow), transparent 70%);
    pointer-events: none;
    opacity: .6;
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-butterfly { filter: drop-shadow(0 0 12px var(--pink-glow)); }
.logo-text {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 600;
    background: linear-gradient(135deg, var(--pink-light), var(--purple-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.header-tier {
    font-size: 12px; padding: 4px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--purple-dark), var(--purple));
    color: var(--gold-light); font-weight: 500;
}

/* ═══ Навигация ═══ */
.nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    display: flex; justify-content: space-around;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0));
    background: linear-gradient(0deg, rgba(10,6,18,.92) 0%, rgba(10,6,18,.78) 60%, rgba(10,6,18,0) 100%);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border-top: 1px solid rgba(155,109,255,.08);
    max-width: 480px; margin: 0 auto;
}
.nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: 14px;
    transition: all .3s ease; color: var(--text-muted);
}
.nav-btn.active { color: var(--pink); background: rgba(244,114,182,.1); }
.nav-btn:active { transform: scale(.92); }
.nav-svg { width: 22px; height: 22px; opacity: .6; transition: opacity .3s; }
.nav-btn.active .nav-svg { opacity: 1; }
/* Белые иконки в навигации — при активной вкладке подкрашиваем */
.nav-btn.active .nav-svg use { stroke: var(--pink); }
.nav-label { font-size: 10px; font-weight: 500; }

/* ═══ Табы ═══ */
.tab { display: none; padding: 0 16px 20px; animation: fadeUp .4s ease; }
.tab.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ Home Hero ═══ */
.home-hero {
    text-align: center; padding: 40px 20px 24px;
}
.hero-butterfly-wrap {
    position: relative; display: inline-block; margin-bottom: 20px;
}
.butterfly-glow {
    position: absolute; inset: -30px;
    background: radial-gradient(circle, var(--pink-glow), transparent 70%);
    border-radius: 50%; pointer-events: none;
    animation: pulse-glow 3s ease-in-out infinite;
}
.hero-butterfly {
    position: relative; z-index: 1;
    filter: drop-shadow(0 0 20px var(--pink-glow));
    animation: float 3s ease-in-out infinite;
}
.hero-title {
    font-family: var(--font-display);
    font-size: 36px; font-weight: 700;
    background: linear-gradient(135deg, var(--pink-light), var(--purple-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 8px;
}
.hero-sub {
    font-size: 15px; color: var(--text-dim); margin-bottom: 28px; letter-spacing: .5px;
}

/* ═══ Кнопки ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 28px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 15px; font-weight: 500;
    cursor: pointer; transition: all .3s ease;
    text-decoration: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { flex-shrink: 0; }

.btn-primary {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white; box-shadow: 0 4px 20px var(--purple-glow);
}
.btn-primary:hover { box-shadow: 0 6px 30px var(--purple-glow); transform: translateY(-1px); }

.btn-glow {
    animation: glow-pulse 2.5s ease-in-out infinite;
}
@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 4px 20px var(--purple-glow); }
    50% { box-shadow: 0 4px 40px var(--pink-glow), 0 0 60px rgba(108,60,224,.2); }
}

.btn-secondary {
    background: var(--bg-card); color: var(--text-dim);
    border: 1px solid rgba(108,60,224,.3);
}
.btn-secondary:hover { border-color: var(--purple); color: var(--text); }

.btn-accent {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white; padding: 10px 20px; border-radius: var(--radius-xs);
}

.btn-full { width: 100%; }

/* spinner inside buttons */
.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white; border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Daily Quote ═══ */
.daily-quote {
    margin: 24px 16px; padding: 18px 20px;
    background: var(--surface-1); border-radius: var(--radius);
    border: 1px solid var(--surface-border);
    border-left: 3px solid var(--purple);
    display: flex; gap: 12px; align-items: flex-start;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.quote-icon { flex-shrink: 0; margin-top: 2px; opacity: .5; }
.quote-text {
    font-family: var(--font-display);
    font-size: 16px; font-style: italic;
    color: var(--text-dim); line-height: 1.5;
}

/* ═══ Daily Card Result ═══ */
.daily-result { padding: 0 4px; animation: fadeUp .5s ease; }
.card-reveal { text-align: center; margin-bottom: 20px; }
.card-frame {
    display: inline-block; padding: 28px 36px;
    background: linear-gradient(160deg, #0e0828, #1a1040 50%, #120a2e);
    border-radius: var(--radius);
    border: 1.5px solid rgba(155,109,255,.55);
    box-shadow:
        0 0 16px rgba(108,60,224,.4),
        0 0 40px rgba(108,60,224,.18),
        inset 0 1px 0 rgba(155,109,255,.1);
    animation: cardAppear .6s ease;
}
.card-inner { text-align: center; }
.card-suit-icon { margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.card-name {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 600;
    color: #e8deff;
    text-shadow: 0 0 12px rgba(155,109,255,.3);
}
.card-reversed {
    font-size: 12px; color: var(--pink-light); margin-top: 6px; font-style: italic;
    opacity: .8;
}

@keyframes cardAppear {
    from { opacity: 0; transform: scale(.8) rotateY(90deg); }
    to { opacity: 1; transform: scale(1) rotateY(0); }
}

.daily-interpretation {
    margin: 16px 0; padding: 18px; background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 14px; line-height: 1.7; color: var(--text-dim);
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.daily-affirmation {
    padding: 14px; text-align: center;
    background: linear-gradient(135deg, rgba(108,60,224,.15), rgba(244,114,182,.1));
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 16px; font-weight: 500; color: var(--pink-light);
    font-style: italic;
}

/* ═══ Section Titles ═══ */
.section-title {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display);
    font-size: 24px; font-weight: 600;
    padding: 20px 0 16px; color: var(--text);
}
.section-icon { opacity: .7; flex-shrink: 0; }

/* ═══ Spreads Grid ═══ */
.spreads-grid { display: flex; flex-direction: column; gap: 10px; }
.spread-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; background: var(--surface-1);
    border-radius: var(--radius); cursor: pointer;
    border: 1px solid var(--surface-border);
    transition: all .3s ease;
    position: relative; overflow: hidden;
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 4px 16px rgba(0,0,0,.18);
}
.spread-card:not(.locked):hover {
    border-color: var(--surface-border-strong);
    background: var(--surface-1-hover);
    transform: translateX(4px);
}
.spread-card:not(.locked):active { transform: scale(.98); }
.spread-card.locked { opacity: .5; cursor: not-allowed; }
.spread-icon-wrap {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(108,60,224,.15); border-radius: 12px;
}
.spread-svg-icon { opacity: .85; }
.spread-info { flex: 1; min-width: 0; }
.spread-name { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.spread-desc { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.spread-cards-count { font-size: 11px; color: var(--text-muted); }
.spread-lock {
    position: absolute; top: 12px; right: 12px; opacity: .4;
}

/* ═══ History ═══ */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    transition: all .2s;
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}
.history-item:hover { background: var(--surface-1-hover); border-color: var(--surface-border-strong); }
.history-emoji {
    width: 36px; height: 36px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(108,60,224,.12); border-radius: 10px;
}
.history-info { flex: 1; min-width: 0; }
.history-type { font-weight: 500; font-size: 14px; }
.history-question {
    font-size: 12px; color: var(--text-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-date { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.history-empty {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted); font-size: 14px; line-height: 1.7;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* ═══ History detail ═══ */
.history-item { cursor: pointer; }
.history-item .history-chevron {
    flex-shrink: 0; opacity: .35; margin-left: 4px;
}
.detail-question {
    padding: 10px 14px; margin-bottom: 14px;
    background: rgba(108,60,224,.08); border-radius: var(--radius-xs);
    font-size: 13px; color: var(--text-dim); font-style: italic;
    border-left: 3px solid var(--purple);
}
.detail-question.hidden { display: none; }

/* ═══ Profile ═══ */
.profile-card {
    text-align: center; padding: 32px 20px 24px;
}
.profile-avatar {
    position: relative; display: inline-block; margin-bottom: 16px;
}
.avatar-ring {
    position: absolute; inset: -8px;
    border: 2px solid var(--purple);
    border-radius: 50%;
    animation: ring-rotate 8s linear infinite;
}
@keyframes ring-rotate { to { transform: rotate(360deg); } }
.avatar-butterfly {
    filter: drop-shadow(0 0 12px var(--pink-glow));
}
.profile-name {
    font-family: var(--font-display);
    font-size: 24px; font-weight: 600; margin-bottom: 4px;
}
.profile-tier {
    font-size: 14px; color: var(--gold-light);
}

.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin: 0 0 20px;
}
.stat-card {
    background: var(--surface-1); border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    padding: 14px 8px; text-align: center;
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700;
    background: linear-gradient(135deg, var(--pink-light), var(--purple-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.profile-section {
    background: var(--surface-1); border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 4px 0; margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.profile-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--hairline);
}
.profile-row:last-child { border-bottom: none; }
.row-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-dim);
}
.row-icon { opacity: .6; }
.row-value { font-size: 13px; font-weight: 500; }
.row-code { font-family: monospace; font-size: 12px; color: var(--purple-light); }

/* Referral link block */
.profile-ref {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--hairline);
}
.profile-ref-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-dim);
    margin-bottom: 10px;
}
.profile-ref-head svg { opacity: .6; }
.profile-ref-box {
    display: flex; align-items: stretch; gap: 0;
    width: 100%;
    background: rgba(108,60,224,.08);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .25s, background .25s, transform .15s;
    font-family: inherit;
    text-align: left;
    color: inherit;
}
.profile-ref-box:hover { border-color: var(--surface-border-strong); background: rgba(108,60,224,.12); }
.profile-ref-box:active { transform: scale(.99); }
.profile-ref-box:disabled { opacity: .5; cursor: not-allowed; }
.profile-ref-link {
    flex: 1; min-width: 0;
    padding: 11px 12px;
    font-family: 'SF Mono', ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--purple-light);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    align-self: center;
}
.profile-ref-copy {
    display: flex; align-items: center; gap: 6px;
    padding: 0 14px;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
    transition: filter .25s;
}
.profile-ref-copy svg { stroke: currentColor; }
.profile-ref-box.copied .profile-ref-copy {
    background: linear-gradient(135deg, #22c55e, #4ade80);
}
.profile-ref-box.copied {
    border-color: rgba(74,222,128,.4);
}
@media (max-width: 360px) {
    .profile-ref-copy-label { display: none; }
    .profile-ref-copy { padding: 0 12px; }
}

/* Промокод */
.promo-section {
    background: var(--surface-1); border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 18px 16px; margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.promo-title {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-display);
    font-size: 18px; font-weight: 600; margin-bottom: 12px;
}
.promo-icon { opacity: .6; }
.promo-input-row { display: flex; gap: 8px; }
.promo-input {
    flex: 1; padding: 10px 14px;
    background: var(--bg-surface); color: var(--text);
    border: 1px solid rgba(108,60,224,.3);
    border-radius: var(--radius-xs);
    font-size: 14px; outline: none;
    transition: border-color .3s;
}
.promo-input:focus { border-color: var(--purple); }
.promo-input::placeholder { color: var(--text-muted); }
.promo-result {
    margin-top: 8px; font-size: 13px;
    padding: 8px 12px; border-radius: var(--radius-xs);
}
.promo-success { background: rgba(34,197,94,.1); color: #4ade80; }
.promo-error { background: rgba(239,68,68,.1); color: #f87171; }

/* ═══ Modal ═══ */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }
.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
}
.modal-content {
    position: relative; z-index: 1;
    width: 100%; max-width: 480px; max-height: 90vh;
    background: linear-gradient(180deg, #1a1230 0%, #120a26 100%);
    border-top: 1px solid var(--surface-border-strong);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 32px;
    overflow-y: auto;
    animation: slideUp .3s ease;
    box-shadow: 0 -10px 40px rgba(0,0,0,.5);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: rgba(255,255,255,.1); border: none; color: var(--text-dim);
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .2s;
}
.modal-close:hover { background: rgba(255,255,255,.2); }

.modal-header { text-align: center; margin-bottom: 20px; }
.modal-icon { margin-bottom: 8px; display: flex; align-items: center; justify-content: center; }
.modal-title {
    font-family: var(--font-display);
    font-size: 24px; font-weight: 600;
}
.modal-desc { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.modal-textarea {
    width: 100%; padding: 12px 14px;
    background: var(--bg-card); color: var(--text);
    border: 1px solid rgba(108,60,224,.3);
    border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 14px;
    resize: none; outline: none;
    transition: border-color .3s; margin-bottom: 14px;
}
.modal-textarea:focus { border-color: var(--purple); }
.modal-textarea::placeholder { color: var(--text-muted); }

/* Reading result in modal */
.reading-result { animation: fadeUp .4s ease; margin-top: 16px; }
.reading-cards {
    display: flex; flex-wrap: nowrap; gap: 12px;
    justify-content: center; margin-bottom: 16px;
    overflow-x: auto; padding: 4px 0;
}
.reading-card {
    flex: 1 1 0; min-width: 0; max-width: 220px;
    display: flex; flex-direction: column; align-items: center;
}
.reading-card-inner {
    width: 100%; aspect-ratio: 2/3;
    background: linear-gradient(160deg, #0e0828, #1a1040 50%, #120a2e);
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 12px 8px;
    border: 1.5px solid rgba(155,109,255,.5);
    box-shadow:
        0 0 14px rgba(108,60,224,.35),
        0 0 30px rgba(108,60,224,.12),
        inset 0 1px 0 rgba(155,109,255,.08);
    position: relative; overflow: hidden;
}
.reading-card-inner::before {
    content: ''; position: absolute; inset: 6px;
    border: 1px solid rgba(155,109,255,.15);
    border-radius: calc(var(--radius) - 4px);
    pointer-events: none;
}
.card-position {
    font-size: 10px; color: var(--purple-light); text-transform: uppercase;
    letter-spacing: 2px; margin-bottom: 8px; font-weight: 500;
    position: absolute; top: 14px;
}
.card-emoji {
    display: flex; align-items: center; justify-content: center;
    flex: 1;
}
.card-reversed-badge {
    position: absolute; bottom: 10px;
    font-size: 9px; color: var(--pink-light); font-style: italic;
    opacity: .7; letter-spacing: .5px;
}
.card-caption {
    margin-top: 10px; text-align: center;
    font-family: var(--font-display);
    font-size: 14px; font-weight: 600;
    color: #e8deff;
    text-shadow: 0 0 8px rgba(155,109,255,.2);
    line-height: 1.3;
}
.reading-interpretation {
    padding: 18px; background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 14px; line-height: 1.7; color: var(--text-dim);
}

/* ═══ Reading Overlay (fullscreen animation) ═══ */
.reading-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    transition: opacity .5s ease;
    pointer-events: none;
}
.reading-overlay.active { pointer-events: auto; }
.reading-overlay.hidden { display: none; }
.reading-overlay.fade-out { opacity: 0; pointer-events: none; }

/* Curtain fill layer */
.reading-overlay-curtain {
    position: absolute; inset: 0; z-index: 0;
    background: #06020f;
    clip-path: circle(0% at 50% 80%);
    transition: clip-path 1s cubic-bezier(.4,.0,.2,1);
}
.reading-overlay.reveal .reading-overlay-curtain {
    clip-path: circle(150% at 50% 80%);
}

.reading-overlay canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity .8s ease .6s;
}
.reading-overlay.reveal canvas {
    opacity: 1;
}
.reading-overlay-content {
    position: relative; z-index: 2;
    text-align: center; padding: 0 30px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .6s ease .9s, transform .6s ease .9s;
}
.reading-overlay.reveal .reading-overlay-content {
    opacity: 1;
    transform: translateY(0);
}
.reading-overlay-stage {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 500;
    color: #d4b5ff;
    text-shadow: 0 0 20px rgba(155,109,255,.4);
    animation: stagePulse 2s ease-in-out infinite;
    letter-spacing: .5px;
    line-height: 1.5;
    transition: opacity .2s ease;
}
@keyframes stagePulse {
    0%, 100% { opacity: .7; }
    50% { opacity: 1; }
}

/* Progress bar */
.overlay-progress {
    margin-top: 28px;
    width: 220px;
    margin-left: auto; margin-right: auto;
}
.overlay-progress-track {
    position: relative;
    height: 4px;
    border-radius: 4px;
    background: rgba(155,109,255,.15);
    overflow: hidden;
}
.overlay-progress-fill {
    position: absolute; top: 0; left: 0;
    height: 100%; width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #9b6dff, #c084fc, #d8b4fe);
    transition: width 2s cubic-bezier(.4,.0,.2,1);
}
.overlay-progress-glow {
    position: absolute; top: -3px; left: 0;
    height: 10px; width: 0%;
    border-radius: 6px;
    background: linear-gradient(90deg, transparent 60%, rgba(200,132,252,.6));
    filter: blur(4px);
    transition: width 2s cubic-bezier(.4,.0,.2,1);
}
.overlay-progress-text {
    margin-top: 10px;
    font-family: var(--font-body);
    font-size: 12px;
    color: rgba(200,160,252,.5);
    letter-spacing: 1px;
}

/* ═══ Collapsible interpretation ═══ */
.collapsible { position: relative; }
.collapsible-preview {
    color: var(--text-dim);
    font-size: 14px; line-height: 1.6;
}
.collapsible-full {
    font-size: 14px; line-height: 1.7;
    color: var(--text-dim);
}
.collapsible-full strong {
    color: var(--pink-light); font-weight: 600;
    display: inline-block; margin-top: 10px;
}
.collapsible-full em {
    color: var(--text); font-style: italic;
}
.collapsible-full blockquote {
    margin: 10px 0; padding: 10px 14px;
    border-left: 3px solid var(--purple);
    background: rgba(108, 60, 224, .08);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-style: italic; color: var(--text-dim);
}
.collapsible-toggle {
    display: inline-block; margin-top: 10px;
    background: none; border: none;
    color: var(--purple-light); font-size: 13px; font-weight: 500;
    cursor: pointer; padding: 4px 0;
    transition: color .2s;
}
.collapsible-toggle:hover { color: var(--pink); }

/* HTML in interpretation blocks */
.daily-interpretation strong,
.reading-interpretation strong { color: var(--pink-light); font-weight: 600; }
.daily-interpretation em,
.reading-interpretation em { color: var(--text); }
.daily-interpretation blockquote,
.reading-interpretation blockquote {
    margin: 10px 0; padding: 10px 14px;
    border-left: 3px solid var(--purple);
    background: rgba(108, 60, 224, .08);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-style: italic;
}

/* ═══ Shake animation ═══ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}
.shake { animation: shake .4s ease; border-color: #f472b6 !important; }

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--purple-dark); border-radius: 2px; }

/* ═══ Chat Tab ═══ */
#tab-chat { padding: 0; position: relative; }
#tab-chat.active { display: flex; flex-direction: column; height: calc(100vh - 130px); }

/* Butterfly icon in nav — needs special sizing */
.nav-svg-butterfly { transform: scale(1.15); }

/* Locked state */
.chat-locked {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px; text-align: center;
}
.chat-locked-inner {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.chat-locked-title {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 600; color: var(--text);
}
.chat-locked-text {
    font-size: 14px; color: var(--text-dim); max-width: 260px; line-height: 1.5;
}

/* Chat container */
.chat-container {
    display: flex; flex-direction: column; flex: 1; min-height: 0;
}
.chat-container:not(.hidden) { display: flex; }

/* Chat header */
.chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: var(--surface-1);
    border-bottom: 1px solid var(--surface-border);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chat-header-butterfly {
    filter: drop-shadow(0 0 8px var(--pink-glow));
}
.chat-header-info { flex: 1; }
.chat-header-name {
    font-family: var(--font-display);
    font-size: 17px; font-weight: 600;
    background: linear-gradient(135deg, var(--pink-light), var(--purple-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.chat-header-status {
    font-size: 11px; color: #4ade80;
}
.chat-header-status.typing {
    color: var(--pink-light);
}
.chat-trial-badge {
    font-size: 11px; padding: 3px 10px;
    border-radius: 12px;
    background: rgba(108,60,224,.2);
    color: var(--purple-light); white-space: nowrap;
}

/* Messages area */
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px 12px; display: flex;
    flex-direction: column; gap: 10px;
    scroll-behavior: smooth;
}

/* Welcome */
.chat-welcome {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 30px 20px; text-align: center;
}
.chat-welcome-text {
    font-size: 14px; color: var(--text-dim); line-height: 1.5;
    max-width: 260px;
}

/* Message bubbles */
.chat-msg {
    max-width: 82%; padding: 10px 14px;
    border-radius: 16px; font-size: 14px; line-height: 1.55;
    animation: chatMsgIn .35s ease both;
    word-wrap: break-word;
}
.chat-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--purple), #7c3aed);
    color: white; border-bottom-right-radius: 4px;
}
.chat-msg-bot {
    align-self: flex-start;
    background: var(--surface-1);
    color: var(--text-dim);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--surface-border);
}
.chat-msg-bot strong { color: var(--pink-light); font-weight: 600; }
.chat-msg-bot em { color: var(--text); }

@keyframes chatMsgIn {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typing indicator */
.chat-typing {
    align-self: flex-start;
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-radius: 16px; border-bottom-left-radius: 4px;
    border: 1px solid rgba(108,60,224,.12);
    animation: chatMsgIn .3s ease both;
}
.chat-typing-dots {
    display: flex; gap: 4px;
}
.chat-typing-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--purple-light); opacity: .4;
    animation: typingDot 1.4s ease-in-out infinite;
}
.chat-typing-dots span:nth-child(2) { animation-delay: .2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Input area */
.chat-input-row {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 12px 12px 14px;
    background: linear-gradient(0deg, rgba(10,6,18,.95) 0%, rgba(10,6,18,.7) 70%, rgba(10,6,18,0) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-shrink: 0;
}
.chat-input {
    flex: 1; padding: 10px 14px;
    background: var(--bg-card); color: var(--text);
    border: 1px solid rgba(108,60,224,.25);
    border-radius: 20px;
    font-family: var(--font-body); font-size: 14px;
    resize: none; outline: none;
    max-height: 120px; line-height: 1.4;
    transition: border-color .3s;
}
.chat-input:focus { border-color: var(--purple); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    border: none; border-radius: 50%; cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 2px 12px var(--purple-glow);
}
.chat-send-btn:active { transform: scale(.9); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Limit reached banner */
.chat-limit-banner {
    padding: 12px 16px; text-align: center;
    background: rgba(244,114,182,.08);
    border-top: 1px solid rgba(244,114,182,.2);
    font-size: 13px; color: var(--pink-light); line-height: 1.5;
    flex-shrink: 0;
}
.chat-limit-banner a {
    color: var(--purple-light); text-decoration: underline;
    cursor: pointer;
}

/* ═══ Settings Form ═══ */
.settings-hint {
    font-size: 12px; color: var(--text-dim); margin-bottom: 14px;
    line-height: 1.5;
}
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.settings-row { display: flex; flex-direction: column; gap: 4px; }
.settings-label {
    font-size: 11px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .5px;
    font-weight: 500;
}
.settings-input {
    width: 100%; padding: 10px 12px;
    background: var(--bg-card); color: var(--text);
    border: 1px solid rgba(108,60,224,.2);
    border-radius: var(--radius);
    font-family: var(--font-body); font-size: 14px;
    outline: none;
    transition: border-color .3s;
    -webkit-appearance: none;
}
.settings-input:focus { border-color: var(--purple); }
.settings-input::placeholder { color: var(--text-muted); }
select.settings-input { cursor: pointer; }
.settings-saved {
    text-align: center; font-size: 13px; color: #4ade80;
    margin-top: 8px;
    animation: fadeUp .4s ease;
}

/* ═══ Home — Profile Prompt ═══ */
.home-profile-prompt {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(135deg, rgba(108,60,224,.1), rgba(244,114,182,.08));
    border: 1px solid rgba(155,109,255,.15);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 16px 16px 0;
    animation: fadeUp .5s ease;
}
.prompt-icon { flex-shrink: 0; opacity: .6; }
.prompt-icon svg { stroke: var(--purple-light); }
.prompt-text { flex: 1; }
.prompt-title {
    font-family: var(--font-display);
    font-size: 14px; font-weight: 600; color: var(--text);
}
.prompt-desc { font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.4; }
.prompt-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background: rgba(155,109,255,.15);
    border: 1px solid rgba(155,109,255,.3);
    border-radius: 20px;
    color: var(--purple-light);
    font-size: 12px; font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}
.prompt-btn:active { background: rgba(155,109,255,.25); }

/* ═══ Home — Daily Insight Card ═══ */
.home-insight {
    margin: 16px 16px 0;
    background: var(--surface-1);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 16px;
    animation: fadeUp .5s ease .1s both;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.insight-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.insight-icon { stroke: var(--purple-light); opacity: .8; }
.insight-title {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 600; color: var(--text);
    flex: 1;
}
.insight-date {
    font-size: 11px; color: var(--text-dim);
}
.insight-body {
    display: flex; align-items: flex-start; gap: 12px;
}
.insight-card-icon {
    flex: 0 0 auto;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(155,109,255,.1);
    border-radius: 12px;
    border: 1px solid rgba(155,109,255,.15);
}
.insight-card-icon svg { stroke: var(--purple-light); }
.insight-content { flex: 1; min-width: 0; }
.insight-card-name {
    font-family: var(--font-display);
    font-size: 14px; font-weight: 600; color: var(--text);
    margin-bottom: 4px;
}
.insight-text {
    font-size: 12px; color: var(--text-dim); line-height: 1.5;
}

/* ═══ Natal Chart Tab ═══ */
.natal-locked {
    display: flex; align-items: center; justify-content: center;
    min-height: 60vh; text-align: center; padding: 20px;
}
.natal-locked-inner {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.natal-locked-title {
    font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text-main);
}
.natal-locked-text {
    font-size: 14px; color: var(--text-muted); max-width: 260px;
}

.natal-container { padding: 10px 0 100px; }

.natal-header {
    text-align: center; padding: 20px 0 24px;
}
.natal-icon-wrap {
    position: relative; display: inline-block; margin-bottom: 16px;
}
.natal-icon-glow {
    position: absolute; inset: -24px;
    background: radial-gradient(circle, rgba(181,122,255,.3), transparent 70%);
    border-radius: 50%; pointer-events: none;
    animation: pulse-glow 3s ease-in-out infinite;
}
.natal-icon { position: relative; z-index: 1; }
.natal-icon use { stroke: var(--purple-light); }
.natal-title {
    font-family: var(--font-display); font-size: 24px; font-weight: 600;
    color: var(--text-main); margin: 0 0 6px;
}
.natal-subtitle {
    font-size: 14px; color: var(--text-muted); margin: 0;
}

.natal-info {
    background: var(--surface-1); border: 1px solid var(--surface-border);
    border-radius: var(--radius); padding: 16px; margin: 16px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.natal-data-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.natal-data-row:last-child { border-bottom: none; }
.natal-data-label { font-size: 13px; color: var(--text-muted); }
.natal-data-value { font-size: 14px; color: var(--text-main); font-weight: 500; }

.natal-hint {
    text-align: center; font-size: 12px; color: var(--text-dim);
    margin: 8px 0 16px; font-style: italic;
}

.natal-result {
    margin-top: 20px;
    background: var(--surface-1); border: 1px solid var(--surface-border);
    border-radius: var(--radius); padding: 20px;
    line-height: 1.7; color: var(--text-sub); font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.natal-result b { color: var(--text-main); }
.natal-result blockquote {
    border-left: 3px solid var(--purple); margin: 12px 0;
    padding: 10px 14px; background: rgba(181,122,255,.06);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

.natal-loading {
    text-align: center; padding: 40px 20px;
}
.natal-loading-spinner {
    width: 40px; height: 40px; margin: 0 auto 16px;
    border: 3px solid rgba(181,122,255,.15);
    border-top-color: var(--purple-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.natal-loading-text {
    font-size: 14px; color: var(--text-muted); font-style: italic;
}

/* ═══ Mobile optimizations ═══ */

/* Предотвращаем подсветку при нажатии */
button, a, .nav-btn, .quick-card, .spread-card {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Предотвращаем зум на инпутах iOS */
input, select, textarea {
    font-size: 16px !important;
    touch-action: manipulation;
}

/* Фикс bounce-эффекта на iOS */
.tab {
    -webkit-overflow-scrolling: touch;
}

/* Маленькие экраны (iPhone SE, Galaxy S/A) */
@media (max-height: 680px) {
    .home-hero { padding: 20px 16px 16px; }
    .hero-title { font-size: 28px; }
    .hero-sub { font-size: 13px; margin-bottom: 16px; }
    .hero-butterfly-wrap svg { width: 64px; height: 64px; }
    .daily-quote { padding: 14px; margin: 12px 16px 0; }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .nav-btn { padding: 4px 6px; }
    .nav-label { font-size: 9px; }
    .nav-svg { width: 20px; height: 20px; }
    .hero-title { font-size: 26px; }
    .logo-text { font-size: 18px; }
    .tab { padding: 0 12px 16px; }
    .insight-body { gap: 8px; }
    .insight-card-icon { width: 44px; height: 44px; }
}

/* Большие экраны (iPad, планшеты) */
@media (min-width: 768px) {
    .app { max-width: 520px; }
    .header { padding: 16px 24px; }
    .tab { padding: 0 24px 24px; }
}

/* Telegram-only gate */
.tg-gate {
    position: fixed; inset: 0;
    background: linear-gradient(180deg, #0a0612 0%, #1a0e2e 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 24px;
}
.tg-gate-inner {
    max-width: 360px; text-align: center;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(216,180,254,.15);
    border-radius: 24px; padding: 36px 24px;
    backdrop-filter: blur(20px);
}
.tg-gate-emoji { font-size: 56px; margin-bottom: 12px; }
.tg-gate-inner h2 { color: #f3e8ff; font-size: 24px; margin: 0 0 12px; }
.tg-gate-inner p { color: rgba(243,232,255,.7); font-size: 15px; margin: 0 0 24px; line-height: 1.5; }
.tg-gate-btn {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white; text-decoration: none;
    border-radius: 14px; font-weight: 600; font-size: 15px;
    box-shadow: 0 4px 24px rgba(168,85,247,.4);
}
