/*
 * DiviniGen Wish Master V1
 * Clean Wish architecture.
 * Mirrors approved Dream Main + Reading Loading visual laws.
 */

/* ---------------------------------------------------------
   PAGE
--------------------------------------------------------- */

.divinigen-wish-wrap {
    position: relative;
    min-height: calc(100svh - 71px);
    padding: clamp(72px, 9vw, 130px) 24px clamp(56px, 7vw, 96px);
    overflow: visible;
    background: transparent;
    color: #f3f3f3;
}

.divinigen-wish-wrap::before,
.divinigen-wish-wrap::after {
    content: none !important;
    display: none !important;
}

.divinigen-wish-inner {
    position: relative;
    z-index: 2;
    width: min(100%, 920px);
    margin: 0 auto;
}

/* ---------------------------------------------------------
   HERO — DREAM-SIZE PARTICLE STAR
--------------------------------------------------------- */

.divinigen-wish-hero {
    text-align: center;
    margin: 0 auto clamp(24px, 3.5vw, 38px);
}

.dg-wish-star-stage-v42 {
    position: relative;
    width: clamp(238px, 27vw, 360px);
    aspect-ratio: 1 / 1;
    margin: clamp(-34px, -2vw, -12px) auto clamp(28px, 3vw, 44px);
    overflow: visible;
    transform-origin: 50% 54%;
}

.dg-wish-star-particles-v42 {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    overflow: visible;
    clip-path: none;
    mix-blend-mode: screen;
    pointer-events: none;
}

.dg-wish-star-stage-v42.is-canvas-ready
.dg-wish-star-particles-v42 {
    opacity: var(--dg-wish-star-opacity, 1);
}

.divinigen-wish-kicker {
    margin: 0 0 14px;
    color: rgba(225,230,235,.52);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.divinigen-wish-title {
    margin: 0;
    color: #f4f2ed;
    font-size: clamp(34px, 5vw, 58px);
    font-weight: 400;
    line-height: 1.08;
}

.divinigen-wish-subtitle {
    width: min(100%, 720px);
    margin: 15px auto 0;
    color: rgba(239,238,234,.70);
    font-size: clamp(15px, 1.5vw, 17px);
    line-height: 1.7;
}

/* ---------------------------------------------------------
   WISH COMPOSER
--------------------------------------------------------- */

.divinigen-wish-stage {
    width: min(100%, 760px);
    margin: 0 auto;
}

.divinigen-wish-card {
    padding: clamp(24px, 4vw, 38px);
    border: 1px solid rgba(218,225,232,.11);
    border-radius: 18px;
    background:
        linear-gradient(112deg, rgba(255,255,255,.025), transparent 30%),
        linear-gradient(180deg, rgba(19,23,27,.93), rgba(6,8,10,.97));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.035),
        0 22px 55px rgba(0,0,0,.24);
}

.divinigen-wish-label {
    display: block;
    margin-bottom: 12px;
    color: rgba(225,230,235,.56);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.divinigen-wish-textarea {
    display: block;
    width: 100%;
    min-height: 150px;
    resize: vertical;
    padding: 18px 20px;
    border: 1px solid rgba(220,228,235,.13);
    border-radius: 14px;
    outline: none;
    background: rgba(3,5,7,.72);
    color: #f1f1ef;
    font: inherit;
    line-height: 1.7;
    box-sizing: border-box;
}

.divinigen-wish-textarea:focus {
    border-color: rgba(225,232,238,.34);
    box-shadow: 0 0 0 1px rgba(225,232,238,.07);
}

.divinigen-wish-note {
    margin-top: 13px;
    color: rgba(225,230,235,.42);
    font-size: 12px;
    line-height: 1.6;
}

.divinigen-wish-actions {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

/* ---------------------------------------------------------
   LOADING — READING MASTER STRUCTURE
--------------------------------------------------------- */

.divinigen-wish-loader {
    display: none;
    width: 100%;
}

.divinigen-wish-loader.is-active {
    display: block;
}

.dg-wish-loading-shell-v4538 {
    width: min(100%, 760px);
    margin: 0 auto;
    text-align: center;
}

.dg-wish-loading-title-v4538 {
    margin: 8px 0 12px;
    color: #f4f2ed;
    font-size: clamp(30px, 4.4vw, 48px);
    font-weight: 400;
    line-height: 1.1;
}

.dg-wish-loading-intro-v4538 {
    width: min(100%, 620px);
    margin-left: auto;
    margin-right: auto;
}

.dg-wish-reading-core-v4538 {
    overflow: hidden;
}

.dg-wish-loader-particle-star-v4538 {
    position: relative;
    z-index: 2;
    display: block;
    width: 84%;
    height: 84%;
    margin: auto;
    background: transparent;
    mix-blend-mode: screen;
}

/* ---------------------------------------------------------
   RESULT
--------------------------------------------------------- */

.divinigen-wish-sent,
.divinigen-wish-bad {
    display: none;
    width: min(100%, 680px);
    margin: 0 auto;
    text-align: center;
}

.divinigen-wish-sent.is-active,
.divinigen-wish-bad.is-active {
    display: block;
}

.divinigen-wish-sent-title,
.divinigen-wish-bad-title {
    margin: 8px 0 20px;
    color: #f4f2ed;
    font-size: clamp(30px, 4vw, 46px);
    font-weight: 400;
}

.divinigen-wish-sent-text,
.divinigen-wish-bad-text {
    color: rgba(239,238,234,.75);
    line-height: 1.9;
}

.divinigen-wish-reset {
    margin-top: 28px;
}

/* ---------------------------------------------------------
   STATE TRANSITIONS
--------------------------------------------------------- */

.divinigen-wish-wrap.is-sending .divinigen-wish-hero,
.divinigen-wish-wrap.is-complete-v425 .divinigen-wish-hero {
    display: none;
}

.divinigen-wish-wrap.is-sending .divinigen-wish-card,
.divinigen-wish-wrap.is-complete-v425 .divinigen-wish-card {
    display: none;
}

/*
 * Keep Loading geometrically stable.
 * Once complete, collapse the main-scene runway so Result + shared paths
 * become one composition.
 */
.divinigen-wish-wrap.is-complete-v425 {
    min-height: auto;
}

/* ---------------------------------------------------------
   MOBILE
--------------------------------------------------------- */

@media (max-width: 767px) {
    .divinigen-wish-wrap {
        min-height: auto;
        padding: 58px 16px 56px;
    }

    .dg-wish-star-stage-v42 {
        width: min(238px, 72vw);
        margin: -22px auto 28px;
    }

    .divinigen-wish-hero {
        margin-bottom: 30px;
    }

    .divinigen-wish-card {
        padding: 22px 18px;
    }

    .divinigen-wish-textarea {
        min-height: 138px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dg-wish-star-particles-v42 {
        transition: none;
    }
}

/* ============================================================
   WISH MASTER V1 — ORACLE WHISPER
============================================================ */

.dg-wish-oracle-whisper-v451 {
    position: relative;
    max-width: 610px;
    min-height: 108px;
    margin: 26px auto 2px;
    padding: 20px 28px 22px;
    border-top: 1px solid rgba(255,255,255,.075);
    overflow: visible;
    isolation: isolate;
}

.dg-wish-oracle-whisper-v451::before {
    content: "";
    position: absolute;
    inset: 8px 8% 0;
    z-index: -1;
    background: radial-gradient(
        ellipse at center,
        rgba(202,221,230,.055),
        transparent 70%
    );
    filter: blur(12px);
    pointer-events: none;
}

.dg-wish-oracle-kicker-v451 {
    margin-bottom: 10px;
    color: rgba(223,231,235,.55);
    font-size: 10px;
    letter-spacing: .24em;
    text-transform: uppercase;
}

.dg-wish-oracle-text-v451 {
    position: relative;
    z-index: 2;
    margin: 0;
    color: rgba(239,241,240,.9);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(17px, 2vw, 21px);
    font-style: italic;
    line-height: 1.72;
    letter-spacing: .025em;
    text-wrap: balance;
    opacity: var(--dg-wish-whisper-opacity-v451, 1);
    transform: translate3d(
        0,
        var(--dg-wish-whisper-shift-v451, 0px),
        0
    );
    filter: blur(var(--dg-wish-whisper-blur-v451, 0px));
    will-change: opacity, transform, filter;
}

.dg-wish-oracle-particles-v451 {
    position: absolute;
    z-index: 3;
    inset: -30px -8%;
    width: 116%;
    height: calc(100% + 60px);
    pointer-events: none;
    mix-blend-mode: screen;
    filter: drop-shadow(0 0 5px rgba(224,238,244,.20));
}

.dg-wish-oracle-word-v455 {
    display: inline-block;
    white-space: nowrap;
}

.dg-wish-oracle-glyph-v455 {
    display: inline-block;
    opacity: 1;
    transform: translate3d(0,0,0) scale(1);
    filter: none;
    transform-origin: 50% 55%;
    will-change: opacity, transform, filter;
}

/* Accepted standalone Oracle Whisper geometry. */
.dg-wish-oracle-separate-v457 {
    display: none;
    width: min(560px, calc(100% - 40px));
    max-width: 560px;
    min-height: 132px;
    margin: 32px auto 10px;
    padding: 22px 26px 24px;
    border: 1px solid rgba(223,233,238,.075);
    border-top-color: rgba(223,233,238,.13);
    border-radius: 18px;
    background:
        radial-gradient(
            ellipse at 50% 0%,
            rgba(201,221,231,.05),
            transparent 68%
        ),
        rgba(8,10,12,.20);
    box-shadow: 0 18px 46px rgba(0,0,0,.14);
    overflow: visible;
    text-align: center;
}

.dg-wish-oracle-separate-v457.is-active-v457 {
    display: block;
    animation: dgWishOracleRevealMasterV1 680ms ease both;
}

.dg-wish-oracle-separate-v457::before {
    inset: 10px 10% 6px;
    opacity: .9;
}

.dg-wish-oracle-separate-v457 .dg-wish-oracle-kicker-v451,
.dg-wish-oracle-separate-v457 .dg-wish-oracle-text-v451 {
    text-align: center;
}

.dg-wish-oracle-separate-v457 .dg-wish-oracle-kicker-v451 {
    margin-bottom: 12px;
}

.dg-wish-oracle-separate-v457 .dg-wish-oracle-text-v451 {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.dg-wish-oracle-separate-v457.is-holding-v458 {
    position: sticky;
    bottom: clamp(18px, 8vh, 72px);
    z-index: 9;
    box-shadow:
        0 20px 54px rgba(0,0,0,.20),
        0 0 34px rgba(205,224,234,.035);
}

.dg-wish-oracle-separate-v457.is-dissolving-v458 {
    border-top-color: rgba(223,233,238,.17);
}

@keyframes dgWishOracleRevealMasterV1 {
    from {
        opacity: 0;
        transform: translate3d(0,10px,0);
    }
    to {
        opacity: 1;
        transform: translate3d(0,0,0);
    }
}

/* ============================================================
   WISH MASTER V1 — RESULT TYPOGRAPHY
============================================================ */

.dg-wish-v42 .divinigen-wish-sent-title {
    max-inline-size: 14ch;
    margin-inline: auto;
    text-wrap: balance;
}

.dg-wish-v42 .divinigen-wish-sent-text {
    width: min(100%, 40rem);
    margin-inline: auto;
    text-align: center;
}

.dg-wish-v42 .divinigen-wish-sent-text p {
    max-inline-size: 38ch;
    margin: 0 auto 16px;
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: normal;
}

.dg-wish-v42 .divinigen-wish-sent-text p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   RESPONSIVE ORACLE / RESULT
============================================================ */

@media (max-width: 768px) {
    .dg-wish-v42 .divinigen-wish-sent {
        padding-inline: clamp(18px, 5vw, 28px);
    }

    .dg-wish-v42 .divinigen-wish-sent-title {
        max-inline-size: 12ch;
        margin-bottom: clamp(16px, 4vw, 20px);
        font-size: clamp(28px, 7.2vw, 34px);
        line-height: 1.18;
        letter-spacing: .012em;
    }

    .dg-wish-v42 .divinigen-wish-sent-text {
        width: 100%;
        max-width: none;
        font-size: clamp(15.5px, 3.9vw, 17px);
        line-height: 1.72;
    }

    .dg-wish-v42 .divinigen-wish-sent-text p {
        max-inline-size: 36ch;
        margin-bottom: clamp(16px, 4.2vw, 22px);
    }
}

@media (max-width: 720px) {
    .dg-wish-oracle-whisper-v451 {
        margin-top: 22px;
        padding: 18px 12px 20px;
        min-height: 102px;
    }

    .dg-wish-oracle-text-v451 {
        font-size: 17px;
        line-height: 1.65;
    }

    .dg-wish-oracle-separate-v457 {
        width: calc(100% - 32px);
        min-height: 126px;
        margin: 16px auto 10px;
        padding: 20px 16px 22px;
    }

    .dg-wish-oracle-separate-v457.is-holding-v458 {
        bottom: max(14px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    .dg-wish-v42 .divinigen-wish-sent-title {
        max-inline-size: 11.5ch;
        font-size: clamp(27px, 7.4vw, 31px);
    }

    .dg-wish-v42 .divinigen-wish-sent-text {
        font-size: clamp(15px, 4vw, 16.5px);
        line-height: 1.68;
    }

    .dg-wish-v42 .divinigen-wish-sent-text p {
        max-inline-size: 34ch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dg-wish-oracle-text-v451,
    .dg-wish-oracle-glyph-v455 {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .dg-wish-oracle-particles-v451 {
        display: none !important;
    }

    .dg-wish-oracle-separate-v457.is-active-v457 {
        animation: none;
    }

    .dg-wish-oracle-separate-v457.is-holding-v458 {
        position: static;
    }
}

/* ============================================================
   WISH MASTER V1 — MAIN / RESULT PATH POLISH
============================================================ */

/*
 * Main Wish owns the shared four-path ending too.
 * Universe hides Wish paths by default because Wish is a single-page flow;
 * restore them for the resting Main scene.
 */
body:not(.dg-wish-result-visible-v43)
.dg-result-paths-shell-v43[data-result-context="wish"] {
    display: block;
}

/* Keep navigation out of the Loading composition. */
.divinigen-wish-wrap.dg-wish-v42.is-sending
~ .dg-result-paths-shell-v43[data-result-context="wish"] {
    display: none;
}

/*
 * Result needs a small natural scroll runway before the shared navigation.
 * Keep Universe's own result-path margin authoritative.
 */
.dg-page-shell
.divinigen-wish-wrap.dg-wish-v42.is-complete-v425 {
    padding-bottom: clamp(260px, 24vw, 340px);
}

@media (max-width: 767px) {
    .dg-page-shell
    .divinigen-wish-wrap.dg-wish-v42.is-complete-v425 {
        padding-bottom: 180px;
    }
}

/* Wish Main + Result — accepted Dream/Dice path reveal choreography. */
.dg-result-paths-shell-v43[data-result-context="wish"]
.dg-result-paths-v43 {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity .9s ease,
        transform 1.05s cubic-bezier(.22,.75,.22,1);
}

.dg-result-paths-shell-v43[data-result-context="wish"]
.dg-result-paths-v43.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .dg-result-paths-shell-v43[data-result-context="wish"]
    .dg-result-paths-v43 {
        opacity: 1;
        transform: none;
        transition: none;
    }
}


/* Wish Master — restore JS-to-CSS star scroll choreography bridge. */
.dg-wish-star-stage-v42 {
    transform: translate3d(0, var(--dg-wish-star-shift, 0px), 0) scale(var(--dg-wish-star-scale, 1));
    will-change: transform;
}

/* Wish Master — connect JS title choreography to visible hero copy. */
.divinigen-wish-kicker,
.divinigen-wish-title,
.divinigen-wish-subtitle {
    transform: translate3d(0, var(--dg-wish-title-shift, 0px), 0);
    opacity: var(--dg-wish-title-opacity, 1);
    will-change: transform, opacity;
}

/* Wish Master — keep moving hero copy behind the composer. */
.divinigen-wish-hero {
    position: relative;
    z-index: 1;
}

.divinigen-wish-stage {
    position: relative;
    z-index: 3;
}

/* Dream-matched Main-page lower breathing room. */
.divinigen-wish-wrap.dg-wish-v42:not(.is-sending):not(.is-complete-v425) {
    min-height: 135svh;
}

@media (max-width: 767px) {
    .divinigen-wish-wrap.dg-wish-v42:not(.is-sending):not(.is-complete-v425) {
        min-height: 125svh;
    }
}

/* Dream-matched Wish Main lower breathing room after shared paths. */
body:not(.dg-wish-result-visible-v43)
.dg-result-paths-shell-v43[data-result-context="wish"] {
    margin-bottom: clamp(220px, 28vh, 340px);
}

@media (max-width: 760px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-bottom: clamp(150px, 22vh, 220px);
    }
}

/* Wish Main — final Dream/Dice-matched footer breathing room polish. */
body:not(.dg-wish-result-visible-v43)
.dg-result-paths-shell-v43[data-result-context="wish"] {
    margin-bottom: clamp(320px, 40vh, 440px);
}

@media (max-width: 760px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-bottom: clamp(210px, 30vh, 300px);
    }
}

/* Wish Main — align navigation vertically with accepted Dice/Dream rhythm. */
@media (min-width: 761px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-top: clamp(-165px, -9vw, -92px);
    }
}

@media (max-width: 760px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-top: -54px;
    }
}

/* Wish Main — final link-bar separation from composer. */
@media (min-width: 761px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-top: clamp(-125px, -6vw, -64px);
    }
}

@media (max-width: 760px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-top: -28px;
    }
}

/* Wish Main — final Dice-matched card-to-links gap. */
@media (min-width: 761px) {
    body:not(.dg-wish-result-visible-v43)
    .dg-result-paths-shell-v43[data-result-context="wish"] {
        margin-top: clamp(-95px, -4vw, -44px);
    }
}

/* ============================================================
   STEP 17N — WISH RESULT ORACLE WHISPER SCROLL REPAIR
   RESULT ONLY — WISH MAIN UNTOUCHED
============================================================ */

body.dg-wish-result-visible-v43
.dg-wish-oracle-separate-v457.is-holding-v458 {
    position: relative;
    bottom: auto;
    z-index: 4;
}

@media (max-width: 720px) {
    body.dg-wish-result-visible-v43
    .dg-wish-oracle-separate-v457.is-holding-v458 {
        position: relative;
        bottom: auto;
        width: calc(100% - 32px);
        margin-left: auto;
        margin-right: auto;
    }
}

/* ============================================================
   STEP 17N-C — ORACLE WHISPER FINAL POLISH
   RESULT ONLY — NO STICKY OVERLAP
============================================================ */

/* A little more breathing room above Oracle Whisper. */
body.dg-wish-result-visible-v43
.dg-wish-oracle-separate-v457 {
    margin-top: 46px;
}

/* Restore a gentle scroll-triggered movement without sticky positioning. */
body.dg-wish-result-visible-v43
.dg-wish-oracle-separate-v457.is-holding-v458 {
    position: relative;
    bottom: auto;
    transform: translate3d(0,-10px,0);
    transition:
        transform .55s ease,
        border-color .8s ease,
        background .8s ease,
        box-shadow .8s ease;
}

/* After the whisper has dissolved, remove the visible box residue. */
body.dg-wish-result-visible-v43
.dg-wish-oracle-separate-v457.is-complete-v458 {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

/* Let the Oracle Whisper label fade with the completed frame. */
body.dg-wish-result-visible-v43
.dg-wish-oracle-separate-v457.is-complete-v458
.dg-wish-oracle-kicker-v451 {
    opacity: 0;
    transition: opacity .8s ease;
}

@media (max-width: 720px) {
    body.dg-wish-result-visible-v43
    .dg-wish-oracle-separate-v457 {
        margin-top: 38px;
    }

    body.dg-wish-result-visible-v43
    .dg-wish-oracle-separate-v457.is-holding-v458 {
        transform: translate3d(0,-7px,0);
    }
}

/* ============================================================
   STEP 17N-D — WISH RESULT GEOMETRY
   RESULT ONLY — MAIN + LOADING UNTOUCHED
============================================================ */

body.dg-wish-result-visible-v43
.dg-page-shell
.divinigen-wish-wrap.dg-wish-v42.is-complete-v425 {
    padding-top: clamp(120px, 11vw, 160px);
    padding-bottom: clamp(90px, 8vw, 125px);
}

@media (max-width: 767px) {
    body.dg-wish-result-visible-v43
    .dg-page-shell
    .divinigen-wish-wrap.dg-wish-v42.is-complete-v425 {
        padding-top: 92px;
        padding-bottom: 76px;
    }
}
