@font-face {
  font-family: "Temple Serif";
  src: url("./assets/fonts/temple-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --porcelain: #f3e9d2;
  --parchment: #e0caa0;
  --aged-gold: #bd9860;
  --muted-ink: #c6b497;
  --night-ink: #16130f;
  --rule: #b2905e72;
  --fine-rule: #ccaf7640;
  --lacquer: #78382c;
  --control-fill: #201a13f2;
  --control-hover: #433124;
  --panel-fill: #201911f7;
  --serif: "Songti SC", STSong, "Noto Serif SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --display: "Temple Serif", var(--serif);
  --sans: -apple-system, BlinkMacSystemFont, system-ui, "Noto Sans SC", sans-serif;
  --edge-x: clamp(20px, 2.65vw, 48px);
  --edge-y: clamp(18px, 2.6vh, 38px);
  --safe-left: calc(var(--edge-x) + env(safe-area-inset-left, 0px));
  --safe-right: calc(var(--edge-x) + env(safe-area-inset-right, 0px));
  --safe-top: calc(var(--edge-y) + env(safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--edge-y) + env(safe-area-inset-bottom, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--night-ink);
  color: var(--porcelain);
  font: 400 16px/1.55 var(--sans);
  overscroll-behavior: none;
}

#world {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.scene-shading {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #0d0a07ab 0%, #130d0939 12%, transparent 29%, transparent 71%, #110e0b37 87%, #100b08a8 100%);
}

body[data-mode="entry"] .scene-shading {
  background:
    linear-gradient(90deg, #110d09eb 0%, #140e0ab3 31%, #19120a49 55%, transparent 75%),
    linear-gradient(0deg, #100c08b5, transparent 47%),
    linear-gradient(180deg, #110a0875, transparent 22%);
}

body[data-mode="map"] .scene-shading {
  background: linear-gradient(180deg, #15120dac, transparent 23%, transparent 73%, #18130d83);
}

.scene-shading::before, .scene-shading::after {
  position: absolute;
  right: 0;
  left: 0;
  height: clamp(17px, 6.4dvh, 58px);
  content: "";
  background: #100c0a;
  opacity: 0;
  transition: opacity .45s ease;
}

.scene-shading::before { top: 0; }
.scene-shading::after { bottom: 0; }
body[data-mode="ritual"] .scene-shading::before,
body[data-mode="ritual"] .scene-shading::after { opacity: .88; }

button {
  min-inline-size: 44px;
  min-block-size: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .46rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: .55rem .82rem;
  background: var(--control-fill);
  color: var(--porcelain);
  font: inherit;
  font-size: .88rem;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

@media (hover: hover) {
  button:not(:disabled):hover { background: var(--control-hover); border-color: var(--aged-gold); }
}
button:not(:disabled):active { background: #51382a; border-color: var(--aged-gold); }
button:disabled { opacity: .55; cursor: default; }
:where(button, a, input, select, summary):focus-visible {
  outline: 2px solid #f0cb84;
  outline-offset: 3px;
}

.ui-icon {
  flex: 0 0 auto;
  inline-size: 1.2em;
  block-size: 1.2em;
  color: inherit;
  pointer-events: none;
}

.primary-action,
#enter,
#act {
  border-color: #ba9067;
  min-block-size: 48px;
  padding-inline: 1.15rem;
  background: linear-gradient(180deg, #864234, var(--lacquer) 47%, #602d24);
  color: #fff2d5;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .055em;
  box-shadow: inset 0 0 0 1px #e5b27b39, 0 3px 12px #10090565;
}

@media (hover: hover) {
  button.primary-action:not(:disabled):hover,
  #enter:not(:disabled):hover,
  #act:not(:disabled):hover {
    border-color: #deb67b;
    background: linear-gradient(180deg, #a0513c, #864234 48%, #73382c);
  }
}

.hud-brand, .hud-tools, #entry, #nav, #pad, #actions, #incense-controls, #site-overview, #notice {
  position: fixed;
}

.hud-brand {
  z-index: 3;
  inset-block-start: var(--safe-top);
  inset-inline-start: var(--safe-left);
  display: flex;
  align-items: center;
  gap: .72rem;
  max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right) - 23rem);
  text-shadow: 0 2px 5px #120b09, 0 1px 13px #120b09d0;
  pointer-events: none;
}

.brand-emblem {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 44px;
  block-size: 44px;
  border: 1px solid #a4704d;
  border-radius: 3px;
  background: #5e2b25ed;
  color: #ebd2a3;
  font: 700 1.3rem/1 var(--serif);
  box-shadow: 0 2px 8px #170e09b0, inset 0 0 0 2px #47231b, inset 0 0 0 3px #b18e5963;
}

.brand-emblem .ui-icon { width: 24px; height: 24px; }
.hud-brand > a.brand-emblem {
  min-inline-size: 44px;
  min-block-size: 44px;
  text-decoration: none;
  pointer-events: auto;
}
.brand-emblem.ui-icon { -webkit-mask: none; mask: none; }
.brand-emblem.ui-icon::after {
  width: 60%;
  height: 60%;
  background-color: currentColor;
  -webkit-mask: var(--temple-ui-icon) center / contain no-repeat;
  mask: var(--temple-ui-icon) center / contain no-repeat;
  content: "";
}
.hud-brand > div { min-inline-size: 0; }
.brand-wordmark { display: grid; gap: .24rem; min-inline-size: 0; }
:is(b.brand-wordmark, .brand-wordmark b) {
  display: block;
  font: 600 clamp(1.15rem, 1.7vw, 1.5rem)/1.08 var(--display);
  letter-spacing: .16em;
  white-space: nowrap;
}

#route-level {
  display: block;
  max-inline-size: 100%;
  margin: .25rem 0 0;
  overflow: hidden;
  color: var(--parchment);
  font-size: .79rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-tools {
  z-index: 4;
  inset-block-start: var(--safe-top);
  inset-inline-end: var(--safe-right);
  display: flex;
  align-items: center;
  gap: .85rem;
  max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right));
}

.hud-meta { display: flex; align-items: center; gap: .62rem; }
.language-picker { display: inline-flex; align-items: center; flex: none; }
.language-picker button { min-inline-size: 44px; min-block-size: 44px; padding-inline: .3rem; }
.language-picker button + button { margin-inline-start: -1px; }
.language-picker button[aria-pressed="true"] { z-index: 1; border-color: #c6a06a; background: #4a3627; color: #ffe7b7; }
.language-picker button:focus-visible { z-index: 2; }

.hud-weather {
  display: inline-flex;
  gap: .46rem;
  align-items: baseline;
  color: var(--porcelain);
  font-size: .79rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 2px 6px #130b08, 0 0 9px #130b08;
}
.hud-weather #weather { color: var(--parchment); }
.hud-weather #weather:not(:empty)::before { margin-inline-end: .46rem; color: #c9ad7f; content: "·"; }
.utility-tools { display: flex; align-items: center; gap: .38rem; }
.utility-tools button { padding-inline: .65rem; }
.utility-tools [aria-pressed="true"], .nav-trigger[aria-expanded="true"] {
  border-color: #c6a06a;
  background: #4a3627f0;
  color: #ffe7b7;
}

.panel, dialog {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background:
    repeating-linear-gradient(123deg, #f0d8aa05 0, #f0d8aa05 1px, transparent 1px, transparent 5px),
    linear-gradient(148deg, #302419f8, var(--panel-fill) 60%);
  color: var(--porcelain);
  box-shadow: inset 0 0 0 3px #291e15, 0 15px 35px #1009058a;
}

#entry {
  z-index: 2;
  inset-inline-start: calc(clamp(29px, 8vw, 145px) + env(safe-area-inset-left, 0px));
  inset-block-end: calc(clamp(53px, 12vh, 145px) + env(safe-area-inset-bottom, 0px));
  inline-size: min(39rem, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right));
  max-block-size: calc(100dvh - var(--safe-top) - 2 * var(--edge-y) - 72px);
  margin: 0;
  padding: .4rem 0 .2rem clamp(17px, 2.4vw, 32px);
  border: 0;
  overflow: auto;
  background: linear-gradient(90deg, #100d0936, transparent 86%);
  box-shadow: none;
  animation: entry-reveal .48s ease-out both;
}

#entry::before {
  position: absolute;
  inset: 0 auto 0 0;
  inline-size: 1px;
  background: linear-gradient(180deg, transparent, #c8a76db3 18%, #c8a76d61 72%, transparent);
  content: "";
}

@keyframes entry-reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry-context {
  display: inline-flex;
  align-items: center;
  gap: .64rem;
  color: #e3c393;
  font-size: .83rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-shadow: 0 2px 6px #110d0b;
}
.entry-context::before { width: 19px; height: 1px; background: #c6a06b; content: ""; }

#entry h1 {
  margin: .34em 0 .28em;
  max-inline-size: 10em;
  color: #fff2d6;
  font: 600 clamp(3.2rem, 6.2vw, 6.1rem)/1.02 var(--display);
  letter-spacing: .065em;
  text-wrap: balance;
  text-shadow: 0 2px 18px #170e09;
}

.entry-copy {
  margin: 0 0 1.25rem;
  max-inline-size: 29em;
  color: #f1e0bf;
  font-size: clamp(1rem, 1.3vw, 1.18rem);
  line-height: 1.76;
  text-wrap: balance;
  text-shadow: 0 2px 7px #180f0a;
}

.entry-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
#enter { justify-content: flex-start; min-inline-size: 9.5rem; }
#enter .ui-icon { margin-inline-start: .48rem; }
#entry #entry-status {
  margin: .65rem 0 0;
  color: #e7cda3;
  font-size: .82rem;
  line-height: 1.42;
}
#entry #entry-status:empty { display: none; }
#entry #entry-status[data-state="error"] { color: #ffd0b7; }
.entry-hint {
  display: block;
  margin-block-start: .85rem;
  color: #d7c5a6;
  font-size: .79rem;
  line-height: 1.55;
  text-shadow: 0 1px 6px #0e0a08;
}
.entry-hint :is(.hint-touch, .touch-hint) { display: none; }

#nav {
  z-index: 6;
  inset-block-end: var(--safe-bottom);
  inset-inline-start: var(--safe-left);
}

.nav-trigger { gap: .57rem; padding-inline: .72rem .9rem; }
.nav-sheet {
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: calc(100% + 10px);
  inline-size: min(21rem, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 105px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  padding: .67rem;
  background: linear-gradient(150deg, #312318f8, #1e1812fa);
  box-shadow: 0 5px 20px #0c0706a6;
}
.nav-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .31rem; }
.nav-list button { justify-content: flex-start; inline-size: 100%; padding-inline: .66rem; }
.nav-list [aria-current="location"], .nav-list [aria-pressed="true"] { border-color: #caa776; background: #4a3525; }
.nav-sheet > :is(#avatar, [data-registration-trigger]) { width: 100%; justify-content: flex-start; margin-block-start: .45rem; padding-inline: .66rem; }
body:has(#nav-toggle[aria-expanded="true"]) :is(#pad, #actions) { visibility: hidden; pointer-events: none; }

#actions {
  z-index: 5;
  inset-block-end: var(--safe-bottom);
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: .30rem;
  max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right));
  text-align: center;
  text-shadow: 0 2px 5px #160d09;
  transform: translateX(-50%);
}
#actions .action-icon { flex: none; inline-size: 1.45rem; block-size: 1.45rem; color: #f0d9a7; filter: drop-shadow(0 1px 2px #170f08); }
#place { color: var(--porcelain); font: 700 1rem/1.25 var(--serif); letter-spacing: .10em; }
#act { min-inline-size: 7.8rem; }
.key-hint {
  min-inline-size: 1.46rem;
  min-block-size: 1.4rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d6b68791;
  border-radius: 2px;
  padding: 0 .2rem;
  color: #ffe9bd;
  font: 600 .69rem/1 var(--sans);
  letter-spacing: 0;
}

#pad {
  z-index: 5;
  inset-inline-start: var(--safe-left);
  inset-block-end: calc(var(--safe-bottom) + 57px);
  display: none;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
  gap: 4px;
  touch-action: none;
  -webkit-touch-callout: none;
}
#pad button { width: 44px; height: 44px; min-width: 44px; padding: 0; user-select: none; touch-action: none; }
#pad [data-key="w"] { grid-area: 1 / 2; }
#pad [data-key="a"] { grid-area: 2 / 1; }
#pad [data-key="s"] { grid-area: 2 / 2; }
#pad [data-key="d"] { grid-area: 2 / 3; }

#incense-controls {
  z-index: 8;
  inset-inline: var(--safe-left) var(--safe-right);
  inset-block-end: calc(var(--safe-bottom) + 10px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 42rem) 1fr;
  align-items: end;
  column-gap: .85rem;
  pointer-events: none;
}
.ritual-caption {
  grid-column: 2;
  display: grid;
  justify-items: center;
  gap: .28rem;
  justify-self: center;
  min-inline-size: min(15rem, 100%);
  max-inline-size: 100%;
  margin: 0;
  border-block-end: 1px solid #c59c647a;
  padding: .74rem 1.18rem .8rem;
  background: linear-gradient(90deg, transparent, #130e0cc9 19%, #130e0ce0 50%, #130e0cc9 81%, transparent);
  color: #fff0d1;
}
.ritual-caption .ui-icon { color: var(--parchment); }
.ritual-caption:has(#incense-subtitle:empty) { visibility: hidden; }
#incense-subtitle {
  margin: 0;
  font: 600 clamp(1.04rem, 1.72vw, 1.45rem)/1.53 var(--serif);
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 2px 6px #0d0806;
}
#incense-subtitle:empty { display: none; }
.ritual-buttons {
  grid-column: 3;
  display: flex;
  justify-content: end;
  gap: .39rem;
  pointer-events: auto;
}
.ritual-buttons button { border-color: #b48d5d88; }
body[data-mode="ritual"] :is(.hud-brand, .hud-tools) { opacity: .83; }

#notice {
  z-index: 9;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  max-inline-size: min(86vw, 34rem);
  border: 1px solid var(--fine-rule);
  border-inline-start-color: var(--aged-gold);
  border-radius: 2px;
  padding: .52rem .82rem;
  background: #21180ff5;
  color: #f3e5c7;
  font-size: .87rem;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
#notice:empty { display: none; }

#site-overview {
  z-index: 4;
  inset-block-end: var(--safe-bottom);
  inset-inline-start: var(--safe-left);
  inline-size: min(21rem, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 76px);
  overflow: auto;
  padding: 1rem 1.13rem;
}
#site-overview h2, dialog h2 {
  margin: 0 0 .45rem;
  color: var(--porcelain);
  font: 700 clamp(1.25rem, 2vw, 1.55rem)/1.21 var(--serif);
  letter-spacing: .045em;
}
#site-overview p { margin: .46rem 0 .68rem; color: var(--parchment); font-size: .88rem; }
#site-overview small { display: block; margin-block-start: .7rem; color: var(--muted-ink); font-size: .76rem; }
.site-controls { display: flex; flex-wrap: wrap; gap: .38rem; }
#site-labels { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#site-labels span {
  position: absolute;
  transform: translate(-50%, -126%);
  border: 1px solid #b7976280;
  padding: .22rem .5rem;
  background: #1e2119ed;
  color: #f4e0b9;
  font: 600 .82rem/1.3 var(--serif);
  white-space: nowrap;
  box-shadow: 0 2px 8px #100b09b3;
}

.card-dialog, dialog {
  inline-size: min(29rem, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(17px, 3vw, 27px);
  scrollbar-color: #ab8757 #2c2018;
}
dialog[open] {
  position: fixed;
  inset-block: var(--safe-top) var(--safe-bottom);
  inset-inline: var(--safe-left) var(--safe-right);
  block-size: fit-content;
  margin: auto;
}
#card[open] { display: flex; flex-direction: column; overflow: hidden; }
#card #detail {
  min-block-size: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
#card > .modal-actions {
  flex: none;
  align-items: center;
  justify-content: space-between;
  margin-block-start: .7rem;
  border-block-start: 1px solid var(--fine-rule);
  padding-block-start: .55rem;
}
dialog::backdrop { background: #100b09b8; }
dialog p { margin: .55rem 0 1.05rem; color: #e4d2ad; line-height: 1.65; }
dialog label { display: block; margin: .62rem 0; color: #e7d5b3; }
dialog a, #site-overview a { color: #efc889; text-underline-offset: .19em; }
dialog button { margin-block: .15rem; }
#card > #close, .modal-actions { margin-block-start: .88rem; }
.modal-actions { display: flex; flex-wrap: wrap; gap: .48rem; }
#modal-copy:empty { display: none; }
:is(#detail, #modal-content) > button { margin-inline-end: .24rem; }
#detail :is(input:not([type="color"]), select, textarea) { inline-size: 100%; margin-block-start: .2rem; }
input, select, textarea {
  min-block-size: 44px;
  max-inline-size: 100%;
  border: 1px solid #8d7250;
  border-radius: 2px;
  padding: .46rem .63rem;
  background: #31251b;
  color: #f6e5c6;
  font: inherit;
}
input[type="color"] { min-inline-size: 3.1rem; padding: .2rem; }
#registration-nickname { inline-size: 100%; }
#registration-status:empty { margin: 0; }
#registration-status[data-state="error"] { color: #ffd0b7; }
.audio-heading { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .5rem; }
.audio-heading h2 { margin: 0; }
#audio-panel p { margin: .64rem 0 1rem; }
#audio-panel label { display: flex; justify-content: space-between; align-items: center; margin: .66rem 0 0; }
#audio-panel input[type="range"] { width: 100%; margin: 0; padding: 0; accent-color: #ca9c64; cursor: pointer; }
#audio-panel output { color: #f0c890; font-variant-numeric: tabular-nums; }

html:lang(en) { --serif: Palatino, "Palatino Linotype", Georgia, serif; --display: var(--serif); }
html:lang(en) #entry h1 { letter-spacing: -.025em; }
html:lang(en) .hud-brand .brand-wordmark { letter-spacing: .02em; white-space: normal; }
html:lang(en) .entry-context { letter-spacing: .07em; }
html:lang(en) :is(.nav-list button, #act) { white-space: normal; }

@media (pointer: coarse), (max-width: 650px) {
  #pad:not([hidden]) { display: grid; }
  #actions {
    left: auto;
    right: var(--safe-right);
    bottom: calc(var(--safe-bottom) + 60px);
    align-items: flex-end;
    max-inline-size: max(118px, calc(100vw - var(--safe-left) - var(--safe-right) - 147px));
    text-align: end;
    transform: none;
  }
  #act { min-inline-size: auto; padding-inline: .75rem; }
  .key-hint, .entry-hint :is(.hint-keyboard, .keyboard-hint) { display: none; }
  .entry-hint :is(.hint-touch, .touch-hint) { display: inline; }
}

@media (max-width: 980px) {
  .hud-brand { max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right) - 20rem); }
  .hud-tools { gap: .49rem; }
  .utility-tools button { position: relative; width: 44px; height: 44px; padding: 0; }
  .utility-tools .button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 730px) {
  :root { --edge-x: 13px; --edge-y: 13px; }
  .hud-brand { max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right) - 147px); gap: .51rem; }
  .brand-emblem { inline-size: 38px; block-size: 38px; }
  .brand-emblem .ui-icon { width: 21px; height: 21px; }
  :is(b.brand-wordmark, .brand-wordmark b) { font-size: 1.17rem; letter-spacing: .14em; }
  html:lang(en) .hud-brand .brand-wordmark { font-size: 1rem; }
  #route-level { font-size: .71rem; }
  .hud-tools { flex-direction: column; align-items: flex-end; gap: .18rem; }
  .utility-tools { order: -1; gap: .21rem; }
  .hud-meta { gap: .47rem; }
  .hud-weather { gap: .29rem; font-size: .73rem; }
  .hud-weather #weather:not(:empty)::before { margin-inline-end: .28rem; }
  #notice { top: calc(var(--safe-top) + 101px); }
  #entry { inset-inline-start: var(--safe-left); max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right)); }
  #incense-controls { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
  .ritual-caption, .ritual-buttons { grid-column: 1; }
}

@media (max-width: 650px) and (orientation: portrait) {
  body[data-mode="entry"] .scene-shading {
    background: linear-gradient(0deg, #120d09f7 0%, #160f0be0 23%, #170f0a70 42%, transparent 66%),
      linear-gradient(180deg, #140d08b5, transparent 23%);
  }
  #entry { inset-block-end: calc(var(--safe-bottom) + 24px); padding-inline-start: 13px; }
  #entry h1 { font-size: clamp(2.88rem, 12.5vw, 4rem); }
  html:lang(en) #entry h1 { max-inline-size: 9em; font-size: clamp(2.5rem, 11.5vw, 3.75rem); }
  html:lang(en) .entry-copy { max-inline-size: 27ch; }
  .entry-copy { margin-block-end: 1rem; max-inline-size: 13.55em; text-wrap: wrap; }
  #site-overview { padding: .85rem; }
}

@media (max-width: 360px) {
  .audio-heading > button .button-label { display: none; }
}

@media (orientation: landscape) and (max-height: 530px) {
  :root { --edge-x: 13px; --edge-y: 10px; }
  .hud-brand { max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right) - 21rem); }
  .brand-emblem { inline-size: 38px; block-size: 38px; }
  #entry {
    inset-inline-start: calc(clamp(18px, 5vw, 45px) + env(safe-area-inset-left, 0px));
    inset-block-end: calc(var(--safe-bottom) + 9px);
    max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 59px);
    inline-size: min(26rem, 60vw);
  }
  #entry h1 { font-size: clamp(2.2rem, 6.5vw, 3.6rem); }
  html:lang(en) #entry h1 { font-size: clamp(2rem, 5vw, 2.65rem); }
  .entry-copy { margin-block-end: .55rem; line-height: 1.46; }
  .entry-hint { margin-block-start: .35rem; }
  .nav-sheet {
    inline-size: min(24rem, calc(100vw - var(--safe-left) - var(--safe-right)));
    max-block-size: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 58px);
  }
  .nav-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #pad { inset-block-end: calc(var(--safe-bottom) + 50px); }
  #actions { inset-block-end: calc(var(--safe-bottom) + 12px); }
  #incense-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, min(25rem, calc(100% - 26rem))) minmax(0, 1fr);
    column-gap: .42rem;
  }
  .ritual-caption { grid-column: 2; padding: .51rem .68rem; }
  .ritual-buttons { grid-column: 3; }
  .ritual-buttons button { padding-inline: .53rem; }
  #audio-panel .audio-heading { position: sticky; z-index: 1; inset-block-start: 0; background: #2a2118; }
  #card { padding: 15px 20px; }
  #card #modal-copy { margin: .35rem 0 .62rem; }
  #card #modal-content > label {
    display: grid;
    grid-template-columns: minmax(4.6rem, max-content) minmax(0, 1fr);
    align-items: center;
    gap: .52rem;
    margin-block: .37rem;
  }
  #card #modal-content > label > :is(input, select, textarea) { margin-block-start: 0; }
}

@media (orientation: landscape) and (max-width: 730px) {
  .hud-brand { max-inline-size: calc(100vw - var(--safe-left) - var(--safe-right) - 146px); }
  #incense-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .ritual-caption { grid-column: 1; }
  .ritual-buttons { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

#mazu-close-exit {
  position: fixed;
  z-index: 4;
  inset-inline-end: var(--safe-right);
  inset-block-end: var(--safe-bottom);
  border-color: #ba9067;
  padding-inline: .95rem;
}
