/* ═══════════════════════════════════════════════════
   Подарок для Викули — стили
   Палитра: розовый · персиковый · лавандовый
   ═══════════════════════════════════════════════════ */

:root {
    --pink:      #ff8fb3;
    --pink-soft: #ffc4d6;
    --peach:     #ffd9c2;
    --lavender:  #d9c9ff;
    --lilac:     #b9a6e8;
    --gold:      #ffd98a;
    --text:      #5c3a54;
    --text-soft: #8a6280;
    --night-text:#f3ecff;

    --glass-bg: linear-gradient(135deg, rgba(255,255,255,0.42), rgba(255,255,255,0.14));
    --glass-bg-strong: linear-gradient(135deg, rgba(255,255,255,0.6), rgba(255,255,255,0.28));
    --glass-bg-night: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.05));

    --cursor-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24'%3E%3Cpath d='M12 21C12 21 4 15.5 4 9.8 4 7 6 5 8.4 5 10 5 11.3 5.8 12 7 12.7 5.8 14 5 15.6 5 18 5 20 7 20 9.8 20 15.5 12 21 12 21Z' fill='%23ff8fb3' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E") 13 13, auto;
    --cursor-heart-hover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 24 24'%3E%3Cpath d='M12 21C12 21 4 15.5 4 9.8 4 7 6 5 8.4 5 10 5 11.3 5.8 12 7 12.7 5.8 14 5 15.6 5 18 5 20 7 20 9.8 20 15.5 12 21 12 21Z' fill='%23c9a6ff' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E") 15 15, pointer;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    color: var(--text);
    cursor: var(--cursor-heart);
    -webkit-tap-highlight-color: transparent;
}

button, a, .leaf, .big-star, .flip-card, .mem-card {
    cursor: var(--cursor-heart-hover);
}

button {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
}

.hidden { display: none !important; }

svg.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 2;
    vertical-align: -0.12em;
}

/* ═══════════════ Фоновые слои ═══════════════ */

.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    transition: opacity 1.6s ease;
}

.bg-day {
    background: linear-gradient(160deg, #ffe4ec 0%, #ffd9c8 30%, #f3d9ff 68%, #dcd0ff 100%);
    background-size: 200% 200%;
    animation: bg-drift 22s ease-in-out infinite alternate;
}

.bg-night {
    background: radial-gradient(120% 90% at 50% 110%, #4a3a75 0%, #2c2350 45%, #171233 100%);
    opacity: 0;
}

body.night .bg-day   { opacity: 0; }
body.night .bg-night { opacity: 1; }

.night-glow {
    position: absolute;
    left: 50%; bottom: -30%;
    width: 120vmax; height: 120vmax;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255,143,179,0.16) 0%, transparent 55%);
    animation: glow-breathe 6s ease-in-out infinite;
}

@keyframes bg-drift {
    from { background-position: 0% 0%; }
    to   { background-position: 100% 100%; }
}

@keyframes glow-breathe {
    0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(1); }
    50%      { opacity: 1;    transform: translateX(-50%) scale(1.08); }
}

/* ═══════════════ Лепестки ═══════════════ */

#petal-layer {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.petal {
    position: absolute;
    top: -5vh;
    border-radius: 100% 0 100% 0;
    background: linear-gradient(135deg, var(--p-c1, #ffc4d6), var(--p-c2, #ff9fbe));
    opacity: 0.8;
    animation: petal-fall var(--p-dur, 11s) linear forwards;
}

@keyframes petal-fall {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    8%   { opacity: 0.85; }
    85%  { opacity: 0.8; }
    100% { transform: translate(var(--p-drift, 60px), 108vh) rotate(var(--p-rot, 540deg)); opacity: 0; }
}

/* ═══════════════ Экраны и переходы ═══════════════ */

#app { position: fixed; inset: 0; }

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 28px 18px 90px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.97) translateY(14px);
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.9s;
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.9s ease 0.35s, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.35s, visibility 0s;
    z-index: 2;
}

.screen.dissolving {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(6px);
    transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease, visibility 0s linear 0.8s;
}

/* ═══════════════ Общие элементы ═══════════════ */

.appear { animation: pop-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes pop-in {
    from { opacity: 0; transform: translateY(26px) scale(0.94); }
    to   { opacity: 1; transform: none; }
}

.screen-head {
    text-align: center;
    max-width: 640px;
    animation: pop-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen-head h2 {
    font-family: 'Comfortaa', sans-serif;
    font-size: clamp(22px, 4.2vw, 34px);
    margin: 14px 0 6px;
    background: linear-gradient(100deg, #e2588a, #a678e8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.screen-head p {
    color: var(--text-soft);
    font-size: clamp(14px, 2.4vw, 17px);
}

.head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    color: var(--pink);
    font-size: 26px;
    animation: icon-float 4s ease-in-out infinite;
}

body.night .head-icon { background: var(--glass-bg-night); color: var(--pink-soft); }

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

.screen-foot { margin-top: 6px; }

/* Кнопки — стекло + «дыхание» */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    border-radius: 999px;
    font-family: 'Comfortaa', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.35s ease;
    animation: breathe 3.2s ease-in-out infinite;
}

.btn:hover  { transform: translateY(-3px) scale(1.04); background: linear-gradient(135deg, rgba(255,255,255,0.75), rgba(255,255,255,0.4)); }
.btn:active { transform: scale(0.96); }
.btn svg.lucide { color: var(--pink); font-size: 19px; }

.btn-main {
    background: linear-gradient(135deg, rgba(255,168,199,0.75), rgba(214,190,255,0.6));
    color: #fff;
    text-shadow: 0 1px 6px rgba(180, 80, 130, 0.35);
}
.btn-main svg.lucide { color: #fff; }
.btn-main:hover { background: linear-gradient(135deg, rgba(255,150,188,0.9), rgba(200,170,255,0.8)); }

.btn-night {
    background: linear-gradient(135deg, rgba(255,168,199,0.35), rgba(160,130,255,0.3));
    color: var(--night-text);
}

@keyframes breathe {
    0%, 100% { scale: 1; }
    50%      { scale: 1.035; }
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-soft);
    padding: 8px 14px;
    border-radius: 999px;
    transition: color 0.3s ease, transform 0.3s ease;
}
.link-btn:hover { color: var(--pink); transform: scale(1.05); }
.link-btn svg.lucide { color: var(--gold); }
.link-btn-night { color: rgba(243,236,255,0.65); }
.link-btn-night:hover { color: var(--night-text); }

/* ═══════════════ 1. Пин-код ═══════════════ */

.hearts-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.float-heart {
    position: absolute;
    bottom: -8vh;
    color: rgba(255, 143, 179, var(--h-op, 0.35));
    animation: heart-rise var(--h-dur, 14s) linear infinite;
    animation-delay: var(--h-delay, 0s);
}

.float-heart svg { width: var(--h-size, 26px); height: var(--h-size, 26px); fill: currentColor; }

@keyframes heart-rise {
    0%   { transform: translateY(0) translateX(0) rotate(-8deg) scale(0.9); opacity: 0; }
    10%  { opacity: 1; }
    50%  { transform: translateY(-55vh) translateX(var(--h-sway, 30px)) rotate(8deg) scale(1.05); }
    90%  { opacity: 0.7; }
    100% { transform: translateY(-115vh) translateX(0) rotate(-6deg) scale(0.95); opacity: 0; }
}

.pin-card {
    position: relative;
    width: min(400px, 94vw);
    padding: 34px 28px 28px;
    border-radius: 32px;
    background: linear-gradient(150deg, rgba(255,196,214,0.5), rgba(255,255,255,0.28) 45%, rgba(217,201,255,0.42));
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    text-align: center;
}

.lock-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px; height: 76px;
    margin: -72px auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(255,214,228,0.6));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--pink);
    font-size: 32px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.4s ease;
}

.lock-circle.unlocked {
    color: #6dcf94;
    transform: scale(1.18) rotate(-8deg);
}

.pin-envelope-icon {
    color: var(--lilac);
    font-size: 22px;
    margin-bottom: 6px;
    animation: icon-float 3.6s ease-in-out infinite;
}

.pin-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(28px, 6vw, 36px);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 4px;
}

.pin-sub { color: var(--text-soft); font-size: 15px; margin-bottom: 20px; }

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 22px;
}

.pin-dots span {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
    transition: background 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-dots span.filled {
    background: linear-gradient(135deg, var(--pink), var(--lilac));
    transform: scale(1.25);
}

.pin-dots.shake { animation: shake 0.5s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(9px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 68px);
    gap: 12px;
    justify-content: center;
    margin-bottom: 14px;
}

.key {
    height: 58px;
    border-radius: 20px;
    font-family: 'Comfortaa', sans-serif;
    font-size: 21px;
    font-weight: 700;
    color: var(--text);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.key:hover  { transform: translateY(-2px) scale(1.06); background: var(--glass-bg-strong); }
.key:active { transform: scale(0.92); }
.key-del { font-size: 20px; color: var(--text-soft); }
.key svg.lucide { vertical-align: -0.18em; }

.hint-text {
    font-family: 'Caveat', cursive;
    font-size: 21px;
    color: var(--text-soft);
    min-height: 28px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hint-text.show { opacity: 1; transform: none; }

/* ═══════════════ 2. Конверт и письмо ═══════════════ */

.envelope-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.envelope-scene.opened { opacity: 0; transform: scale(1.1) translateY(-30px); pointer-events: none; }

.envelope {
    position: relative;
    width: min(340px, 84vw);
    aspect-ratio: 1.45;
    animation: env-hover 4s ease-in-out infinite;
    filter: drop-shadow(0 18px 30px rgba(180, 90, 140, 0.25));
}

@keyframes env-hover {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-10px) rotate(1deg); }
}

.env-back, .env-front, .env-flap, .env-paper-peek {
    position: absolute;
    border-radius: 14px;
}

.env-back {
    inset: 0;
    background: linear-gradient(150deg, #f9b8cf, #eba6d2);
}

.env-paper-peek {
    left: 6%; right: 6%;
    top: 6%; bottom: 12%;
    background: linear-gradient(180deg, #fffaf5, #fff0f5);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.55s;
}

.envelope.open .env-paper-peek { transform: translateY(-46%); }

.env-front {
    inset: 0;
    background:
        linear-gradient(to bottom right, transparent 49%, rgba(255,255,255,0.16) 50%),
        linear-gradient(to bottom left, transparent 49%, rgba(255,255,255,0.16) 50%),
        linear-gradient(200deg, #ffd0e0 0%, #f7b3d2 55%, #edaad4 100%);
    clip-path: polygon(0 0, 50% 42%, 100% 0, 100% 100%, 0 100%);
    z-index: 2;
}

.env-flap {
    inset: 0 0 auto 0;
    height: 52%;
    background: linear-gradient(180deg, #fbc3d8, #f2aed4);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 3;
}

.envelope.open .env-flap {
    transform: rotateX(180deg);
    z-index: 1;
    filter: brightness(1.06);
}

.env-seal {
    position: absolute;
    left: 50%; top: 46%;
    transform: translate(-50%, -50%);
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff9dbd, #e786c8);
    color: #fff;
    font-size: 26px;
    z-index: 4;
    animation: seal-pulse 2.4s ease-in-out infinite;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.env-seal svg { fill: currentColor; }

.envelope.open .env-seal {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

@keyframes seal-pulse {
    0%, 100% { box-shadow: var(--glass-shadow), 0 0 0 0 rgba(255, 143, 179, 0.5); }
    50%      { box-shadow: var(--glass-shadow), 0 0 0 16px rgba(255, 143, 179, 0); }
}

.tap-hint {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    color: var(--text-soft);
    animation: icon-float 3s ease-in-out infinite;
}

.letter-card {
    position: relative;
    width: min(560px, 94vw);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 40px 36px 34px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255,252,248,0.92), rgba(255,242,247,0.88));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    text-align: center;
    animation: letter-unfold 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
    transform-origin: top center;
}

@keyframes letter-unfold {
    0%   { opacity: 0; transform: perspective(900px) rotateX(-55deg) translateY(40px) scale(0.9); }
    60%  { opacity: 1; }
    100% { transform: none; }
}

.letter-deco {
    color: var(--pink);
    font-size: 30px;
    margin-bottom: 10px;
    animation: icon-float 4s ease-in-out infinite;
}

.letter-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(32px, 6.4vw, 44px);
    font-weight: 700;
    color: #d8558a;
    min-height: 1.3em;
    margin-bottom: 14px;
}

.letter-title .caret {
    display: inline-block;
    width: 2px; height: 0.9em;
    margin-left: 3px;
    background: var(--pink);
    vertical-align: -0.12em;
    animation: caret-blink 0.85s step-end infinite;
}

@keyframes caret-blink { 50% { opacity: 0; } }

.letter-body {
    font-family: 'Caveat', cursive;
    font-size: clamp(21px, 4vw, 26px);
    line-height: 1.45;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.letter-body p {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-body p.shown { opacity: 1; transform: none; }
.letter-body svg.lucide { color: var(--pink); fill: var(--pink); }

/* ═══════════════ 3. Галерея — слайдер ═══════════════ */

#s-gallery {
    padding: 0;
    justify-content: flex-start;
}

.gallery-slider {
    position: relative;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 0 86px;
}

/* Стек карточек */
.gallery-stack {
    position: relative;
    width: min(380px, 88vw);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
}

.mem-card {
    position: absolute;
    inset: 0;
    border-radius: 28px;
    overflow: hidden;
    background: var(--glass-bg);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.2),
        var(--glass-shadow);
    will-change: transform, opacity;
    transition: transform 0.08s linear, opacity 0.08s linear;
    touch-action: none;
}

/* Карточки за активной — видны краями (как стек) */
.mem-card.below-1 {
    transform: scale(0.94) translateY(18px);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    z-index: 1;
}
.mem-card.below-2 {
    transform: scale(0.88) translateY(34px);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    z-index: 0;
    opacity: 0.75;
}
.mem-card.below-3 { opacity: 0; z-index: -1; }

.mem-card.top {
    z-index: 3;
    transition: none;
}

/* Улетает влево/вправо */
.mem-card.fly-left {
    transform: translateX(-130%) rotate(-18deg) !important;
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.55, 0, 1, 0.45), opacity 0.42s ease !important;
}
.mem-card.fly-right {
    transform: translateX(130%) rotate(18deg) !important;
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.55, 0, 1, 0.45), opacity 0.42s ease !important;
}

/* Возврат если не докрутили */
.mem-card.snap-back {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Метки like / nope при свайпе */
.swipe-label {
    position: absolute;
    top: 30px;
    font-family: 'Caveat', cursive;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.05em;
    border: 4px solid currentColor;
    border-radius: 10px;
    padding: 4px 14px;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 10;
}

.swipe-label.love  { left: 20px;  color: #ff8fb3; transform: rotate(-12deg); }
.swipe-label.nope  { right: 20px; color: #a0aec0; transform: rotate(12deg); }

.mem-photo {
    position: absolute;
    inset: 0;
}

.mem-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}

.mem-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,0.92);
    font-size: 52px;
    background: var(--ph-grad, linear-gradient(150deg, #ffb8ce, #c9b3f5));
}

.mem-placeholder small {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    opacity: 0.8;
}

/* Нижняя панель с подписью — всегда видна */
.mem-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 80px 24px 24px;
    background: linear-gradient(to top, rgba(60, 20, 55, 0.88), rgba(60, 20, 55, 0.55) 55%, transparent);
    color: #fff;
}

.mem-overlay h3 {
    font-family: 'Caveat', cursive;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
}

.mem-overlay time {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pink-soft);
    margin: 3px 0 7px;
}

.mem-overlay p {
    font-size: 16px;
    line-height: 1.4;
    opacity: 0.9;
}

/* Счётчик и кнопки под слайдером */
.gallery-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 0 0;
    flex-shrink: 0;
}

.gallery-counter {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    color: var(--text-soft);
    min-width: 54px;
    text-align: center;
}

.gallery-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    animation: breathe 3s ease-in-out infinite;
}
.gallery-btn:hover  { transform: scale(1.12); }
.gallery-btn:active { transform: scale(0.9); }
.gallery-btn.btn-love { color: var(--pink); }
.gallery-btn.btn-skip { color: var(--text-soft); }

/* Точки-прогресс */
.gallery-dots {
    display: flex;
    gap: 7px;
    padding: 6px 0 0;
    flex-shrink: 0;
}

.gallery-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(180, 120, 160, 0.25);
    transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.3s ease;
}
.gallery-dot.seen { background: rgba(255, 143, 179, 0.45); }
.gallery-dot.current {
    background: linear-gradient(135deg, var(--pink), var(--lilac));
    transform: scale(1.4);
}

/* ═══════════════ 5. Колесо ═══════════════ */

.wheel-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.wheel-box {
    position: relative;
    width: min(360px, 86vw);
    aspect-ratio: 1;
    animation: pop-in 1s cubic-bezier(0.22, 1, 0.36, 1) both 0.15s;
}

.wheel-svg-wrap {
    width: 100%; height: 100%;
    border-radius: 50%;
    filter: drop-shadow(0 14px 30px rgba(170, 90, 150, 0.3));
}

.wheel-svg-wrap svg {
    width: 100%; height: 100%;
    display: block;
    transition: transform 4.6s cubic-bezier(0.12, 0.75, 0.08, 1);
}

.wheel-pointer {
    position: absolute;
    top: -14px; left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff, #ffe3ee);
    color: var(--pink);
    font-size: 20px;
}

.wheel-pointer::after {
    content: '';
    position: absolute;
    bottom: -8px; left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #ffeef4;
    border-bottom: none;
}

.wheel-pointer svg { fill: currentColor; }

.wheel-hub {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 96px; height: 96px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 2;
    background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,224,236,0.85));
    font-family: 'Comfortaa', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #d8558a;
    animation: breathe 2.6s ease-in-out infinite;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wheel-hub svg.lucide { color: var(--gold); font-size: 20px; }
.wheel-hub:hover  { transform: translate(-50%, -50%) scale(1.07); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(0.94); }
.wheel-hub:disabled { opacity: 0.75; pointer-events: none; }

.wheel-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
    border-radius: 22px;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: pop-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.wheel-result-icon {
    display: flex;
    width: 52px; height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-soft), var(--lavender));
    color: #fff;
    font-size: 24px;
    flex-shrink: 0;
}

.wheel-result-text {
    font-family: 'Caveat', cursive;
    font-size: 27px;
    font-weight: 700;
    color: var(--text);
}

/* ═══════════════ 6. Дерево ═══════════════ */

.tree-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tree-stage {
    position: relative;
    width: min(430px, 94vw);
    animation: pop-in 1s cubic-bezier(0.22, 1, 0.36, 1) both 0.15s;
}

.tree-svg { width: 100%; height: auto; display: block; }

.tree-leaves { position: absolute; inset: 0; }

.leaf {
    position: absolute;
    width: 44px; height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50% 50% 50% 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.85), rgba(200,240,205,0.75));
    color: #4da06c;
    font-size: 19px;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease, color 0.4s ease;
    animation: leaf-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both var(--d, 0s),
               leaf-sway 3.6s ease-in-out infinite calc(var(--d, 0s) + 0.7s);
}

@keyframes leaf-in {
    from { opacity: 0; transform: scale(0) rotate(-40deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes leaf-sway {
    0%, 100% { rotate: -4deg; }
    50%      { rotate: 5deg; }
}

.leaf:hover { transform: scale(1.18) !important; }

.leaf.opened {
    background: linear-gradient(135deg, var(--pink-soft), #ffa8c7);
    color: #fff;
    animation: leaf-in 0.7s both, leaf-sway 3.6s ease-in-out infinite;
}

.leaf.opened svg { fill: currentColor; }

.tree-counter {
    font-family: 'Caveat', cursive;
    font-size: 21px;
    color: var(--text-soft);
    min-height: 26px;
}

/* ═══════════════ 7. Карточки ═══════════════ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 200px));
    gap: 18px;
    width: min(680px, 94vw);
    justify-content: center;
    perspective: 1200px;
}

.flip-card {
    aspect-ratio: 3 / 3.8;
    position: relative;
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease var(--d, 0s), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s);
}

.screen.active .flip-card.revealed { opacity: 1; transform: none; }

.flip-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.flip-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-card:not(.flipped):hover .flip-inner { transform: rotateY(14deg) translateY(-5px); }

.flip-face {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px;
    text-align: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.flip-front {
    background: linear-gradient(150deg, rgba(255,184,206,0.6), rgba(201,179,245,0.5));
    color: rgba(255,255,255,0.95);
    font-size: 34px;
}

.flip-front small {
    font-family: 'Comfortaa', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(160deg, rgba(255,252,250,0.9), rgba(255,235,243,0.85));
}

.flip-back .flip-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pink-soft), var(--lavender));
    color: #fff;
    font-size: 23px;
}

.flip-back p {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    line-height: 1.25;
    color: var(--text);
}

/* ═══════════════ 8. Ночное небо ═══════════════ */

#s-sky { padding: 0; }

.sky-stage {
    position: relative;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Снизу запас, чтобы кнопку не перекрывала навигация-точки */
    padding: 40px 18px 96px;
}

.sky-head h2 {
    background: linear-gradient(100deg, #ffc4d6, #c9b3f5);
    -webkit-background-clip: text;
    background-clip: text;
}

.sky-head p { color: rgba(243,236,255,0.6); }

.sky-stars { position: absolute; inset: 0; overflow: hidden; }

.tiny-star {
    position: absolute;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: #fff;
    opacity: 0.6;
    animation: twinkle var(--t-dur, 3s) ease-in-out infinite var(--t-delay, 0s);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50%      { opacity: 0.9;  transform: scale(1.3); }
}

.big-star {
    position: absolute;
    width: 46px; height: 46px;
    margin: -23px 0 0 -23px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffe9a8;
    filter: drop-shadow(0 0 10px rgba(255, 224, 130, 0.8));
    animation: big-twinkle 2.8s ease-in-out infinite var(--t-delay, 0s);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.4s ease;
    z-index: 2;
}

.big-star svg { width: 30px; height: 30px; fill: currentColor; stroke: none; }

.big-star:hover { transform: scale(1.35); }

.big-star.lit {
    color: var(--pink-soft);
    filter: drop-shadow(0 0 14px rgba(255, 160, 195, 0.9));
    animation: none;
}

@keyframes big-twinkle {
    0%, 100% { opacity: 0.75; transform: scale(0.94); }
    50%      { opacity: 1;    transform: scale(1.1); }
}

.sky-panel {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(480px, 90vw);
    padding: 18px 26px;
    border-radius: 22px;
    background: var(--glass-bg-night);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    color: var(--night-text);
    animation: pop-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.sky-panel-icon { color: var(--gold); font-size: 24px; flex-shrink: 0; }
.sky-panel-icon svg { fill: currentColor; stroke: none; }

.sky-panel p {
    font-family: 'Caveat', cursive;
    font-size: 23px;
    line-height: 1.3;
}

.sky-foot { position: relative; z-index: 3; }

/* ═══════════════ 9. Финал ═══════════════ */

#s-final { padding: 0; overflow: hidden; }

#fx-canvas {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.final-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
    padding: 24px;
    min-height: 100%;
    width: 100%;
}

.final-glow {
    position: absolute;
    left: 50%; top: 50%;
    width: 90vmin; height: 90vmin;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255,143,179,0.22) 0%, rgba(201,166,255,0.1) 45%, transparent 70%);
    animation: glow-breathe-c 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glow-breathe-c {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.12); }
}

.final-line1 {
    font-family: 'Caveat', cursive;
    font-size: clamp(28px, 6vw, 44px);
    color: rgba(243, 236, 255, 0.85);
    min-height: 1.3em;
}

.final-line2 {
    font-family: 'Caveat', cursive;
    font-size: clamp(44px, 10vw, 84px);
    font-weight: 700;
    line-height: 1.1;
    min-height: 1.15em;
    background: linear-gradient(100deg, #ffb3c9, #ffd9a8, #d9b8ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 24px rgba(255, 143, 179, 0.35));
}

.final-line1 .caret, .final-line2 .caret {
    display: inline-block;
    width: 3px; height: 0.85em;
    margin-left: 4px;
    background: var(--pink-soft);
    vertical-align: -0.08em;
    animation: caret-blink 0.85s step-end infinite;
}

.final-heart {
    color: var(--pink);
    font-size: 42px;
    animation: heart-beat 1.6s ease-in-out infinite, pop-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.final-heart svg { fill: currentColor; filter: drop-shadow(0 0 18px rgba(255, 143, 179, 0.7)); }

@keyframes heart-beat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.18); }
    28% { transform: scale(1); }
    42% { transform: scale(1.12); }
    56% { transform: scale(1); }
}

.final-foot {
    font-family: 'Comfortaa', sans-serif;
    font-size: 14px;
    color: rgba(243, 236, 255, 0.55);
    letter-spacing: 0.04em;
    animation: pop-in 1.2s ease both;
}

/* ═══════════════ Навигация-точки ═══════════════ */

#nav-dots {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--glass-bg);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: var(--glass-shadow);
    transition: opacity 0.6s ease;
}

body.night #nav-dots { background: var(--glass-bg-night); }

.nav-dot {
    width: 10px; height: 10px;
    padding: 0;
    border-radius: 50%;
    background: rgba(140, 100, 130, 0.3);
    transition: background 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.night .nav-dot { background: rgba(255,255,255,0.25); }

.nav-dot.visited { background: rgba(255, 143, 179, 0.55); }
.nav-dot.current {
    background: linear-gradient(135deg, var(--pink), var(--lilac));
    transform: scale(1.5);
}
.nav-dot.visited:hover { transform: scale(1.4); }
.nav-dot:disabled { pointer-events: none; }

/* ═══════════════ Модальное окно ═══════════════ */

#modal-root {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(90, 50, 90, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade-in 0.4s ease both;
}

@keyframes fade-in { from { opacity: 0; } }

.modal-card {
    position: relative;
    width: min(400px, 92vw);
    padding: 30px 28px 26px;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(255,252,250,0.95), rgba(255,236,244,0.92));
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: pop-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.modal-icon {
    width: 58px; height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #bfe8c8, #9ed8b5);
    color: #fff;
    font-size: 26px;
}

.modal-icon.pink { background: linear-gradient(135deg, var(--pink-soft), #f4a3c8); }

.modal-card p {
    font-family: 'Caveat', cursive;
    font-size: 25px;
    line-height: 1.35;
    color: var(--text);
}

/* ═══════════════ Искры от кликов ═══════════════ */

#spark-layer {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    overflow: hidden;
}

.spark {
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--s-color, #ffd98a);
    animation: spark-fly var(--s-dur, 0.6s) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.spark.star-shape {
    border-radius: 0;
    clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
}

@keyframes spark-fly {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--s-x, 30px), var(--s-y, -30px)) scale(0); opacity: 0; }
}

/* ═══════════════ Адаптив ═══════════════ */

@media (max-width: 720px) {
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .cards-grid   { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .screen { padding-bottom: 84px; }
    .keypad { grid-template-columns: repeat(3, 62px); gap: 10px; }
    .letter-card { padding: 30px 22px 26px; }
    .leaf { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
}

@media (max-width: 380px) {
    .keypad { grid-template-columns: repeat(3, 56px); }
    .key { height: 52px; }
}

/* Плавная прокрутка внутри экранов */
.screen::-webkit-scrollbar { width: 0; }

/* ═══════════════ Собачка на машине ═══════════════ */

#dog-drive {
    position: fixed;
    bottom: 4px;
    left: 0;
    z-index: 5;
    width: clamp(120px, 20vw, 190px);
    pointer-events: none;
    transform: translateX(-150%);
}

#dog-drive.driving      { animation: dog-drive-left 8s linear forwards; }
#dog-drive.driving.flip { animation: dog-drive-right 8s linear forwards; }
#dog-drive.flip img     { transform: scaleX(-1); }

#dog-drive img {
    width: 100%;
    display: block;
    animation: dog-bob 0.45s ease-in-out infinite;
    filter: drop-shadow(0 10px 10px rgba(80, 40, 70, 0.3));
}

/* Едет справа налево (машина смотрит влево) */
@keyframes dog-drive-left {
    from { transform: translateX(105vw); }
    to   { transform: translateX(-150%); }
}

/* Обратный рейс — слева направо (картинка отзеркалена) */
@keyframes dog-drive-right {
    from { transform: translateX(-150%); }
    to   { transform: translateX(105vw); }
}

/* Подпрыгивание как на дороге */
@keyframes dog-bob {
    0%, 100% { translate: 0 0;    rotate: -1.6deg; }
    50%      { translate: 0 -5px; rotate: 1.4deg; }
}

/* ═══════════════ Оверлей «переверни устройство» ═══════════════ */

#rotate-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    text-align: center;
    padding: 30px;
    background: rgba(26, 14, 34, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    animation: fade-in 0.4s ease both;
}

.rotate-icon {
    font-size: 74px;
    color: var(--pink-soft);
    animation: rotate-hint 2.6s ease-in-out infinite;
}

.rotate-icon svg.lucide { stroke-width: 1.5; }

@keyframes rotate-hint {
    0%, 18%   { transform: rotate(0deg); }
    45%, 82%  { transform: rotate(90deg); }
    100%      { transform: rotate(0deg); }
}

.rotate-title {
    font-family: 'Comfortaa', sans-serif;
    font-size: 24px;
    font-weight: 700;
}

.rotate-sub {
    font-family: 'Caveat', cursive;
    font-size: 23px;
    color: rgba(255, 255, 255, 0.65);
    max-width: 320px;
}

/* Пользователи с ограничением анимаций */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.2s !important;
    }
}
