/* ============ HUD (v6, immersive minimal) ============
   Default: the hall owns the screen. Always on: a small merit badge (top-left, 28px), a small bell (top-right, 32px) and one paw button
   (bottom-right, 44px) that fans out the menu. Everything else fades in only when relevant: place title (2 s on entering), a thin bead strip
   (when stroking / progress changes / tapping the merit badge, 3 s), one notice slot (quips, toasts, signs), court actions float up at their spot.
   One material for all of it: frosted rice paper rgba(255,250,240,.72) + blur(10px), 1px gold hairline, one soft shadow.
   UI.audit() (ui.js, ?debug=1) checks pairwise overlap (>= 8 px), viewport bounds and text overflow. */
:root {
  --glass-bg: rgba(255, 250, 240, .72); --glass-line: rgba(214, 170, 80, .62); --glass-shadow: 0 5px 14px rgba(104, 66, 38, .16), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.glass, .toast, .signc, .quipc, .bannerc, .flc, .stand-pill, #napbanner, #sound-menu, #menu, #prompt, #ring .rb, #ack-btn, #fab, .ntag.act {
  background: var(--glass-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--glass-line); border-radius: 16px; box-shadow: var(--glass-shadow);
}
#hud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 8px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); }
#hud > #tags { position: absolute; inset: 0; }

/* ---- the two corner badges ---- */
#pill-merit { grid-area: 1 / 1; align-self: start; display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 4px; border-radius: 14px; pointer-events: auto; cursor: pointer; transition: opacity .6s; max-width: 40vw; }
#pill-merit .paw-badge { width: 22px; height: 22px; padding: 4px; border-radius: 50%; background-color: rgba(252, 214, 206, .85); flex: none; }
#pill-merit b { font-family: var(--font-title); font-weight: 400; font-size: 15px; color: var(--ink); white-space: nowrap; line-height: 1; }
#pill-merit .bless { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; margin-left: 2px; padding-left: 5px; border-left: 1px solid var(--glass-line); white-space: nowrap; }
#pill-merit .bless b { font-size: 11px; } #pill-merit .bless .feather { width: 9px; height: 9px; border-radius: 80% 0 80% 0; background: linear-gradient(135deg, #ffe08a, #f3a86a); transform: rotate(-20deg); }
#btn-sound { grid-area: 1 / 3; align-self: start; justify-self: end; position: relative; width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 16px; pointer-events: auto; cursor: pointer; transition: opacity .6s, transform .16s cubic-bezier(.3, 1.7, .5, 1); }
#btn-sound .ico { width: 20px; height: 20px; } #btn-sound.off .ico { filter: grayscale(1) opacity(.55); }
#btn-sound.off::after { content: ""; position: absolute; left: 8px; right: 8px; top: 15px; height: 2.5px; border-radius: 2px; background: #c9604f; transform: rotate(-38deg); box-shadow: 0 0 0 1px #fff6e3; }
#btn-sound:active { transform: scale(.88); }
#hud.idle #pill-merit, #hud.idle #btn-sound { opacity: .6; }

/* ---- top centre: transient things stack here (never on top of each other) ---- */
#topc { grid-area: 1 / 2; justify-self: center; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; max-width: 100%; pointer-events: none; }
#titlebox { display: flex; align-items: center; gap: 8px; padding: 0 4px; opacity: 0; transform: translateY(-4px); transition: opacity .6s, transform .6s; height: 0; overflow: visible; min-width: 0; }
#titlebox.show { opacity: 1; transform: none; height: 26px; }
#titlebox::before, #titlebox::after { content: ""; width: 22px; height: 1px; background: linear-gradient(90deg, transparent, #d6aa50); flex: none; } #titlebox::after { transform: scaleX(-1); }
#titlebox #place { font-family: var(--font-title); font-size: 18px; color: #fff8ea; letter-spacing: .22em; text-indent: .22em; white-space: nowrap; text-shadow: 0 1px 3px rgba(60, 35, 15, .85), 0 0 10px rgba(60, 35, 15, .55); }
#titlebox #monkhud { position: static; font-size: 10.5px; color: #fff8ea; text-shadow: 0 1px 3px rgba(60, 35, 15, .85); white-space: nowrap; background: none; border: 0; box-shadow: none; padding: 0; }
#beadbar { display: none; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 8px; border-radius: 14px; width: min(100%, 300px); opacity: 0; transition: opacity .6s; pointer-events: none; }
#beadbar.show { display: flex; opacity: 1; }
#bb-label { display: none; }
#beads-row { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 2px; }
#beads-row::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: repeating-linear-gradient(90deg, #cf7a62 0 4px, #e9a38e 4px 8px); border-radius: 2px; opacity: .85; }
.bc { position: relative; flex: 1 1 0; min-width: 0; max-width: 18px; aspect-ratio: 1; }
.bead { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #fff, #f5ece0 55%, #ddd0c0); box-shadow: inset 0 -2px 3px rgba(120, 90, 60, .2), 0 1px 2px rgba(100, 60, 30, .3); }
.bead::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #fff6c8, #f4c85a 55%, #cf9524); box-shadow: inset 0 -2px 3px rgba(130, 80, 10, .3); opacity: var(--part, 0); transition: opacity .5s; }
.bead.on::after { opacity: 1; }
.bead.flash { animation: beadpop .7s cubic-bezier(.3, 1.8, .5, 1); }
.bead.flash::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; background: radial-gradient(circle, #fff8d0 0, rgba(255, 240, 170, 0) 70%); animation: glint .7s ease-out forwards; pointer-events: none; }
@keyframes beadpop { 0% { transform: scale(.6); } 55% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes glint { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: scale(1.7); } }
#deity-face { position: relative; flex: none; width: 28px; height: 24px; display: grid; place-items: center; }
#deity-face .df-art { position: absolute; inset: 1px; border-radius: 50% 50% 46% 46%; background:
  radial-gradient(ellipse 3px 1.8px at 33% 58%, transparent 60%, #7a4a22 62% 90%, transparent 92%), radial-gradient(ellipse 3px 1.8px at 67% 58%, transparent 60%, #7a4a22 62% 90%, transparent 92%),
  radial-gradient(circle at 50% 72%, #f3a09a 0 1.3px, transparent 1.8px), radial-gradient(circle at 40% 30%, #ffe9a4, #f6c360 70%, #e2a444); box-shadow: 0 0 0 1.5px #fff4d8; }
#deity-face .zz { position: absolute; right: -3px; top: -7px; font-family: var(--font-title); font-size: 10px; color: #8c7bc4; text-shadow: 0 1px 0 #fff; animation: zzf 2.6s ease-in-out infinite; }
@keyframes zzf { 0%, 100% { transform: translateY(0) rotate(8deg); opacity: .9; } 50% { transform: translateY(-3px) rotate(-6deg); opacity: .55; } }
#deity-face.awake .zz { display: none; } #deity-face.awake { animation: beadpop .8s; }
#napbanner { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 8px; max-width: 100%; font-family: var(--font-title); font-size: var(--fs-body); color: #5d4f8f; border-radius: 16px; }
#napbanner[hidden] { display: none; } #napbanner .ico { width: 22px; height: 22px; flex: none; } #nap-t { min-width: 0; overflow-wrap: anywhere; text-wrap: balance; text-align: center; }

/* ---- middle (free play area) ---- */
#mid { grid-area: 2 / 1 / 3 / -1; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; position: relative; pointer-events: none; }
#mid-c { grid-area: 1 / 1 / 3 / 2; pointer-events: none; }
#prompt { grid-area: 2 / 1 / 3 / 2; position: relative; inset: auto; margin: 0 auto; align-self: end; width: min(330px, 100%); pointer-events: auto; padding: 16px 18px 14px; text-align: center; animation: pop .42s cubic-bezier(.3, 1.5, .5, 1); }
#prompt .paw-tag { position: absolute; width: 28px; height: 28px; left: 50%; top: -15px; margin-left: -14px; padding: 5px; border-radius: 50%; background: #fff6e3; border: 1px solid var(--glass-line); }
#hud.busy #bottom #fabbox { visibility: hidden; }

/* ---- notice slot items (one at a time) ---- */
.toast { position: relative; padding: 8px 16px 9px; font-size: var(--fs-body); text-align: center; overflow-wrap: anywhere; text-wrap: balance; animation: tin .38s cubic-bezier(.3, 1.6, .5, 1); transition: opacity .35s, transform .35s; }
.signc { position: relative; padding: 7px 18px 8px; text-align: center; animation: tin .4s cubic-bezier(.3, 1.6, .5, 1); transition: opacity .35s, transform .35s; }
.signc .st { font-family: var(--font-title); font-size: var(--fs-btn); letter-spacing: .24em; text-indent: .24em; color: #b9852a; }
.signc .sb { font-size: var(--fs-body); margin-top: 1px; overflow-wrap: anywhere; text-wrap: balance; }
.quipc { display: flex; align-items: center; gap: 8px; padding: 7px 14px 8px 8px; animation: tin .5s cubic-bezier(.3, 1.5, .5, 1); transition: opacity .35s, transform .35s; }
.quipc .ico { width: 30px; height: 30px; flex: none; } .quipc span { font-size: var(--fs-body); line-height: 1.45; text-wrap: balance; overflow-wrap: anywhere; min-width: 0; }
.bannerc { padding: 8px 20px 9px; text-align: center; font-family: var(--font-title); font-size: var(--fs-title); color: #8a5a14; letter-spacing: .06em; border-color: #e0b04e; animation: bannerin .6s cubic-bezier(.3, 1.5, .5, 1); transition: opacity .35s, transform .35s; text-wrap: balance; overflow-wrap: anywhere; }
.flc { padding: 4px 14px 5px; font-size: var(--fs-small); text-align: center; text-wrap: balance; overflow-wrap: anywhere; animation: tin .4s; transition: opacity .35s, transform .35s; }
#slot .out { opacity: 0; transform: translateY(6px); }
@keyframes tin { from { transform: translateY(8px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bannerin { from { transform: translateY(-10px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- bottom row: contextual sit bar (left/centre) + the paw button (right) ---- */
#bottom { grid-area: 3 / 1 / 4 / -1; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; min-width: 0; pointer-events: none; }
#sitbar { display: flex; justify-content: flex-start; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1 1 auto; }
#sitbar:not(:has(button:not([hidden]))) { display: none; }
.stand-pill { pointer-events: auto; height: 38px; padding: 0 16px; border-radius: 19px; font-family: var(--font-title); font-size: var(--fs-btn); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); transition: transform .16s cubic-bezier(.3, 1.7, .5, 1); }
.stand-pill .ico { width: 22px; height: 22px; } .stand-pill.chant { border-color: #e0b04e; background: rgba(252, 226, 170, .8); color: #6a4414; } .stand-pill:active { transform: scale(.92); }
#daze-back { position: absolute; z-index: 9; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); }
#fabbox { margin-left: auto; position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; flex: none; max-height: 100%; }
#fab { pointer-events: auto; width: 44px; height: 44px; border-radius: 22px; padding: 0; display: grid; place-items: center; cursor: pointer; transition: transform .2s cubic-bezier(.3, 1.7, .5, 1), opacity .6s; }
#fab .ico { width: 26px; height: 26px; } #fab:active { transform: scale(.88); } #fab.open { background: rgba(252, 226, 200, .9); }
#hud.idle #fab { opacity: .6; }
#fabmenu { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-radius: 18px; pointer-events: none; animation: fabin .3s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 100% 100%; max-height: calc(100vh - 160px); flex-wrap: wrap; align-content: flex-end; }
#fabmenu[hidden] { display: none; }
@keyframes fabin { from { transform: scale(.7) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.fi { pointer-events: auto; position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 8px; height: 38px; min-width: 112px; padding: 0 12px 0 8px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; font-family: var(--font-title); color: var(--ink); transition: transform .16s cubic-bezier(.3, 1.7, .5, 1), background .2s; }
.fi:hover { background: rgba(255, 255, 255, .45); } .fi:active { transform: scale(.94); }
.fi .ico { width: 26px; height: 26px; flex: none; }
.fi .dl { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; }
.fi .dl b, .fi .dl .fl { font-family: var(--font-title); font-weight: 400; font-size: 13px; white-space: nowrap; }
.fi .dl small { font-size: 10px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fi.cool { filter: saturate(.55) opacity(.8); } #btn-dnd.on { background: rgba(196, 184, 238, .55); } #btn-dnd.on .dl small { color: #6d5cb0; }
#hud.z-hall .fi[data-z="court"], #hud.z-court .fi[data-z="hall"] { display: none; }
.fi .o-check { position: absolute; right: 6px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--matcha-d); border: 1.5px solid #fff6e3; opacity: 0; transform: scale(.3); pointer-events: none; z-index: 2; }
.fi .o-check::after { content: ""; position: absolute; left: 4px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(40deg); }
.fi .o-check.pop { animation: checkpop 2.4s ease-out forwards; }
.fbtn.quest.alldone small, .alldone small { color: var(--matcha-d); }
/* court hotspots: a small button floats up at the spot when you are close */
.ntag.act { pointer-events: auto; cursor: pointer; height: 30px; padding: 0 12px 0 10px; border-radius: 15px; background: var(--glass-bg); border: 1px solid var(--glass-line); animation: ackpop .35s cubic-bezier(.3, 1.7, .5, 1); }
.ntag.act::before { display: none; } .ntag.act .nt-t { color: var(--ink); font-size: 12.5px; } .ntag.act .nt-bell { width: 12px; height: 12px; }

/* ---- popups share the material ---- */
#menu { padding: 12px 14px 14px; } #menu::after { background: #fdf6e6; border-color: var(--glass-line); border-width: 1px; }
#sound-menu { top: calc(10px + var(--safe-t) + 8px + 44px + 14px); right: calc(22px + var(--safe-r)); padding: 8px; }
#ring .rb { width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; }
#hud.ringing #tags { opacity: 0; transition: opacity .2s; }
#ack-btn { height: 36px; padding: 0 14px 0 8px; }

/* ---- art that still applies: bead / deity head / icons / reveal card frame ---- */
.a-bead_on .bead::after { background: var(--img-bead_on) center / contain no-repeat; box-shadow: none; }
.a-bead_off .bead { background: var(--img-bead_off) center / contain no-repeat; box-shadow: none; }
.a-deity_face #deity-face .df-art { background: var(--img-deity_face) center / contain no-repeat; box-shadow: none; inset: 0; border-radius: 0; filter: drop-shadow(0 2px 3px rgba(100, 60, 30, .3)); }
.a-card_frame #rv-card { background: var(--img-card_frame) center / 100% 100% no-repeat; border: 0; box-shadow: none; --rw: min(300px, calc(100vw - 48px), calc((100vh - 24px) * 519 / 768)); width: var(--rw); box-sizing: border-box; aspect-ratio: 519 / 768; padding: calc(var(--rw) * .19) calc(var(--rw) * .13) calc(var(--rw) * .1); --rvs: 1; /* padding in % would resolve against the full-width #reveal, not the card */ display: flex; flex-direction: column; align-items: center; justify-content: center; filter: drop-shadow(0 8px 14px rgba(80, 45, 20, .3)); overflow: hidden; backdrop-filter: none; -webkit-backdrop-filter: none; }
.a-card_frame #rv-cat { max-height: 34%; max-width: 62%; flex: 0 1 auto; min-height: 0; object-fit: contain; }
.a-card_frame #rv-a { font-size: max(12px, calc(clamp(17px, .6vw + 15px, 21px) * var(--rvs))); line-height: 1.3; max-width: 100%; }
.a-card_frame #rv-b { font-size: max(12px, calc(var(--fs-body) * var(--rvs))); line-height: 1.3; max-width: 100%; }
.a-card_frame #rv-c { font-size: max(11px, calc(var(--fs-small) * var(--rvs))); line-height: 1.3; max-width: 100%; }
.a-card_frame #rv-tag { font-size: max(12px, calc(var(--fs-btn) * var(--rvs))); }
.a-card_frame #reveal.rare #rv-card, .a-card_frame #reveal.hero #rv-card { background: var(--img-card_frame) center / 100% 100% no-repeat; box-shadow: none; filter: drop-shadow(0 0 22px rgba(255, 205, 110, .9)) drop-shadow(0 8px 14px rgba(80, 45, 20, .3)); }
.a-icon_incense .ico[data-ico="incense"], .a-icon_bell .ico[data-ico="bell"], .a-icon_koi .ico[data-ico="koi"], .a-icon_fortune .ico[data-ico="fortune"], .a-icon_beads .ico[data-ico="beads"],
.a-icon_paw .ico[data-ico="paw"], .a-icon_blink .ico[data-ico="blink"], .a-icon_quiet .ico[data-ico="quiet"], .a-icon_gate .ico[data-ico="gate"], .a-icon_hall .ico[data-ico="hall"] { background-size: contain; filter: drop-shadow(0 1px 1px rgba(80, 50, 20, .25)); }
.a-icon_incense .ico[data-ico="incense"] { background-image: var(--img-icon_incense); } .a-icon_bell .ico[data-ico="bell"] { background-image: var(--img-icon_bell); }
.a-icon_koi .ico[data-ico="koi"] { background-image: var(--img-icon_koi); } .a-icon_fortune .ico[data-ico="fortune"] { background-image: var(--img-icon_fortune); }
.a-icon_beads .ico[data-ico="beads"] { background-image: var(--img-icon_beads); } .a-icon_paw .ico[data-ico="paw"] { background-image: var(--img-icon_paw); }
.a-icon_blink .ico[data-ico="blink"] { background-image: var(--img-icon_blink); } .a-icon_quiet .ico[data-ico="quiet"] { background-image: var(--img-icon_quiet); }
.a-icon_gate .ico[data-ico="gate"] { background-image: var(--img-icon_gate); } .a-icon_hall .ico[data-ico="hall"] { background-image: var(--img-icon_hall); }
.a-icon_incense .ico[data-ico="incense"] svg, .a-icon_bell .ico[data-ico="bell"] svg, .a-icon_koi .ico[data-ico="koi"] svg, .a-icon_fortune .ico[data-ico="fortune"] svg, .a-icon_beads .ico[data-ico="beads"] svg,
.a-icon_paw .ico[data-ico="paw"] svg, .a-icon_blink .ico[data-ico="blink"] svg, .a-icon_quiet .ico[data-ico="quiet"] svg, .a-icon_gate .ico[data-ico="gate"] svg, .a-icon_hall .ico[data-ico="hall"] svg { display: none; }


/* ---- narrow / short screens ---- */
@media (max-width: 340px) { #pill-merit b { font-size: 14px; } }
@media (orientation: landscape) and (max-height: 540px) { #fabmenu { max-height: calc(100vh - 110px); } .fi { height: 34px; } }

/* ---- paw button: breathing, first-run guide, reminders, badge ---- */
#fab { position: relative; animation: fabbreath 3s ease-in-out infinite; }
#fab.open, #fab:active { animation: none; }
@keyframes fabbreath { 0%, 100% { transform: scale(1); box-shadow: var(--glass-shadow), 0 0 0 0 rgba(255, 214, 120, 0); } 50% { transform: scale(1.06); box-shadow: var(--glass-shadow), 0 0 16px 3px rgba(255, 214, 120, .65); } }
#fab.hop { animation: fabhop .8s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes fabhop { 0% { transform: translateY(0); } 30% { transform: translateY(-9px) scale(1.08); } 55% { transform: translateY(0); } 72% { transform: translateY(-4px); } 100% { transform: translateY(0); } }
#fab-cnt { position: absolute; right: 3px; top: 3px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: #ee8f86; color: #fff; font-family: var(--font-title); font-weight: 400; font-size: 9.5px; line-height: 14px; text-align: center; pointer-events: none; }
#fab-cnt[hidden] { display: none; }
#fab .o-check { position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--matcha-d); border: 1.5px solid #fff6e3; opacity: 0; transform: scale(.3); pointer-events: none; }
#fab .o-check::after { content: ""; position: absolute; left: 4px; top: 1.5px; width: 3.5px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(40deg); }
#fab .o-check.pop { animation: checkpop 2.4s ease-out forwards; }
#fabhint { align-self: flex-end; display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; margin-bottom: 4px; max-width: calc(100% - 64px); border-radius: 18px; font-size: var(--fs-body); opacity: 0; transform: translateX(8px) scale(.94); transition: opacity .5s, transform .5s cubic-bezier(.3, 1.5, .5, 1); pointer-events: none; flex: 0 1 auto; min-width: 0; }
#fabhint[hidden] { display: none; } #fabhint.show { opacity: 1; transform: none; }
#fabhint span { min-width: 0; overflow-wrap: anywhere; text-wrap: balance; } #fabhint .ico { width: 20px; height: 20px; flex: none; animation: pawpoke 1.1s ease-in-out infinite; }
@keyframes pawpoke { 0%, 100% { transform: translateX(0) rotate(-14deg); } 50% { transform: translateX(4px) rotate(-14deg); } }
.fi .qdot { position: absolute; right: 8px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #ee8f86; box-shadow: 0 0 0 1.5px rgba(255, 250, 240, .9); pointer-events: none; }
#fabrow { display: flex; align-items: flex-end; justify-content: flex-end; gap: 12px; max-width: calc(100vw - 24px); pointer-events: none; }
#fabhint { margin-bottom: 0; align-self: center; }
#fabhint { max-width: none; } #fabhint span { white-space: nowrap; }
@media (max-width: 330px) { #fabhint span { white-space: normal; } }
#fabmenu { position: absolute; right: 0; bottom: calc(100% + 12px); max-height: calc(100vh - 130px - var(--safe-t) - var(--safe-b)); }
#fabmenu { flex-wrap: nowrap; overflow-y: auto; overscroll-behavior: contain; }
@media (max-height: 540px) { #fabmenu { gap: 8px; padding: 6px; max-height: calc(100vh - 100px); } .fi { height: 29px; min-width: 100px; } .fi .dl small { display: none; } .fi .ico { width: 22px; height: 22px; } .fi .o-check, .fi .qdot { top: 4px; } }

/* ---- mountain fog (connection stutter): idle video over the game, HUD keeps only the bell ---- */
#fog { position: fixed; inset: 0; z-index: 1; opacity: 0; transition: opacity 1.2s ease; pointer-events: none; background: #d9cdb8; overflow: hidden; }
#fog.on { opacity: 1; pointer-events: auto; }
#fog[hidden] { display: none; }
#fog .fog-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s linear; }
#fog .fog-v.live { opacity: 1; }
#fog .fog-still { position: absolute; inset: -4%; background: var(--still, none) 50% 40% / cover no-repeat; opacity: 1; animation: kenburns 22s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.08) translate(-1.2%, -.8%); } }
#fog-note { position: absolute; left: 50%; bottom: calc(18% + var(--safe-b)); transform: translateX(-50%); padding: 8px 20px 9px; font-size: var(--fs-body); max-width: calc(100% - 48px); text-align: center; text-wrap: balance; }
#hud.fogged > *:not(#btn-sound) { opacity: 0 !important; pointer-events: none !important; transition: opacity .8s; }
#hud.fogged > #btn-sound { position: relative; z-index: 3; }
#queue-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
#queue { overflow: hidden; }
#hud { z-index: 2; }
#fog .fog-v { transition: opacity 1.5s linear; } #fog .fog-v.top { z-index: 2; }
#fog-note { z-index: 3; }
.ntag.chant { height: 18px; padding: 0 8px; border-radius: 9px; background: rgba(255, 250, 240, .86); border: 1px solid rgba(240, 170, 160, .8); } .ntag.chant::before, .ntag.chant .nt-bell { display: none; } .ntag.chant .nt-t { font-size: 11px; color: #c0605a; line-height: 16px; padding: 0; }

/* ---- 云顶小花园 ---- */
#vig { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.1s ease; background: radial-gradient(ellipse at 50% 52%, rgba(255, 190, 210, 0) 52%, rgba(255, 176, 202, .32) 82%, rgba(255, 160, 192, .5) 100%); }
#vig.on { opacity: 1; }
#gaze-bar { position: absolute; z-index: 9; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 12px; pointer-events: none; }
#gaze-bar[hidden] { display: none; } #gaze-bar .stand-pill { pointer-events: auto; }
#hud.gazing > *:not(#gaze-bar):not(#game):not(#vig) { opacity: 0 !important; pointer-events: none !important; transition: opacity .8s; }
#hud.z-cloud .fi[data-z="hall"] { display: none; }
.ntag.long { height: auto; max-width: min(250px, calc(100vw - 40px)); padding: 6px 12px 7px; flex-direction: column; align-items: center; gap: 5px; border-radius: 12px; }
.ntag.long::before, .ntag.long .nt-bell { display: none; }
.ntag.long .nt-t { white-space: normal; overflow: visible; text-align: center; text-wrap: balance; overflow-wrap: anywhere; line-height: 1.3; }
.nt-prog { display: flex; gap: 3px; justify-content: center; } .nt-prog i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 243, 212, .35); box-shadow: inset 0 0 0 1px rgba(255, 243, 212, .7); } .nt-prog i.on { background: #ffe08a; box-shadow: 0 0 4px #ffd36a; }
.ntag .nt-cloud { flex: none; width: 16px; height: 11px; margin-left: -1px; background: radial-gradient(circle at 28% 62%, #fff 0 36%, transparent 38%), radial-gradient(circle at 52% 42%, #fff 0 42%, transparent 44%), radial-gradient(circle at 76% 64%, #fff 0 34%, transparent 36%); filter: drop-shadow(0 0 1.5px #86a9e0) drop-shadow(0 0 1px #86a9e0); }

/* ---- 公共香炉: wish picker + wish card ---- */
#incpick, #incwish { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(70,40,24,.42); animation: tin .3s; }
#incpick[hidden], #incwish[hidden] { display: none; }
#inc-card { width: min(340px, calc(100vw - 36px)); max-height: calc(100vh - 24px); overflow: auto; padding: 18px 18px 18px; }
#inc-t, #iw-t { font-family: var(--font-title); font-size: var(--fs-title); letter-spacing: .16em; text-indent: .16em; color: var(--ink); text-align: center; overflow-wrap: anywhere; }
#inc-s { font-size: var(--fs-small); color: var(--ink-2); margin: 2px 0 12px; text-align: center; }
#inc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.slip { pointer-events: auto; min-height: 54px; padding: 6px 8px; border-radius: 12px; border: 2px solid #ecd49a; border-left: 6px solid #f2a99a; background: linear-gradient(180deg, #fffdf4, #fbf0d4); font: inherit; font-size: var(--fs-small); color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; min-width: 0; cursor: pointer; }
.slip:active { transform: scale(.95); }
#inc-no { display: flex; margin: 0 auto; min-width: 120px; }
@media (max-height: 460px) { #inc-card { width: min(640px, calc(100vw - 36px)); } #inc-list { grid-template-columns: 1fr 1fr 1fr 1fr; } .slip { min-height: 44px; } }
#iw-card { width: min(320px, calc(100vw - 40px)); padding: 20px 20px 18px; }
#iw-w { margin: 12px 0 10px; padding: 14px 12px; border-radius: 14px; background: linear-gradient(180deg, #fffdf4, #fbf0d4); border: 2px solid #ecd49a; font-size: var(--fs-body); color: var(--ink); text-align: center; overflow-wrap: anywhere; }
#iw-h { display: flex; justify-content: center; gap: 4px; margin: 0 0 12px; min-height: 16px; }
#iw-h[hidden] { display: none; }
#iw-h i { width: 14px; height: 13px; background: radial-gradient(circle at 30% 30%, #ff9db0, #f06f8c); clip-path: path('M7 13 C-4 5 2 -2 7 3 C12 -2 18 5 7 13Z'); }
#iw-like[hidden] { display: none; } #iw-like:disabled { opacity: .55; }

/* dev only (?debug=1): keep the debug readout out of the HUD grid (it used to claim column 1 and squeeze the notice slot to a vertical sliver) */
#debug { position: absolute; left: 8px; bottom: 6px; z-index: 9; font: 10px/1.3 ui-monospace, monospace; color: #fff; text-shadow: 0 1px 2px #000; white-space: pre; pointer-events: none; }

/* modal cards (incense pick / wish card / quests / fortune / pet ask) own the screen: the world name plates must not show through them */
#hud.busy #tags { visibility: hidden; }

/* ---- way-finding: small edge pill while the door is off screen (only until the first door is used) ---- */
#navpill { position: absolute; z-index: 6; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translate(-50%, 10px); display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 16px 0 12px; border-radius: 17px; font-family: var(--font-title); font-size: 14px; color: var(--ink); opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s cubic-bezier(.3, 1.5, .5, 1); border: 0; }
#navpill.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; }
#navpill .np-a { width: 9px; height: 9px; border: solid #b9852a; border-width: 0 3px 3px 0; border-radius: 1px; transform: rotate(45deg) translate(-2px, -2px); animation: npbob 1s ease-in-out infinite; flex: none; }
#navpill.up .np-a { transform: rotate(-135deg) translate(-2px, -2px); animation-name: npbobu; }
#navpill span { white-space: nowrap; }
@keyframes npbob { 0%, 100% { transform: rotate(45deg) translate(-2px, -2px); } 50% { transform: rotate(45deg) translate(1px, 1px); } }
@keyframes npbobu { 0%, 100% { transform: rotate(-135deg) translate(-2px, -2px); } 50% { transform: rotate(-135deg) translate(1px, 1px); } }
/* short landscape: the menu may now hold two extra "去哪儿" rows, so it scrolls before it reaches the sound button */
@media (max-height: 540px) { #fabmenu { max-height: calc(100vh - 152px - var(--safe-t) - var(--safe-b)); } }

/* short landscape: the framed card is only ~230px wide, so drop the portrait and keep the text readable */
@media (max-height: 520px) { .a-card_frame #rv-cat { display: none; } }

/* deity wake: full-screen video, HUD fades out (bell button + notice slot stay) */
#wakecover { position: fixed; inset: 0; z-index: 0; background: #2a1d14; opacity: 0; transition: opacity .6s ease; pointer-events: none; }
#wakecover.on { opacity: 1; } #wakecover:not(.on) { transition-duration: .8s; }
#wakecover[hidden] { display: none; }
#wakecover video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
#hud.waking > *:not(#btn-sound):not(#topc) { opacity: 0 !important; pointer-events: none !important; transition: opacity .6s; }

/* wide screens (desktop landscape / tablets): bigger corner controls; phones keep the compact sizes */
@media (min-width: 1024px), (min-width: 700px) and (min-height: 700px) {
  #fab { width: 62px; height: 62px; border-radius: 31px; } #fab .ico { width: 36px; height: 36px; }
  #fab-cnt { right: 5px; top: 5px; min-width: 18px; height: 18px; border-radius: 9px; font-size: 12px; line-height: 18px; }
  #fab .o-check { width: 20px; height: 20px; left: 3px; top: 3px; }
  #btn-sound { width: 46px; height: 46px; border-radius: 23px; } #btn-sound .ico { width: 28px; height: 28px; }
  #btn-sound.off::after { left: 11px; right: 11px; top: 21.5px; }
  #pill-merit { height: 36px; padding: 0 14px 0 5px; border-radius: 18px; gap: 7px; } #pill-merit .paw-badge { width: 28px; height: 28px; padding: 5px; }
  #pill-merit b { font-size: 19px; } #pill-merit .bless { font-size: 12px; } #pill-merit .bless b { font-size: 14px; } #pill-merit .bless .feather { width: 12px; height: 12px; }
  #sound-menu { top: calc(10px + var(--safe-t) + 46px + 12px); }
  #fabrow { gap: 14px; } #fabhint { padding: 8px 10px 8px 16px; font-size: 15px; } #fabhint .ico { width: 24px; height: 24px; }
  #fabmenu { bottom: calc(100% + 14px); }
}

/* garden buttons (dance / tai chi): the plush icon sits inside a normal stand pill */
.gpill .gi { width: 22px; height: 26px; object-fit: contain; flex: none; } .gpill span { min-width: 0; white-space: nowrap; }

/* short landscape: the paw menu now holds up to three "去哪儿" rows, so it lays out in two columns instead of scrolling */
@media (orientation: landscape) and (max-height: 540px) { #fabmenu { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; align-items: stretch; } #fabmenu[hidden] { display: none; } }
