* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #c8b99a;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button:focus {
    outline: none;
}

button:focus-visible {
    outline: 2px solid #fff2c7;
    outline-offset: 2px;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    overflow: hidden;
    background: #071d4c;
    opacity: 1;
    transition: opacity 0.8s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

@media (max-width: 768px) and (orientation: portrait) {
    .loading-video {
        object-fit: cover;
    }
}

.loading-tip {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(12% + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    color: #fff;
    font-size: 17px;
    letter-spacing: 4px;
    white-space: nowrap;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

.loading-subtitle {
    display: none;
    position: absolute;
    left: 50%;
    bottom: calc(7% + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.loading-screen.ready .loading-subtitle {
    display: block;
}

.loading-screen.playing .loading-subtitle {
    display: none;
}

.loading-screen.ready {
    cursor: pointer;
}

.loading-screen.ready .loading-tip {
    display: block;
    animation: loadingTipPulse 1.4s ease-in-out infinite;
}

.loading-screen.playing .loading-tip {
    display: none;
}

.loading-skip {
    display: none;
    position: absolute;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 20px;
    z-index: 2;
    padding: 7px 18px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 30px;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 14px;
    letter-spacing: 2px;
}

.loading-screen.can-skip .loading-skip {
    display: block;
}

@keyframes loadingTipPulse {

    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 1;
    }
}

#app,
.viewport {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.viewport {
    touch-action: none;
    cursor: grab;
}

.viewport.dragging {
    cursor: grabbing;
}

.map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 3761px;
    height: 3120px;
    transform-origin: 0 0;
    transform: translate3d(0, 0, 0) scale(0.5);
    transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.map-container.dragging {
    transition: none;
}

.map-image {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.marker {
    position: absolute;
    width: 130px;
    height: 138px;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.marker-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.marker-selected,
.marker-open,
.book-selected {
    opacity: 0;
}

.marker.is-animating .marker-selected {
    animation: markerFrameSwitch 0.8s linear infinite;
}

.marker.visited .marker-img {
    opacity: 0;
    animation: none;
}

.marker.visited .marker-open,
.book-item.active .book-selected {
    opacity: 1;
}

.book-item.active .book-img:first-child {
    opacity: 0;
}

@keyframes markerFrameSwitch {
    0%,
    49.99% {
        opacity: 0;
    }

    50%,
    100% {
        opacity: 1;
    }
}

.edge-mask {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.book-panel {
    position: fixed;
    left: 50%;
    bottom: 30px;
    z-index: 10;
    width: min(94vw, 420px);
    aspect-ratio: 660 / 600;
    transform: translateX(-50%);
    background: url("../images/bjk.png") center / 100% 100% no-repeat;
    pointer-events: none;
}

.book-grid {
    position: absolute;
    top: 9%;
    right: 8%;
    bottom: calc(17% + env(safe-area-inset-bottom, 0px));
    left: 8%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    column-gap: 4%;
    row-gap: 2%;
    pointer-events: auto;
}

.book-panel-text {
    position: absolute;
    bottom: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: 65%;
    pointer-events: none;
}

.book-item {
    position: relative;
    min-width: 0;
    min-height: 0;
    transition: transform 0.15s ease;
}

.book-item:active {
    transform: scale(0.94);
}

.book-item::after {
    content: "";
    position: absolute;
    bottom: 1%;
    left: 7%;
    z-index: 2;
    width: 55%;
    aspect-ratio: 57 / 56;
    background: url("../images/g.png") center / 100% 100% no-repeat;
    opacity: 0;
    transform: scale(0.65);
    transform-origin: center bottom;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.book-item.visited::after {
    opacity: 1;
    transform: scale(1);
}

.book-img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.visitor-count {
    position: fixed;
    top: calc(19px + env(safe-area-inset-top, 0px));
    right: calc(15px + env(safe-area-inset-right, 0px));
    z-index: 20;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    background: rgba(18, 35, 43, 0.48);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    color: #fff4d6;
    font-size: 13px;
    line-height: 18px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
}

.visitor-count span {
    margin: 0 2px;
    color: #ffe3a3;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.music-button {
    position: fixed;
    top: calc(15px + env(safe-area-inset-top, 0px));
    left: calc(15px + env(safe-area-inset-left, 0px));
    z-index: 20;
    width: 33.6px;
    height: 33.6px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    background: rgba(18, 35, 43, 0.48);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.music-icon {
    display: block;
    width: 100%;
    height: 100%;
    background: url("../images/bgmoff.png") center / 100% 100% no-repeat;
    pointer-events: none;
}

.music-button.is-playing .music-icon {
    background-image: url("../images/bgmon.png");
    animation: musicIconSpin 4s linear infinite;
}

@keyframes musicIconSpin {
    to {
        transform: rotate(360deg);
    }
}

.secret-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: rgba(4, 14, 28, 0.76);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.secret-modal.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.secret-dialog {
    position: relative;
    width: min(90vw, calc(90vh * 844 / 1496), 430px);
    aspect-ratio: 844 / 1496;
    background: url("../images/nr.png") center / 100% 100% no-repeat;
    transform: translateY(16px) scale(0.96);
    transition: transform 0.25s ease;
}

.secret-modal.visible .secret-dialog {
    transform: translateY(0) scale(1);
}

.secret-scroll {
    position: absolute;
    top: 7%;
    right: 9%;
    bottom: 20%;
    left: 9%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 91, 52, 0.45) transparent;
    -webkit-user-select: text;
    user-select: text;
}

.secret-scroll::-webkit-scrollbar {
    width: 4px;
}

.secret-scroll::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(139, 91, 52, 0.45);
}

.secret-title {
    color: #74351f;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    letter-spacing: 2px;
}

.secret-subtitle {
    margin: 7px 0 18px;
    color: #a06942;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    letter-spacing: 1px;
}

.secret-image,
.secret-video {
    display: block;
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 3px 12px rgba(80, 44, 20, 0.16);
}

.secret-video[hidden] {
    display: none;
}

.secret-body {
    margin-top: 18px;
    color: #5c4734;
    font-size: 15px;
    line-height: 1.9;
    text-align: justify;
}

.secret-body p+p {
    margin-top: 12px;
}

.secret-body img {
    max-width: 100%;
    height: auto;
}

.secret-body iframe.video.vertical-video {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    aspect-ratio: 9 / 16;
}

.secret-close {
    position: absolute;
    bottom: 5%;
    left: 50%;
    width: 16%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translateX(-50%);
}

.completion-screen {
    position: fixed;
    inset: 0;
    z-index: 70;
    overflow: hidden;
    background: #061b45;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.completion-screen.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.completion-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: calc(100vh * 844 / 1496);
    max-height: calc(100vw * 1496 / 844);
}

.completion-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.poster {
    position: absolute;
    cursor: pointer;
    overflow: hidden;
}

.poster img {
    display: block;
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
}

.poster-1 {
    left: 10.43%;
    top: 25.53%;
    width: 23.7%;
    height: 22.73%;
}

.poster-2 {
    left: 37.91%;
    top: 25.53%;
    width: 23.7%;
    height: 22.73%;
}

.poster-3 {
    left: 65.4%;
    top: 25.53%;
    width: 23.7%;
    height: 22.73%;
}

.poster-4 {
    left: 10.43%;
    top: 49.3%;
    width: 23.7%;
    height: 22.73%;
}

.poster-5 {
    left: 37.91%;
    top: 49.3%;
    width: 23.7%;
    height: 22.73%;
}

.poster-6 {
    left: 65.4%;
    top: 49.3%;
    width: 23.7%;
    height: 22.73%;
}

.back-to-map {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    z-index: 80;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.poster-zoom {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.poster-zoom.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.poster-zoom-img {
    width: 80vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
}

.poster-zoom-tip {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
}

@media (orientation: landscape) and (max-height: 600px) {
    .book-panel {
        width: min(62vw, 330px);
    }

    .secret-title {
        font-size: 15px;
    }

    .secret-subtitle {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .secret-body {
        margin-top: 10px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .map-container,
    .marker-img,
    .book-item,
    .book-item::after,
    .book-img,
    .secret-modal,
    .secret-dialog,
    .completion-screen {
        transition: none;
    }
}