:root {
  color-scheme: light;
  --paper: #f7f6f0;
  --card: #fcfbf7;
  --ink: #2f382d;
  --muted: #5f675a;
  --green: #455940;
  --green-dark: #344b34;
  --line: #e2e3d8;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'STSong', 'SimSun', Georgia, serif;
  --sans: 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #7d885f; outline-offset: 4px; }
main:focus { outline: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 700; }
[data-icon] { display: inline-grid; place-items: center; flex: 0 0 auto; }
.icon { display: block; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(1192px, calc(100% - 96px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 8px 14px; background: white; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.header { background: #fbfaf6; border-bottom: 1px solid #eae9e1; }
.header-inner { height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.brand { display: inline-flex; justify-self: start; align-items: center; gap: 10px; font: 700 26px/1 var(--serif); letter-spacing: .13em; }
.brand-mark { width: 36px; height: 36px; border-radius: 50%; background: #e8ece1; color: #4c6447; font-size: 20px; }
nav { height: 100%; display: flex; align-items: stretch; gap: 36px; }
nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: 14px; white-space: nowrap; }
nav a:hover, nav a[aria-current] { color: var(--green-dark); }
nav a[aria-current] { font-weight: 700; }
nav a[aria-current]::after { content: ''; position: absolute; bottom: 15px; left: 50%; width: 16px; height: 2px; border-radius: 2px; background: #7b8b70; transform: translateX(-50%); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 8px; background: var(--green); color: white; font-size: 14px; font-weight: 650; white-space: nowrap; transition: background .18s, border-color .18s, color .18s; }
.button:hover { background: var(--green-dark); }
.header-create { justify-self: end; min-height: 39px; padding-inline: 13px; }
.button.outline { color: var(--green-dark); background: transparent; border-color: #bfc9b7; }
.button.outline:hover { background: #ecede4; }
.button.danger { background: #8a403b; }
.button.danger:hover { background: #71332f; }

main { flex: 1; padding-block: 31px 64px; }
.hero { position: relative; display: grid; align-items: center; isolation: isolate; overflow: hidden; min-height: 434px; padding: 40px 66px; border-radius: 19px; background: #232c23; color: #fffdf4; }
.hero::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, rgba(22, 31, 24, .76), rgba(22, 31, 24, .28) 52%, transparent 76%), url('assets/remembrance.jpg') 62% 58% / cover no-repeat; }
.hero-content { position: relative; width: min(100%, 550px); }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: #d8decf; font-size: 13px; letter-spacing: .19em; }
.eyebrow::before { content: ''; width: 23px; height: 1px; background: #b8c4a7; }
.hero h1 { font-size: clamp(45px, 5.6vw, 76px); line-height: 1.12; letter-spacing: .035em; }
.hero h1 span { display: block; color: #e2e7d5; }
.hero-copy { margin-top: 18px; color: #edf0e5; font-size: 15px; line-height: 1.8; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 25px; }
.hero-buttons .button { min-height: 45px; padding-inline: 17px; }
.hero-primary { background: #eef0e2; color: #364b35; }
.hero-primary:hover { background: white; }
.hero-secondary { background: #e2e9d510; color: #f7f8f0; border-color: #d8dfcc70; }
.hero-secondary:hover { background: #e2e9d530; }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; margin: 20px 0 40px; }
.quick-action { min-width: 0; display: flex; align-items: center; gap: 15px; min-height: 93px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; text-align: left; color: var(--ink); transition: background .18s, border-color .18s, transform .18s; }
.quick-action:hover { background: #fffffc; border-color: #b7c3ae; transform: translateY(-2px); }
.quick-icon, .card-icon { width: 42px; height: 42px; border-radius: 12px; background: #edf0e6; color: #526a4c; font-size: 22px; }
.quick-action:nth-child(2) .quick-icon, .tone-light { background: #f4eddd; color: #836739; }
.quick-action:nth-child(3) .quick-icon, .tone-note { background: #f1ebe8; color: #80665e; }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { font-size: 15px; font-weight: 700; }
.quick-action small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.quick-action .quick-arrow { margin-left: auto; color: #76816d; }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 0 0 17px; }
.section-head h2, .panel h2 { font-size: 30px; line-height: 1.24; letter-spacing: .045em; }
.section-head p, .page-heading p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.join-hall { margin: 0 0 16px; max-width: 520px; }
.join-hall label { display: block; margin-bottom: 6px; color: var(--green-dark); font-weight: 650; }
.join-hall > div { display: flex; gap: 8px; }
.join-hall input { min-width: 0; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fffdf8; font: inherit; font-size: 16px; }
.join-hall .button { flex: 0 0 auto; }
.join-hall .form-error:empty { display: none; }
.text-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; color: var(--green-dark); font-size: 14px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.hall-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.hall-card { display: flex; min-width: 0; align-items: center; gap: 16px; padding: 14px; min-height: 110px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); transition: border-color .18s, background .18s; }
.hall-card:hover { border-color: #b7c3ae; background: #fffffc; }
.hall-card .card-art { display: grid; flex-shrink: 0; place-items: center; width: 86px; height: 78px; overflow: hidden; border-radius: 8px; background: #e9ede1; color: #6b7e60; font-size: 33px; }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.card-art.sample { background: #27362a url('assets/remembrance.jpg') 83% 64% / auto 127px no-repeat; }
.hall-card-body { min-width: 0; flex: 1; }
.hall-card h3 { overflow-wrap: anywhere; font: 700 21px/1.35 var(--serif); letter-spacing: .04em; }
.hall-card p, .hall-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.hall-card .next { margin: 0 7px 0 1px; color: #65755f; }
.sample-tag { display: inline-block; margin-left: 8px; vertical-align: middle; padding: 2px 6px; border-radius: 4px; background: #edf0e6; color: #53644d; font: 500 11px/1.35 var(--sans); letter-spacing: 0; }
.new-hall { border-style: dashed; border-color: #c9cebf; background: #f3f3eb; text-align: left; color: var(--ink); }
.new-hall .card-icon { margin-inline: 11px; width: 56px; height: 56px; font-size: 24px; }
.footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 20px; }
.footer-brand { font-size: 18px; }
.footer-brand .brand-mark { width: 28px; height: 28px; font-size: 16px; }
.footer p { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }

.page-heading { margin: 22px 0 25px; }
.page-heading h1 { font-size: clamp(40px, 6vw, 60px); line-height: 1.13; letter-spacing: .04em; overflow-wrap: anywhere; }
.detail-nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); gap: 15px; }
.panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.panel h2 { margin-bottom: 12px; font-size: 25px; }
.panel .body-copy, .note-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.muted { color: var(--muted); }
.notes-list { display: grid; gap: 10px; }
.note { min-width: 0; padding: 15px 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.note-header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 15px; margin-bottom: 5px; color: var(--green-dark); font-size: 13px; }
.note-header a:hover { text-decoration: underline; }
.note-header time { color: var(--muted); font-size: 12px; }
.note-text { font-size: 14px; }
.counts { margin-top: 12px; color: var(--muted); font-size: 13px; }

dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 0; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--card); box-shadow: 0 20px 90px #20241b30; }
dialog::backdrop { background: #1d281e84; }
.dialog-inner { padding: 24px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-header h2 { font-size: 27px; line-height: 1.24; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 8px; color: var(--green); background: #eeefe8; }
.icon-button:hover { background: #e1e6db; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 650; }
.form input, .form textarea, .form select { min-width: 0; width: 100%; padding: 8px 10px; border: 1px solid #cdd4c6; border-radius: 7px; background: white; color: var(--ink); font-size: 14px; }
.form textarea { resize: vertical; min-height: 88px; }
.form [type=file] { padding: 6px; }
.form [type=file]::file-selector-button { margin-right: 10px; padding: 4px 8px; border: 0; border-radius: 5px; background: #e8ece2; color: var(--green-dark); cursor: pointer; }
.form .check { display: flex; align-items: center; gap: 8px; }
.form .check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.dialog-copy { margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dialog-actions .delete-link { margin-right: auto; padding: 5px 0; border: 0; background: transparent; color: #843e37; font-size: 13px; }
.dialog-actions .delete-link:hover { text-decoration: underline; }
.form-error { min-height: 0; color: #843e37; font-size: 13px; }
.form-error:empty { display: none; }
.chooser { display: grid; gap: 7px; }
.choice { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.choice:hover { border-color: #a6b49f; }
.toast { position: fixed; z-index: 4; bottom: 25px; right: 25px; max-width: min(390px, calc(100% - 50px)); padding: 11px 16px; border-radius: 8px; background: var(--green-dark); color: white; font-size: 14px; box-shadow: 0 6px 20px #24271b2b; }
.toast:empty { display: none; }

@media (max-width: 850px) {
  .shell { width: calc(100% - 48px); }
  .hero { padding-inline: 37px; min-height: 399px; }
  .quick-action { gap: 10px; padding-inline: 12px; }
  .quick-arrow { display: none; }
  .quick-actions, .hall-grid, .detail-grid { gap: 10px; }
}
@media (max-width: 600px) {
  .shell { width: calc(100% - 30px); }
  main { padding-block: 17px 44px; }
  .header-inner { height: auto; min-height: 62px; grid-template-columns: 1fr auto; padding-top: 10px; }
  .brand { font-size: 23px; }
  .brand-mark { width: 32px; height: 32px; }
  .header-create { grid-column: 2; grid-row: 1; }
  nav { grid-column: 1 / -1; justify-content: center; gap: 34px; min-height: 43px; margin-top: 2px; }
  nav a[aria-current]::after { bottom: 3px; }
  .hero { min-height: 388px; padding: 26px 22px; border-radius: 13px; }
  .hero::before { background-image: linear-gradient(90deg, rgba(22,31,24,.86), rgba(22,31,24,.56) 55%, rgba(22,31,24,.30)), url('assets/remembrance.jpg'); background-position: center, 68% center; }
  .hero h1 { font-size: clamp(39px, 9vw, 56px); }
  .hero-copy { font-size: 14px; }
  .hero-buttons { gap: 8px; }
  .hero-buttons .button { padding-inline: 12px; }
  .quick-actions { gap: 6px; margin: 12px 0 31px; }
  .quick-action { flex-direction: column; justify-content: center; gap: 5px; padding: 8px 2px; min-height: 76px; text-align: center; }
  .quick-icon { width: 33px; height: 33px; border-radius: 9px; font-size: 18px; }
  .quick-action strong { font-size: 13px; }
  .quick-action small { display: none; }
  .hall-grid, .detail-grid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 25px; }
  .section-head p { font-size: 13px; }
  .panel { padding: 16px; }
  .footer-inner { flex-wrap: wrap; padding-block: 15px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.ceremony { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #f3efe4; }
.ceremony-stage { position: relative; isolation: isolate; overflow: hidden; height: clamp(258px, 43vw, 537px); container-type: size; background: #21291f; color: #fcf4df; }
.ceremony-stage::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; box-shadow: inset 0 0 95px #15130d4a; }
.ceremony-scene { --hall-background: url('assets/animated-hall-wide.jpg'); position: absolute; top: 50%; left: 50%; width: max(100cqw, 222.22cqh); height: max(100cqh, 45cqw); transform: translate(-50%, -50%); background: #22291f var(--hall-background) center / 100% 100% no-repeat; }
.altar-profile { position: absolute; top: 7%; left: 50%; display: grid; justify-items: center; width: min(292px, 25%); transform: translateX(-50%); text-align: center; text-shadow: 0 2px 10px #111a10; }
.altar-portrait { width: clamp(40px, 15.5cqh, 84px); aspect-ratio: .83; padding: clamp(3px, 1.2cqh, 7px); border: 1px solid #be9e67; border-radius: 3px; background: linear-gradient(141deg,#7b5d3d,#372921 49%,#9e7247); box-shadow: 0 0 0 2px #14170e70, 0 6px 15px #0c100c7a, inset 0 0 0 2px #271e13; }
.altar-mat { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; border: 1px solid #b3996f; background: #343e31; color: #d8d0b8; font-size: clamp(23px, 7.5cqh, 40px); }
.altar-mat img { width: 100%; height: 100%; object-fit: cover; }
.altar-profile h1 { max-width: 100%; margin-top: 6px; font-size: clamp(21px, 6.8cqh, 37px); line-height: 1.1; letter-spacing: .075em; overflow-wrap: anywhere; }
.altar-profile h1.altar-name-long { font-size: clamp(16px, 4.8cqh, 26px); letter-spacing: .03em; }
.altar-profile h1.altar-name-extended { font-size: clamp(12px, 3.4cqh, 18px); letter-spacing: .01em; }
.altar-profile h1.altar-name-long, .altar-profile h1.altar-name-extended { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.altar-profile p { max-width: 100%; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f0e3cb; font-size: clamp(10px, 2.6cqh, 14px); line-height: 1.35; }
.hall-visitor, .hall-hearth, .table-gifts { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ambient-hall, .ambient-hall i, .ambient-hall b { position: absolute; inset: 0; pointer-events: none; }
.ambient-hall i { background: var(--hall-background) center / 100% 100% no-repeat; mask-image: radial-gradient(ellipse 13% 36% at 13% 32%, #000 23%, #0000 92%); transform-origin: 14% 0; animation: drape-drift 8.4s ease-in-out infinite alternate; }
.ambient-hall i + i { mask-image: radial-gradient(ellipse 13% 37% at 87% 33%, #000 23%, #0000 92%); transform-origin: 87% 0; animation-delay: -2.6s; animation-direction: alternate-reverse; }
.ambient-hall b { background: radial-gradient(ellipse 41% 22% at 68% 76%, #f3bb7352, transparent 74%), radial-gradient(ellipse 36% 34% at 88% 53%, #ffd5a635, transparent 75%); mix-blend-mode: screen; animation: hall-light 6.7s ease-in-out infinite alternate; }
@keyframes drape-drift { from { transform: skewX(-.48deg) translateY(0); } to { transform: skewX(1deg) translateY(.8%); } }
@keyframes hall-light { from { opacity: .28; transform: translateX(-1.5%); } to { opacity: .82; transform: translateX(1.5%); } }
.scene-candles i { position: absolute; top: 31.9%; left: 38.68%; width: clamp(4px, 1.5cqh, 8px); height: clamp(8px, 2.4cqh, 15px); transform: translateX(-50%); border-radius: 57% 44% 55% 47%; background: #ffe6a0; box-shadow: 0 0 4px #ffc971, 0 0 14px #ee9a46; animation: candle-flicker 2.7s ease-in-out infinite alternate; }
.scene-candles i + i { left: 61.24%; animation-delay: .9s; }
@keyframes candle-flicker { 30% { transform: translateX(-50%) skewX(-7deg) scale(.91); opacity: .85; } 75% { transform: translateX(-50%) skewX(4deg) scaleY(1.08); } }
.incense-cup { position: absolute; bottom: 50.55%; left: 50%; transform: translateX(-50%); width: clamp(39px, 14.6cqh, 99px); height: auto; filter: drop-shadow(0 2px 2px #1b100ca6); }
.ceremony-caption, .hall-code, .music-toggle, .sound-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #f0dfbf69; border-radius: 6px; color: #fff2d9; background: #24251bd9; font-size: 12px; white-space: nowrap; }
.ceremony-id, .hall-audio { position: absolute; z-index: 2; top: 16px; }
.ceremony-id { left: 16px; display: flex; align-items: flex-start; gap: 5px; }
.hall-code { font-variant-numeric: tabular-nums; cursor: copy; }
.hall-code:hover { background: #4c402beb; }
.hall-audio { right: 16px; display: flex; gap: 6px; }
.music-toggle, .sound-toggle { min-height: 36px; }
.music-toggle:hover, .sound-toggle:hover { background: #4c402beb; border-color: #f0dfbfaa; }
.music-toggle:focus-visible, .sound-toggle:focus-visible { outline-color: #f3d9a6; }
.sound-toggle[aria-pressed=false] { color: #e1c985; }
.ceremony-toolbar { display: flex; min-height: 56px; padding: 8px 15px; align-items: center; justify-content: space-between; gap: 8px; background: #eee8d9; color: #574e3e; }
.ceremony-toolbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ceremony-social { min-height: 48px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 6px 15px; background: #f3eee2; border-top: 1px solid #ded7c5; }
.ceremony-social[hidden], .presence-status[hidden] { display: none; }
.presence-status { color: var(--green-dark); font-size: 13px; }
.gesture-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.gesture-actions .button { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.visitor-status { font-size: 13px; }
.ceremony-sequence { min-height: 36px; padding-inline: 11px; font-size: 13px; }
.ceremony [aria-disabled=true], .quick-action[aria-disabled=true] { cursor: wait; opacity: .68; }
.ceremony-controls { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1px; padding: 1px 0 0; background: #ded7c5; }
.world-3d, .world-directions, .ceremony-toolbar-actions [hidden] { display: none; }
[data-world] .ceremony-scene { opacity: 0; pointer-events: none; }
[data-world] .world-3d { display: block; position: absolute; inset: 0; }
.world-3d canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.world-3d canvas:active { cursor: grabbing; }
.world-3d canvas:focus-visible { outline: 2px solid #f7e7bf; outline-offset: -4px; }
.world-traverse { background: #41543c; color: #fff8e9; border-color: #41543c; }
.world-traverse:hover { background: #364932; color: #fff8e9; }
.world-traverse:disabled { opacity: .59; }
.ceremony:has([data-world=courtyard]) [data-ritual], .ceremony:has([data-world=courtyard]) [data-action=gift-picker] { cursor: default; }
.world-directions { position: absolute; z-index: 2; bottom: 13px; left: 13px; grid-template-columns: repeat(3, 41px); grid-template-rows: repeat(2, 41px); gap: 4px; }
.world-directions button { display: grid; place-items: center; border-radius: 8px; border: 1px solid #f0dfbf87; background: #24251bdd; color: #fff2d9; font-size: 20px; touch-action: none; user-select: none; }
.world-directions [data-walk=up] { grid-column: 2; }
.world-directions [data-walk=left] { grid-row: 2; grid-column: 1; }
.world-directions [data-walk=down] { grid-row: 2; grid-column: 2; }
.world-directions [data-walk=right] { grid-row: 2; grid-column: 3; }
.world-directions button[data-pressed] { background: #716249; }
@media (pointer: coarse) {
  [data-world] .world-directions { display: grid; }
}
.ritual-button { display: flex; justify-content: center; align-items: center; gap: 11px; min-height: 78px; min-width: 0; padding: 8px; border: 0; background: #f8f5ed; color: #414439; text-align: left; transition: background .18s, color .18s; }
.ritual-button:hover { background: #ede6d6; color: #53462b; }
.ritual-button:focus-visible { outline-offset: -4px; }
.ritual-button:active { background: #e8dcc0; }
.ritual-icon { width: 42px; height: 42px; border: 1px solid #ded2b8; border-radius: 10px; color: #735a34; background: #eee7d7; font-size: 24px; }
[data-ritual=kneel] .ritual-icon { background: #e9eddf; border-color: #d5ddca; color: #4e6348; }
.ritual-label { display: grid; gap: 1px; }
.ritual-label strong { font-size: 15px; }
.ritual-label small { font-size: 12px; color: #625d4d; }
.counts + .quick-actions { margin-top: 8px; margin-bottom: 24px; }
.avatar-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.avatar-choice { min-height: 84px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #f6f2e8; display: grid; place-items: center; gap: 3px; color: var(--green-dark); }
.avatar-choice [data-icon] { font-size: 25px; }
.avatar-choice:hover, .avatar-choice[aria-pressed=true] { border-color: #829376; background: #eaf0e2; }
.gift-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.gift-tile { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 82px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 9px; background: #f8f5ec; color: var(--green-dark); font: inherit; font-size: 14px; cursor: pointer; touch-action: manipulation; }
.gift-tile:hover, .gift-tile:focus-visible { border-color: #9b8967; background: #f0eadb; }
.gift-tile-art { display: grid; place-items: center; width: 100%; height: 42px; color: #79643b; font-size: 24px; }
.gift-tile-art img { width: min(72px, 95%); height: 42px; object-fit: contain; filter: drop-shadow(0 3px 3px #49341340); }

.ritual-effect { display: none; position: absolute; width: 0; height: 0; pointer-events: none; }
.ritual-effect[data-active] { display: block; }
.incense-effect { top: 43.95%; left: 50%; --incense-unit: clamp(.56px,.187cqh,1.14px); }
.incense-effect i, .incense-effect b { position: absolute; --stem-x: -4; --tip-x: -5.3; --stem-height: 22; --slant: -3.5deg; }
.incense-effect i { left: calc(var(--stem-x) * var(--incense-unit)); bottom: 0; width: max(1px,calc(1.42 * var(--incense-unit))); height: calc(var(--stem-height) * var(--incense-unit)); border-radius: 40% 40% 0 0; background: linear-gradient(to top,#743d27 8%,#b47752 28%,#b29357 31%,#a48a5b 91%,#695946); transform: rotate(var(--slant)); transform-origin: bottom; }
.incense-effect i:nth-of-type(2), .incense-effect b:nth-of-type(2) { --stem-x: 0; --tip-x: 0; --stem-height: 26; --slant: 0deg; }
.incense-effect i:nth-of-type(3), .incense-effect b:nth-of-type(3) { --stem-x: 4; --tip-x: 5.25; --stem-height: 23; --slant: 3.5deg; }
.incense-effect i::after { content: ''; position: absolute; inset: 0 0 auto; height: max(1px,calc(1.32 * var(--incense-unit))); border-radius: 50%; background: #ffb56e; box-shadow: 0 0 3px 1px #e96134aa; }
.incense-effect b { bottom: calc(var(--stem-height) * var(--incense-unit)); left: calc(var(--tip-x) * var(--incense-unit)); width: max(4px,calc(7.6 * var(--incense-unit))); height: max(11px,calc(25 * var(--incense-unit))); border-radius: 56% 74% 37% 54%; transform: translateX(-50%); background: radial-gradient(ellipse at 53% 68%,#dedbd1a5,transparent 69%); filter: blur(1.6px); animation: incense-rise 4.7s linear infinite; }
.incense-effect b:nth-of-type(2) { animation-delay: -1.35s; animation-duration: 5.3s; }
.incense-effect b:nth-of-type(3) { animation-delay: -2.2s; animation-duration: 4.9s; }
@keyframes incense-rise {
  0% { opacity: 0; transform: translate(-50%,0) scale(.25,.62); }
  14% { opacity: .72; transform: translate(-58%,-7px) scale(.62,1); }
  38% { opacity: .61; transform: translate(8%,-22px) rotate(8deg) scale(1.25,1.12); }
  67% { opacity: .35; transform: translate(-92%,-44px) rotate(-18deg) scale(2.2,1.32); }
  100% { opacity: 0; transform: translate(45%,-69px) scale(3.1,1.5); }
}
@media (max-width: 600px) {
  .ceremony { border-radius: 12px; }
  .ceremony-stage { height: clamp(208px, 62vw, 300px); }
  .ceremony-id, .hall-audio { top: 9px; }
  .ceremony-caption, .music-toggle, .sound-toggle { padding: 3px 6px; font-size: 11px; }
  .ceremony-id { left: 9px; flex-direction: column; gap: 4px; }
  .hall-code { min-height: 29px; padding: 4px 6px; font-size: 11px; }
  .hall-audio { right: 9px; gap: 4px; }
  .music-toggle, .sound-toggle { min-height: 34px; }
  .ceremony-toolbar { padding-inline: 9px; }
  .visitor-status, .ceremony-sequence { font-size: 12px; }
  .ceremony-sequence { padding-inline: 8px; }
  .ritual-button { min-height: 80px; flex-direction: column; gap: 4px; text-align: center; padding: 7px 2px; }
  .ritual-icon { width: 32px; height: 32px; border-radius: 7px; font-size: 19px; }
  .ritual-label { line-height: 1.3; }
  .ritual-label strong { font-size: 13px; }
  .ritual-label small { font-size: 11px; }
}

@media (max-width: 600px) {
  .ceremony:not([data-enlarged]) .ceremony-stage[data-world] { height: clamp(310px, 91vw, 414px); }
  .ceremony:has([data-world]) .ceremony-toolbar-actions { width: 100%; flex-wrap: wrap; }
  .ceremony:has([data-world]) .ceremony-toolbar-actions .ceremony-sequence { min-width: 0; min-height: 39px; }
}
@media (max-width: 480px) {
  .altar-profile { top: 4.7%; }
  .altar-portrait { width: max(32px, 14cqh); }
  .altar-profile h1 { margin-top: 3px; font-size: clamp(18px, 5.6cqw, 24px); }
  .altar-profile h1.altar-name-long { font-size: clamp(13px, 4cqw, 18px); }
  .altar-profile h1.altar-name-extended { font-size: clamp(11px, 3.4cqw, 15px); }
  .altar-profile p { margin-top: 2px; }
  .music-toggle { min-width: 34px; justify-content: center; }
  .music-toggle > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 375px) {
  .ceremony-toolbar-actions { gap: 4px; }
  .ceremony-toolbar-actions .button { padding-inline: 6px; }
  .avatar-button [data-icon] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ritual-effect i, .ritual-effect b, .scene-candles i, .ambient-hall i, .ambient-hall b { animation: none; }
}

/* Mobile access and account history */
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.header-music { min-height: 39px; padding-inline: 10px; }
.hall-visible .header-music { display: none; }
.account-link { min-height: 39px; padding-inline: 12px; }
.history-account { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 17px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fcfbf6; overflow-wrap: anywhere; }
.history-account strong { color: var(--green-dark); }
.history-account p { font-size: 13px; color: var(--muted); }
.history-account .button { flex-shrink: 0; }
.history-day { margin-top: 24px; }
.history-day h2 { margin: 0 0 8px; font-size: 18px; }
.history-rows { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fcfbf6; }
.history-row { display: grid; grid-template-columns: minmax(55px, .4fr) minmax(70px, .48fr) minmax(80px, 1fr); align-items: center; gap: 8px 14px; padding: 10px 15px; min-height: 46px; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-row a { color: var(--green-dark); overflow-wrap: anywhere; text-decoration: underline; text-underline-offset: 3px; }
.history-actor { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.family-log { margin-top: 16px; }
.family-log ol { list-style: none; padding: 0; margin: 0; }
.family-log li { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(55px,.65fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.family-log time { color: var(--muted); font-size: 13px; }
@media (min-width: 376px) and (max-width: 600px) {
  .ceremony-id { flex-direction: row; }
}
@media (max-width: 600px) {
  .ceremony-social { padding-inline: 9px; }
  .gesture-actions .button { min-height: 40px; padding-inline: 8px; }
}
.history-row p { grid-column: 2 / -1; margin: 0; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.history-empty { margin: 18px 0 34px; }

/* The wreaths are on the floor. The scrolls hang above the side candles. */
.memorial-wreaths, .elegiac-scrolls, .scroll-blossoms { position: absolute; inset: 0; pointer-events: none; }
.memorial-wreaths img { position: absolute; left: 21.7%; bottom: 26.4%; width: auto; height: 42%; transform: translateX(-50%); filter: brightness(.83) saturate(.82) drop-shadow(2px 7px 5px #1f130cf2); }
.memorial-wreaths img + img { left: 78.3%; transform: translateX(-50%) scaleX(-1); filter: brightness(.94) saturate(.88) drop-shadow(2px 7px 5px #1f130cb0); }
.elegiac-scrolls span { position: absolute; top: 6.2%; left: 35.3%; display: grid; place-items: center; width: clamp(19px,8.4cqh,45px); height: clamp(65px,31.7cqh,172px); transform: translateX(-50%) rotate(-.75deg); background: url('assets/scroll-paper.webp') center / 100% 100% no-repeat; filter: brightness(.82) drop-shadow(2px 4px 5px #160d0bad); }
.elegiac-scrolls span + span { left: 64.7%; transform: translateX(-50%) rotate(.65deg); filter: brightness(.91) drop-shadow(2px 4px 5px #160d0b9f); }
.elegiac-scrolls b { display: block; transform: translateY(1%); color: #392e26; font: 550 clamp(12px,4.18cqh,24px)/1.15 'Kaiti SC',KaiTi,STKaiti,var(--serif); letter-spacing: .235em; writing-mode: vertical-rl; white-space: nowrap; mix-blend-mode: multiply; text-shadow: 0 0 .3px #4130236e; }
.scroll-blossoms img { position: absolute; left: 32.6%; bottom: 63.35%; width: auto; height: clamp(25px,11.7cqh,62px); transform: translateX(-50%) rotate(-5deg); filter: brightness(.88) saturate(.83) drop-shadow(1px 3px 2px #21190e72); }
.scroll-blossoms img + img { left: 67.4%; transform: translateX(-50%) scaleX(-1) rotate(-5deg); filter: brightness(.96) saturate(.88) drop-shadow(1px 3px 2px #21190e72); }
.scene-size { position: absolute; z-index: 2; right: 12px; bottom: 12px; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #f0dfbf76; border-radius: 8px; background: #24251bdc; color: #fff2d9; touch-action: manipulation; }
.scene-size:hover { background: #45392a; }
.scene-size:focus-visible { outline-color: #f3d9a6; }
.ceremony-enlarged { overflow: hidden; }
.ceremony[data-enlarged] { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; justify-content: center; border: 0; border-radius: 0; overflow-y: auto; overscroll-behavior: contain; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: #1f241c; }
.ceremony[data-enlarged] .ceremony-stage { height: clamp(230px, 65vw, 610px); flex-shrink: 0; }
.ceremony[data-enlarged] .ceremony-toolbar, .ceremony[data-enlarged] .ceremony-controls { flex-shrink: 0; }
@media (orientation: landscape) {
  .ceremony[data-enlarged] .ceremony-stage { height: max(160px, calc(100vh - 150px)); height: max(160px, calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
}
@media (max-width: 600px) {
  .header-actions { grid-column: 2; grid-row: 1; gap: 6px; }
  .header-actions .button { min-height: 38px; padding-inline: 8px; font-size: 12px; }
  .header-music > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  .header-music { min-width: 35px; }
  nav { gap: clamp(14px, 4.7vw, 30px); }
  nav a { font-size: 13px; min-height: 44px; }
  .form input, .form textarea, .form select { font-size: 16px; }
  .ceremony-stage { height: clamp(208px, 65vw, 320px); }
  .elegiac-scrolls span { left: 34.8%; top: 37px; width: clamp(17px,8.4cqh,24px); height: clamp(58px,27cqh,86px); }
  .elegiac-scrolls span + span { left: 65.2%; }
  .elegiac-scrolls b { font-size: clamp(11px,4.35cqh,14px); letter-spacing: .13em; }
  .scroll-blossoms img { bottom: 57%; }
  .scene-size { right: 8px; bottom: 8px; }
  .history-account { margin-inline: 0; padding: 12px; flex-wrap: wrap; }
  .history-row { padding-inline: 10px; gap: 6px 8px; font-size: 13px; }
  .button, .ritual-button, .choice, .quick-action { touch-action: manipulation; }
}
@media (max-width: 360px) {
  .header .brand { font-size: 18px; white-space: nowrap; }
  .header-actions .button { gap: 4px; }
  .header-create [data-icon] { display: none; }
}
@supports not (width: 1cqh) {
  .ceremony-scene { width: max(100%, 490px); height: 100%; }
  .ceremony[data-enlarged] .ceremony-scene { width: max(100%, 530px); }
  .memorial-wreaths img { height: 42%; }
}
