/* ========================================
   LOVE WISH-LIST — Neo-Nostalgia Dark UI
   Mobile-first · Dark Mode · Gradient CTAs
   ======================================== */

:root {
    /* Colors */
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 45, 120, 0.5);

    --text: #f5f5f5;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-hint: rgba(255, 255, 255, 0.35);

    --pink: #ff2d78;
    --purple: #9b59ff;
    --gradient: linear-gradient(135deg, #ff2d78, #9b59ff);
    --gradient-soft: linear-gradient(135deg, rgba(255, 45, 120, 0.15), rgba(155, 89, 255, 0.15));
    --glow-pink: 0 0 30px rgba(255, 45, 120, 0.3);
    --glow-purple: 0 0 30px rgba(155, 89, 255, 0.3);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-handwritten: 'Caveat', cursive;

    /* Spacing */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --container-px: 20px;

    /* Animation */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== RESET ==================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.5;
}

button, a {
    font-family: var(--font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==================== APP CONTAINER ==================== */

#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ==================== SCREENS ==================== */

.screen {
    display: none;
    min-height: 100dvh;
    opacity: 0;
    transform: translateY(20px);
}

.screen.active {
    display: flex;
    animation: screenIn 0.5s var(--ease-out) forwards;
}

.screen.exiting {
    animation: screenOut 0.3s var(--ease-out) forwards;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes screenOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

.screen-content {
    width: 100%;
    padding: 60px var(--container-px) calc(40px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
}

.screen-center {
    justify-content: center;
    min-height: 100dvh;
}

/* ==================== TYPOGRAPHY ==================== */

h1 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

h2 {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 320px;
}

.subtitle-sm {
    font-size: 0.9rem;
    color: var(--text-hint);
    text-align: center;
    margin-bottom: 24px;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-hint);
    text-align: center;
    margin-top: 16px;
}

/* ==================== BADGE ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    background: var(--gradient-soft);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.badge-his {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(155, 89, 255, 0.15));
}

/* ==================== BUTTONS ==================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 18px 32px;
    width: 100%;
    max-width: 360px;
    transition: all 0.2s var(--ease-out);
    box-shadow: var(--glow-pink);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:active::before {
    opacity: 1;
}

.btn-huge {
    padding: 20px 32px;
    font-size: 1.1rem;
    border-radius: 20px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px 28px;
    width: 100%;
    max-width: 360px;
    margin-top: 12px;
    transition: all 0.2s;
}

.btn-secondary:hover,
.btn-secondary:active {
    border-color: var(--border-active);
    color: var(--text);
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-hint);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 12px;
    margin-top: 16px;
    transition: color 0.2s;
}

.btn-ghost:active {
    color: var(--text-secondary);
}

/* ==================== PROGRESS BAR ==================== */

.progress-bar {
    width: 100%;
    max-width: 200px;
    height: 4px;
    background: var(--border);
    border-radius: 100px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 100px;
    transition: width 0.4s var(--ease-out);
}

.step-label {
    font-size: 0.8rem;
    color: var(--text-hint);
    font-weight: 500;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== QUIZ CARDS ==================== */

.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 380px;
}

.cards-grid .quiz-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.cards-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 380px;
}

.quiz-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    transition: all 0.25s var(--ease-spring);
    text-align: center;
    -webkit-user-select: none;
    user-select: none;
}

.quiz-card:active {
    transform: scale(0.96);
}

.quiz-card.selected {
    border-color: var(--pink);
    background: linear-gradient(135deg, rgba(255, 45, 120, 0.1), rgba(155, 89, 255, 0.08));
    box-shadow: 0 0 20px rgba(255, 45, 120, 0.15), inset 0 0 20px rgba(255, 45, 120, 0.05);
    transform: scale(1.02);
}

.quiz-card-wide {
    flex-direction: row;
    text-align: left;
    padding: 18px 20px;
    gap: 14px;
}

.quiz-card-wide .card-emoji {
    font-size: 2rem;
    flex-shrink: 0;
}

.quiz-card-wide .card-title,
.quiz-card-wide .card-desc {
    text-align: left;
}

.card-emoji {
    font-size: 2.2rem;
    line-height: 1;
}

.card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-hint);
    line-height: 1.4;
}

/* ==================== HEART LOADER ==================== */

.heart-loader {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 40px;
}

.heart-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    font-size: 50px;
    line-height: 1;
    animation: heartbeat 1.2s ease-in-out infinite;
}

.heart-pulse::before {
    content: '💗';
}

.heart-rings {
    position: absolute;
    inset: 0;
}

.ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--pink);
    border-radius: 50%;
    opacity: 0;
    animation: ringPulse 2.4s var(--ease-out) infinite;
}

.ring-2 { animation-delay: 0.8s; }
.ring-3 { animation-delay: 1.6s; }

@keyframes heartbeat {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    15% { transform: translate(-50%, -50%) scale(1.25); }
    30% { transform: translate(-50%, -50%) scale(1); }
    45% { transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes ringPulse {
    0% { transform: scale(0.5); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

.loading-text {
    text-align: center;
    margin-bottom: 12px;
}

.loading-sub {
    color: var(--text-hint);
    font-size: 0.9rem;
    text-align: center;
    animation: textFade 2s infinite;
}

@keyframes textFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ==================== LOVE IS CARD ==================== */

.love-card {
    width: 100%;
    max-width: 340px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 28px;
    animation: cardAppear 0.6s var(--ease-spring);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.love-card-sticker {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 45, 120, 0.05) 0%, transparent 100%);
    padding: 24px;
}

.love-card-sticker img {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.love-card-text {
    padding: 0 24px 20px;
}

.ai-text {
    font-family: var(--font-handwritten);
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    text-align: center;
}

.ai-text-sm {
    font-size: 1.15rem;
}

.love-card-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-hint);
    font-weight: 500;
}

.result-badge {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 600;
}

.share-hint {
    font-size: 0.82rem;
    color: var(--text-hint);
    text-align: center;
    line-height: 1.5;
    margin-top: 12px;
    margin-bottom: 24px;
}

/* ==================== MATCH SCREEN ==================== */

.match-cards {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 28px;
    justify-content: center;
}

.love-card-mini {
    width: 45%;
    max-width: 170px;
    margin-bottom: 0;
    border-radius: 18px;
}

.love-card-mini .love-card-sticker {
    padding: 12px;
    aspect-ratio: auto;
}

.love-card-mini .love-card-sticker img {
    width: 100px;
    height: 100px;
}

.love-card-mini .love-card-text {
    padding: 0 12px 14px;
}

.love-card-mini .love-card-meta {
    padding: 10px 12px;
}

.card-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 0 0;
}

.match-heart {
    font-size: 1.5rem;
    animation: heartFloat 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes heartFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

.match-analysis,
.match-plan {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
}

.match-analysis p,
.match-plan div {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
}

.match-plan h3 {
    margin-bottom: 14px;
}

.btn-share {
    margin-top: 8px;
}

/* ==================== STICKER PREVIEW ==================== */

.sticker-preview {
    width: 150px;
    height: 150px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

.sticker-preview img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(255, 45, 120, 0.2));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== PROMO SCREEN ==================== */

.promo-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

.promo-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    margin: 24px 0 32px;
}

.promo-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.promo-feature span:first-child {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.btn-promo {
    background: linear-gradient(135deg, #3b82f6, #9b59ff);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

/* ==================== VIBRATION SUPPORT ==================== */

@media (hover: none) and (pointer: coarse) {
    .quiz-card:active,
    .btn-primary:active {
        transition-duration: 0.1s;
    }
}

/* ==================== ANIMATIONS FOR ELEMENTS ==================== */

.fade-in {
    animation: fadeIn 0.5s var(--ease-out) forwards;
}

.fade-in-up {
    animation: fadeInUp 0.5s var(--ease-out) forwards;
}

.scale-in {
    animation: scaleIn 0.4s var(--ease-spring) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Stagger children animations */
.screen.active .quiz-card:nth-child(1) { animation: fadeInUp 0.4s var(--ease-out) 0.05s both; }
.screen.active .quiz-card:nth-child(2) { animation: fadeInUp 0.4s var(--ease-out) 0.1s both; }
.screen.active .quiz-card:nth-child(3) { animation: fadeInUp 0.4s var(--ease-out) 0.15s both; }
.screen.active .quiz-card:nth-child(4) { animation: fadeInUp 0.4s var(--ease-out) 0.2s both; }
.screen.active .quiz-card:nth-child(5) { animation: fadeInUp 0.4s var(--ease-out) 0.25s both; }

/* ==================== SCROLLBAR ==================== */

::-webkit-scrollbar { width: 0; }
body { scrollbar-width: none; }

/* ==================== DESKTOP ENHANCEMENT ==================== */

@media (min-width: 431px) {
    body {
        background:
            radial-gradient(ellipse at 20% 50%, rgba(255, 45, 120, 0.06), transparent 50%),
            radial-gradient(ellipse at 80% 50%, rgba(155, 89, 255, 0.06), transparent 50%),
            var(--bg);
    }

    #app {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

/* ==================== SHARE MODAL ==================== */

.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: background 0.3s ease;
}

.share-modal-overlay.open {
    background: rgba(0, 0, 0, 0.6);
}

.share-modal-overlay.closing {
    background: rgba(0, 0, 0, 0);
}

.share-modal {
    width: 100%;
    max-width: 430px;
    background: #1a1a1a;
    border-radius: 24px 24px 0 0;
    padding: 20px 20px calc(24px + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.35s var(--ease-out);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.share-modal-overlay.open .share-modal {
    transform: translateY(0);
}

.share-modal-overlay.closing .share-modal {
    transform: translateY(100%);
}

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

.share-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.share-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}

.share-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.share-modal-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.share-btn:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-btn-tg { border-color: rgba(38, 165, 227, 0.3); }
.share-btn-tg:hover { background: rgba(38, 165, 227, 0.12); border-color: rgba(38, 165, 227, 0.5); }
.share-btn-tg svg { color: #26A5E4; }

.share-btn-wa { border-color: rgba(37, 211, 102, 0.3); }
.share-btn-wa:hover { background: rgba(37, 211, 102, 0.12); border-color: rgba(37, 211, 102, 0.5); }
.share-btn-wa svg { color: #25D366; }

.share-btn-vk { border-color: rgba(0, 119, 255, 0.3); }
.share-btn-vk:hover { background: rgba(0, 119, 255, 0.12); border-color: rgba(0, 119, 255, 0.5); }
.share-btn-vk svg { color: #0077FF; }

.share-btn-copy { border-color: rgba(155, 89, 255, 0.3); }
.share-btn-copy:hover { background: rgba(155, 89, 255, 0.12); border-color: rgba(155, 89, 255, 0.5); }
.share-btn-copy svg { color: #9b59ff; }

.share-btn-native {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn-native:hover {
    border-color: var(--border-active);
    color: var(--text);
}

/* Desktop: center modal instead of bottom sheet */
@media (min-width: 431px) {
    .share-modal-overlay {
        align-items: center;
    }

    .share-modal {
        border-radius: 24px;
        max-width: 400px;
        transform: translateY(30px);
        opacity: 0;
        transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
    }

    .share-modal-overlay.open .share-modal {
        transform: translateY(0);
        opacity: 1;
    }

    .share-modal-overlay.closing .share-modal {
        transform: translateY(30px);
        opacity: 0;
    }
}
