* {
    box-sizing: border-box;
}
:root {
    color-scheme: light;
    --edge: clamp(16px, 4vw, 60px);
    --serif: var(--font-serif);
    --bar: 56px;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
    font: inherit;
}
button,
a {
    -webkit-tap-highlight-color: transparent;
}
button {
    cursor: pointer;
    color: inherit;
}
button:disabled {
    opacity: 0.62;
    cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
#world:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}
[hidden] {
    display: none !important;
}
.garden-header {
    position: relative;
    z-index: 2;
    min-height: calc(var(--bar) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--edge) 0;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font: 600 18px var(--serif);
    letter-spacing: 0.08em;
    color: var(--ink);
    text-decoration: none;
}
.seal {
    width: 20px;
    height: 30px;
    display: grid;
    align-content: center;
    text-align: center;
    line-height: 12px;
    font-size: 11px;
    color: #fff8e6;
    border: 1px solid var(--cinnabar);
    box-shadow: inset 0 0 0 1px #fbf7efa8;
    background: var(--cinnabar);
}
.header-title {
    border-left: 1px solid var(--line-strong);
    padding-left: 14px;
    font: 500 13px var(--serif);
    color: var(--ink-mute);
    letter-spacing: 0.08em;
}
.language {
    margin-left: auto;
    color: var(--ink-soft);
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 15px 2px;
    text-underline-offset: 4px;
}
.invite-main {
    min-height: calc(100svh - var(--bar));
    display: grid;
    align-content: end;
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.invite-landscape {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(0deg, #342e23a3, transparent 65%),
        url('/assets/images/memorial/courtyard.webp') center/cover,
        var(--paper-deep);
}
.invite-card {
    width: min(100%, 460px);
    margin: clamp(120px, 25vh, 280px) auto 0;
    padding: 28px var(--edge) max(28px, env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 3px solid var(--gold);
    box-shadow: var(--shadow);
}
.garden-rule {
    width: 35px;
    height: 2px;
    background: var(--gold);
}
.invite-card h1,
.sheet-head h2,
.bio-detail h3 {
    font: 500 clamp(24px, 4vw, 36px) var(--serif);
    margin: 14px 0;
    letter-spacing: 0.06em;
}
.invite-card p,
.bio-detail p {
    color: var(--ink-soft);
    line-height: 1.7;
    overflow-wrap: anywhere;
}
label {
    display: block;
    font-size: 14px;
    margin: 14px 0 6px;
}
input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: var(--white);
    color: var(--ink);
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 16px;
    min-height: 44px;
}
textarea {
    resize: vertical;
}
.primary,
.secondary {
    border: 0;
    min-height: 46px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
}
.primary {
    color: var(--white);
    background: #55442c;
    width: 100%;
}
.primary:hover {
    background: #6b5332;
}
.secondary {
    background: var(--paper-deep);
    padding: 8px 18px;
}
form > .primary,
.invite-card a.primary {
    margin-top: 16px;
}
.visiting {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}
#experience {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.stage {
    flex: 1;
    min-height: 190px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: #bec5ac url('/assets/images/memorial/courtyard.webp') center/cover;
}
#world,
.scene-wash {
    position: absolute;
    inset: 0;
}
#world {
    outline: none;
    touch-action: none;
}
#world canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.scene-wash {
    pointer-events: none;
    background: linear-gradient(180deg, #24231964 0%, transparent 32%, transparent 72%, #27221640 100%);
}
.scene-heading {
    position: absolute;
    pointer-events: none;
    left: var(--edge);
    top: clamp(16px, 3vh, 32px);
    max-width: 63%;
    color: var(--white);
    text-shadow: 0 1px 8px #302818a6;
}
.scene-heading h1 {
    font: 500 clamp(26px, 5vw, 46px) / 1.15 var(--serif);
    margin: 5px 0;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.scene-heading p {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.1em;
}
.garden-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 0.15em;
}
.line {
    width: 22px;
    height: 1px;
    background: #f1ddb5;
}
.scene-tools {
    position: absolute;
    right: var(--edge);
    top: 18px;
    display: grid;
    gap: 8px;
}
.glass,
.presence {
    background: #383124c7;
    border: 1px solid #f8f2e45c;
    color: var(--white);
    box-shadow: 0 2px 8px #34281315;
    border-radius: 22px;
    padding: 8px 13px;
    font-size: 13px;
}
.glass {
    min-height: 44px;
}
.walk-controls {
    position: absolute;
    left: var(--edge);
    bottom: 16px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}
.stick {
    width: 74px;
    height: 74px;
    border: 1px solid #fff8eaca;
    border-radius: 50%;
    background: #4c44364a;
    display: grid;
    place-items: center;
    touch-action: none;
    user-select: none;
    pointer-events: auto;
    box-shadow: inset 0 0 0 7px #fbf7ef12;
}
.stick i {
    display: block;
    width: 31px;
    height: 31px;
    border: 1px solid #fffc;
    border-radius: 50%;
    background: #fff7ddc7;
    box-shadow: 0 3px 8px #29221544;
}
.movement-help,
.scene-status {
    color: white;
    text-shadow: 0 1px 3px #18130e;
    font-size: 12px;
}
.movement-help {
    background: #27241d8c;
    border-radius: 20px;
    padding: 4px 10px;
}
.scene-status {
    position: absolute;
    left: 50%;
    bottom: 24%;
    translate: -50% 0;
    background: #302b21e0;
    border-radius: 20px;
    padding: 8px 14px;
    text-align: center;
    pointer-events: none;
    max-width: 85%;
    width: max-content;
}
.scene-status:empty {
    display: none;
}
.presence {
    position: absolute;
    right: var(--edge);
    bottom: 16px;
    font-size: 12px;
}
.back {
    position: absolute;
    left: var(--edge);
    bottom: 16px;
}
.dock {
    flex-shrink: 0;
    z-index: 1;
    position: relative;
    background: var(--paper);
    padding: 13px var(--edge) max(15px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-strong);
}
.dock-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.dock-label {
    font-size: 11px;
    color: var(--ink-mute);
    letter-spacing: 0.1em;
}
.dock h2 {
    font: 600 20px/1.25 var(--serif);
    margin: 3px 0 0;
    overflow-wrap: anywhere;
}
.book-button {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    padding: 7px 15px;
    min-height: 44px;
    font-size: 14px;
}
#ritual-shelf {
    display: flex;
    gap: 8px;
    overflow: auto;
    padding: 2px 0 5px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}
.ritual {
    flex: 0 0 76px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 75px;
    padding: 4px;
    font: 500 14px var(--serif);
    scroll-snap-align: start;
}
.ritual:hover {
    border-color: var(--gold);
}
.ritual img {
    width: 48px;
    height: 40px;
    object-fit: contain;
}
#experience[data-mode='altar'] .walk-controls,
.flat .walk-controls {
    display: none;
}
#flat-portrait {
    position: absolute;
    left: 50%;
    top: 51%;
    transform: translate(-50%, -50%);
    width: min(160px, 32vw);
    background: linear-gradient(135deg, #88724d, #40372b);
    border: 5px double #d3b476;
    box-shadow: 0 10px 25px #241c18aa;
    padding: 8px;
    text-align: center;
    color: var(--ivory);
}
#flat-portrait img {
    width: 100%;
    max-height: 21vh;
    object-fit: contain;
}
#flat-portrait strong {
    font: 48px var(--serif);
    display: block;
}
#flat-portrait span {
    display: block;
    margin: 4px 0;
}
dialog {
    color: var(--ink);
    background: var(--paper);
    padding: 20px max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom));
    width: min(100%, 460px);
    max-width: 100%;
    max-height: 84dvh;
    overflow: auto;
    overscroll-behavior: contain;
    margin: auto auto 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px 14px 0 0;
    box-shadow: var(--shadow);
}
dialog::backdrop {
    background: #221c1790;
}
.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.sheet-head h2 {
    font-size: 23px;
    margin: 0;
}
.close {
    background: transparent;
    border: 0;
    min-width: 44px;
    height: 44px;
    font-size: 26px;
}
.offering-preview {
    display: flex;
    gap: 13px;
    align-items: center;
    color: var(--ink-soft);
}
.offering-preview img {
    width: 70px;
    height: 60px;
    object-fit: contain;
}
#tribute-form small {
    color: var(--ink-mute);
    line-height: 1.5;
}
.error {
    color: var(--cinnabar);
}
.book-entry {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.book-entry b {
    font: 600 17px var(--serif);
}
.book-entry time {
    display: block;
    font-size: 12px;
    color: var(--ink-mute);
    margin: 4px 0;
}
.book-entry p {
    white-space: pre-wrap;
    margin: 7px 0 0;
    line-height: 1.6;
}
.plot-list {
    display: grid;
}
.plot-list button {
    font: 500 17px var(--serif);
    text-align: left;
    padding: 13px 3px;
    min-height: 48px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
}
.plot-list span {
    float: right;
    color: var(--gold-deep);
}
.court-pages {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}
.court-pages a {
    color: var(--gold-deep);
    padding: 8px 0;
}
.bio-detail img {
    max-height: 200px;
    max-width: 100%;
    display: block;
    margin: auto;
}
.bio-detail small {
    color: var(--ink-mute);
}
.plain {
    padding: 20px;
    background: var(--paper);
}
@media (min-width: 700px) {
    .invite-card {
        margin: 12vh 9vw;
        padding: 36px 40px;
        border-radius: 5px;
    }
    .dock {
        padding-left: max(var(--edge), calc((100vw - 880px) / 2));
        padding-right: max(var(--edge), calc((100vw - 880px) / 2));
    }
    dialog {
        margin: auto;
        border-radius: 10px;
    }
}
@media (max-width: 450px) {
    .visiting:lang(en) .header-title {
        font-size: 11px;
    }
    .presence {
        bottom: 96px;
    }
}
@media (max-height: 540px) and (orientation: landscape) {
    :root {
        --bar: 42px;
    }
    #experience {
        flex-direction: row;
    }
    .stage {
        min-height: 0;
    }
    .dock {
        width: 235px;
        overflow: auto;
        padding: 16px;
    }
    #ritual-shelf {
        flex-wrap: wrap;
    }
    .ritual {
        flex: 1 1 55px;
    }
    .movement-help {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
    }
}

@media (max-width: 699px) {
    .invite-landscape {
        background-image:
            linear-gradient(0deg, #342e2355, transparent 65%),
            url('/assets/images/memorial/courtyard-mobile.webp');
    }
    .stage {
        background-image: url('/assets/images/memorial/courtyard-mobile.webp');
    }
}

#flat-offerings {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--paper-deep);
    border-bottom: 3px solid var(--gold-deep);
}
#flat-offerings:empty {
    display: none;
}
#flat-offerings img {
    width: 31px;
    height: 31px;
    object-fit: contain;
}
