: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-picture { --crop-x: 62%; --crop-y: 58%; --candle-zoom: 1.22; position: absolute; z-index: -2; inset: 0; overflow: hidden; background: url('assets/remembrance.jpg') var(--crop-x) var(--crop-y) / cover no-repeat; }
.hero::after { 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%); pointer-events: none; }
.hero-scene { display: none; }
@supports (width: 1cqw) and (mask-image: radial-gradient(black, transparent)) {
  .hero-picture { container-type: size; background: none; }
  .hero-scene {
    /* The overlay positions use the source photograph's 1983 × 793 coordinate space. */
    --scene-width: max(100cqw, calc(100cqh * 1983 / 793));
    position: absolute;
    display: block;
    left: var(--crop-x);
    top: var(--crop-y);
    width: var(--scene-width);
    height: calc(var(--scene-width) * 793 / 1983);
    transform-origin: 68.23% 71.45%;
    transform: translate(calc(-1 * var(--crop-x)), calc(-1 * var(--crop-y))) scale(var(--candle-zoom));
    background: url('assets/remembrance.jpg') center / 100% 100% no-repeat;
  }
  .hero-wick-patch {
    position: absolute;
    inset: 0;
    background: inherit;
    transform: translateX(1.12%);
    mask-image: radial-gradient(ellipse .76% 3.95% at 67.11% 68.65%, #000 72%, transparent 100%);
  }
  .hero-candlelight {
    position: absolute;
    inset: 59% 17% 0 49%;
    background:
      radial-gradient(ellipse 19% 29% at 57% 31%, #ffaf493f, transparent),
      radial-gradient(ellipse 35% 25% at 54% 71%, #ff963648, transparent);
    mix-blend-mode: screen;
    animation: hero-candle-glow 3.2s ease-in-out infinite;
  }
  .hero-flame {
    position: absolute;
    left: 68.23%;
    bottom: 28.55%;
    width: .78%;
    height: 5.8%;
    border-radius: 56% 44% 48% 52% / 81% 78% 22% 19%;
    background: radial-gradient(ellipse at 50% 66%, #fffef2 0%, #fff9dc 37%, #ffdc95 66%, #ffab4b 86%);
    box-shadow: 0 0 9px #ffb452af, 0 0 22px #ffc4668c;
    transform-origin: 50% 97%;
    animation: hero-flame-sway 3.2s ease-in-out infinite;
  }
  @keyframes hero-flame-sway {
    0%, 100% { transform: translateX(-50%) rotate(2deg) scale(.96, 1); }
    14% { transform: translateX(-50%) rotate(-5deg) scale(.86, 1.09); }
    28% { transform: translateX(-50%) rotate(5deg) scale(1.09, .84); }
    47% { transform: translateX(-50%) rotate(-2deg) scale(.91, 1.07); }
    66% { transform: translateX(-50%) rotate(8deg) scale(.98, .93); }
    82% { transform: translateX(-50%) rotate(-6deg) scale(.87, 1.12); }
  }
  @keyframes hero-candle-glow {
    0%, 100% { opacity: .46; }
    15%, 82% { opacity: .72; }
    30%, 65% { opacity: .3; }
    47% { opacity: .59; }
  }
  @media (prefers-reduced-motion: reduce) {
    .hero-wick-patch, .hero-candlelight, .hero-flame { display: none; animation: none; }
  }
}
.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; }
.hero-martyr { background: #ebe0c6; color: #3d4331; }
.hero-martyr:hover { background: #fff3d7; }

.martyr-section { margin: 23px 0 33px; padding: 22px; border: 1px solid #d9e0d2; border-radius: 15px; background: #eef0e8; scroll-margin-top: 16px; }
.martyr-section h2:focus { outline: none; }
.martyr-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.martyr-card { min-width: 0; border: 1px solid #dce1d5; border-radius: 10px; background: var(--card); }
.martyr-card:hover { border-color: #a9b59f; background: #fffdf8; }
.martyr-card-link { display: flex; align-items: center; gap: 12px; padding: 11px; }
.martyr-portrait { display: grid; place-items: center; flex: none; width: 58px; height: 75px; overflow: hidden; border-radius: 5px; background: #293a30; }
.martyr-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; }
.martyr-nameplate { color: #e3d5b7; font-family: var(--serif); font-size: 14px; font-weight: 700; line-height: 1.15; letter-spacing: .08em; white-space: nowrap; writing-mode: vertical-rl; }
.altar-mat .martyr-nameplate { font-size: clamp(13px, 2.4vw, 22px); }
.martyr-card h3 { color: var(--green-dark); font: 700 20px/1.25 var(--serif); }
.martyr-card p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.martyr-card-body > span { color: var(--green-dark); font-weight: 650; font-size: 13px; }
.martyr-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid #e6e8de; }
.martyr-actions a { display: grid; place-items: center; min-height: 44px; color: var(--green-dark); font-size: 14px; }
.martyr-actions a + a { border-left: 1px solid #e6e8de; }
.martyr-card-link:hover, .martyr-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.martyr-heading { margin-bottom: 15px; }
.martyr-heading p { color: var(--muted); font-size: 14px; }
.martyr-heading h1 { color: var(--green-dark); font-size: clamp(28px, 4.5vw, 42px); }
.martyr-heading h1 span { display: inline-block; margin-left: .7em; color: var(--muted); font-size: .53em; letter-spacing: .07em; }
.martyr-sources { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 14px; font-size: 14px; }
.martyr-sources a { color: var(--green-dark); text-decoration: underline; text-underline-offset: 3px; }

.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; }
.home-guide { margin-top: 43px; padding-top: 26px; border-top: 1px solid var(--line); }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.guide-card { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.guide-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 10px; background: #edf0e6; color: #526a4c; font-size: 21px; }
.guide-card:nth-child(2) .guide-icon { background: #f4eddd; color: #836739; }
.guide-card:nth-child(3) .guide-icon { background: #f1ebe8; color: #80665e; }
.guide-card h3 { font-size: 17px; }
.guide-card p { margin: 7px 0 12px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.guide-card .text-link { min-height: 44px; margin-top: auto; padding: 0; border: 0; background: none; text-align: left; font-weight: 650; }
.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-actions, .visit-sign-in { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.invite-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: #edf0e6; }
.invite-code strong { color: var(--green-dark); font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.invite-form input { min-height: 44px; font-size: 16px; }
.invite-form [data-invite-message] { color: var(--muted); font-size: 14px; }
.invite-form [data-invite-message]:empty { display: none; }
.invite-qr { display: grid; justify-items: center; gap: 7px; padding: 10px 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f2f4eb; text-align: center; }
.invite-qr img { width: min(175px, 100%); height: auto; border-radius: 6px; }
.invite-qr p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.invite-count { color: var(--muted); font-size: 14px; }
.invite-count strong { color: var(--green-dark); font-variant-numeric: tabular-nums; }
.family-log .invite-count { margin: 0 0 12px; }
.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; }
.wall-message { margin-block: 12px; }
.wall-withdraw { min-height: 44px; padding: 0; border: 0; background: none; }
.wall-more { margin-top: 14px; }
.private-notes { margin-top: 28px; }
.private-notes summary { cursor: pointer; font-weight: 650; }
.private-notes > div { margin-top: 12px; }
.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; }
.account-form label { font-size: 15px; }
.account-form input:not([type=checkbox]) { min-height: 44px; font-size: 16px; }
.account-form .account-hint { color: var(--muted); font-size: 14px; font-weight: 400; }
.account-form > .account-hint { margin: -5px 0 0; }
.account-form [data-legacy-account]:empty { display: none; }
.account-actions { display: grid; gap: 8px; }
.account-actions .button { min-height: 44px; }
.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) {
  .martyr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .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: 224px; padding: 16px; border-radius: 13px; }
  .hero-picture { --crop-x: 56%; --crop-y: 52%; --candle-zoom: 1.07; }
  .hero::after { background: linear-gradient(90deg, #162019ed, #162019b0 57%, #16201921), linear-gradient(0deg, #1620196b, transparent 44%); }
  .hero .eyebrow { gap: 7px; margin-bottom: 6px; font-size: 11px; }
  .hero .eyebrow::before { width: 17px; }
  .hero h1 { font-size: clamp(28px, 8.2vw, 42px); }
  .hero-copy { max-width: 260px; margin-top: 9px; font-size: 12px; line-height: 1.55; }
  .hero-buttons { gap: 6px; margin-top: 12px; }
  .hero-buttons .button { gap: 5px; min-height: 44px; padding-inline: 9px; font-size: 13px; }
  .hero-buttons .hero-martyr { display: none; }
  .martyr-section { margin: 10px 0 28px; padding: 12px; }
  .martyr-section .section-head { margin-bottom: 9px; }
  .martyr-section .section-head p { margin-top: 4px; }
  .martyr-grid { gap: 7px; }
  .martyr-card-link { gap: 7px; padding: 7px 6px; }
  .martyr-portrait { width: 37px; height: 52px; }
  .martyr-card-body { min-width: 0; line-height: 1.4; }
  .martyr-card h3 { font-size: 17px; }
  .martyr-card p { margin: 2px 0; font-size: 11px; }
  .martyr-card-body > span { display: block; font-size: 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; }
  .home-guide { margin-top: 30px; padding-top: 20px; }
  .guide-grid { grid-template-columns: 1fr; gap: 9px; }
  .guide-card { padding: 15px; }
  .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 { background: #21291f; color: #fcf4df; }
.scene-viewport { position: relative; isolation: isolate; overflow: hidden; height: clamp(258px, 43vw, 537px); container-type: size; }
.scene-viewport::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 :is(h1,h2) { 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 :is(h1,h2).altar-name-long { font-size: clamp(16px, 4.8cqh, 26px); letter-spacing: .03em; }
.altar-profile :is(h1,h2).altar-name-extended { font-size: clamp(12px, 3.4cqh, 18px); letter-spacing: .01em; }
.altar-profile :is(h1,h2).altar-name-long, .altar-profile :is(h1,h2).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: 10px 15px; align-items: center; justify-content: space-between; gap: 10px; background: #f6f3e9; color: #574e3e; }
.ceremony-toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.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], .gesture-actions[hidden] { display: none; }
.presence-status { color: var(--green-dark); font-size: 13px; }
.hall-chat { border-top: 1px solid #ded7c5; background: #faf8f0; color: var(--green-dark); }
.hall-chat > summary { min-height: 44px; padding: 10px 16px; cursor: pointer; font-weight: 650; }
.hall-chat > summary:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.hall-chat-toggle { display: none; }
.hall-chat-visibility { margin-left: 7px; font-size: 11px; font-weight: 400; }
.hall-chat [data-unread]:not([hidden]) { display: inline-block; min-width: 22px; margin-left: 5px; padding: 0 5px; border-radius: 10px; background: #455940; color: white; text-align: center; font-size: 12px; }
.hall-chat-content { padding: 0 15px 12px; }
.hall-chat-hint, .hall-chat-status { font-size: 13px; color: var(--muted); }
.hall-chat-status { margin-top: 6px; }
.hall-chat-status:empty { display: none; }
.hall-chat-log { display: grid; gap: 8px; max-height: 178px; margin: 8px 0; padding: 0; overflow: auto; overscroll-behavior: contain; list-style: none; }
.hall-chat-log:empty { display: none; }
.hall-chat-log li { padding: 7px 10px; border: 1px solid #e7e7da; border-radius: 8px; background: white; overflow-wrap: anywhere; }
.hall-chat-log time { margin-left: 10px; color: var(--muted); font-size: 12px; }
.hall-chat-log p { color: var(--ink); }
.chat-report { flex: none; margin-left: auto; padding: 1px 3px; border: 0; background: transparent; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }
.hall-chat-form { display: flex; gap: 7px; }
.hall-chat-form input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid #bfc9b7; border-radius: 8px; background: white; color: var(--ink); font-size: 16px; }
.hall-chat-form .button:disabled { opacity: .58; cursor: default; }
.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 { min-width: 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.visitor-status:empty { display: none; }
.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; }
.button.world-traverse { background: #41543c; color: #fff8e9; border-color: #41543c; }
.button.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; }
.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-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 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px; }
  .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-toolbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .ceremony-toolbar-actions .ceremony-sequence { min-width: 0; min-height: 42px; }
  .ceremony-toolbar-actions:has([data-action=pavilion][hidden]) .world-traverse { grid-column: 1 / -1; }
  .visitor-status { padding-inline: 2px; }
}
@media (max-width: 480px) {
  .altar-profile { top: 4.7%; }
  .altar-portrait { width: max(32px, 14cqh); }
  .altar-profile :is(h1,h2) { margin-top: 3px; font-size: clamp(18px, 5.6cqw, 24px); }
  .altar-profile :is(h1,h2).altar-name-long { font-size: clamp(13px, 4cqw, 18px); }
  .altar-profile :is(h1,h2).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 { display: grid; place-items: center; width: 36px; min-height: 36px; border: 1px solid #f0dfbf69; border-radius: 6px; background: #24251bd9; 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; 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] .scene-viewport { height: clamp(243px, 74vw, 680px); }
@media (orientation: landscape) {
  .ceremony[data-enlarged] .scene-viewport { height: max(165px, calc(100svh - 140px - 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; }
  .scene-viewport { height: clamp(208px, 65vw, 320px); }
  .hall-visible main { padding-top: 12px; }
  .hall-visible .detail-nav { gap: 6px; margin-bottom: 9px; }
  .hall-visible .detail-actions .button { min-height: 38px; gap: 5px; padding-inline: 8px; font-size: 12px; }
  .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%; }
  .hall-audio :is(.music-toggle, .sound-toggle, .scene-size) { width: 38px; min-height: 38px; justify-content: center; }
  .hall-audio :is(.music-toggle, .sound-toggle) > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ceremony-caption, .hall-code { min-height: 32px; }
  .ceremony-id { flex-flow: row wrap; max-width: calc(100% - 148px); }
  .ceremony-controls .ritual-button { min-height: 71px; }
  .ceremony-social { padding: 8px 10px; }
  .gesture-actions { justify-content: flex-end; }
  .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) {
  body:has(main > .hero) .header-actions .header-create { display: none; }
  .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%; }
}

[data-stage-chat] .hall-chat { border-top: 1px solid #d5c29c40; background: #242e25; color: #f6edda; }
[data-stage-chat] .hall-chat > summary { min-height: 44px; padding: 5px 13px; display: flex; align-items: center; gap: 7px; list-style: none; font-size: 13px; }
[data-stage-chat] .hall-chat > summary::-webkit-details-marker { display: none; }
[data-stage-chat] .hall-chat > summary:focus-visible { outline-color: #f3d9a6; }
[data-stage-chat] .hall-chat-visibility { margin-left: 1px; color: #cdc8ad; }
[data-stage-chat] .hall-chat-toggle { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: #e1dac1; font-size: 12px; font-weight: 400; }
[data-stage-chat] .hall-chat-toggle::before { content: ''; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1px 1px 0; transform: translateY(2px) rotate(225deg); }
[data-stage-chat] .hall-chat[open] .hall-chat-toggle::before { transform: translateY(-2px) rotate(45deg); }
[data-stage-chat] .hall-chat-toggle::after { content: "展开"; }
[data-stage-chat] .hall-chat[open] .hall-chat-toggle::after { content: "收起"; }
[data-stage-chat] .hall-chat-content { padding: 0 12px 10px; }
[data-stage-chat] .hall-chat-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[data-stage-chat] .hall-chat-status { color: #e6dbbc; font-size: 12px; }
[data-stage-chat] .hall-chat-log { gap: 0; max-height: 50px; margin: 0 0 6px; }
[data-stage-chat] .hall-chat-log li { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 2px 3px; border: 0; background: transparent; font-size: 13px; line-height: 21px; }
[data-stage-chat] .hall-chat-log strong { flex: none; max-width: min(8em, 33%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e0c388; }
[data-stage-chat] .hall-chat-log time { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[data-stage-chat] .hall-chat-log p { min-width: 0; color: #fff4dc; }
[data-stage-chat] .chat-report { color: #ded8bb; }
[data-stage-chat] .hall-chat-form input { min-height: 44px; padding-inline: 10px; background: #343e33; border-color: #657161; color: #fff8e7; }
[data-stage-chat] .hall-chat-form input::placeholder { color: #cecdbd; }
[data-stage-chat] .hall-chat-form input:focus-visible { outline-color: #ead8ac; }
[data-stage-chat] .hall-chat-form .button { padding-inline: 15px; background: #e9d9af; color: #2d3527; }
[data-stage-chat] .hall-chat-form .button:hover { background: #f6e6bd; }

@media (max-width: 600px) {
  .ceremony:not([data-enlarged]):has([data-world]) { --scene-clearance: 305px; margin-inline: -9px; }
  .martyr-heading { margin-bottom: 9px; }
  .martyr-heading h1 { line-height: 1.25; }
  .martyr-heading + .ceremony:not([data-enlarged]) { --scene-clearance: 365px; }

  /* Leave room for the hall heading and the open chat on short phone screens. */
  .ceremony:not([data-enlarged]) [data-world] .scene-viewport {
    height: clamp(245px, 102vw, 540px);
    max-height: max(200px, calc(100svh - var(--scene-clearance)));
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .ceremony[data-enlarged] [data-world] .scene-viewport {
    height: clamp(240px, calc(100svh - 165px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 760px);
  }
}
@media (min-width: 601px) and (min-height: 601px) and (pointer: coarse) {
  [data-world] .world-directions { display: grid; bottom: 8px; left: 9px; grid-template-columns: repeat(4, 42px); grid-template-rows: 42px; gap: 0; overflow: hidden; border: 1px solid #f0dfbf76; border-radius: 8px; background: #23271fdf; }
  .world-directions [data-walk] { grid-area: auto; border: 0; border-radius: 0; background: transparent; }
  .world-directions [data-walk] + [data-walk] { border-left: 1px solid #f0dfbf42; }
  .world-directions button[data-pressed] { background: #716249; }
}
