@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;300;700;800;900&family=NATS&display=swap');

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

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    color: #fff;
    background: #07091e;
}

/* ═══════════════════════════════════════
   ФОН
═══════════════════════════════════════ */
/* Падающая звезда */
.shooting-star {
    position: absolute;
    top: 0; left: 0;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px #fff, 0 0 20px #a389ff;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: shooting-star-move 1s ease-out forwards;
}
.shooting-star::after {
    content: '';
    position: absolute;
    top: 50%; right: 0;
    transform: translateY(-50%);
    width: 120px; height: 1px;
    background: linear-gradient(to left, rgba(255,255,255,0.8), transparent);
}

@keyframes shooting-star-move {
    0% { opacity: 0; transform: rotate(var(--star-angle)) translateX(0) scale(0); }
    20% { opacity: 1; transform: rotate(var(--star-angle)) translateX(0) scale(1); }
    100% { opacity: 0; transform: rotate(var(--star-angle)) translateX(var(--star-dist)) scale(0.1); }
}

/* Удалили эффект блеска для стабильности */
#stars-container {
    position: fixed;
    inset: -5%;
    z-index: 0;
    background: url('assets/bg.webp') center/cover no-repeat;
    overflow: hidden;
    will-change: transform;
}

#stars-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(7, 9, 30, 0.4);
    z-index: 0;
}

/* Туманности поверх фото */
.nebula {
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.4;
}
.nebula-1 { background: radial-gradient(ellipse at 20% 15%, rgba(80,20,160,.65) 0%, transparent 50%); }
.nebula-2 { background: radial-gradient(ellipse at 78% 60%, rgba(20,50,140,.55) 0%, transparent 50%); }
.nebula-3 { background: radial-gradient(ellipse at 50% 90%, rgba(100,30,200,.45) 0%, transparent 45%); }

/* Мерцающие звёзды */
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    animation: twinkle var(--d) infinite ease-in-out;
    z-index: 2;
}

/* Звезды с лучами (Суперновые) */
.star-glow {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.4);
    animation: twinkle var(--d) infinite ease-in-out;
    z-index: 2;
}

.star-glow::before,
.star-glow::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 80%);
    border-radius: 50%;
}

.star-glow::before { width: var(--beam-w, 40px); height: 1px; }
.star-glow::after { width: 1px; height: var(--beam-h, 40px); }

@keyframes twinkle {
    0%,100% { opacity:.15; transform:scale(.7); }
    50% { opacity:1; transform:scale(1.4); }
}

/* Яркие звёзды созвездий */
.constellation-star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px 2px rgba(163,137,255,.55), 0 0 12px 4px rgba(80,80,255,.25);
    animation: ctwinkle var(--ts) infinite ease-in-out;
}
@keyframes ctwinkle {
    0%,100% { opacity:.2; transform:scale(.7); }
    30%  { opacity:1;   transform:scale(1.6); }
    65%  { opacity:.35; transform:scale(1); }
}

/* ═══════════════════════════════════════
   ШАПКА — прибита к верху
═══════════════════════════════════════ */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    text-align: center;
}

.logo-icon {
    width: 104px;
    height: 104px;
    margin-bottom: 20px;
    animation: rotateLogo 40s linear infinite;
    will-change: transform;
}
@keyframes rotateLogo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.title {
    font-size: clamp(48px, 11vw, 90px);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    text-transform: uppercase;
    /* Градиент сверху вниз: 65% белый, 35% сине-серый */
    background: linear-gradient(to bottom, #FFFFFF 0%, #FFFFFF 65%, #9196BE 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    
    margin-bottom: 10px;
}

.subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(24px, 5.2vw, 42px);
    font-weight: 300;
    margin-top: 24px;
    line-height: 96%;
    opacity: 1;
    letter-spacing: 0;
}

/* ═══════════════════════════════════════
   CTA — «ВЫТЯНИ КАРТУ» + шеврон
   Расположен над картами
═══════════════════════════════════════ */
.app-container {
    position: fixed;
    bottom: -70px; left: 0; right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.choose-section {
    text-align: center;
    margin-bottom: 30px;
    animation: chevBounce 2s infinite ease-in-out;
}

.choose-text {
    font-size: clamp(20px, 4.2vw, 40px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    /* Градиент сверху вниз: 65% белый, 35% сине-серый */
    background: linear-gradient(to bottom, #FFFFFF 0%, #FFFFFF 65%, #9196BE 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    margin-bottom: 0px;
}

.chevron-icon {
    width: 60px;
    height: 60px;
    opacity: 0.8;
}
@keyframes chevBounce {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(12px); }
}

/* ═══════════════════════════════════════
   КАРТЫ — крупный веер из 3
═══════════════════════════════════════ */
.cards-wrapper {
    position: relative;
    width: 100%;
    height: calc(58vw * 1.54 + 30px);
    max-height: 380px;
    transform: translateY(-72px);
}

.loader {
    position: absolute;
    width: 40px; height: 40px;
    border: 2px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.card {
    position: absolute;
    /* Карта ~45% ширины экрана */
    width: 46vw;
    max-width: 200px;
    /* Соотношение сторон карты примерно 0.65 */
    height: calc(46vw / 0.65);
    max-height: 308px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform .5s cubic-bezier(.23,1,.32,1), filter .3s;
    transform-origin: bottom center;
    bottom: 0;
    left: 50%;
    /* Убираем margin-left, центрирование будет через translate в JS */
}

/* Каждая карта — своя z-индекс (центральная — сверху) */
.card:nth-child(1) { z-index: 1; }
.card:nth-child(2) { z-index: 3; } /* центральная */
.card:nth-child(3) { z-index: 1; }

.card.sway {
    animation: sway var(--sw-dur, 4.5s) var(--sw-delay, 0s) infinite ease-in-out;
}
@keyframes sway {
    0%,100% { transform: var(--base-t); }
    50%      { transform: var(--base-t-hover); }
}

@keyframes modalSway {
    0% { transform: rotateY(180deg) rotateX(0deg) translateY(0); }
    25% { transform: rotateY(185deg) rotateX(2deg) translateY(-8px); }
    50% { transform: rotateY(180deg) rotateX(0deg) translateY(-15px); }
    75% { transform: rotateY(175deg) rotateX(-2deg) translateY(-8px); }
    100% { transform: rotateY(180deg) rotateX(0deg) translateY(0); }
}

.modal-sway {
    animation: modalSway 6s ease-in-out infinite;
}

.card-inner {
    width: 100%; height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .9s cubic-bezier(.175,.885,.32,1.275);
}
.card.flipped .card-inner { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 14px;
    box-shadow: 
        0 10px 30px rgba(26, 14, 87, 0.85),
        0 0 0 1px rgba(255, 255, 255, .07);
    overflow: hidden;
}

.card-back {
    background: url('assets/cards/bg.webp') center/cover no-repeat;
}

.card-front {
    background: #0d0d20;
    transform: rotateY(180deg);
    background-size: cover;
    background-position: center;
}

/* ═══════════════════════════════════════
   МОДАЛЬНОЕ ОКНО
═══════════════════════════════════════ */
.modal {
    position: fixed; inset: 0;
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }

.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(5,7,26,.95);
}

.modal-content {
    position: relative;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px 30px;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 22px; right: 22px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: #fff; font-size: 1.2rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
    z-index: 10;
}
.close-btn:hover { background: rgba(255,255,255,.15); }

.single-card-container {
    width: 280px;
    height: 430px;
    perspective: 1000px;
    margin-bottom: 10px;
    margin-top: -40px;
    flex-shrink: 0;
}
.single-card-container .card { position: relative; width: 100%; height: 100%; left: auto; margin: 0; max-width: none; max-height: none; }
.single-card-container .card-inner { width: 100%; height: 100%; }

.card-info { text-align: center; max-width: 320px; padding-top: 15px; }

#card-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: -1px;

    /* Стили как у главной надписи Наталочка */
    background: linear-gradient(to bottom, #FFFFFF 0%, #FFFFFF 65%, #9196BE 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    
}

#card-description {
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.65;
    opacity: .85;
}

.share-btn {
    margin-top: 20px;
    background: #1A0E57;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 15px 44px;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .5px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(26, 14, 87, 0.6);
    transition: transform .2s;
}
.share-btn:active { transform: scale(.97); }

/* ═══════════════════════════════════════
   «ПРИХОДИ ЗАВТРА»
═══════════════════════════════════════ */
.tomorrow-msg {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, calc(-50% + 112px));
    text-align: center;
    padding: 20px 32px 24px;
    background: rgba(10,12,40,.85);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    width: 82%;
    max-width: 340px;
    z-index: 50;
}
.tomorrow-msg.hidden { display: none; }
.tomorrow-logo { width: 44px; opacity: .65; margin-bottom: 16px; }
.tomorrow-msg p { font-size: .95rem; font-weight: 300; line-height: 1.65; opacity: .88; }
