:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f7f7f4;
  background: #202c27;
  --surface: #23262580;
  --line: #e8e9e848;
  --gold: #e2bf7c;
  --inset: clamp(12px, 2vw, 26px);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #f6d894; outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.mast { padding: var(--inset); }
.mast a { color: inherit; text-decoration: none; font-size: 13px; font-weight: 750; letter-spacing: .2em; }
[lang=zh-Hant] { font-family: "Songti TC", "Noto Serif TC", "PMingLiU", serif; }
.mast strong { display: block; font-size: 19px; font-weight: 600; line-height: 1.15; letter-spacing: .12em; }
.mast small { font-size: 9px; letter-spacing: .18em; color: #efeeeb; }
.shell:has(.layout:not([hidden])) .mast {
  position: fixed;
  z-index: 2;
  top: max(10px, env(safe-area-inset-top));
  left: max(var(--inset), env(safe-area-inset-left));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 7px 11px;
  backdrop-filter: blur(9px);
}
.layout { position: relative; min-height: 100vh; min-height: 100dvh; isolation: isolate; }
.intro {
  position: absolute;
  z-index: 1;
  top: max(10px, env(safe-area-inset-top));
  right: max(var(--inset), env(safe-area-inset-right));
  display: grid;
  justify-items: end;
  gap: 7px;
  width: min(340px, calc(100% - 110px));
  pointer-events: none;
}
.intro > * { pointer-events: auto; }
.intro > .room-actions { pointer-events: none; }
.room-actions > button { pointer-events: auto; }
.presence {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}
.presence::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #a9bb94; }
.invite-actions, .utility, .room-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.room-actions { justify-content: flex-end; }
.visit-menu { min-width: 64px; max-width: min(220px,100%); }
.visit-menu[open] { padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.visit-menu summary { list-style: none; min-height: 44px; padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 500; text-align: center; }
.visit-menu summary, .map-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.visit-menu summary svg, .map-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.visit-menu, .map-button { backdrop-filter: blur(9px); border-radius: 22px; }
.visit-menu summary::-webkit-details-marker { display: none; }
.visit-menu:not([open]) summary { border: 1px solid var(--line); border-radius: 23px; background: var(--surface); }
.visit-menu .presence { margin: 3px 0 7px; }
.visit-menu .room-actions { display: grid; grid-template-columns: 1fr 1fr; }
.visit-menu .room-actions button { white-space: normal; }
button, .invite-actions a {
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  background: var(--surface);
  font: 600 12px/1.2 system-ui, sans-serif;
  cursor: pointer;
}
button:hover, button[aria-pressed=true] { background: #344638; }
button:disabled { opacity: .65; cursor: wait; }
button.primary { color: #211d15; background: #e4c489; border-color: #eac993; }
button.primary:hover { background: #f4d59d; }
.invite-actions a { display: inline-flex; align-items: center; text-underline-offset: 3px; }
.invite-panel {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}
.invite-panel label { display: block; margin-bottom: 4px; font-weight: 650; }
.invite-panel input {
  width: 100%; min-height: 40px; padding: 7px; margin-bottom: 6px;
  border: 1px solid var(--line); background: #25332a; color: inherit; border-radius: 5px; font-size: 16px;
}
.invite-panel button, .utility button { background: #2c3a30; }
.invite-panel button:hover, .utility button:hover { background: #415446; }
#invite-status { max-width: 100%; padding: 6px 9px; background: var(--surface); border-radius: 5px; text-align: end; }
#invite-status:empty { display: none; }
.invitation-preview { max-width: 700px; margin: 12px auto 32px; padding: 0 var(--inset); }
.invitation-preview img { display: block; width: 100%; height: auto; border-radius: 8px; }
.invitation-preview h1 { font: 400 clamp(44px, 8vw, 72px)/1 Georgia, serif; margin: 24px 0 10px; }
.invitation-preview p { line-height: 1.5; }
.scene {
  position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(ellipse at 52% 52%, #7f7052, #283a31 74%);
}
.world, .world canvas { width: 100%; height: 100%; display: block; }
.world { position: relative; }
.visitor-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.visitor-name {
  position: absolute; top: 0; left: 0; max-width: 190px; padding: 3px 9px;
  border: 1px solid #fff7dd88; border-radius: 14px; background: #eee8d5ed;
  color: #535b45; font: 600 11px/1.35 system-ui, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 7px #1b231c24;
}
.scene-loading {
  position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 17px;
  background: #152421; color: #e9d8b6; text-align: center;
}
.scene-loading strong { font-size: 33px; font-weight: 500; line-height: 1.2; letter-spacing: .22em; }
.scene-loading progress { width: min(220px, 65vw); height: 6px; accent-color: #bf9a61; }
.scene-loading span { font-size: 13px; }
.map-button {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 67px);
  left: max(var(--inset), env(safe-area-inset-left)); border-radius: 20px;
}
.temple-dialog {
  position: fixed; width: min(430px, 100% - 24px); max-height: calc(100dvh - 24px);
  box-sizing: border-box; padding: 19px; color: #f6e9ce; background: #222c23;
  border: 1px solid #dbc39a62; border-radius: 16px;
}
.temple-dialog::backdrop { background: #111c1880; backdrop-filter: blur(5px); }
.temple-dialog h2 { padding-right: 43px; margin: 2px 0 15px; font: 400 25px/1.1 Georgia, serif; }
.temple-dialog p { font-size: 13px; }
.art-credit { margin: 16px 0 0; line-height: 1.5; color: #dfcaa7; }
.art-credit a { color: inherit; text-underline-offset: 2px; }
.temple-dialog label { display: flex; gap: 12px; align-items: center; min-height: 44px; }
#audio-settings input { margin-left: auto; max-width: 45%; accent-color: #dec08c; }
.shop { display: flex; justify-content: center; align-items: center; gap: .35em; min-height: 44px; padding: 8px 12px; border-radius: 15px; background: #e4c489; color: #211d15; text-decoration: none; font-size: 13px; font-weight: 700; }
.shop:hover { background: #f4d59d; }
.shop-dialog { width: min(620px, 100% - 24px); color: #f4f4ee; background: #242c28; }
.shop-dialog button, .shop-dialog a { -webkit-tap-highlight-color: transparent; }
.shop-dialog > h2:focus { outline: none; }
.shop-products, .shop-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.shop-products { margin-bottom: 13px; }
.shop-products button { width: 100%; min-height: 44px; padding: 6px 9px; text-align: left; font-size: 13px; font-weight: 550; }
.shop-collection { margin-bottom: 12px; border-radius: 8px; }
.shop-cards { gap: 12px; }
.shop-cards button {
  display: grid; grid-template-rows: auto 1fr auto; gap: 7px; width: 100%; height: 100%;
  padding: 7px; border-radius: 10px; text-align: left; font-size: 13px; line-height: 1.3;
  white-space: normal; background: #ffffff08;
}
.shop-cards img { display:block; width:100%; aspect-ratio:1.36; object-fit:contain; border-radius:6px; background:#181e1a; }
.shop-price { color:#efd3a0; font-weight:700; font-variant-numeric:tabular-nums; }
.shop-cards li:first-child .shop-price { font-size: 14px; }
#shop-category > .shop-actions { margin-bottom: 12px; }
#shop-detail { display: grid; grid-template-columns: minmax(0,.90fr) minmax(0,1fr); gap: 14px 18px; align-items: start; }
#shop-photo { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 10px; background: #f3eee4; }
.shop-details dl { display: grid; gap: 3px; margin: 0; }
.shop-details dt { color: #c9d0c9; font-size: 12px; font-weight: 650; }
.shop-details dd { margin: 0 0 8px; font-size: 14px; line-height: 1.4; }
.shop-details p { margin: 0 0 8px; font-size: 14px; line-height: 1.46; }
.shop-details .shop-care { margin: 0; color: #c9d0c9; font-size: 12px; }
.shop-actions { display: flex; justify-content: space-between; gap: 9px; grid-column: 1/-1; }
.shop-actions .shop { border-radius: 8px; background: #e7eae0; color: #26362f; }
.shop-actions .shop:hover { background: #fff; }
@media (max-width: 490px) {
  #shop-detail { grid-template-columns: 1fr; }
  .shop-cards { gap: 8px; }
  #shop-photo { aspect-ratio: auto; height: clamp(142px,28dvh,235px); }
  .shop-actions { flex-wrap: wrap; }
}
.temple-map {
  position: relative; aspect-ratio: 56 / 73; overflow: hidden; border-radius: 12px;
  width: min(100%, 48dvh); margin-inline: auto;
  background: #5b5f3c;
}
#map-view { background: #202322d9; border-color: var(--line); color: #fff; }
#map-view h2 { font: 500 19px/1.2 system-ui, sans-serif; }
#map-place-list summary { min-height: 44px; padding: 12px 3px; cursor: pointer; font-size: 13px; }
#map-terrain { display: block; width: 100%; height: 100%; pointer-events: none; }
.map-pin {
  position: absolute; z-index: 1; width: 44px; height: 44px; padding: 0; border: 0;
  background: none; transform: translate(-50%,-50%);
}
.map-pin::before { content: ''; display: block; margin: auto; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #453625; background: #f3cca1; }
.map-destinations { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.map-destinations button { text-align: start; }
.map-pin:hover::before,.map-pin:focus-visible::before { background: #fff2cf; }
.map-position { position: absolute; z-index: 2; transform: translate(-50%,-50%); width: 9px; height: 9px; border-radius: 50%; background: #8be8d7; box-shadow: 0 0 0 2px #25635d; pointer-events: none; }
.bow-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; margin: 2px 0 8px; }
.bow-progress progress { flex: 1; height: 6px; accent-color: #d7b777; }
.world canvas { touch-action: none; }
.world canvas:focus-visible { outline-offset: -3px; }
.scene-area, .scene-tip {
  position: absolute;
  pointer-events: none;
  left: max(var(--inset), env(safe-area-inset-left));
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #fff6e1;
  background: var(--surface);
  font-size: 12px;
}
.scene-area { top: calc(max(10px, env(safe-area-inset-top)) + 57px); }
.place-action { width: 100%; margin-bottom: 6px; }
.scene-tip { top: calc(91px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(88%,360px); border-radius: 20px; text-align: center; color: #fff; backdrop-filter: blur(8px); }
.room:has([data-action=bow][aria-pressed=true]) .scene-tip { visibility: hidden; }
.room-console {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 2 * var(--inset)));
}
.room-console .message { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(85vw,360px); padding: 6px 10px; border-radius: 13px; background: #242525a6; }
.room-console .message:empty { display: none; }
.room-console .place-action { display: flex; align-items: center; justify-content: center; width: max-content; max-width: 100%; margin: 4px auto 8px; border-radius: 22px; color: #fff; background: #272828a6; border: 1px solid #eeefed50; font-weight: 500; backdrop-filter: blur(8px); }
.room-console .place-action:hover, .room-console .place-action:focus-visible { background: #3b3d3bc7; }
.handwashing .room-console > :not(#handwash-exit):not(.message) { display:none !important; }
.handwashing .scene-tip, .handwashing .visitor-labels { visibility:hidden; }
.handwashing #open-map { visibility:hidden; }
.sound-toggle { position:absolute; right:max(var(--inset),env(safe-area-inset-right)); top:calc(73px + env(safe-area-inset-top)); border:1px solid #eeefed50; border-radius:22px; padding:8px 12px; color:#fff; background:#272828a6; backdrop-filter:blur(8px); font-size:12px; }
.room-console button, .room-console a, .practice button, .practice a, .mala-strand { -webkit-tap-highlight-color: transparent; }
.altar-actions { display:flex; align-items:center; justify-content:center; gap:8px; }
.room-console .altar-actions .place-action { margin-inline:0; padding-inline:15px; }
.shell:has(.layout:not([hidden])) footer { display: none; }

.practice {
  width: min(480px, 100% - 24px); max-height: calc(100dvh - 24px);
  padding: 22px 20px 18px;
  overflow: auto; text-align: center; color: #f7f7f4; background: transparent;
  border: 0; text-shadow: 0 1px 5px #242625a6;
}
.practice::backdrop { background: #22252550; backdrop-filter: blur(8px); }
.practice h2 { margin: 0; font: 400 32px/1.1 Georgia, serif; }
.practice p { margin: 8px 0; color: #eeeeeb; font-size: 13px; }
.practice-close { position: absolute; top: 9px; right: 9px; width: 44px; border-radius: 50%; font-size: 22px; }
.mala-strand {
  display: block; width: auto; height: clamp(200px, 59dvh, 480px); max-width: 90%;
  margin: 8px auto; touch-action: none; cursor: ns-resize;
  filter: drop-shadow(3px 9px 13px #10090580);
}
#mala-progress { font-variant-numeric: tabular-nums; }
.mala-learn {
  display:inline-flex; align-items:center; gap:.35em; min-height:44px;
  margin-top:4px; padding:0 14px; border-radius:22px; background:#777b792c;
  color:#f5f5f3; font-size:12px; text-underline-offset:3px;
}
.mala-learn:hover { background:#8f94944d; color:#fff; }
.woodfish-view { margin: auto auto max(55px, 11dvh); }
.woodfish-view::backdrop { backdrop-filter: blur(10px); }
.woodfish-stage {
  position: relative; display: block; margin: 12px auto; padding: 0;
  width: min(284px, 86%); aspect-ratio: 1.16;
}
.woodfish-stage::before {
  content:''; position:absolute; left:6%; right:1%; bottom:5%; height:24%;
  border-radius:50%; background:radial-gradient(ellipse,#a4704f8c 0%,#5d3529b5 66%,#452b2170 84%);
  box-shadow:0 9px 12px #19100b91; pointer-events:none;
}
#woodfish-target {
  position: absolute; inset: 1% 14% 13% 2%; padding: 0; border: 0;
  -webkit-tap-highlight-color: transparent; user-select: none; touch-action: manipulation;
  background: transparent;
  filter: drop-shadow(0 10px 13px #180b075c);
  clip-path: polygon(7% 67%, 12% 43%, 26% 25%, 44% 17%, 57% 18%, 66% 7%, 77% 0, 86% 0, 94% 15%, 94% 29%, 88% 44%, 79% 62%, 75% 82%, 63% 96%, 42% 100%, 25% 94%, 12% 84%);
}
#woodfish-target img { display:block; width:100%; height:100%; object-fit:contain; pointer-events:none; }
#woodfish-target:focus-visible { filter: drop-shadow(0 0 5px #ecca8c); }
.woodfish-striker {
  position:absolute; z-index:1; width:35%; height:4.8%; right:4.5%; top:87%;
  transform:rotate(-4deg); transform-origin:100% center;
  border-radius:12px; background:linear-gradient(#cba278,#82552d); box-shadow:0 2px 3px #21140c8a; pointer-events:none;
}
.woodfish-striker::before {
  content:''; position:absolute; left:-7%; top:-53%; width:24%; aspect-ratio:1;
  border-radius:50%; background:radial-gradient(circle at 33% 29%,#ad7c54,#593316 77%);
  box-shadow:0 3px 5px #21140c73;
}
.woodfish-grip {
  position:absolute; right:-12%; top:-85%; width:26%; height:300%; border-radius:44%;
  opacity:0; background:linear-gradient(85deg,#dbaf88,#a77354); box-shadow:1px 4px 6px #23170c5c;
}
.woodfish-grip::before {
  content:''; position:absolute; left:-12%; top:16%; width:65%; height:34%;
  border-radius:48%; transform:rotate(-30deg); background:#dfb594;
}
.mallet-raised .woodfish-striker { right:15%; top:35%; transform:rotate(30deg); }
.mallet-raised .woodfish-grip { opacity:1; }
#woodfish-target.struck { animation:woodfish-body .18s linear; }
#woodfish-target.struck + .woodfish-striker { animation:woodfish-tap .18s ease-in-out; }
#woodfish-target.struck.repeat-strike + .woodfish-striker { animation-name:woodfish-repeat; }
#woodfish-target.struck:not(.repeat-strike) + .woodfish-striker .woodfish-grip { animation:woodfish-grip .06s linear; }
@keyframes woodfish-tap {
  0% { right:4.5%; top:87%; transform:rotate(-4deg); }
  27%,100% { right:15%; top:35%; transform:rotate(30deg); }
  58.3% { right:23%; top:39%; transform:rotate(14deg); }
}
@keyframes woodfish-repeat {
  0%,27%,100% { right:15%; top:35%; transform:rotate(30deg); }
  58.3% { right:23%; top:39%; transform:rotate(14deg); }
}
@keyframes woodfish-grip {
  0% { opacity:0; }
  100% { opacity:1; }
}
@keyframes woodfish-body {
  56%,72% { transform:none; }
  62% { transform:translate(-1px,1px) rotate(-.7deg); }
}
@media (prefers-reduced-motion: reduce) { #woodfish-target.struck, #woodfish-target.struck + .woodfish-striker, #woodfish-target.struck + .woodfish-striker .woodfish-grip { animation:none; } }
#weather-settings select { margin-left:auto; max-width:62%; min-height:40px; padding:5px 8px; border:1px solid var(--line); border-radius:9px; color:inherit; background:#2d3431; }
.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 28px; background: #2426258c; backdrop-filter: blur(10px); }
.controls button { min-height: 48px; padding: 3px 1px; background: transparent; border-color: transparent; border-radius: 24px; font-weight: 500; font-size: 11px; }
.controls button svg { display: block; margin: 0 auto 3px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.controls button:hover, .controls button[aria-pressed=true] { background: #eee9de25; }
.room-console .bow-progress { padding: 5px 9px; border-radius: 13px; background: #242625a0; }
.utility { justify-content: space-between; margin-top: 5px; }
.count { display: flex; justify-content: space-between; gap: 7px; font-size: 12px; margin: 0; }
.count output { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--gold); }
.bead-count progress { display: block; width: 100%; height: 7px; accent-color: var(--gold); }
.message { font-size: 12px; line-height: 1.35; margin: 0 0 6px; }
#view-note { margin: 4px 0 0; }
.light-view { position: absolute; inset: 0; }
.light-view img { width: 100%; height: 100%; object-fit: cover; opacity: .68; }
.light-view p {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(172px + env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100% - 2 * var(--inset)); color: #fff6e1;
  background: var(--surface); margin: 0; padding: 9px 12px; font-size: 13px; border-radius: 6px;
}
#leave-dialog {
  width: min(420px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line);
  border-radius: 8px; background: #202c27; color: inherit;
}
#leave-dialog::backdrop { background: #111b17a0; }
#visitors {
  width: min(420px, calc(100% - 24px)); max-height: min(80dvh, 620px);
  padding: 18px; border: 1px solid #c6a67484; border-radius: 14px;
  color: #fbefda; background: #242a24; pointer-events: auto;
}
#visitors::backdrop { background: #121911a8; }
.visitor-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.visitor-heading h2 { font: 600 24px/1.2 "Songti SC", SimSun, serif; margin: 0; }
#visitor, #chat-message {
  min-width: 0; min-height: 44px; color: inherit; background: #141e17;
  border: 1px solid #c6a67468; border-radius: 6px; padding: 7px 10px; font-size: 16px;
}
#visitor { width: 100%; margin-top: 6px; }
#visitor-state { min-height: 1.4em; margin: 10px 0; font-size: 13px; }
#visitor-messages { list-style: none; min-height: 65px; max-height: 27dvh; padding: 0 5px; overflow: auto; font-size: 14px; }
#visitor-messages li { margin: 6px 0; overflow-wrap: anywhere; }
#visitor-chat { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
#leave-title { font: 400 28px/1.15 Georgia, serif; margin: 0; }
#leave-description { font-size: 14px; line-height: 1.5; margin: 10px 0 16px; }
footer { padding: 10px var(--inset); color: #d4d9ce; font-size: 12px; }
@media (min-width: 700px) and (min-height: 411px) {
  .scene-tip {
    top: max(20px, env(safe-area-inset-top)); bottom: auto; left: 50%;
    width: max-content; transform: translateX(-50%); border-radius: 20px;
  }
}
@media (max-height: 410px) and (orientation: landscape) {
  .scene-tip { display: none; }
  .room-console {
    left: auto; right: max(var(--inset), env(safe-area-inset-right));
    transform: none; width: min(340px, calc(50% - var(--inset) - 46px));
  }
}
[lang="zh-Hant"]{font-family:"Microsoft JhengHei","Noto Serif TC",PMingLiU,serif}
