/* Modern House – Pudełko z prezentem (popup) */

.mhgb,
.mhgb-launcher,
.mhgb-trigger {
    --mhgb-dark: #1F1C1C;
    --mhgb-orange: #E86245;
    --mhgb-orange-dark: #C84E33;
    --mhgb-beige: #F5F0EC;
    --mhgb-line: #D9D0C7;
    --mhgb-muted: #6B6461;
}

.mhgb *,
.mhgb *::before,
.mhgb *::after {
    box-sizing: border-box;
}

html.mhgb-locked {
    overflow: hidden;
}

.mhgb[hidden],
.mhgb [hidden],
.mhgb-launcher[hidden] {
    display: none !important;
}

/* ---------- Okno ---------- */

.mhgb {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mhgb__overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 17, 17, 0.62);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mhgb__dialog {
    position: relative;
    width: min(440px, 100%);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    color: var(--mhgb-dark);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.mhgb.is-visible .mhgb__overlay,
.mhgb.is-visible .mhgb__dialog {
    opacity: 1;
}

.mhgb.is-visible .mhgb__dialog {
    transform: none;
}

.mhgb__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--mhgb-dark);
    background: rgba(255, 255, 255, 0.8);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.mhgb__close:hover,
.mhgb__close:focus-visible {
    background: var(--mhgb-beige);
}

/* ---------- Scena z pudełkiem ---------- */

.mhgb__stage {
    position: relative;
    height: 270px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 70%, rgba(232, 98, 69, 0.18), rgba(232, 98, 69, 0) 60%),
        var(--mhgb-beige);
}

.mhgb__gift {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 250px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    transform: translateX(-50%);
    -webkit-tap-highlight-color: transparent;
}

.mhgb__gift:disabled {
    cursor: progress;
}

.mhgb.is-opened .mhgb__gift {
    cursor: default;
}

.mhgb__gift:focus-visible {
    outline: 3px solid rgba(232, 98, 69, 0.45);
    outline-offset: 4px;
}

.mhgb__gift-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    animation: mhgb-bob 2.6s ease-in-out infinite;
}

.mhgb__gift:hover .mhgb__gift-svg {
    animation-duration: 1.4s;
}

.mhgb__lid,
.mhgb__body {
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

/* Wieko co chwilę "podskakuje", zachęcając do kliknięcia. */
.mhgb__lid {
    animation: mhgb-lid-tease 3.2s ease-in-out infinite;
}

.mhgb__sparkles path {
    transform-box: fill-box;
    transform-origin: center;
    animation: mhgb-twinkle 1.8s ease-in-out infinite;
}

.mhgb__sparkles path:nth-child(2) {
    animation-delay: 0.6s;
}

.mhgb__sparkles path:nth-child(3) {
    animation-delay: 1.1s;
}

@keyframes mhgb-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes mhgb-lid-tease {
    0%, 70%, 100% { transform: translateY(0) rotate(0); }
    76% { transform: translateY(-9px) rotate(-3deg); }
    82% { transform: translateY(0) rotate(0); }
    88% { transform: translateY(-5px) rotate(2deg); }
    94% { transform: translateY(0) rotate(0); }
}

@keyframes mhgb-twinkle {
    0%, 100% { transform: scale(0.6); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* Czekamy na losowanie – pudełko się trzęsie. */
.mhgb.is-waiting .mhgb__gift-svg,
.mhgb.is-nudged .mhgb__gift-svg {
    animation: mhgb-shake 0.5s ease-in-out infinite;
}

.mhgb.is-nudged .mhgb__gift-svg {
    animation-iteration-count: 1;
}

@keyframes mhgb-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-4deg) translateY(-2px); }
    40% { transform: rotate(4deg); }
    60% { transform: rotate(-3deg) translateY(-1px); }
    80% { transform: rotate(3deg); }
}

/* Otwarcie: wieko wylatuje, pudełko się ugina, w tle rozbłysk. */
.mhgb.is-opened .mhgb__gift-svg {
    animation: none;
}

.mhgb.is-opened .mhgb__lid {
    animation: mhgb-lid-off 0.65s cubic-bezier(0.3, 0.6, 0.4, 1) forwards;
}

.mhgb.is-opened .mhgb__body {
    animation: mhgb-squash 0.5s ease-out;
}

.mhgb.is-opened .mhgb__sparkles {
    opacity: 0;
    transition: opacity 0.2s ease;
}

@keyframes mhgb-lid-off {
    0% { transform: translate(0, 0) rotate(0); opacity: 1; }
    25% { transform: translate(0, 6px) rotate(0); }
    100% { transform: translate(120px, -210px) rotate(38deg); opacity: 0; }
}

@keyframes mhgb-squash {
    0% { transform: scale(1, 1); }
    30% { transform: scale(1.06, 0.9); }
    60% { transform: scale(0.97, 1.05); }
    100% { transform: scale(1, 1); }
}

.mhgb__glow {
    position: absolute;
    left: 50%;
    bottom: 40px;
    width: 520px;
    height: 520px;
    margin-left: -260px;
    margin-bottom: -170px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0, rgba(255, 255, 255, 0) 32%),
        repeating-conic-gradient(rgba(232, 98, 69, 0.22) 0 10deg, rgba(232, 98, 69, 0) 10deg 22deg);
    -webkit-mask: radial-gradient(circle, #000 0, #000 30%, transparent 62%);
    mask: radial-gradient(circle, #000 0, #000 30%, transparent 62%);
    opacity: 0;
    transform: scale(0.3);
    pointer-events: none;
}

.mhgb.is-revealed .mhgb__glow {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.6s ease;
    animation: mhgb-spin 14s linear infinite;
}

@keyframes mhgb-spin {
    to { rotate: 360deg; }
}

/* ---------- Dymek z podpowiedzią ---------- */

.mhgb__bubble {
    position: absolute;
    left: 18px;
    top: 26px;
    z-index: 5;
    max-width: 150px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    background: var(--mhgb-dark);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(31, 28, 28, 0.22);
    transform-origin: 85% 100%;
    animation: mhgb-bubble-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.4s both, mhgb-bubble-float 3s ease-in-out 1s infinite;
    transition: background-color 0.25s ease, opacity 0.2s ease;
    pointer-events: none;
}

/* Ogonek dymka skierowany w stronę prezentu. */
.mhgb__bubble::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: inherit;
    border-radius: 0 0 3px 0;
    transform: rotate(45deg) skew(8deg, 8deg);
}

.mhgb.is-ready .mhgb__bubble {
    background: var(--mhgb-orange);
    animation: mhgb-bubble-pulse 1.1s ease-in-out infinite;
}

.mhgb.is-waiting .mhgb__bubble,
.mhgb.is-opened .mhgb__bubble {
    opacity: 0;
    animation: none;
}

@keyframes mhgb-bubble-in {
    0% { opacity: 0; transform: scale(0.4) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes mhgb-bubble-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.07); }
}

/* ---------- Nagroda wyskakująca z pudełka ---------- */

.mhgb__prize {
    position: absolute;
    left: 50%;
    top: 18px;
    z-index: 3;
    width: min(300px, calc(100% - 100px));
    padding: 18px 16px 16px;
    text-align: center;
    background: #fff;
    border-top: 5px solid var(--mhgb-orange);
    box-shadow: 0 18px 40px rgba(31, 28, 28, 0.28);
    opacity: 0;
    transform: translate(-50%, 150px) scale(0.2);
    pointer-events: none;
}

.mhgb.is-revealed .mhgb__prize {
    animation: mhgb-pop 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
}

.mhgb.is-restored .mhgb__prize,
.mhgb.is-restored .mhgb__glow {
    animation-duration: 0s;
}

.mhgb.is-restored .mhgb__lid {
    animation: none;
    opacity: 0;
}

@keyframes mhgb-pop {
    0% { opacity: 0; transform: translate(-50%, 150px) scale(0.2); }
    35% { opacity: 1; }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.mhgb__prize-headline {
    display: block;
    font-size: 44px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--mhgb-dark);
}

.mhgb__prize-subline {
    display: block;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--mhgb-orange);
}

.mhgb__prize-code {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 14px;
    font-family: "Courier New", Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--mhgb-dark);
    background: var(--mhgb-beige);
    border: 2px dashed var(--mhgb-orange);
}

.mhgb__burst {
    position: absolute;
    left: 50%;
    bottom: 110px;
    z-index: 2;
    pointer-events: none;
}

.mhgb__confetti {
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 13px;
    opacity: 0;
    animation: mhgb-confetti 1.5s cubic-bezier(0.15, 0.7, 0.4, 1) var(--d, 0s) forwards;
}

@keyframes mhgb-confetti {
    0% { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(0.4); }
    75% { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 40px)) rotate(var(--r)) scale(1); }
}

/* ---------- Treść ---------- */

.mhgb__content {
    padding: 24px 28px 28px;
}

.mhgb__title {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--mhgb-dark);
}

.mhgb__title:focus {
    outline: none;
}

.mhgb__text {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--mhgb-dark);
}

.mhgb__form {
    display: grid;
    gap: 12px;
}

.mhgb__sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.mhgb__input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    font: inherit;
    font-size: 16px;
    color: var(--mhgb-dark);
    background: #fff;
    border: 1px solid var(--mhgb-line);
    border-radius: 0;
}

.mhgb__input:focus {
    outline: none;
    border-color: var(--mhgb-orange);
    box-shadow: 0 0 0 3px rgba(232, 98, 69, 0.2);
}

.mhgb__hp {
    position: absolute !important;
    left: -10000px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.mhgb__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--mhgb-muted);
    cursor: pointer;
}

.mhgb__checkbox {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--mhgb-orange);
}

.mhgb__consent a {
    color: inherit;
    text-decoration: underline;
}

.mhgb__error {
    margin: 0;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #8A1F0E;
    background: #FBE3DC;
    border-left: 3px solid var(--mhgb-orange);
}

.mhgb__button,
.mhgb-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 14px 28px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    text-align: center;
    text-decoration: none;
    background: var(--mhgb-orange);
    border: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mhgb-trigger {
    width: auto;
}

.mhgb__button:hover,
.mhgb__button:focus-visible,
.mhgb-trigger:hover,
.mhgb-trigger:focus-visible {
    color: #fff;
    background: var(--mhgb-orange-dark);
}

.mhgb__button:disabled {
    cursor: progress;
    opacity: 0.75;
}

.mhgb__note {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--mhgb-muted);
}

.mhgb__form .mhgb__note {
    margin: 0;
}

.mhgb__legal {
    margin: 16px 0 0;
    padding-top: 12px;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: var(--mhgb-muted);
    border-top: 1px solid var(--mhgb-line);
}

.mhgb__legal a {
    color: inherit;
    text-decoration: underline;
}

.mhgb__legal a:hover,
.mhgb__legal a:focus-visible {
    color: var(--mhgb-orange-dark);
}

.mhgb__result-prize {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.mhgb__code-row {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
}

.mhgb__code {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 8px 12px;
    font-family: "Courier New", Courier, monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--mhgb-dark);
    background: var(--mhgb-beige);
    border: 2px dashed var(--mhgb-orange);
    white-space: nowrap;
}

.mhgb__copy {
    flex: 0 0 auto;
    min-width: 116px;
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--mhgb-dark);
    border: 0;
    cursor: pointer;
}

.mhgb__copy:hover,
.mhgb__copy:focus-visible {
    background: #000;
}

/* ---------- Pływający przycisk ---------- */

.mhgb-launcher {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 70px;
    height: 70px;
    padding: 6px 0 0;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--mhgb-dark);
    background: #fff;
    border: 2px solid var(--mhgb-orange);
    border-radius: 50%;
    box-shadow: 0 10px 28px rgba(31, 28, 28, 0.25);
    cursor: pointer;
    animation: mhgb-launcher 4s ease-in-out infinite;
}

.mhgb-launcher:hover,
.mhgb-launcher:focus-visible {
    background: var(--mhgb-beige);
}

@keyframes mhgb-launcher {
    0%, 82%, 100% { transform: rotate(0); }
    86% { transform: rotate(-10deg); }
    90% { transform: rotate(10deg); }
    94% { transform: rotate(-6deg); }
}

@media (max-width: 480px) {
    .mhgb {
        padding: 10px;
    }

    .mhgb__stage {
        height: 240px;
    }

    .mhgb__gift {
        width: 200px;
    }

    .mhgb__bubble {
        left: 12px;
        top: 16px;
        max-width: 124px;
        padding: 8px 11px;
        font-size: 12px;
    }

    .mhgb__content {
        padding: 20px 20px 22px;
    }

    .mhgb__title {
        font-size: 22px;
    }

    .mhgb__prize-headline {
        font-size: 38px;
    }

    .mhgb__code-row {
        flex-direction: column;
    }

    .mhgb__copy {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhgb *,
    .mhgb-launcher {
        animation: none !important;
        transition: none !important;
    }

    .mhgb.is-opened .mhgb__lid {
        opacity: 0;
    }

    .mhgb.is-revealed .mhgb__prize {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}
