/* ============================================================
   云隐寺 · 山中半日
   A quiet, paper-and-ink interface over a clay miniature temple.
   ============================================================ */

:root{
  --paper: #f4efe2;
  --paper-2: #eae3d2;
  --paper-3: #ded5c0;
  --ink: #2b302a;
  --ink-2: #4c5349;
  --ink-3: #767d6f;
  --moss: #465a47;
  --moss-2: #5f735f;
  --jade: #8ba08b;
  --cinnabar: #a8462f;
  --cinnabar-2: #8d3524;
  --gold: #b89355;
  --gold-2: #d6b97c;
  --line: rgba(54, 63, 50, .16);
  --line-strong: rgba(54, 63, 50, .28);
  --glass: rgba(247, 242, 230, .72);
  --glass-strong: rgba(248, 244, 234, .9);
  --shadow: 0 18px 50px rgba(34, 42, 31, .16), 0 2px 8px rgba(34, 42, 31, .08);
  --shadow-soft: 0 8px 26px rgba(34, 42, 31, .12);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --kb: 0px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; margin: 0; padding: 0; }
html{ background: #e9e3d3; }
body{
  font-family: var(--sans);
  color: var(--ink);
  background: #e9e3d3;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button{ font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
input, textarea{ font: inherit; color: inherit; }
::selection{ background: rgba(168, 70, 47, .18); }

#app{ position: fixed; inset: 0; overflow: hidden; }
#world{ position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#world:active{ cursor: grabbing; }
#world.is-pointing{ cursor: pointer; }

.scene-wash{
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(245, 240, 225, .16), transparent 18%, transparent 78%, rgba(45, 52, 42, .10)),
    radial-gradient(120% 80% at 50% 0%, rgba(255, 249, 232, .18), transparent 55%);
  mix-blend-mode: soft-light;
}
.scene-vignette{
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 160px 40px rgba(41, 49, 38, .20), inset 0 0 40px rgba(41, 49, 38, .10);
}
.scene-grain{
  position: absolute; inset: 0; pointer-events: none; opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ---------------- Boot ---------------- */
.boot{
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 12%, #f8f3e6 0%, #efe9d9 46%, #e2dbc8 100%);
  transition: opacity 1.1s var(--ease), visibility 1.1s;
}
.boot.is-leaving{ opacity: 0; visibility: hidden; }
.boot-mountains{ position: absolute; inset: 0; opacity: .9; }
.boot-mountains svg{ width: 100%; height: 100%; display: block; }
.boot-inner{
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 24px; transform: translateY(-2vh);
}
.boot-seal{
  width: 54px; height: 54px; display: grid; place-items: center;
  color: #fbf6e8; background: var(--cinnabar);
  font-family: var(--serif); font-size: 28px; line-height: 1;
  border-radius: 5px; box-shadow: 0 8px 24px rgba(141, 53, 36, .24);
  transform: rotate(-2deg); margin-bottom: 26px;
  position: relative;
}
.boot-seal::after{
  content: ""; position: absolute; inset: 4px; border: 1px solid rgba(255, 248, 231, .48); border-radius: 2px;
}
.boot-kicker{
  margin: 0 0 12px; font-size: 9px; letter-spacing: .46em; color: var(--ink-3); text-indent: .46em;
}
.boot-title{
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(44px, 6vw, 64px);
  letter-spacing: .3em; text-indent: .3em; color: #354035; line-height: 1.1;
}
.boot-sub{
  margin: 18px 0 0; color: var(--ink-2); font-size: 13px; letter-spacing: .28em; text-indent: .28em;
}
.boot-meter{
  width: 132px; height: 1px; margin: 42px 0 14px; background: rgba(70, 90, 71, .16); overflow: hidden;
}
.boot-meter i{
  display: block; width: 0%; height: 100%; background: linear-gradient(90deg, transparent, var(--gold), var(--cinnabar));
  transition: width .6s var(--ease);
}
.boot-status{
  margin: 0; font-size: 11px; letter-spacing: .18em; color: var(--ink-3); min-height: 1.6em;
}
.boot-enter{
  margin-top: 26px; display: inline-flex; align-items: center; gap: 12px;
  height: 52px; padding: 0 28px 0 30px; border-radius: 999px;
  background: #3f5141; color: #f7f1e3; font-size: 14px; letter-spacing: .18em;
  box-shadow: 0 16px 34px rgba(45, 60, 46, .22);
  transition: transform .35s var(--ease), background .35s, box-shadow .35s;
  animation: enter-in .9s var(--ease) both;
}
.boot-enter:hover{ background: #4b5f4b; transform: translateY(-2px); box-shadow: 0 20px 40px rgba(45, 60, 46, .26); }
.boot-enter:active{ transform: translateY(0) scale(.985); }
.boot-enter svg{ width: 18px; height: 18px; transition: transform .35s var(--ease); }
.boot-enter:hover svg{ transform: translateX(4px); }
@keyframes enter-in{ from{ opacity: 0; transform: translateY(10px); } to{ opacity: 1; transform: translateY(0); } }
.boot-foot{
  margin: 30px 0 0; font-family: var(--serif); font-size: 11px; letter-spacing: .34em; color: #8a8f7e;
  text-indent: .34em;
}
.boot-sound{
  position: absolute; bottom: max(24px, var(--safe-bottom)); left: 0; right: 0;
  margin: 0; text-align: center; font-size: 10px; letter-spacing: .14em; color: #8c9182; z-index: 2;
}
.boot.is-error .boot-meter{ display: none; }
.boot.is-error .boot-status{ color: var(--cinnabar); }

/* ---------------- HUD ---------------- */
.hud{ position: absolute; inset: 0; z-index: 20; pointer-events: none; opacity: 0; transition: opacity 1s var(--ease) .2s; }
.hud.is-ready{ opacity: 1; }
.hud button{ pointer-events: auto; }
.hud:not(.is-ready) .chat-bar{ pointer-events: none; opacity: 0; }
body.is-chatting #hint{ opacity: 0; pointer-events: none; }
body.is-chatting .scene-label{ opacity: 0; }
.topbar{
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(20px + var(--safe-top)) 26px 0;
  pointer-events: none;
}
.topbar-left, .topbar-right{ display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.topbar-right{ gap: 8px; }

.brand{
  display: flex; align-items: center; gap: 11px;
  padding: 7px 15px 7px 8px; border-radius: 999px;
  background: var(--glass); border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.15); -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition: transform .3s var(--ease), background .3s;
}
.brand:hover{ transform: translateY(-1px); background: var(--glass-strong); }
.brand-seal{
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
  background: var(--cinnabar); color: #fbf5e6; border-radius: 3px;
  font-family: var(--serif); font-size: 18px; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 246, 228, .3);
}
.brand-text{ display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.brand-text b{ font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: .18em; }
.brand-text small{ font-size: 7px; letter-spacing: .22em; color: var(--ink-3); margin-top: 4px; }

.timechip{
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 999px;
  font-size: 11px; letter-spacing: .12em; color: var(--ink-2);
  background: rgba(247, 242, 230, .46); border: 1px solid rgba(255, 255, 255, .34);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.time-dot{ width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(184, 147, 85, .16); }
.chip-sep{ opacity: .45; }

.tool{
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; min-width: 40px; padding: 0 13px; border-radius: 999px;
  background: var(--glass); border: 1px solid rgba(255, 255, 255, .46);
  box-shadow: 0 6px 18px rgba(34, 42, 31, .10);
  backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  font-size: 11px; letter-spacing: .08em; color: var(--ink-2);
  transition: transform .25s var(--ease), background .25s, color .25s;
}
.tool:hover{ transform: translateY(-1px); background: var(--glass-strong); color: var(--ink); }
.tool:active{ transform: translateY(0) scale(.98); }
.icon-tool{ width: 40px; padding: 0; }
.icon-tool svg{ width: 19px; height: 19px; }
.presence{ padding: 0 13px; font-variant-numeric: tabular-nums; }
.live-dot{
  width: 6px; height: 6px; border-radius: 50%; background: #7f9b7d;
  box-shadow: 0 0 0 3px rgba(127, 155, 125, .14); animation: live 3.4s ease-in-out infinite;
}
@keyframes live{ 50%{ opacity: .35; box-shadow: 0 0 0 5px rgba(127, 155, 125, .05); } }
.support{ color: #7d4a37; background: rgba(250, 240, 224, .74); border-color: rgba(184, 147, 85, .3); }
.support svg{ width: 17px; height: 17px; color: var(--cinnabar); }
.support:hover{ background: #fbf3e1; color: var(--cinnabar-2); }
.tool-label{ white-space: nowrap; }
#btn-sound svg{ display: none; }
#btn-sound .i-sound-off{ display: block; }
#btn-sound[aria-pressed="true"] .i-sound-off{ display: none; }
#btn-sound[aria-pressed="true"] .i-sound-on{ display: block; }

/* ---------------- Scene labels ---------------- */
.scene-label[hidden]{ display: none; }
.scene-label{
  position: absolute; z-index: 24; transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 12px; border-radius: 999px;
  background: rgba(250, 246, 236, .92); border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 10px 26px rgba(30, 38, 28, .18);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 12px; letter-spacing: .1em; color: var(--ink); white-space: nowrap;
  pointer-events: auto; transition: opacity .2s;
}
.scene-label::after{
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px;
  background: rgba(250, 246, 236, .92); border-right: 1px solid rgba(255,255,255,.7); border-bottom: 1px solid rgba(255,255,255,.7);
  transform: translateX(-50%) rotate(45deg);
}
.scene-label-dot{ width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.scene-label kbd{
  font-family: var(--sans); font-size: 9px; color: var(--ink-3); background: rgba(70, 90, 71, .08);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-left: 1px;
}

/* ---------------- Toast ---------------- */
.toast-stack{
  position: absolute; left: 50%; bottom: calc(118px + var(--safe-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 35; pointer-events: none;
  width: min(92vw, 520px);
}
.toast{
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(47, 56, 44, .88); color: #f7f1e3;
  font-size: 12px; letter-spacing: .06em; line-height: 1.5;
  box-shadow: 0 12px 30px rgba(26, 32, 24, .22);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toast-in .5s var(--ease) both;
}
.toast.is-out{ animation: toast-out .4s var(--ease) both; }
.toast b{ color: var(--gold-2); font-weight: 500; }
@keyframes toast-in{ from{ opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out{ to{ opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------------- Hint ---------------- */
.hint{
  position: absolute; left: 50%; bottom: calc(112px + var(--safe-bottom)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 8px 10px 8px 15px; border-radius: 999px;
  font-size: 10px; letter-spacing: .08em; color: rgba(247, 242, 230, .82);
  background: rgba(44, 52, 41, .42); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.hint i{ width: 2px; height: 2px; border-radius: 50%; background: rgba(247, 242, 230, .4); }
.hint button{
  margin-left: 3px; padding: 3px 9px; border-radius: 999px; font-size: 10px;
  color: rgba(247, 242, 230, .72); background: rgba(255, 255, 255, .08);
}
.hint.is-hidden{ opacity: 0; transform: translate(-50%, 8px); pointer-events: none; }

/* ---------------- Dock ---------------- */
.dock{
  position: absolute; left: 50%; bottom: calc(22px + var(--safe-bottom)); transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 2px; padding: 7px;
  border-radius: 24px;
  background: rgba(247, 242, 230, .78); border: 1px solid rgba(255, 255, 255, .58);
  box-shadow: 0 16px 44px rgba(30, 38, 28, .18), inset 0 1px 0 rgba(255,255,255,.6);
  backdrop-filter: blur(22px) saturate(1.12); -webkit-backdrop-filter: blur(22px) saturate(1.12);
  pointer-events: auto;
}
.dock-item{
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 64px; height: 58px; border-radius: 17px; color: var(--ink-2);
  transition: background .25s, color .25s, transform .25s var(--ease);
}
.dock-item:hover{ background: rgba(70, 90, 71, .07); color: var(--moss); transform: translateY(-1px); }
.dock-item:active{ transform: scale(.96); }
.dock-item.is-active{ background: rgba(70, 90, 71, .10); color: var(--moss); }
.dock-ico{ width: 27px; height: 27px; display: grid; place-items: center; }
.dock-ico svg{ width: 27px; height: 27px; }
.dock-item > span:last-child{ font-size: 10px; letter-spacing: .1em; }
.dock-more{ display: none; }

.joystick{ display: none; }

/* ---------------- Modals ---------------- */
.modal-root{ position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.modal-root.is-open{ pointer-events: auto; }
.modal-backdrop{
  position: absolute; inset: 0; background: rgba(36, 43, 34, .36);
  backdrop-filter: blur(4px) saturate(.92); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .35s var(--ease);
}
.modal-root.is-open .modal-backdrop{ opacity: 1; }
.sheet-wrap{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 28px;
  overflow: auto; overscroll-behavior: contain;
}
.sheet{
  position: relative; width: min(560px, 100%); max-height: min(86vh, 820px); overflow: auto;
  border-radius: 22px; padding: 30px 30px 26px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 252, 245, .96), rgba(243, 237, 223, .98) 58%, rgba(236, 228, 210, .99));
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: 0 40px 100px rgba(24, 32, 22, .34), inset 0 0 0 1px rgba(184, 147, 85, .10);
  transform: translateY(18px) scale(.985); opacity: 0;
  transition: transform .48s var(--ease), opacity .4s var(--ease);
  scrollbar-width: thin; scrollbar-color: rgba(70, 90, 71, .28) transparent;
}
.modal-root.is-open .sheet{ transform: none; opacity: 1; }
.sheet::-webkit-scrollbar{ width: 5px; }
.sheet::-webkit-scrollbar-thumb{ background: rgba(70, 90, 71, .22); border-radius: 99px; }
.sheet.is-wide{ width: min(700px, 100%); }
.sheet.is-narrow{ width: min(430px, 100%); }
.sheet::before{
  content: ""; position: absolute; inset: 10px; border: 1px solid rgba(184, 147, 85, .16);
  border-radius: 14px; pointer-events: none;
}
.sheet-close{
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-3); background: rgba(70, 90, 71, .06);
  transition: background .2s, color .2s;
}
.sheet-close:hover{ background: rgba(70, 90, 71, .12); color: var(--ink); }
.sheet-close svg{ width: 15px; height: 15px; }
.sheet-kicker{
  margin: 0 0 9px; font-size: 9px; letter-spacing: .32em; color: var(--gold); text-indent: .32em;
  text-transform: uppercase;
}
.sheet-title{
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: 26px; letter-spacing: .12em; color: #354035;
  line-height: 1.35;
}
.sheet-lead{ margin: 10px 0 0; font-size: 12px; line-height: 1.9; color: var(--ink-2); letter-spacing: .04em; }
.sheet-rule{ height: 1px; margin: 22px 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.sheet-foot{ margin: 18px 0 0; font-size: 10px; line-height: 1.8; color: var(--ink-3); letter-spacing: .04em; }
.sheet-actions{ display: flex; align-items: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px;
  font-size: 12px; letter-spacing: .12em; color: var(--ink-2);
  background: rgba(70, 90, 71, .07); border: 1px solid rgba(70, 90, 71, .12);
  transition: transform .25s var(--ease), background .25s, box-shadow .25s, color .25s;
}
.btn:hover{ background: rgba(70, 90, 71, .12); transform: translateY(-1px); }
.btn:active{ transform: scale(.98); }
.btn-primary{
  color: #f8f2e3; background: #405340; border-color: #405340;
  box-shadow: 0 12px 26px rgba(58, 76, 58, .20);
}
.btn-primary:hover{ background: #4a604a; color: #fffaf0; }
.btn-cinnabar{
  color: #fbf3e2; background: var(--cinnabar); border-color: var(--cinnabar);
  box-shadow: 0 12px 26px rgba(141, 53, 36, .20);
}
.btn-cinnabar:hover{ background: #b64d34; }
.btn-ghost{ background: transparent; border-color: var(--line); }
.btn-sm{ min-height: 34px; padding: 0 14px; font-size: 11px; }
.btn[disabled]{ opacity: .45; cursor: default; transform: none; }

.field{ margin: 18px 0 0; }
.field label{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 11px; letter-spacing: .1em; color: var(--ink-2); }
.field label small{ color: var(--ink-3); font-size: 10px; letter-spacing: .02em; }
.field input[type="text"], .field textarea{
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 253, 246, .72); padding: 13px 14px;
  font-size: 13px; letter-spacing: .04em; color: var(--ink);
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field textarea{ resize: vertical; min-height: 84px; line-height: 1.75; }
.field input::placeholder, .field textarea::placeholder{ color: rgba(76, 83, 73, .42); }
.field input:focus, .field textarea:focus{ border-color: rgba(184, 147, 85, .65); background: #fffdf7; box-shadow: 0 0 0 3px rgba(184, 147, 85, .12); outline: none; }
.field-meta{ display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: var(--ink-3); }
.counter{ font-variant-numeric: tabular-nums; }

.choice-row{ display: flex; gap: 8px; flex-wrap: wrap; }
.choice{
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 253, 246, .55);
  font-size: 11px; letter-spacing: .06em; color: var(--ink-2); transition: all .2s;
}
.choice:hover{ border-color: var(--line-strong); }
.choice.is-on{ border-color: var(--gold); background: rgba(184, 147, 85, .12); color: #7a5a2f; box-shadow: inset 0 0 0 1px rgba(184, 147, 85, .2); }
.swatch{ width: 12px; height: 12px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

.seg{ display: flex; gap: 3px; padding: 4px; border-radius: 999px; background: rgba(70, 90, 71, .06); border: 1px solid var(--line); }
.seg button{ flex: 1; min-height: 34px; border-radius: 999px; font-size: 11px; letter-spacing: .1em; color: var(--ink-3); transition: all .2s; }
.seg button.is-on{ background: rgba(255, 253, 246, .9); color: var(--ink); box-shadow: 0 3px 10px rgba(34,42,31,.08); }

.stat-row{ display: flex; gap: 10px; margin-top: 18px; }
.stat{
  flex: 1; padding: 14px 12px; border-radius: 14px; text-align: center;
  background: rgba(255, 253, 246, .5); border: 1px solid var(--line);
}
.stat b{ display: block; font-family: var(--serif); font-weight: 500; font-size: 22px; color: #3c4a3c; font-variant-numeric: tabular-nums; }
.stat span{ display: block; margin-top: 4px; font-size: 9px; letter-spacing: .12em; color: var(--ink-3); }

.note{
  padding: 12px 14px; border-radius: 12px; font-size: 10px; line-height: 1.9; color: var(--ink-3);
  background: rgba(184, 147, 85, .07); border: 1px solid rgba(184, 147, 85, .16);
}
.note b{ color: #7a5a2f; font-weight: 500; }
.note.cinnabar{ background: rgba(168, 70, 47, .05); border-color: rgba(168, 70, 47, .14); }

/* Menu */
.menu-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.menu-item{
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 14px; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 253, 246, .48);
  transition: transform .25s var(--ease), background .25s, border-color .25s;
}
.menu-item:hover{ transform: translateY(-2px); background: rgba(255, 253, 246, .9); border-color: rgba(184, 147, 85, .34); }
.menu-ico{ width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(70, 90, 71, .07); color: var(--moss); }
.menu-ico svg{ width: 19px; height: 19px; }
.menu-item b{ display: block; font-size: 12px; font-weight: 500; letter-spacing: .08em; }
.menu-item small{ display: block; margin-top: 4px; font-size: 9px; line-height: 1.6; color: var(--ink-3); letter-spacing: .02em; }
.menu-links{ display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 20px; }
.menu-links button{ font-size: 10px; letter-spacing: .06em; color: var(--ink-3); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }
.menu-links button:hover{ color: var(--ink); }

/* Lamp wall */
.lamp-toolbar{ display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.lamp-count{ font-size: 10px; letter-spacing: .08em; color: var(--ink-3); }
.lamp-count b{ color: var(--cinnabar); font-weight: 500; }
.lamp-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.lamp-card{
  position: relative; padding: 15px 14px 12px 16px; border-radius: 13px; text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, .82), rgba(250, 244, 231, .58));
  border: 1px solid var(--line); overflow: hidden; transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.lamp-card:hover{ transform: translateY(-2px); border-color: rgba(184, 147, 85, .4); background: #fffdf7; }
.lamp-card::before{
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 2px;
  background: var(--lamp, var(--gold));
}
.lamp-wish{ margin: 0; font-family: var(--serif); font-size: 13px; line-height: 1.75; color: #3b4237; letter-spacing: .03em; }
.lamp-meta{ display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 9px; color: var(--ink-3); letter-spacing: .04em; }
.lamp-cheer{ display: inline-flex; align-items: center; gap: 4px; font-size: 9px; color: var(--ink-3); }
.lamp-cheer svg{ width: 12px; height: 12px; }
.lamp-cheer.is-on{ color: var(--cinnabar); }
.lamp-empty{ grid-column: 1 / -1; padding: 34px 18px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-3); font-size: 11px; line-height: 1.9; }
.lamp-empty b{ display: block; font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }

/* Quote card */
.quote-card{
  position: relative; margin-top: 20px; padding: 34px 30px 28px; border-radius: 16px;
  background:
    radial-gradient(100% 90% at 20% 0%, rgba(255, 253, 246, .95), rgba(242, 235, 219, .8));
  border: 1px solid rgba(184, 147, 85, .26);
  box-shadow: inset 0 0 0 6px rgba(255, 253, 246, .35);
  text-align: center;
}
.quote-card::before, .quote-card::after{
  content: ""; position: absolute; width: 16px; height: 16px; border-color: rgba(184, 147, 85, .44); border-style: solid;
}
.quote-card::before{ top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.quote-card::after{ bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }
.quote-mark{ font-family: var(--serif); font-size: 34px; line-height: 1; color: rgba(168, 70, 47, .32); }
.quote-text{ margin: 4px 0 0; font-family: var(--serif); font-size: clamp(20px, 3.2vw, 26px); line-height: 1.85; letter-spacing: .08em; color: #354035; }
.quote-source{ margin: 16px 0 0; font-size: 10px; letter-spacing: .16em; color: var(--ink-3); }
.quote-actions{ display: flex; justify-content: center; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.quote-actions .btn{ min-height: 38px; padding: 0 16px; font-size: 10px; }

/* Incense / offering */
.offering-visual{ display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 92px; margin: 8px 0 2px; }
.incense-stick{ width: 3px; height: 62px; border-radius: 2px; background: linear-gradient(180deg, #b18a5e, #6f5436); position: relative; transform-origin: bottom; }
.incense-stick::before{ content: ""; position: absolute; top: -2px; left: -1.5px; width: 6px; height: 6px; border-radius: 50%; background: #d9844f; box-shadow: 0 0 8px 2px rgba(217, 132, 79, .55); }
.incense-stick::after{
  content: ""; position: absolute; bottom: -3px; left: -3px; width: 9px; height: 5px; border-radius: 50%; background: #8b3a2a;
}
.incense-stick:nth-child(2){ height: 70px; }
.incense-smoke{
  position: absolute; bottom: 80px; left: 50%; width: 40px; height: 90px; transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(220, 215, 200, .35), transparent 70%);
  filter: blur(8px); animation: smoke 5s ease-in-out infinite;
}
@keyframes smoke{ 0%{ transform: translate(-50%, 10px) scale(.8); opacity: 0; } 30%{ opacity: .9; } 100%{ transform: translate(-30%, -50px) scale(1.4); opacity: 0; } }

/* Support / QR */
.support-tabs{ margin-top: 18px; }
.qr-stage{ display: flex; justify-content: center; margin-top: 18px; }
.qr-card{
  width: 250px; padding: 14px 14px 16px; border-radius: 16px; text-align: center;
  background: #fffdf8; border: 1px solid rgba(184, 147, 85, .3);
  box-shadow: 0 14px 32px rgba(34, 42, 31, .10), inset 0 0 0 5px rgba(184, 147, 85, .05);
}
.qr-frame{ position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f5f0e4; }
.qr-frame img{ width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-brand{ display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; font-size: 11px; letter-spacing: .08em; color: var(--ink-2); }
.qr-brand svg{ width: 15px; height: 15px; }
.qr-brand.wechat{ color: #3f7a45; }
.qr-brand.alipay{ color: #2b6fa8; }
.qr-hint{ margin: 10px 0 0; font-size: 9px; color: var(--ink-3); letter-spacing: .04em; }
.payee{ display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding: 11px 4px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); font-size: 11px; color: var(--ink-2); }
.payee b{ font-weight: 500; letter-spacing: .06em; }
.payee span{ color: var(--ink-3); font-size: 10px; }
.support-note{ margin-top: 16px; }
.amount-row{ display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.amount-row .choice{ min-width: 58px; justify-content: center; }

/* Woodfish */
.practice{
  position: absolute; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(90% 90% at 50% 30%, rgba(58, 72, 56, .96), rgba(31, 40, 30, .985));
  color: #f4eee0; opacity: 0; visibility: hidden; transition: opacity .5s var(--ease), visibility .5s;
  padding: 24px;
}
.practice.is-open{ opacity: 1; visibility: visible; }
.practice-close{ position: absolute; top: 20px; right: 20px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(244, 238, 224, .18); display: grid; place-items: center; color: rgba(244, 238, 224, .7); }
.practice-close:hover{ background: rgba(244, 238, 224, .08); color: #fff; }
.practice-close svg{ width: 17px; height: 17px; }
.practice-kicker{ font-size: 9px; letter-spacing: .4em; color: rgba(214, 185, 124, .7); text-indent: .4em; margin: 0 0 8px; }
.practice-title{ font-family: var(--serif); font-weight: 500; font-size: 28px; letter-spacing: .18em; text-indent: .18em; margin: 0; }
.practice-sub{ margin: 8px 0 0; font-size: 11px; color: rgba(244, 238, 224, .55); letter-spacing: .1em; }
.woodfish-stage{ position: relative; width: min(340px, 74vw); aspect-ratio: 1.25; margin: 22px 0 4px; display: grid; place-items: center; }
.woodfish-body{
  position: relative; width: 100%; height: 82%; border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background:
    radial-gradient(70% 70% at 36% 26%, #a9774b 0%, #8b5c35 38%, #6c4327 70%, #4d2f1c 100%);
  box-shadow: inset -18px -22px 40px rgba(33, 20, 11, .55), inset 14px 14px 30px rgba(222, 176, 118, .18), 0 30px 60px rgba(0, 0, 0, .4);
  border: 2px solid rgba(214, 185, 124, .18);
  transition: transform .08s ease;
}
.woodfish-body::before{
  content: ""; position: absolute; left: 50%; bottom: 16%; width: 44%; height: 12%; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(50% 50% at 50% 40%, #2b1a10, #56341f);
  box-shadow: inset 0 5px 10px rgba(0,0,0,.55), 0 2px 0 rgba(214, 185, 124, .12);
}
.woodfish-body::after{
  content: ""; position: absolute; left: 50%; top: 14%; width: 30%; height: 3px; transform: translateX(-50%);
  border-radius: 50%; background: rgba(214, 185, 124, .26);
}
.woodfish-body.is-hit{ transform: scale(.985, .96) translateY(2px); }
.woodfish-eye{ position: absolute; top: 36%; width: 10px; height: 10px; border-radius: 50%; background: #2a190f; box-shadow: 0 0 0 3px rgba(214, 185, 124, .12); }
.woodfish-eye.l{ left: 22%; } .woodfish-eye.r{ right: 22%; }
.woodfish-grain{ position: absolute; inset: 0; border-radius: inherit; opacity: .16; background-image: repeating-linear-gradient(100deg, transparent 0 14px, rgba(255, 224, 178, .55) 15px, transparent 16px 31px); mix-blend-mode: overlay; }
.woodfish-mallet{
  position: absolute; right: -4%; top: 6%; width: 15%; height: 74%; border-radius: 14px;
  background: linear-gradient(90deg, #7d5331, #a9794d 55%, #5d3c23);
  transform: rotate(26deg); transform-origin: 50% 92%;
  box-shadow: 0 12px 22px rgba(0,0,0,.35); transition: transform .1s ease;
}
.woodfish-mallet::before{
  content: ""; position: absolute; top: -3%; left: -35%; width: 170%; height: 24%; border-radius: 50%;
  background: radial-gradient(50% 50% at 40% 30%, #c99a69, #7a4f2d 70%);
}
.woodfish-mallet.is-hit{ transform: rotate(8deg); }
.woodfish-hint{ margin: 6px 0 0; font-size: 10px; color: rgba(244, 238, 224, .45); letter-spacing: .12em; }
.woodfish-count{ font-family: var(--serif); font-size: 54px; line-height: 1; color: #f6efdf; font-variant-numeric: tabular-nums; margin-top: 4px; }
.woodfish-count small{ font-family: var(--sans); font-size: 10px; letter-spacing: .16em; color: rgba(244, 238, 224, .45); margin-left: 8px; }
.woodfish-meta{ display: flex; gap: 26px; margin-top: 14px; font-size: 10px; letter-spacing: .08em; color: rgba(244, 238, 224, .5); }
.woodfish-meta b{ color: rgba(244, 238, 224, .9); font-weight: 400; font-variant-numeric: tabular-nums; }
.woodfish-actions{ display: flex; gap: 8px; margin-top: 18px; }
.practice .btn{ color: rgba(244, 238, 224, .78); border-color: rgba(244, 238, 224, .18); background: rgba(244, 238, 224, .05); }
.practice .btn:hover{ background: rgba(244, 238, 224, .12); color: #fff; }
.practice .btn-primary{ background: #d6b97c; border-color: #d6b97c; color: #2f3a2e; }
.practice .btn-primary:hover{ background: #e4ca91; color: #2f3a2e; }

/* Beads */
.beads-stage{ position: relative; width: min(360px, 82vw); aspect-ratio: 1; margin: 18px 0 6px; touch-action: none; }
.beads-stage svg{ width: 100%; height: 100%; overflow: visible; }
.bead{ fill: #6f4c2f; stroke: #d6b97c; stroke-width: .5; transition: fill .2s, r .2s; }
.bead.is-counted{ fill: #c29a5f; }
.bead.is-current{ fill: #e7c88a; stroke: #fff3d6; }
.beads-center{ position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.beads-center b{ font-family: var(--serif); font-size: 48px; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.beads-center span{ margin-top: 6px; font-size: 9px; letter-spacing: .2em; color: rgba(244, 238, 224, .45); }
.beads-note{ font-size: 10px; color: rgba(244, 238, 224, .45); letter-spacing: .1em; margin-top: 4px; }
.beads-complete{ color: #e7c88a; font-family: var(--serif); font-size: 15px; letter-spacing: .1em; margin-top: 6px; min-height: 1.5em; }

/* Meditation */
.meditate-layer{
  position: absolute; inset: 0; z-index: 56; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(80% 80% at 50% 42%, rgba(28, 37, 28, .78), rgba(20, 27, 20, .94));
  opacity: 0; visibility: hidden; transition: opacity .8s var(--ease), visibility .8s; color: #f2ecdc;
}
.meditate-layer.is-open{ opacity: 1; visibility: visible; }
.meditate-kicker{ font-size: 9px; letter-spacing: .42em; color: rgba(214, 185, 124, .65); text-indent: .42em; }
.meditate-title{ font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: .26em; text-indent: .26em; margin: 14px 0 0; }
.breath-wrap{ position: relative; width: min(280px, 66vw); aspect-ratio: 1; margin: 34px 0 10px; display: grid; place-items: center; }
.breath-ring{ position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(214, 185, 124, .18); }
.breath-ring:nth-child(2){ inset: 12%; border-color: rgba(214, 185, 124, .12); }
.breath-ball{
  width: 38%; height: 38%; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(231, 200, 138, .5), rgba(160, 180, 150, .12) 70%);
  box-shadow: 0 0 60px rgba(214, 185, 124, .18); transition: transform 4s var(--ease), opacity 4s var(--ease);
}
.meditate-layer.is-in .breath-ball{ transform: scale(1.3); }
.breath-text{ position: absolute; font-family: var(--serif); font-size: 14px; letter-spacing: .2em; color: rgba(242, 236, 220, .7); text-indent: .2em; }
.meditate-time{ font-family: var(--serif); font-size: 15px; letter-spacing: .14em; color: rgba(242, 236, 220, .55); font-variant-numeric: tabular-nums; }
.meditate-actions{ display: flex; gap: 8px; margin-top: 28px; }
.meditate-layer .btn{ color: rgba(242, 236, 220, .7); border-color: rgba(242, 236, 220, .16); background: rgba(242, 236, 220, .04); }
.meditate-layer .btn:hover{ background: rgba(242, 236, 220, .1); color: #fff; }

/* Presence */
.presence-head{ display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(70, 90, 71, .05); border: 1px solid var(--line); }
.presence-num{ font-family: var(--serif); font-size: 30px; line-height: 1; color: #3c4a3c; font-variant-numeric: tabular-nums; }
.presence-copy{ font-size: 10px; line-height: 1.6; color: var(--ink-3); }
.presence-copy b{ display: block; font-size: 11px; font-weight: 500; color: var(--ink-2); letter-spacing: .06em; }
.presence-list{ margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.presence-row{ display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px dashed var(--line); font-size: 11px; color: var(--ink-2); }
.presence-row:last-child{ border-bottom: 0; }
.presence-dot{ width: 6px; height: 6px; border-radius: 50%; background: var(--jade); flex: none; box-shadow: 0 0 0 3px rgba(139, 160, 139, .14); }
.presence-row span{ flex: 1; }
.presence-row time{ font-size: 9px; color: var(--ink-3); }
.presence-row b{ font-weight: 500; color: var(--ink); }

/* Collection */
.collection-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.rel-item{ padding: 16px 8px 12px; border-radius: 13px; text-align: center; border: 1px solid var(--line); background: rgba(255, 253, 246, .48); }
.rel-glyph{ width: 46px; height: 46px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; background: rgba(70, 90, 71, .06); font-family: var(--serif); font-size: 21px; color: var(--moss); }
.rel-item b{ display: block; font-size: 10px; font-weight: 500; letter-spacing: .06em; }
.rel-item small{ display: block; margin-top: 4px; font-size: 8px; color: var(--ink-3); line-height: 1.5; }
.rel-item.is-locked{ opacity: .45; }

/* About / prose */
.prose{ margin-top: 4px; font-size: 12px; line-height: 2.1; color: var(--ink-2); letter-spacing: .03em; }
.prose p{ margin: 0 0 12px; }
.prose h3{ margin: 22px 0 8px; font-family: var(--serif); font-weight: 500; font-size: 15px; letter-spacing: .12em; color: #3c4a3c; }
.prose .verse{ font-family: var(--serif); font-size: 14px; color: #5b6655; text-align: center; line-height: 2; margin: 18px 0; letter-spacing: .1em; }
.prose a{ color: var(--cinnabar); text-decoration: underline; text-underline-offset: 3px; }
.legal{ font-size: 10px; line-height: 1.95; color: var(--ink-3); }
.legal b{ color: var(--ink-2); font-weight: 500; }

/* Settings */
.setting-row{ display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 2px; border-bottom: 1px dashed var(--line); }
.setting-row:last-child{ border-bottom: 0; }
.setting-copy b{ display: block; font-size: 12px; font-weight: 500; letter-spacing: .06em; }
.setting-copy small{ display: block; margin-top: 3px; font-size: 9px; color: var(--ink-3); line-height: 1.5; }
.setting-row input[type="range"]{ width: 120px; accent-color: var(--moss); }
.setting-row .seg{ width: 190px; }

/* Empty / error */
.sheet-error{ padding: 18px; border-radius: 12px; background: rgba(168, 70, 47, .06); border: 1px solid rgba(168, 70, 47, .16); font-size: 11px; line-height: 1.8; color: #7d3f30; margin-top: 16px; }

/* noscript */
.noscript{ position: fixed; inset: 0; display: grid; place-content: center; padding: 30px; text-align: center; background: #efe9d9; }
.noscript h1{ font-family: var(--serif); font-weight: 500; letter-spacing: .3em; }
.noscript p{ font-size: 13px; color: var(--ink-2); }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px){
  .topbar{ padding: calc(12px + var(--safe-top)) 12px 0; }
  .topbar-left, .topbar-right{ gap: 6px; }
  .brand{ padding: 5px 11px 5px 6px; gap: 8px; }
  .brand-seal{ width: 28px; height: 28px; font-size: 16px; }
  .brand-text b{ font-size: 13px; letter-spacing: .12em; }
  .brand-text small{ display: none; }
  .timechip{ display: none; }
  .tool{ height: 38px; min-width: 38px; padding: 0 11px; }
  .icon-tool{ width: 38px; padding: 0; }
  .presence{ padding: 0 10px; }
  .tool-label{ display: none; }
  .support .tool-label{ display: inline; }
  .support{ padding: 0 12px; }
  .dock{ bottom: calc(12px + var(--safe-bottom)); padding: 6px; gap: 0; border-radius: 21px; width: calc(100% - 20px); max-width: 430px; justify-content: space-between; }
  .dock-item{ flex: 1; width: auto; height: 54px; border-radius: 15px; }
  .dock-ico, .dock-ico svg{ width: 24px; height: 24px; }
  .dock-item > span:last-child{ font-size: 9px; }
  .dock-more{ display: flex; }
  .hint{ bottom: calc(94px + var(--safe-bottom) + var(--kb)); gap: 7px; font-size: 9px; padding: 7px 8px 7px 11px; max-width: calc(100vw - 24px); overflow: hidden; }
  .hint span:nth-of-type(2), .hint i:nth-of-type(1){ display: none; }
  .toast-stack{ bottom: calc(96px + var(--safe-bottom)); }
  .scene-label{ font-size: 11px; padding: 6px 9px 6px 10px; }
  .scene-label kbd{ display: none; }
  .sheet-wrap{ align-items: flex-end; padding: 0; }
  .sheet{ width: 100%; max-height: 88vh; border-radius: 24px 24px 0 0; padding: 26px 20px calc(22px + var(--safe-bottom)); transform: translateY(40px); }
  .sheet::before{ inset: 8px; border-radius: 18px; }
  .sheet-title{ font-size: 23px; }
  .menu-grid{ grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-item{ padding: 13px 11px; gap: 9px; }
  .menu-ico{ width: 28px; height: 28px; }
  .lamp-grid{ grid-template-columns: 1fr; }
  .stat-row{ gap: 8px; }
  .stat b{ font-size: 20px; }
  .qr-card{ width: min(250px, 78vw); }
  .quote-card{ padding: 28px 20px 22px; }
  .woodfish-stage{ width: min(300px, 78vw); margin-top: 12px; }
  .woodfish-count{ font-size: 44px; }
  .practice-title{ font-size: 24px; }
  .beads-center b{ font-size: 40px; }
  .collection-grid{ grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 390px){
  .support .tool-label{ display: none; }
  .dock-item > span:last-child{ font-size: 8.5px; }
  .brand-text b{ font-size: 12px; }
  .menu-grid{ grid-template-columns: 1fr; }
  .menu-item small{ display: none; }
}

@media (max-height: 620px) and (orientation: landscape){
  .dock-item{ height: 48px; }
}

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .boot{ transition: none; }
}

/* Landscape phones */
@media (max-height: 520px) and (orientation: landscape){
  .topbar{ padding-top: calc(8px + var(--safe-top)); }
  .dock{ bottom: calc(8px + var(--safe-bottom)); }
  .dock-item{ height: 46px; }
  .hint{ display: none; }
  .toast-stack{ bottom: calc(70px + var(--safe-bottom)); }
  .woodfish-stage{ width: 200px; margin: 6px 0; }
  .practice-title{ font-size: 20px; }
  .woodfish-count{ font-size: 34px; }
}
/* ---------------- Added components ---------------- */
.welcome-list{
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 20px 0 4px;
}
.welcome-list span{
  padding: 12px 10px; border-radius: 12px; text-align: center; font-size: 10px;
  color: var(--ink-3); background: rgba(70, 90, 71, .045); border: 1px solid var(--line);
  line-height: 1.6;
}
.welcome-list b{ display: block; color: var(--ink-2); font-weight: 500; font-size: 11px; margin-bottom: 2px; }

.tea-visual{
  position: relative; height: 132px; margin: 12px 0 4px; display: grid; place-items: center;
}
.tea-cup{
  position: relative; width: 118px; height: 66px;
  border-radius: 8px 8px 58px 58px / 8px 8px 44px 44px;
  background: linear-gradient(160deg, #f7f1e2, #ddd0b6 70%, #c9b893);
  border: 1px solid rgba(120, 100, 70, .22);
  box-shadow: 0 14px 24px rgba(50, 55, 42, .12), inset 0 -8px 16px rgba(120, 100, 70, .12);
}
.tea-cup::before{
  content: ""; position: absolute; right: -22px; top: 16px; width: 28px; height: 26px;
  border: 3px solid #d8cbb0; border-left: 0; border-radius: 0 18px 18px 0;
}
.tea-cup span{
  position: absolute; left: 9px; right: 9px; top: 6px; height: 10px; border-radius: 50%;
  background: var(--tea, #9fb27a); opacity: .8;
}
.tea-cup span::after{
  content: ""; position: absolute; inset: 2px 18px auto; height: 3px; border-radius: 50%;
  background: rgba(255,255,255,.45);
}
.tea-steam{ position: absolute; top: 6px; left: 50%; width: 60px; height: 70px; transform: translateX(-50%); }
.tea-steam i{
  position: absolute; bottom: 0; width: 8px; height: 40px; border-radius: 50%;
  border-left: 1px solid rgba(150, 150, 130, .35);
  animation: tea-rise 4.2s ease-in-out infinite;
}
.tea-steam i:nth-child(1){ left: 16px; animation-delay: 0s; }
.tea-steam i:nth-child(2){ left: 30px; height: 52px; animation-delay: .9s; }
.tea-steam i:nth-child(3){ left: 44px; height: 36px; animation-delay: 1.8s; }
@keyframes tea-rise{
  0%{ opacity: 0; transform: translateY(12px) scaleX(.8); }
  30%{ opacity: .8; }
  100%{ opacity: 0; transform: translateY(-30px) translateX(6px) scaleX(1.4); }
}
.tea-name{
  margin: 0; text-align: center; font-family: var(--serif); font-size: 22px;
  letter-spacing: .16em; color: #3c4a3c; text-indent: .16em;
}

.sutra-lines{ margin-top: 18px; padding: 18px 18px 14px; border-radius: 14px; background: rgba(70, 90, 71, .04); border: 1px solid var(--line); }
.sutra-lines p{
  margin: 0 0 10px; font-family: var(--serif); font-size: 12.5px; line-height: 2;
  color: var(--ink-2); letter-spacing: .03em; text-align: justify;
}
.sutra-lines p:last-child{ margin-bottom: 0; }
.sutra-lines span{
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 8px;
  border-radius: 50%; background: rgba(168, 70, 47, .08); color: var(--cinnabar);
  font-family: var(--sans); font-size: 8px; vertical-align: 1px;
}

.qr-unconfigured{
  display: grid; place-items: center; text-align: center;
  background:
    repeating-linear-gradient(45deg, rgba(70, 90, 71, .035) 0 10px, transparent 10px 20px),
    #faf6ea;
  border: 1px dashed rgba(70, 90, 71, .28);
}
.qr-unconfigured b{
  display: block; font-family: var(--serif); font-size: 18px; font-weight: 500;
  letter-spacing: .12em; color: #4c5a4a; margin-bottom: 6px;
}
.qr-unconfigured span{ font-size: 10px; color: var(--ink-3); letter-spacing: .1em; }
.qr-hint a{ color: var(--cinnabar); text-decoration: underline; text-underline-offset: 2px; }
.cheer-num{ font-variant-numeric: tabular-nums; }

.practice{ overflow-y: auto; }
.practice > *{ flex: none; }

@media (max-width: 760px){
  .welcome-list{ grid-template-columns: 1fr 1fr; }
  .welcome-list span:last-child{ grid-column: 1 / -1; }
  .tea-visual{ height: 118px; transform: scale(.92); }
}
/* Wooden fish refinement: tail, fin and scales */
.woodfish-body{
  border-radius: 48% 52% 45% 45% / 54% 54% 46% 46%;
  transform: rotate(-2deg);
}
.woodfish-stage::before{
  content: "";
  position: absolute; left: -4%; bottom: 18%; width: 34%; height: 48%;
  background: linear-gradient(120deg, #8b5c35, #5a3822 70%);
  clip-path: polygon(100% 42%, 4% 0, 24% 48%, 4% 100%, 100% 62%);
  transform: rotate(-14deg);
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.28));
  opacity: .94;
}
.woodfish-stage::after{
  content: "";
  position: absolute; left: 47%; top: 3%; width: 18%; height: 13%;
  border-radius: 50% 50% 30% 30%;
  background: linear-gradient(180deg, #a9774b, #6c4327);
  transform: rotate(-8deg);
  box-shadow: inset 0 4px 8px rgba(255, 220, 170, .18);
}
.woodfish-grain{
  background-image:
    radial-gradient(circle at 50% 50%, transparent 7px, rgba(255, 224, 178, .42) 8px, transparent 9px);
  background-size: 26px 20px;
  opacity: .13;
  mix-blend-mode: overlay;
}
.woodfish-mallet{
  width: 12%;
  height: 70%;
  border-radius: 18px 18px 9px 9px;
}
.woodfish-mallet::before{
  width: 210%;
  height: 22%;
  left: -55%;
}
/* ---------------- Chat, bubbles, sitting ---------------- */
.chat-bar{
  position: absolute; left: 50%; bottom: calc(102px + var(--safe-bottom) + var(--kb)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; z-index: 30;
  width: min(360px, 64vw); height: 42px; padding: 4px 5px 4px 15px;
  border-radius: 999px;
  background: rgba(247, 242, 230, .78); border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 10px 26px rgba(30, 38, 28, .14);
  backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
  transition: opacity .4s var(--ease), bottom .5s var(--ease), width .4s var(--ease);
}
.chat-bar input{
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  font-size: 12px; letter-spacing: .06em; color: var(--ink);
}
.chat-bar input::placeholder{ color: rgba(76, 83, 73, .42); }
.chat-bar button{
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #f7f1e3; background: #465a47;
  transition: transform .2s var(--ease), background .2s;
}
.chat-bar button:hover{ background: #526a52; transform: scale(1.04); }
.chat-bar button:active{ transform: scale(.94); }
.chat-bar button svg{ width: 17px; height: 17px; }
.chat-bar.is-sending{ opacity: .6; }

.bubble-layer{
  position: absolute; inset: 0; z-index: 23; pointer-events: none; overflow: hidden;
}
.chat-bubble{
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%);
  max-width: 230px; padding: 7px 12px 8px; border-radius: 13px;
  background: rgba(250, 246, 236, .95); border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: 0 8px 22px rgba(30, 38, 28, .16);
  font-size: 12px; line-height: 1.65; letter-spacing: .04em; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity .35s var(--ease), transform .15s linear;
  will-change: left, top;
}
.chat-bubble::after{
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 9px; height: 9px;
  background: rgba(250, 246, 236, .95); border-right: 1px solid rgba(255, 255, 255, .72);
  border-bottom: 1px solid rgba(255, 255, 255, .72);
  transform: translateX(-50%) rotate(45deg);
}
.chat-bubble.is-out{ opacity: 0; }
.chat-bubble.is-mine{ background: rgba(70, 90, 71, .92); color: #f7f1e3; border-color: rgba(70, 90, 71, .4); }
.chat-bubble.is-mine::after{ background: rgba(70, 90, 71, .92); border-color: rgba(70, 90, 71, .4); }

.sit-bar{
  position: absolute; left: 50%; bottom: calc(108px + var(--safe-bottom) + var(--kb)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px; z-index: 31;
  padding: 7px 8px 7px 14px; border-radius: 999px;
  background: rgba(247, 242, 230, .8); border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 10px 26px rgba(30, 38, 28, .14);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  font-size: 11px; letter-spacing: .08em; color: var(--ink-2);
  pointer-events: auto;
}
.sit-bar[hidden]{ display: none; }
.sit-bar b{ font-weight: 500; color: var(--ink); }
.sit-dot{ width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(184, 147, 85, .16); animation: live 3.4s ease-in-out infinite; }
#sit-time{ font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 10px; }
.sit-bar button{ padding: 4px 11px; border-radius: 999px; background: rgba(70, 90, 71, .08); font-size: 10px; color: var(--ink-2); }
.sit-bar button:hover{ background: rgba(70, 90, 71, .15); }

body.is-sitting .dock{ opacity: 0; pointer-events: none; transform: translate(-50%, 18px); }
body.is-sitting #hint{ opacity: 0; pointer-events: none; }
body.is-sitting .chat-bar{ bottom: calc(60px + var(--safe-bottom) + var(--kb)); }
body.is-sitting .sit-bar{ display: flex; }
body.is-sitting .scene-label{ opacity: .35; }
body.is-sitting .joystick{ display: none; }

/* move the transient hint above the chat bar */
.hint{ bottom: calc(168px + var(--safe-bottom)); }
.toast-stack{ bottom: calc(282px + var(--safe-bottom)); }

@media (max-width: 760px){
  .chat-bar{ width: calc(100% - 24px); bottom: calc(88px + var(--safe-bottom) + var(--kb)); height: 40px; }
  .chat-bar input{ font-size: 12px; }
  .sit-bar{ bottom: calc(94px + var(--safe-bottom) + var(--kb)); }
  body.is-sitting .chat-bar{ bottom: calc(48px + var(--safe-bottom) + var(--kb)); }
  .hint{ bottom: calc(152px + var(--safe-bottom)); }
  .toast-stack{ bottom: calc(252px + var(--safe-bottom)); }
  .chat-bubble{ max-width: 190px; font-size: 11px; }
}
@media (max-height: 520px) and (orientation: landscape){
  .chat-bar{ bottom: calc(64px + var(--safe-bottom)); }
  .hint{ display: none; }
  .toast-stack{ bottom: calc(110px + var(--safe-bottom)); }
}
/* Wooden fish SVG + mala beads */
.woodfish-svg{
  width: 100%; height: auto; max-height: 430px; display: block; overflow: visible;
  filter: drop-shadow(0 24px 36px rgba(0, 0, 0, .28));
}
#wf-body{
  transform-box: view-box; transform-origin: 300px 270px;
  transition: transform .08s ease; cursor: pointer; outline: none;
}
#wf-body.is-hit{ transform: scale(.985, .955) translateY(4px); }
#wf-body:focus-visible{ filter: drop-shadow(0 0 8px rgba(231, 200, 138, .65)); }
#wf-mallet{
  transform-box: view-box; transform-origin: 505px 345px;
  transition: transform .1s ease;
}
#wf-mallet.is-hit{ transform: rotate(11deg); }
.woodfish-stage::before, .woodfish-stage::after{ display: none; }

.mala-stage{
  position: relative; width: min(500px, 88vw); height: min(640px, 64vh);
  margin: 14px auto 0; touch-action: none; user-select: none;
  display: grid; place-items: center;
}
.mala-svg{ width: 100%; height: 100%; overflow: visible; display: block; }
.mala-bead{ fill: url(#malaWood); stroke: #351d10; stroke-width: 1.1; }
.mala-bead.is-current{ stroke: #f0d39a; stroke-width: 2.8; }
.mala-guide{ fill: none; stroke: rgba(214, 185, 124, .10); stroke-width: 1.2; }
.mala-marker{ fill: #d8b77a; opacity: .9; }
.mala-center{
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.mala-center b{
  font-family: var(--serif); font-weight: 400; font-size: 58px; line-height: 1;
  color: #f5edda; font-variant-numeric: tabular-nums; text-shadow: 0 4px 20px rgba(0,0,0,.35);
}
.mala-center span{ margin-top: 4px; font-size: 9px; letter-spacing: .24em; color: rgba(244,238,224,.45); }
.mala-center small{ margin-top: 14px; font-size: 8px; letter-spacing: .18em; color: rgba(214,185,124,.45); }
.mala-stage .beads-note{ position: absolute; bottom: -2px; left: 0; right: 0; text-align: center; }

@media (max-width: 760px){
  .mala-stage{ width: min(390px, 92vw); height: min(560px, 58vh); }
  .mala-center b{ font-size: 46px; }
  .woodfish-svg{ max-height: 340px; }
}
/* ---------------- Fishing ---------------- */
.fishing-layer{
  position: absolute; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(90% 90% at 50% 20%, rgba(244, 239, 225, .97), rgba(224, 232, 218, .97) 55%, rgba(196, 211, 195, .98));
  color: var(--ink); opacity: 0; visibility: hidden; transition: opacity .5s var(--ease), visibility .5s;
  padding: 24px; overflow-y: auto;
}
.fishing-layer.is-open{ opacity: 1; visibility: visible; }
.fishing-layer .practice-close{ color: var(--ink-3); border-color: var(--line); }
.fishing-layer .practice-close:hover{ background: rgba(70,90,71,.08); color: var(--ink); }
.fishing-inner{ display: flex; flex-direction: column; align-items: center; text-align: center; width: min(620px, 100%); }
.fishing-layer .practice-kicker{ color: var(--gold); }
.fishing-layer .practice-title{ color: #354035; font-size: 30px; }
.fishing-layer .practice-sub{ color: var(--ink-3); }
.fishing-pond{
  position: relative; width: min(560px, 86vw); height: min(360px, 40vh);
  margin: 22px 0 16px; border-radius: 50%; overflow: hidden; cursor: pointer;
  background:
    radial-gradient(circle at 38% 30%, #a9c2ad 0%, #7fa395 38%, #5e8880 70%, #456d68 100%);
  box-shadow: inset 0 18px 40px rgba(29, 55, 49, .35), inset 0 -20px 30px rgba(20, 40, 34, .25), 0 22px 44px rgba(40, 55, 42, .18);
  border: 8px solid rgba(196, 190, 170, .55);
}
.pond-ripple{ position: absolute; border: 1px solid rgba(240, 247, 231, .32); border-radius: 50%; animation: pond-ripple 5.2s ease-out infinite; }
.pond-ripple.r1{ width: 90px; height: 34px; left: 18%; top: 28%; }
.pond-ripple.r2{ width: 150px; height: 52px; left: 56%; top: 62%; animation-delay: 1.8s; }
.pond-ripple.r3{ width: 70px; height: 24px; left: 66%; top: 22%; animation-delay: 3.1s; }
@keyframes pond-ripple{ 0%{ transform: scale(.55); opacity: 0; } 25%{ opacity: .8; } 100%{ transform: scale(1.35); opacity: 0; } }
.pond-lily{ position: absolute; width: 54px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #8fa66d, #5f7b4b); opacity: .9; }
.pond-lily::after{ content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 55%; background: rgba(90, 120, 70, .5); }
.pond-lily.l1{ left: 12%; bottom: 18%; transform: rotate(-12deg); }
.pond-lily.l2{ right: 16%; bottom: 28%; transform: rotate(18deg) scale(.8); }
.pond-lily.l3{ left: 42%; top: 16%; transform: rotate(5deg) scale(.65); }
.fish-float{
  position: absolute; left: 48%; top: 76%; width: 12px; height: 26px; transform: translate(-50%, -50%);
  border-radius: 50% 50% 45% 45%; background: linear-gradient(180deg, #c94b36 0 55%, #f4ead5 55% 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.3); transition: left .65s var(--ease), top .65s var(--ease);
}
.fish-float i{ position: absolute; left: 50%; top: -8px; width: 2px; height: 9px; background: #5d3a28; transform: translateX(-50%); }
.fish-float.is-bite{ animation: fish-bite .28s ease-in-out infinite; }
@keyframes fish-bite{ 50%{ transform: translate(-50%, -34%) rotate(8deg); } }
.fish-line{ position: absolute; left: 48%; bottom: auto; top: 0; width: 1px; height: 76%; background: linear-gradient(180deg, rgba(240,235,220,.12), rgba(240,235,220,.65)); opacity: 0; transition: opacity .3s; pointer-events: none; }
.fishing-rod{ position: absolute; right: 3%; top: 2%; width: 3px; height: 52%; background: linear-gradient(180deg, #6d4a2f, #3f2a1b); transform: rotate(24deg); transform-origin: bottom center; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,240,210,.12); }
.fishing-rod::before{ content: ""; position: absolute; left: -4px; bottom: -5px; width: 11px; height: 34px; border-radius: 8px; background: #4a3020; }
.fish-status{
  min-height: 1.7em; font-family: var(--serif); font-size: 15px; letter-spacing: .06em; color: #3e4b3c;
  margin: 2px 0 4px;
}
.fish-catch[hidden]{ display: none !important; }
.fish-catch[hidden]{ display: none !important; }
.fish-catch{ display: flex; flex-direction: column; gap: 3px; margin: 2px 0 8px; padding: 10px 18px; border-radius: 12px; background: rgba(255,253,246,.68); border: 1px solid rgba(184,147,85,.28); }
.fish-catch b{ font-family: var(--serif); font-weight: 500; font-size: 16px; color: #3c4a3c; letter-spacing: .08em; }
.fish-catch span{ font-size: 10px; color: var(--ink-3); }
.fish-hint{ margin: 10px 0 0; font-size: 9px; letter-spacing: .08em; color: var(--ink-3); }
.fishing-layer .btn-primary{ min-height: 44px; padding: 0 28px; }
@media (max-width: 760px){
  .fishing-pond{ width: 88vw; height: 34vh; min-height: 220px; margin: 16px 0 12px; }
  .fishing-layer .practice-title{ font-size: 25px; }
}
