/* Новогодняя прокрутка подарка (gift-spin.js) — открывается после отправки
   заявки с заездом в период акции. Подарок уже выбран сервером, лента
   только красиво к нему приезжает. */

html.gs-open,
html.gs-open body {
    overflow: hidden;
}

.gs {
    --cream: #f2d0a4;
    --candy: #d9252e;
    position: fixed;
    inset: 0;
    z-index: 9995;            /* выше баннера cookie (9990), ниже курсора */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(ellipse 80% 70% at 50% 40%, rgba(32, 58, 40, 0.94), rgba(7, 13, 9, 0.97));
    opacity: 0;
    transition: opacity 0.35s ease;
    overflow-y: auto;
}

.gs[hidden] {
    display: none;
}

.gs.is-open {
    opacity: 1;
}

.gs-confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.gs-card {
    position: relative;
    z-index: 1;
    width: min(100%, 580px);
    margin: auto;
    padding: 30px 22px 24px;
    border-radius: 28px;
    text-align: center;
    color: #fbf3e6;
    background:
        radial-gradient(ellipse 90% 50% at 50% 0%, rgba(242, 208, 164, 0.12), transparent 70%),
        linear-gradient(180deg, #1c3324, #102016);
    border: 1px solid rgba(242, 208, 164, 0.22);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.gs.is-open .gs-card {
    transform: none;
}

/* леденцовая кайма сверху */
.gs-card::before {
    content: '';
    position: absolute;
    left: 22px;
    right: 22px;
    top: -1px;
    height: 6px;
    border-radius: 0 0 6px 6px;
    background: repeating-linear-gradient(-50deg, var(--candy) 0 9px, #fffaf4 9px 18px);
    opacity: 0.9;
}

.gs-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(242, 208, 164, 0.25);
    background: rgba(0, 0, 0, 0.2);
    color: var(--cream);
    cursor: pointer;
}

.gs-close:hover {
    background: rgba(242, 208, 164, 0.15);
}

.gs-kicker {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cream);
    opacity: 0.8;
}

.gs-title {
    margin: 6px 0 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 6.4vw, 2.3rem);
    line-height: 1.05;
    color: var(--cream);
    text-shadow: 0 2px 18px rgba(242, 208, 164, 0.25);
}

.gs-text {
    margin: 0 auto 16px;
    max-width: 440px;
    font-family: var(--font-body);
    font-size: 1.12rem;
    line-height: 1.35;
    color: rgba(251, 243, 230, 0.86);
}

/* ---------- шансы по ценности ---------- */
.gs-odds {
    margin: 0 auto 18px;
    max-width: 400px;
    padding: 12px 14px 10px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(242, 208, 164, 0.12);
    text-align: left;
}

.gs-odds-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cream);
}

.gs-nights {
    margin-left: auto;
    padding: 3px 9px;
    border-radius: 99px;
    background: rgba(242, 208, 164, 0.14);
    letter-spacing: 0.06em;
}

.gs-odd {
    display: grid;
    grid-template-columns: 78px 1fr 44px;
    align-items: center;
    gap: 10px;
    padding: 3px 0;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: rgba(251, 243, 230, 0.8);
}

.gs-odd b {
    color: var(--tier);
    font-weight: 700;
    text-transform: uppercase;
}

.gs-odd i {
    position: relative;
    height: 7px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.gs-odd i::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--p);
    border-radius: inherit;
    background: var(--tier);
    box-shadow: 0 0 10px var(--tier);
    transform-origin: left;
    animation: gs-bar 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--n) * 0.08s + 0.3s);
}

.gs-odd span {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.gs-odd em {
    display: block;
    font-style: normal;
    font-size: 0.62rem;
    color: #9fe0a8;
}

@keyframes gs-bar {
    from { transform: scaleX(0); }
}

/* цвета ценности */
.tier-1 { --tier: #9fc6a6; }
.tier-2 { --tier: #6fb6ff; }
.tier-3 { --tier: #c38bff; }
.tier-4 { --tier: #ffcf5a; }

/* ---------- коробка ---------- */
.gs-stage {
    position: relative;
    height: 178px;
    margin-bottom: 18px;
}

.gs-box {
    position: absolute;
    left: 50%;
    bottom: 28px;
    width: 128px;
    height: 128px;
    margin-left: -64px;
    animation: gs-wiggle 2.6s ease-in-out infinite;
    transform-origin: 50% 100%;
}

.gs-box::after {                        /* тень */
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: -8px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
}

.gs-box-base,
.gs-box-lid {
    position: absolute;
    background: linear-gradient(180deg, #e8343d, #a5111a);
    box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.gs-box-base {
    left: 10px;
    right: 10px;
    bottom: 0;
    height: 80px;
    border-radius: 4px 4px 8px 8px;
}

.gs-box-lid {
    left: 2px;
    right: 2px;
    top: 26px;
    height: 28px;
    border-radius: 6px;
    z-index: 1;
    transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.6s ease 0.25s;
}

/* лента */
.gs-box-base::before,
.gs-box-lid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 20px;
    margin-left: -10px;
    background: linear-gradient(90deg, #f3dca8, #fff8e6 45%, #e0bd7a);
}

.gs-box-base::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 26px;
    height: 16px;
    background: linear-gradient(180deg, #f3dca8, #fff8e6 45%, #e0bd7a);
}

/* бант */
.gs-bow {
    position: absolute;
    left: 50%;
    top: -14px;
    width: 0;
    height: 0;
}

.gs-bow::before,
.gs-bow::after {
    content: '';
    position: absolute;
    top: 0;
    width: 34px;
    height: 24px;
    border: 7px solid #fff1d2;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gs-bow::before {
    right: 0;
    transform: rotate(-24deg);
    transform-origin: right bottom;
}

.gs-bow::after {
    left: 0;
    transform: rotate(24deg);
    transform-origin: left bottom;
}

.gs-sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff4c9;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: gs-twinkle 1.8s ease-in-out infinite;
}

.gs-sparkle:nth-of-type(1) { left: 26%; top: 18%; }
.gs-sparkle:nth-of-type(2) { left: 70%; top: 10%; animation-delay: -0.6s; width: 14px; height: 14px; }
.gs-sparkle:nth-of-type(3) { left: 76%; top: 58%; animation-delay: -1.2s; }
.gs-sparkle:nth-of-type(4) { left: 20%; top: 62%; animation-delay: -0.3s; width: 7px; height: 7px; }

@keyframes gs-twinkle {
    0%, 100% { transform: scale(0.4) rotate(0deg); opacity: 0.3; }
    50% { transform: scale(1) rotate(45deg); opacity: 1; }
}

@keyframes gs-wiggle {
    0%, 70%, 100% { transform: rotate(0); }
    76% { transform: rotate(-6deg) translateY(-4px); }
    82% { transform: rotate(5deg) translateY(-6px); }
    88% { transform: rotate(-3deg); }
    94% { transform: rotate(2deg); }
}

/* коробка открывается */
.gs.is-opening .gs-box {
    animation: none;
}

.gs.is-opening .gs-box-lid {
    transform: translate(18px, -90px) rotate(28deg);
    opacity: 0;
}

.gs.is-opening .gs-box-base,
.gs.is-opening .gs-box::after {
    transition: opacity 0.4s ease 0.35s, transform 0.5s ease 0.3s;
    opacity: 0;
    transform: scale(0.8) translateY(12px);
}

/* ---------- лента ---------- */
.gs-reel {
    --w: 112px;                 /* ширина карточки */
    --g: 10px;                  /* зазор */
    position: absolute;
    inset: 4px -22px;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.45s ease, transform 0.45s ease;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent);
}

.gs.is-spinning .gs-reel,
.gs.is-won .gs-reel {
    opacity: 1;
    transform: none;
}

.gs-strip {
    display: flex;
    gap: var(--g);
    height: 100%;
    align-items: center;
    will-change: transform;
}

.gs-item {
    position: relative;
    flex: 0 0 var(--w);
    height: 148px;
    padding: 14px 8px 12px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background:
        radial-gradient(ellipse 80% 55% at 50% 100%, color-mix(in srgb, var(--tier) 30%, transparent), transparent 75%),
        linear-gradient(180deg, #213a2a, #142419);
    border: 1px solid color-mix(in srgb, var(--tier) 45%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s ease, opacity 0.5s ease;
}

.gs-item::after {                       /* полоска ценности */
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--tier);
    box-shadow: 0 0 10px var(--tier);
}

.gs-emoji {
    font-size: 42px;
    line-height: 1;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

img.gs-emoji {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.gs-prize-img {
    display: block;
    width: 96px;
    height: 96px;
    margin: 4px auto 2px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--tier) 45%, transparent));
}

.gs-name {
    font-family: var(--font-display);
    font-size: 0.66rem;
    line-height: 1.2;
    letter-spacing: 0.03em;
    color: #fbf3e6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* указатель по центру */
.gs-pointer {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: linear-gradient(180deg, transparent, #ffd76a 18%, #ffd76a 82%, transparent);
    box-shadow: 0 0 12px #ffcf5a;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gs-pointer::before,
.gs-pointer::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 0;
    height: 0;
    margin-left: -9px;
    border: 9px solid transparent;
}

.gs-pointer::before { top: -2px; border-top: 12px solid #ffd76a; }
.gs-pointer::after { bottom: -2px; border-bottom: 12px solid #ffd76a; }

.gs.is-spinning .gs-pointer {
    opacity: 1;
}

/* выигрыш */
.gs.is-won .gs-item:not(.is-win) {
    opacity: 0.35;
}

.gs-item.is-win {
    z-index: 2;
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--tier), 0 0 34px color-mix(in srgb, var(--tier) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ---------- результат ---------- */
.gs-result {
    display: none;
}

.gs.is-won .gs-intro {
    display: none;
}

/* увеличенная карточка-выигрыш не наезжает на текст */
.gs.is-won .gs-stage {
    margin-top: 26px;
    margin-bottom: 8px;
}

.gs.is-won .gs-result {
    display: block;
    animation: gs-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gs-rise {
    from { opacity: 0; transform: translateY(14px); }
}

.gs-prize {
    margin: 4px 0 6px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.3rem, 5.4vw, 1.8rem);
    line-height: 1.1;
    color: var(--tier);
    text-shadow: 0 0 22px color-mix(in srgb, var(--tier) 45%, transparent);
}

.gs-tier {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 11px;
    border-radius: 99px;
    font-family: var(--font-display);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #0f1d14;
    background: var(--tier);
}

.gs-note {
    margin: 12px auto 18px;
    max-width: 420px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: rgba(251, 243, 230, 0.7);
}

.gs-note a,
.gs-rules { color: var(--cream); text-decoration: underline; text-underline-offset: 2px; }
.gs-rules {
    display: inline-block;
    margin-top: 10px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    opacity: 0.75;
}
.gs-rules:hover { opacity: 1; }
.is-opening .gs-rules { display: none; }

/* ---------- кнопка ---------- */
.gs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
    padding: 15px 28px;
    border: 0;
    border-radius: 99px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #1a120a;
    background: linear-gradient(180deg, #ffe3b0, #f2c27e);
    box-shadow: 0 10px 26px rgba(242, 194, 126, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.gs-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(242, 194, 126, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.gs-btn:focus-visible,
.gs-close:focus-visible {
    outline: 2px solid #fff3d6;
    outline-offset: 3px;
}

.gs.is-spinning .gs-intro .gs-btn {
    opacity: 0.4;
    pointer-events: none;
}

@media (min-width: 640px) {
    .gs-card {
        padding: 36px 34px 28px;
    }

    .gs-reel {
        --w: 124px;
        inset: 4px -34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gs,
    .gs-card,
    .gs-reel,
    .gs-item,
    .gs-box-lid {
        transition: none;
    }

    .gs-box,
    .gs-sparkle,
    .gs-odd i::after,
    .gs.is-won .gs-result {
        animation: none;
    }
}

/* ---------- ленты: по одной на дом (при брони двух домов — две) ---------- */
/* ленты только показывают прокрутку — клики проходят сквозь них (иначе до старта
   невидимые ленты второго дома перекрывали кнопку «Открыть подарки») */
.gs-lanes { position: absolute; inset: 0; pointer-events: none; }
.gs.is-dual:not(.is-spinning):not(.is-won) .gs-lanes { visibility: hidden; }
.gs-lane { position: relative; height: 100%; }

.gs.is-dual .gs-stage { transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1), margin 0.5s ease; }
.gs.is-dual.is-spinning .gs-stage,
.gs.is-dual.is-won .gs-stage { height: 400px; }
.gs.is-dual .gs-lanes { bottom: auto; display: grid; grid-template-rows: 195px 195px; gap: 10px; }
.gs.is-dual .gs-reel { top: 26px; }
.gs.is-dual .gs-pointer { top: 22px; }
.gs-lane-name {
    position: absolute; left: 0; right: 0; top: 0; z-index: 4;
    font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--cream); opacity: 0; transition: opacity 0.4s ease;
}
.gs.is-dual.is-spinning .gs-lane-name,
.gs.is-dual.is-won .gs-lane-name { opacity: 0.85; }
/* пока крутятся две ленты — шансы прячем, чтобы окно влезало в экран телефона */
.gs.is-dual.is-spinning .gs-odds,
.gs.is-dual.is-spinning .gs-intro .gs-text { display: none; }

/* результат: два подарка рядом (на узком экране — друг под другом) */
.gs-prizes--dual { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.gs-prizes--dual .gs-prize-wrap {
    padding: 10px 8px 12px; border-radius: 16px;
    background: color-mix(in srgb, var(--tier) 10%, rgba(0, 0, 0, 0.15));
    border: 1px solid color-mix(in srgb, var(--tier) 40%, transparent);
}
.gs-prizes--dual .gs-prize { font-size: clamp(1.05rem, 4.4vw, 1.35rem); }
.gs-prizes--dual .gs-prize-img { width: 72px; height: 72px; }
.gs-prize-desc { margin: 8px auto 0 !important; font-size: 1rem; }
.gs-lane-tag {
    display: block; margin-bottom: 4px;
    font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cream); opacity: 0.75;
}
@media (max-width: 420px) { .gs-prizes--dual { grid-template-columns: 1fr; } }
