.modal-scene1 h2 {
    letter-spacing: 0.02em;
}

.modal-panel.modal-scene2 {
    border-radius: 12px;
}

.modal-scene2 .modal-btn-next {
    background-image: linear-gradient(to right, #5a3a72 0%, #3a5a72 51%, #5a3a72 100%);
}

.modal-panel.modal-scene3-one {
    background: #182033;
    border: 3px solid #6b8fd4;
    border-radius: 22px;
}

.modal-scene3-one h2 {
    color: #dce8ff;
}

.modal-scene3-one p {
    color: #9fb4e0;
}

.modal-scene3-one .modal-btn {
    padding: 12px 30px;
    border: 2px solid #8ab4f8;
    border-radius: 999px;
    background-image: linear-gradient(120deg, #2a4270, #3d5a94);
    color: #eef4ff;
    text-transform: none;
    letter-spacing: 0.02em;
}

.modal-panel.modal-scene3-two {
    background: #12221e;
    border: 1px solid #3d8f7a;
    border-radius: 6px;
}

.modal-scene3-two h2 {
    color: #b8f5e4;
    font-weight: 500;
}

.modal-scene3-two p {
    color: #7ec9b4;
}

.modal-scene3-two .modal-btn {
    padding: 14px 36px;
    border: 2px solid #4db896;
    border-radius: 4px;
    background: transparent;
    background-image: none;
    color: #a8f0dc;
    box-shadow: inset 0 0 0 1px rgba(77, 184, 150, 0.25);
}

.modal-scene3-two .modal-btn:hover {
    background: rgba(61, 143, 122, 0.35);
}

.modal-panel.modal-scene3-three {
    background: #1a1224;
    border: 2px dashed #9b6ed4;
    border-radius: 14px;
}

.modal-scene3-three h2 {
    color: #e8d4ff;
}

.modal-scene3-three p {
    color: #c4a0e8;
}

.modal-scene3-three .modal-btn {
    padding: 10px 26px;
    border: none;
    border-radius: 10px;
    background-image: linear-gradient(135deg, #4a2d6e 0%, #6b3f9a 100%);
    color: #f3e8ff;
    text-transform: capitalize;
    letter-spacing: 0.04em;
}

.modal-panel.modal-scene3-four {
    background: #221810;
    border: 4px solid #b86a32;
    border-radius: 2px;
}

.modal-scene3-four h2 {
    color: #ffd9b8;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 22px;
}

.modal-scene3-four p {
    color: #d4a078;
}

.modal-scene3-four .modal-btn {
    padding: 18px 40px;
    border: 2px solid #e8a04a;
    border-radius: 0;
    background-image: linear-gradient(to right, #6b3a18, #8f4e22);
    color: #fff5e8;
    font-size: 16px;
    letter-spacing: 0.14em;
}

.modal-panel.modal-scene3-five {
    background: #141820;
    border: 2px solid #5a6a88;
    border-radius: 16px;
}

.modal-scene3-five h2 {
    color: #c8d8f0;
    font-style: italic;
}

.modal-scene3-five p {
    color: #8a9ab8;
}

.modal-scene3-five .modal-btn-close {
    border-color: #6a7a98;
    border-radius: 8px;
    background-image: linear-gradient(to right, #2a3344, #3a4558);
    color: #d0dae8;
}

.modal-scene3-five .modal-btn-next {
    border-color: #7a9ac8;
    border-radius: 8px;
    background-image: linear-gradient(to right, #2a4a72, #3a5a8a);
    color: #e8f0ff;
}

.modal-panel.modal-scene4 {
    border-radius: 10px;
    border-color: #e8a04a;
}

.modal-scene4 h2 {
    font-style: italic;
}

.modal-scene4 .modal-btn-next {
    background-image: linear-gradient(to right, #8a4a1a 0%, #a65c28 51%, #8a4a1a 100%);
}

.modal-panel.modal-scene-ns {
    border: 0;
    border-radius: 16px;
}

.modal-scene-ns .modal-content iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
}

.modal-scene-ns :is(.modal-close, .modal-content .modal-btn) {
    border: 0;
    background: transparent;
    font-weight: 700;
}

.modal-scene-ns :is(.modal-close, .modal-content .modal-btn):hover {
    border: 0;
    background: rgba(255, 255, 255, 0.1);
}

.modal-scene-ns .modal-content .modal-btn {
    align-self: flex-end;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #080b10;
    font-family: "Lato", sans-serif;
}

.terms {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 10;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    text-align: center;
    font-size: 11px;
    color: #929086;
    background: #0a080b;
    box-shadow: 0 0 8px #0a080b;
    border-top-right-radius: 4px;
    padding: 4px 8px;
}
.terms-copyright,
.terms-link {
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.terms-link {
    color: #c0baab;
    cursor: pointer;
    text-decoration: none;
}
.terms-link:hover {
    color: #ddd0ba;
}
.terms:hover .terms-tooltip {
    opacity: 1;
    transition-delay: 800ms;
}
.terms-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    box-sizing: border-box;
    width: min(420px, calc(100vw - 16px));
    padding: 4px 8px;
    border: 1px solid rgba(195, 186, 171, 0.22);
    border-radius: 4px;
    background: rgba(12, 14, 18, 0.96);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    color: #d8d2c6;
    font-size: 11px;
    line-height: 1.4;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    transition: 0.2s;
    transition-delay: 0ms;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#welcome {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow-y: auto;
    color: #e8e4dc;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(88, 68, 54, 0.22), transparent 70%),
        radial-gradient(ellipse 50% 40% at 80% 90%, rgba(18, 8, 100, 0.35), transparent), #06080c;
}

.welcome-stage {
    position: relative;
    box-sizing: border-box;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.welcome-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg viewBox=%270 0 256 256%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cfilter id=%27n%27%3E%3CfeTurbulence type=%27fractalNoise%27 baseFrequency=%270.85%27 numOctaves=%274%27 stitchTiles=%27stitch%27/%3E%3C/filter%3E%3Crect width=%27100%25%27 height=%27100%25%27 filter=%27url%28%23n%29%27 opacity=%270.04%27/%3E%3C/svg%3E");
}

.welcome-inner {
    position: relative;
    flex-shrink: 0;
    width: min(640px, 100%);
    text-align: center;
}

.welcome-eyebrow {
    margin: 0 0 24px;
    color: rgba(232, 228, 220, 0.45);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.welcome-title {
    margin: 0 0 36px;
    color: #f4f0e8;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(48px, 12vw, 88px);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: 0.01em;
}

.welcome-title em {
    font-style: italic;
    font-weight: 600;
    color: #c9b8a8;
}

.welcome-figure {
    margin: 0 auto 36px;
    width: 120px;
    animation: welcome-float 6s ease-in-out infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .welcome-figure {
        animation: none;
    }
}

.welcome-figure img {
    display: block;
    width: 100%;
    height: auto;
    filter: invert(1) hue-rotate(155deg) drop-shadow(0 24px 48px rgba(0, 0, 0, 0.55));
}

.welcome-copy {
    margin: 0 auto 32px;
    max-width: 46ch;
    text-align: left;
    font-weight: 300;
}

.welcome-copy p {
    margin: 0 0 1.1em;
    color: rgba(232, 228, 220, 0.72);
    font-size: clamp(17px, 2.4vw, 20px);
    line-height: 1.55;
}

.welcome-copy p:last-child {
    margin-bottom: 0;
}

.welcome-copy em {
    font-style: italic;
    color: rgba(232, 228, 220, 0.9);
}

.welcome-enter {
    display: inline-block;
    padding: 20px 40px;
    margin: 8px 0 48px;
    border: 1px solid rgba(232, 228, 220, 0.35);
    border-radius: 2px;
    background: linear-gradient(135deg, rgba(88, 68, 54, 0.5) 0%, rgba(18, 8, 100, 0.4) 100%);
    color: #f4f0e8;
    font-family: "IBM Plex Mono", monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-decoration: none;
    text-transform: uppercase;
    transition:
        border-color 0.3s,
        background 0.3s,
        transform 0.2s;
}

.welcome-enter:hover {
    border-color: rgba(232, 228, 220, 0.65);
    background: linear-gradient(135deg, rgba(118, 102, 50, 0.6) 0%, rgba(52, 90, 114, 0.5) 100%);
    transform: translateY(-1px);
}

.exhibition-icon-btn,
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(232, 228, 220, 0.2);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.6);
    color: #e8e4dc;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.exhibition-icon-btn:hover,
.modal-close:hover {
    border-color: rgba(232, 228, 220, 0.45);
    background: rgba(18, 22, 30, 0.88);
    color: #fff;
}

.exhibition-icon-btn:focus-visible,
.modal-close:focus-visible {
    outline: 2px solid rgba(232, 228, 220, 0.55);
    outline-offset: 2px;
}

#exhibition-back {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20;
    display: none;
}

body.is-exhibition #exhibition-back {
    display: flex;
}

#exhibition-help {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: none;
}

body.is-exhibition #exhibition-help {
    display: block;
}

#exhibition-help-panel {
    position: absolute;
    top: 0;
    right: 0;
    box-sizing: border-box;
    width: min(280px, calc(100vw - 24px));
    padding: 32px 16px 20px;
    border: 1px solid rgba(232, 228, 220, 0.2);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.92);
    color: #e8e4dc;
    backdrop-filter: blur(8px);
}

#exhibition-help-panel > .exhibition-icon-btn {
    position: absolute;
    top: 0;
    right: 0;
    border: 0;
}

#exhibition-help-panel .help-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#exhibition-help-panel .help-body[hidden] {
    display: none !important;
}

#exhibition-help-panel .help-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

#exhibition-help-panel .help-item p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(232, 228, 220, 0.85);
}

#exhibition-help-panel .help-small-note {
    display: block;
    font-size: 11.5px;
    margin-top: 2px;
    color: rgba(232, 228, 220, 0.5);
}

#exhibition-help-panel .help-item strong {
    font-weight: 700;
    color: #f4f0e8;
}

#exhibition-help-panel .help-keys {
    display: flex;
    gap: 16px;
    align-items: center;
    color: rgba(232, 228, 220, 0.7);
}

#exhibition-help-panel .help-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#exhibition-help-panel .help-k-row {
    display: flex;
    gap: 4px;
}

#exhibition-help-panel .help-k {
    display: grid;
    place-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 2px;
    border: 1px solid rgba(232, 228, 220, 0.25);
    border-radius: 6px;
    background: rgba(18, 22, 30, 0.65);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    line-height: 1;
}

#exhibition-help-panel .help-k--wide {
    min-width: 86px;
    letter-spacing: 0.08em;
    font-size: 10px;
}

#exhibition-help-panel .help-mouse {
    width: 56px;
    height: 40px;
    color: rgba(232, 228, 220, 0.7);
}

#exhibition-help-panel .help-touch-joystick {
    position: relative;
    width: 48px;
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.12);
}

#exhibition-help-panel .help-touch-joystick::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    translate: 4px -20px;
}

#canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: none;
    width: 100%;
    height: 100%;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body.is-exhibition #canvas {
    display: block;
}

.walk-touch-joystick {
    position: fixed;
    z-index: 6;
    width: 60px;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.12);
}

.walk-touch-joystick::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    translate: var(--x, 0) var(--y, 0);
}

body.is-exhibition #welcome {
    pointer-events: none;
}

#fps {
    position: fixed;
    bottom: 12px;
    right: 12px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font: 12px/1.4 monospace;
    border-radius: 4px;
    z-index: 10;
}

#modal-root {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    pointer-events: none;
    --modal-fade-duration: 120ms;
    --modal-fade-easing: ease-out;
}

#modal-root.is-open {
    display: block;
    pointer-events: auto;
}

#modal-root.is-closing {
    --modal-fade-duration: 180ms;
    --modal-fade-easing: ease-in;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity var(--modal-fade-duration) var(--modal-fade-easing);
}

#modal-root.is-visible .modal-backdrop {
    opacity: 0.55;
}

.modal-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 48px 16px 16px;
    border: 1px solid #666;
    border-radius: 8px;
    background: #0a0a0a;
    color: #eee;
    opacity: 0;
    outline: none;
    transition: opacity var(--modal-fade-duration) var(--modal-fade-easing);
}

#modal-root.is-visible .modal-panel {
    opacity: 1;
}

.modal-panel > .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: auto;
}

.modal-content :is(img, video, iframe) {
    max-width: 100%;
    border: none;
}

.modal-content video {
    width: 100%;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-panel.modal-scene-mm {
    width: min(92vw, 92vh * 16 / 9);
    height: min(92vh, 92vw * 9 / 16);
}

.modal-scene-mm .modal-content {
    flex: 1;
    align-items: stretch;
    justify-content: center;
}

.modal-scene-mm .modal-content iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#subtitle-root {
    position: fixed;
    left: 50%;
    bottom: 40px;
    z-index: 120;
    width: min(760px, calc(100vw - 40px));
    transform: translate(-50%, 12px);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 160ms ease-out,
        transform 160ms ease-out;
}

#subtitle-root.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.subtitle-line {
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 14px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 20px;
    line-height: 1.35;
    text-align: center;
}

.modal-btn {
    padding: 8px 14px;
    border: 1px solid rgba(232, 228, 220, 0.35);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

/* Babylon default unmute control (we unlock audio on user gesture instead) */
#babylonUnmuteButton,
.babylonUnmute {
    display: none !important;
}

