:root {
    --sally-gold: #d5bd82;
    --sally-purple: #a779ca;
}

body.sally-page {
    overflow: hidden;
    color: #efe8d7;
    background: #050a11;
}

body.sally-page.is-modal-open {
    overflow: hidden;
}

body.sally-page.is-sally-loading .site-header,
body.sally-page.is-sally-loading .sally-shell {
    opacity: 0;
}

body.sally-page.is-sally-revealing .site-header {
    animation: sally-page-reveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.sally-page.is-sally-revealing .sally-shell {
    animation: sally-page-reveal 1.8s 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sally-entry-loader {
    position: fixed;
    z-index: 1000;
    inset: 0;
    overflow: hidden;
    color: #f1e9f6;
    background: #170c24;
    opacity: 1;
    visibility: visible;
    transition:
        opacity 1.25s cubic-bezier(0.16, 1, 0.3, 1),
        filter 1.4s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 1.25s;
}

.sally-entry-loader::before {
    content: "";
    position: absolute;
    inset: 18px;
    pointer-events: none;
    border: 1px solid rgba(213, 189, 130, 0.17);
    box-shadow: inset 0 0 60px rgba(150, 89, 183, 0.08);
}

.sally-entry-loader.is-leaving {
    opacity: 0;
    visibility: hidden;
    filter: blur(12px);
    pointer-events: none;
}

.sally-loader-stage {
    position: absolute;
    top: 46%;
    left: 50%;
    width: min(72vw, 580px);
    height: 210px;
    overflow: visible;
    transform: translate(-50%, -50%);
}

.sally-loader-crescent {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 120px;
    aspect-ratio: 1;
    color: #e8d7f0;
    font-size: 6.2rem;
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(181, 102, 255, 0.38));
    transform: translate(-50%, -50%);
    transition: filter 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center;
    animation: sally-crescent-turn 2.4s cubic-bezier(0.82, 0, 0.18, 1) infinite;
}

.sally-loader-copy {
    position: absolute;
    top: calc(46% + 116px);
    left: 50%;
    width: min(82vw, 520px);
    text-align: center;
    transform: translateX(-50%);
}

.sally-loader-title,
.sally-loader-status {
    margin: 0;
}

.sally-loader-title {
    color: #ddc9e8;
    font-size: clamp(1rem, 2vw, 1.35rem);
    letter-spacing: 0.2em;
}

.sally-loader-status {
    margin-top: 10px;
    color: rgba(237, 225, 244, 0.68);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    transition: color 0.55s ease, text-shadow 0.55s ease;
}

.sally-entry-loader.is-complete .sally-loader-status {
    color: #f5e8ff;
    text-shadow: 0 0 16px rgba(187, 106, 242, 0.7);
}

.sally-entry-loader.is-complete .sally-loader-crescent {
    filter: drop-shadow(0 0 24px rgba(209, 150, 247, 0.68));
    animation-play-state: paused;
}

.sally-loader-progress {
    position: absolute;
    top: calc(46% + 190px);
    left: 50%;
    display: grid;
    grid-template-columns: 1fr 3.6em;
    align-items: center;
    gap: 12px;
    width: min(72vw, 360px);
    color: rgba(226, 210, 235, 0.6);
    transform: translateX(-50%);
}

.sally-loader-progress-track {
    position: relative;
    height: 2px;
    background: rgba(216, 194, 226, 0.13);
    box-shadow: 0 0 0 1px rgba(213, 189, 130, 0.08);
}

.sally-loader-progress-track::before,
.sally-loader-progress-track::after {
    content: "◇";
    position: absolute;
    top: 50%;
    color: rgba(213, 189, 130, 0.42);
    font-size: 0.65rem;
    transform: translateY(-52%);
}

.sally-loader-progress-track::before {
    right: calc(100% + 7px);
}

.sally-loader-progress-track::after {
    left: calc(100% + 7px);
}

.sally-loader-progress-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #6e329e, #bb6af2);
    box-shadow: 0 0 8px rgba(181, 102, 255, 0.74);
    transform: scaleX(0);
    transform-origin: left center;
}

.sally-loader-progress-value {
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    letter-spacing: 0.12em;
}

.sally-entry-loader.is-complete .sally-loader-progress-fill {
    background: linear-gradient(90deg, #b566ff, #e0c4ff, #d5bd82);
    box-shadow: 0 0 10px rgba(181, 102, 255, 0.9), 0 0 20px rgba(213, 189, 130, 0.5);
}

.nagia-conversation {
    position: fixed;
    z-index: 20;
    right: 5vw;
    bottom: 28px;
    left: 5vw;
    width: 90vw;
    min-height: 190px;
    padding: 30px clamp(34px, 5vw, 70px);
    color: #efe8d7;
    background: linear-gradient(135deg, rgba(4, 22, 24, 0.97), rgba(18, 12, 27, 0.95));
    border: 1px solid rgba(213, 189, 130, 0.72);
    box-shadow: 0 22px 62px rgba(0, 0, 0, 0.62);
}

.nagia-conversation[hidden] {
    display: none;
}

.nagia-conversation::before {
    content: "";
    position: absolute;
    inset: 7px;
    pointer-events: none;
    border: 1px solid rgba(213, 189, 130, 0.16);
}

.nagia-conversation-speaker {
    margin: 0 0 9px;
    color: var(--sally-gold);
    font-size: 0.76rem;
    letter-spacing: 0.18em;
}

.nagia-conversation-text {
    margin: 0;
    padding-right: 110px;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.85;
}

.nagia-conversation-close,
.nagia-conversation-next {
    position: absolute;
    z-index: 2;
    color: #efe8d7;
    border: 1px solid rgba(213, 189, 130, 0.5);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}

.nagia-conversation-close {
    top: 16px;
    right: 18px;
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
}

.nagia-conversation-next {
    right: 28px;
    bottom: 24px;
    padding: 9px 15px;
    font-family: inherit;
}

.nagia-conversation-close:hover,
.nagia-conversation-close:focus-visible,
.nagia-conversation-next:hover,
.nagia-conversation-next:focus-visible {
    color: #120b18;
    background: var(--sally-gold);
}

.sally-shell {
    position: fixed;
    inset: var(--header-height) 0 0;
    overflow: hidden;
    background: #050a11;
}

.sally-viewport {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    touch-action: pan-x;
}

.sally-viewport::-webkit-scrollbar {
    display: none;
}

.sally-scene {
    position: relative;
    top: 0;
    left: 0;
    width: calc((100dvh - var(--header-height)) * 1870 / 841);
    height: 100%;
    min-height: 560px;
    aspect-ratio: 1870 / 841;
    overflow: hidden;
    background: url("/assets/images/sally/construction-courtyard-v1.png") center / 100% 100% no-repeat;
    transform: none;
}

.sally-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(3, 6, 12, 0.1), transparent 45%, rgba(2, 7, 11, 0.5)),
        radial-gradient(circle at 71% 57%, rgba(255, 195, 104, 0.12), transparent 18%),
        radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.42));
}

.sally-atmosphere {
    position: absolute;
    inset: -12%;
    pointer-events: none;
    background:
        radial-gradient(circle at 73% 48%, rgba(255, 212, 131, 0.13), transparent 10%),
        linear-gradient(112deg, transparent 35%, rgba(154, 113, 196, 0.09) 52%, transparent 69%);
    mix-blend-mode: screen;
    animation: sally-light 9s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate;
}

.construction-notice {
    position: absolute;
    z-index: 4;
    top: 23%;
    left: 29%;
    width: min(390px, 26%);
    padding: 22px 26px 24px;
    background: linear-gradient(105deg, rgba(5, 15, 23, 0.9), rgba(13, 12, 25, 0.72));
    border-left: 3px solid var(--sally-gold);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.44);
}

.construction-notice span {
    color: var(--sally-gold);
    font-size: 0.7rem;
    letter-spacing: 0.24em;
}

.construction-notice strong {
    display: block;
    margin-top: 5px;
    font-size: clamp(1.1rem, 1.8vw, 1.75rem);
    letter-spacing: 0.08em;
}

.construction-notice p {
    margin: 12px 0 0;
    color: rgba(239, 232, 215, 0.76);
    font-size: clamp(0.72rem, 0.8vw, 0.88rem);
    line-height: 1.8;
}

.cheki-hotspot {
    position: absolute;
    z-index: 8;
    right: 22%;
    top: 54%;
    display: grid;
    place-items: center;
    width: 78px;
    aspect-ratio: 1;
    padding: 0;
    color: #f7efd9;
    border: 1px solid rgba(224, 197, 131, 0.8);
    border-radius: 50%;
    background: rgba(8, 12, 20, 0.58);
    box-shadow: 0 0 0 9px rgba(213, 189, 130, 0.08), 0 0 38px rgba(213, 189, 130, 0.35);
    cursor: pointer;
    animation: sally-pulse 3s ease-in-out infinite;
}

.cheki-hotspot-ring {
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(224, 197, 131, 0.52);
    border-radius: inherit;
}

.cheki-hotspot strong {
    position: absolute;
    top: calc(100% + 10px);
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 400;
    white-space: nowrap;
    background: rgba(4, 12, 18, 0.86);
}

.cheki-hotspot:hover,
.cheki-hotspot:focus-visible {
    background: rgba(88, 52, 111, 0.74);
    box-shadow: 0 0 0 13px rgba(177, 117, 216, 0.1), 0 0 62px rgba(177, 117, 216, 0.68);
}

.nagia-portrait {
    position: absolute;
    z-index: 7;
    right: 6.5%;
    bottom: 0;
    width: min(25vw, 430px);
    height: 82%;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.7));
}

.nagia-portrait img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    filter: saturate(0.8) contrast(1.04);
    transform-origin: center bottom;
    animation: nagia-breathe 5.6s ease-in-out infinite;
}

.nagia-portrait > span {
    position: absolute;
    right: 8%;
    bottom: 8%;
    padding: 5px 10px;
    color: rgba(239, 232, 215, 0.86);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    background: rgba(3, 10, 16, 0.78);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s ease, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.nagia-portrait:hover > span,
.nagia-portrait:focus-visible > span {
    opacity: 1;
    transform: translateY(0);
}

.nagia-thought {
    position: absolute;
    z-index: 9;
    right: 18%;
    bottom: 69%;
    width: max-content;
    max-width: min(370px, 28vw);
    padding: 19px 24px;
    color: #272129;
    background: linear-gradient(135deg, rgba(250, 248, 242, 0.98), rgba(228, 220, 231, 0.97));
    border: 1px solid rgba(169, 127, 189, 0.7);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), 0 0 24px rgba(145, 92, 175, 0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateY(13px) scale(0.98);
}

.nagia-thought::after {
    content: "";
    position: absolute;
    right: 18%;
    bottom: -10px;
    width: 18px;
    height: 18px;
    background: #e8e1e9;
    border-right: 1px solid rgba(169, 127, 189, 0.7);
    border-bottom: 1px solid rgba(169, 127, 189, 0.7);
    transform: rotate(45deg);
}

.nagia-thought p {
    margin: 0;
    font-size: clamp(0.74rem, 0.9vw, 0.92rem);
    line-height: 1.75;
    text-align: center;
    line-break: strict;
    word-break: auto-phrase;
    text-wrap: pretty;
}

.nagia-thought.is-visible {
    animation: nagia-thought 6.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.sally-location {
    min-width: 270px;
}

.sally-swipe-hint {
    display: none;
}

.cheki-modal {
    position: fixed;
    z-index: 40;
    inset: var(--header-height) 0 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 12, 0.86);
    backdrop-filter: blur(7px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.45s ease, visibility 0.45s;
}

.cheki-modal[hidden] {
    display: none;
}

.cheki-modal-panel {
    position: relative;
    width: min(1050px, 94vw);
    height: min(820px, calc(100dvh - var(--header-height) - 48px));
    overflow: hidden;
    background: linear-gradient(145deg, rgba(8, 25, 29, 0.99), rgba(11, 9, 22, 0.99));
    border: 1px solid rgba(213, 189, 130, 0.7);
    box-shadow: 0 32px 110px rgba(0, 0, 0, 0.82), 0 0 48px rgba(132, 76, 166, 0.16);
}

.cheki-modal-panel::before {
    content: "";
    position: absolute;
    z-index: 3;
    inset: 9px;
    pointer-events: none;
    border: 1px solid rgba(213, 189, 130, 0.16);
}

.cheki-modal-header {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 92px;
    padding: 18px 26px 15px 34px;
    background: rgba(4, 15, 18, 0.96);
    border-bottom: 1px solid rgba(213, 189, 130, 0.28);
}

.cheki-modal-header p,
.cheki-modal-header h1 {
    margin: 0;
}

.cheki-modal-header p {
    color: var(--sally-gold);
    font-size: 0.66rem;
    letter-spacing: 0.24em;
}

.cheki-modal-header h1 {
    margin-top: 2px;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.12em;
}

.cheki-modal-header button {
    position: relative;
    z-index: 4;
    width: 48px;
    height: 48px;
    color: #efe8d7;
    font-size: 1.4rem;
    border: 1px solid rgba(213, 189, 130, 0.58);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.cheki-modal-header button:hover,
.cheki-modal-header button:focus-visible {
    color: #f5e9ff;
    border-color: var(--sally-purple);
    background: rgba(87, 45, 110, 0.5);
}

.cheki-modal-message {
    position: absolute;
    z-index: 4;
    top: 92px;
    right: 0;
    left: 0;
    min-height: 46px;
    margin: 0;
    padding: 12px 32px;
    color: rgba(239, 232, 215, 0.76);
    font-size: 0.8rem;
    line-height: 1.7;
    background: rgba(10, 25, 29, 0.96);
    border-bottom: 1px solid rgba(213, 189, 130, 0.14);
}

.cheki-modal iframe {
    position: absolute;
    inset: 138px 0 0;
    width: 100%;
    height: calc(100% - 138px);
    border: 0;
    background: #07191d;
}

@keyframes sally-light {
    from { opacity: 0.55; transform: translate3d(-1%, 0, 0); }
    to { opacity: 1; transform: translate3d(1.5%, -0.5%, 0); }
}

@keyframes sally-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.055); }
}

@keyframes nagia-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.006); }
}

@keyframes nagia-thought {
    0% { opacity: 0; transform: translateY(13px) scale(0.98); }
    10%, 78% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-8px) scale(0.99); }
}

@keyframes sally-crescent-turn {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.96); }
    50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.05); }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(0.96); }
}

@keyframes sally-page-reveal {
    from { opacity: 0; filter: blur(8px); transform: scale(1.015); }
    to { opacity: 1; filter: blur(0); transform: scale(1); }
}

@media (max-width: 900px) {
    .sally-entry-loader::before {
        inset: 10px;
    }

    .sally-loader-stage {
        width: 88vw;
        height: 185px;
    }

    .sally-loader-crescent {
        width: 104px;
        font-size: 5.4rem;
    }

    .sally-loader-copy {
        top: calc(46% + 100px);
    }

    .sally-loader-progress {
        top: calc(46% + 172px);
        width: min(76vw, 330px);
    }

    .sally-viewport {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        touch-action: pan-x;
    }

    .sally-scene {
        position: relative;
        top: 0;
        left: 0;
        flex: 0 0 auto;
        width: calc((100dvh - var(--header-height)) * 1870 / 841);
        height: 100%;
        transform: none;
    }

    .construction-notice {
        top: 11%;
        left: 6%;
        width: 290px;
        padding: 16px 19px 18px;
    }

    .nagia-portrait {
        right: 6%;
        width: auto;
        height: 74%;
        aspect-ratio: 1188 / 2048;
    }

    .nagia-thought {
        right: 6%;
        bottom: 68%;
        max-width: min(290px, 72vw);
    }

    .cheki-hotspot {
        right: 22%;
        width: 64px;
    }

    .sally-location {
        min-width: 210px;
    }

    .sally-swipe-hint {
        position: fixed;
        z-index: 12;
        left: 50%;
        bottom: 10px;
        display: block;
        margin: 0;
        padding: 5px 12px;
        color: rgba(255, 255, 255, 0.75);
        background: rgba(0, 0, 0, 0.48);
        font-size: 0.68rem;
        transform: translateX(-50%);
    }

    .nagia-conversation {
        right: 5vw;
        bottom: 18px;
        left: 5vw;
        min-height: 180px;
        padding: 25px 24px 64px;
    }

    .nagia-conversation-text {
        padding-right: 0;
    }

    .nagia-conversation-next {
        right: 20px;
        bottom: 17px;
    }

    .cheki-modal {
        padding: 0;
    }

    .cheki-modal-panel {
        width: 100%;
        height: 100%;
        border: 0;
    }

    .cheki-modal-header {
        height: 76px;
        padding: 13px 14px 11px 20px;
    }

    .cheki-modal-header button {
        width: 46px;
        height: 46px;
    }

    .cheki-modal-message {
        top: 76px;
        min-height: 58px;
        padding: 10px 20px;
        font-size: 0.72rem;
    }

    .cheki-modal iframe {
        inset: 134px 0 0;
        height: calc(100% - 134px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sally-atmosphere,
    .cheki-hotspot,
    .nagia-portrait img,
    .nagia-thought.is-visible,
    .sally-loader-crescent {
        animation: none;
    }
}
