html, body, #root { height: 100%; margin: 0; }
.world-root { position: fixed; inset: 0; overflow: hidden; background: #f7e8da; }
.world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.world-canvas.dragging { cursor: grabbing; }
.world-mark {
    position: absolute; top: max(20px, env(safe-area-inset-top)); left: 0; right: 0;
    text-align: center; pointer-events: none; z-index: 2;
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    color: rgba(94, 70, 60, 0.85);
    transition: opacity 2.5s ease;
}
.world-mark .mark-name {
    font-size: clamp(21px, 5.4vw, 34px); letter-spacing: 0.34em; text-transform: uppercase;
    text-indent: 0.34em; font-weight: 500;
    text-shadow: 0 1px 18px rgba(255, 244, 224, 0.9);
}
.world-mark .mark-rule {
    width: 54px; height: 1px; margin: 10px auto 0;
    background: linear-gradient(90deg, transparent, rgba(190, 150, 90, 0.8), transparent);
}
.world-mark.dim { opacity: 0.38; }
.world-hint {
    position: absolute; top: calc(max(20px, env(safe-area-inset-top)) + 84px); left: 0; right: 0;
    text-align: center; pointer-events: none; z-index: 2;
    font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(94, 70, 60, 0.55); transition: opacity 1.5s ease;
    text-shadow: 0 1px 12px rgba(255, 244, 224, 0.9);
}
.world-hint.gone { opacity: 0; }

.magic-book {
    position: absolute; right: max(18px, env(safe-area-inset-right));
    top: 46%; transform: translateY(-50%);
    width: clamp(78px, 12vw, 118px);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: none; border: 0; padding: 0; margin: 0;
    cursor: pointer; z-index: 3;
    -webkit-tap-highlight-color: transparent;
}
.magic-book.hidden { display: none; }
.magic-book img {
    display: block; width: 100%;
    filter: drop-shadow(0 0 14px rgba(255, 226, 160, 0.85)) drop-shadow(0 8px 18px rgba(150, 110, 55, 0.3));
    animation: book-float 6.5s ease-in-out infinite;
    transition: transform 0.35s ease;
}
.magic-book:hover img, .magic-book:focus-visible img { transform: scale(1.07); }
.magic-book:focus-visible { outline: 2px solid rgba(190, 150, 90, 0.7); outline-offset: 4px; border-radius: 12px; }
.magic-book-caption {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; text-indent: 0.22em;
    color: rgba(94, 70, 60, 0.62);
    text-shadow: 0 1px 10px rgba(255, 244, 224, 0.95);
}
@keyframes book-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9px); }
}

/* open book */
.book-veil {
    position: fixed; inset: 0; z-index: 6;
    background: rgba(244, 232, 252, 0.42);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; justify-content: center; align-items: flex-start;
    padding: max(24px, env(safe-area-inset-top)) 14px 24px;
    overflow-y: auto;
}
.book-open {
    position: relative;
    width: min(620px, 94vw);
    margin-top: 2vh;
    border-radius: 14px;
    background: linear-gradient(160deg, #fdf6e4 0%, #f7ecd2 55%, #f1e2c4 100%);
    border: 1px solid rgba(190, 150, 90, 0.55);
    box-shadow:
        0 0 0 5px rgba(190, 150, 90, 0.16),
        0 0 34px rgba(255, 226, 160, 0.55),
        0 22px 48px rgba(120, 88, 40, 0.32);
    padding: 26px 22px 20px;
    animation: book-arrive 0.45s ease;
}
@keyframes book-arrive {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
.book-close {
    position: absolute; top: 6px; right: 10px;
    background: none; border: 0; cursor: pointer;
    font-family: Georgia, serif; font-size: 26px; line-height: 1;
    color: rgba(120, 88, 40, 0.65); padding: 4px 6px;
}
.book-close:hover { color: rgba(120, 88, 40, 0.95); }
.book-pages { display: flex; gap: 0; }
.book-page { flex: 1 1 0; padding: 14px 16px; position: relative; }
.book-left {
    border-right: 1px solid rgba(150, 110, 55, 0.35);
    box-shadow: inset -14px 0 18px -16px rgba(120, 88, 40, 0.45);
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px;
    text-align: center;
}
.book-right { box-shadow: inset 14px 0 18px -16px rgba(120, 88, 40, 0.45); display: flex; flex-direction: column; gap: 12px; }
.book-invite {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-style: italic; font-size: clamp(17px, 2.6vw, 21px); line-height: 1.6;
    color: #6b4f2a;
}
.book-divider { color: rgba(178, 140, 70, 0.8); font-size: 15px; }
.book-note {
    font-family: Georgia, serif; font-size: 10.5px; letter-spacing: 0.08em;
    color: rgba(107, 79, 42, 0.55);
}
.book-write {
    width: 100%; flex: 1 1 auto; min-height: 150px; resize: none;
    border: 0; outline: none; background:
        repeating-linear-gradient(transparent 0 27px, rgba(150, 110, 55, 0.22) 27px 28px);
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 18px; line-height: 28px; color: #5a3f1e;
    padding: 0 2px;
}
.book-write::placeholder { color: rgba(107, 79, 42, 0.42); font-style: italic; }
.book-seal {
    align-self: center;
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase; text-indent: 0.16em;
    color: #6b4f2a; cursor: pointer;
    background: linear-gradient(160deg, rgba(255, 240, 200, 0.9), rgba(240, 214, 150, 0.9));
    border: 1px solid rgba(178, 140, 70, 0.6); border-radius: 999px;
    padding: 8px 18px;
    box-shadow: 0 2px 10px rgba(150, 110, 55, 0.25);
    transition: transform 0.2s ease;
}
.book-seal:hover { transform: translateY(-1px); }
@media (max-width: 520px) {
    .book-pages { flex-direction: column; }
    .book-left { border-right: 0; border-bottom: 1px solid rgba(150, 110, 55, 0.35); box-shadow: inset 0 -14px 18px -16px rgba(120, 88, 40, 0.45); padding-bottom: 18px; }
    .book-right { box-shadow: none; padding-top: 18px; }
    .book-write { min-height: 120px; }
}
}
