/* ============ 呼噜寺 UI v2 · 萌系禅寺 ============
   rice-paper cream + matcha green + peach pink + a little gold. Fat, round, soft.
   Every art-backed piece is drawn in pure CSS first; when game/assets/ui/<name>.png exists, ui.js adds html.a-<name>
   and the image takes over (see the "ART OVERRIDES" block at the bottom). */

/* ---- fonts: subset woff2 built by tools/build_fonts.py (ZCOOL KuaiLe, OFL). Missing file = system rounded fonts. ---- */
@font-face { font-family: "HuluCute"; src: url("assets/fonts/cute.woff2") format("woff2"); font-display: swap; }
/* @font-face { font-family: "HuluBody"; src: url("assets/fonts/body.woff2") format("woff2"); font-display: swap; }   <- reserved for a rounded body font */

:root {
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);
  --font-title: "HuluCute","ZCOOL KuaiLe","Yuanti SC","Hiragino Maru Gothic ProN","PingFang SC","Noto Sans SC",sans-serif;
  --font-body: "HuluBody","Yuanti SC","Hiragino Maru Gothic ProN","PingFang SC","Noto Sans SC","Microsoft YaHei",sans-serif;
  /* type scale (title 22 / button 15 / body 13 / small 11 at phone width) */
  --fs-title: clamp(20px, 1vw + 18px, 26px);
  --fs-btn: clamp(14px, .3vw + 13.5px, 16px);
  --fs-body: clamp(13px, .2vw + 12.4px, 14px);
  --fs-small: clamp(11px, .15vw + 10.4px, 12px);
  --fs-hero: clamp(34px, 3vw + 24px, 52px);
  --ink: #5b3f30; --ink-2: #92735f; --ink-3: #b99b86;
  --paper: #fff6e3; --paper-2: #fdebc8; --paper-edge: #ecd0a0;
  --matcha: #8fb67e; --matcha-d: #66906a; --matcha-l: #c9e0b8;
  --peach: #f7aaa0; --peach-d: #ee8a86; --peach-l: #fddcd4;
  --gold: #eab84e; --gold-d: #c58f2e; --wood: #94603c; --wood-l: #b27a4d;
  --shadow: 0 6px 14px rgba(104,66,38,.24), 0 1px 3px rgba(104,66,38,.18);
  --shadow-s: 0 3px 8px rgba(104,66,38,.2);
  --soft: inset 0 2px 0 rgba(255,255,255,.75), inset 0 -3px 0 rgba(150,100,60,.12);
  --edge: 10px;
  --om-w: clamp(84px, 24vw, 112px); --om-ar: 1.28; --om-h: calc(var(--om-w) * var(--om-ar));
  --dock-h: calc(var(--om-h) + 24px + var(--safe-b));
  --top-h: 66px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3a2a24; touch-action: none; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; font-family: var(--font-body); color: var(--ink); font-size: var(--fs-body); line-height: 1.5; }
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; }
b { font-weight: 700; font-variant-numeric: tabular-nums; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.ico { display: inline-block; background: center / contain no-repeat; }
.ico svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)); }

/* ---------- shared surfaces ---------- */
.frame, .card, .cloud { background: linear-gradient(180deg, #fffaf0, var(--paper)); border: 3px solid var(--paper-edge); border-radius: 26px; box-shadow: var(--shadow), var(--soft); }
.cloud { border-radius: 30px; }
.ui-pill { background: linear-gradient(180deg, #fffaf0, var(--paper)); border: 2.5px solid var(--paper-edge); box-shadow: var(--shadow-s), var(--soft); }

/* ---------- buttons ---------- */
.btn { pointer-events: auto; position: relative; border: 2.5px solid var(--paper-edge); border-radius: 999px; min-height: 42px; padding: 0 18px; font: inherit; font-family: var(--font-title); font-size: var(--fs-btn); color: var(--ink);
  background: linear-gradient(180deg, #fffdf6, #fbeccb); box-shadow: var(--shadow-s), var(--soft); cursor: pointer; white-space: nowrap; max-width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .16s cubic-bezier(.3,1.7,.5,1); }
.btn:active { transform: scale(.9); }
.btn.primary { color: #fff; border-color: #fbd6cd; text-shadow: 0 1px 0 rgba(150,60,50,.45); background: linear-gradient(180deg, #fbb3a8, var(--peach-d)); }
.btn.matcha { color: #fff; border-color: #dcebcf; text-shadow: 0 1px 0 rgba(50,90,50,.4); background: linear-gradient(180deg, #a9cc97, var(--matcha-d)); }

/* ---------- prompt (someone wants to pet you) + cat menu ---------- */
#prompt, #menu { position: absolute; z-index: 5; pointer-events: auto; padding: 16px 18px 16px; text-align: center; animation: pop .42s cubic-bezier(.3,1.5,.5,1); }
#prompt { left: 0; right: 0; margin: 0 auto; bottom: calc(var(--dock-h) + 10px); width: min(330px, calc(100vw - 24px)); }
#prompt .paw-tag { position: absolute; width: 30px; height: 30px; left: 50%; top: -17px; margin-left: -15px; padding: 5px; border-radius: 50%; background: #fff6e3; border: 2.5px solid var(--paper-edge); box-shadow: var(--shadow-s); }
#prompt-text { font-family: var(--font-title); font-size: var(--fs-title); line-height: 1.3; margin: 6px 0 12px; overflow-wrap: anywhere; text-wrap: balance; }
.row { display: flex; gap: 10px; justify-content: center; }
.row .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.timer { height: 8px; background: rgba(150,110,70,.16); border-radius: 6px; margin-top: 14px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(100,60,30,.2); }
.timer i { display: block; height: 100%; width: 100%; background: repeating-linear-gradient(90deg, #f4c85a 0 10px, #f8d98a 10px 12px); border-radius: 6px; }
#menu { left: 0; top: 0; transform-origin: 50% 100%; width: max-content; min-width: 190px; max-width: min(270px, calc(100vw - 24px)); padding: 12px 14px 14px; border-radius: 26px; }
#menu::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 16px; height: 16px; margin-left: -8px; background: #fdefd0; border-right: 3px solid var(--paper-edge); border-bottom: 3px solid var(--paper-edge); transform: rotate(45deg); border-radius: 0 0 6px 0; }
.ribbon-name { display: block; max-width: 100%; margin: 0 auto 10px; padding: 2px 14px 3px; width: fit-content; border-radius: 10px; background: linear-gradient(180deg, #fde1da, #f9c8bd); border: 2px solid #f3b4a8; font-family: var(--font-title); font-size: var(--fs-btn); color: #7a3f34; overflow-wrap: anywhere; text-wrap: balance; }
@keyframes pop { from { transform: scale(.82) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
#menu.pop-in { animation: pop .3s cubic-bezier(.3,1.5,.5,1); }

/* ---------- fortune slip ---------- */
/* Producer-chosen art (slip_card.webp, 854x1599, cat ears + bell + sakura). Everything is laid out in art pixels via --k (screen px per art px), so the
   card never stretches. Measured in the art: paper (inside the gold line) x 61..796, y 334..1459; safe text area = paper shrunk ~6% (x 105..752, y 378..1415).
   Pill y 384..479, text x 141..711 y 524..1194, buttons y 1234..1334 (portrait). Short landscape: card fitted to height, text horizontal, buttons beside the card. */
#fortune { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(70,40,24,.46); animation: tin .3s; }
#slip { --k: min(calc(92vh / 1599), calc((100vw - 24px) / 854), calc(900px / 1599)); position: relative; width: calc(854 * var(--k)); height: calc(1599 * var(--k)); flex: none;
  background: url(assets/ui/slip_card.webp) center / 100% 100% no-repeat; filter: drop-shadow(0 12px 22px rgba(90,40,30,.4)); animation: slipin .6s cubic-bezier(.3,1.35,.5,1); }
.slip-top { position: absolute; left: 0; right: 0; top: calc(384 * var(--k)); height: calc(95 * var(--k)); display: flex; align-items: center; justify-content: center; }
.slip-no { display: none; }
#fo-tier { font-family: var(--font-title); font-weight: 400; font-size: max(14px, calc(54 * var(--k))); line-height: 1; height: 100%; display: flex; align-items: center; padding: 0 max(8px, calc(40 * var(--k))); border-radius: 999px; color: #fff9e8; letter-spacing: .1em; text-indent: .1em; white-space: nowrap;
  background: linear-gradient(180deg, #ffadbd, #f37f97); box-shadow: 0 3px 0 #d9607a, inset 0 2px 0 rgba(255,255,255,.45); text-shadow: 0 2px 0 rgba(170,60,85,.45); border: 2.5px solid #fff3f0; }
#slip[data-t="0"] #fo-tier { background: linear-gradient(180deg, #ffd27a, #f5a742); box-shadow: 0 3px 0 #d3852a, inset 0 2px 0 rgba(255,255,255,.5); text-shadow: 0 2px 0 rgba(160,90,20,.45); }
#fo-body { position: absolute; left: calc(141 * var(--k)); top: calc(524 * var(--k)); width: calc(570 * var(--k)); height: calc(670 * var(--k)); display: flex; justify-content: center; align-items: center; overflow: hidden; }
#fo-cols { writing-mode: vertical-rl; font-family: var(--font-title); color: #7a4a3a; line-height: 1.25; max-height: 100%; max-width: 100%; }
#fo-cols .fl { display: block; letter-spacing: .12em; white-space: nowrap; margin-left: .45em; }
.slip-foot { position: absolute; left: calc(427 * var(--k) - 160 * var(--k)); width: calc(320 * var(--k)); top: calc(1234 * var(--k)); height: calc(100 * var(--k)); display: flex; align-items: center; justify-content: center; gap: max(5px, calc(14 * var(--k))); }
.slip-foot .btn { min-height: 0; height: min(100%, 40px); min-width: 0; padding: 0 max(9px, calc(26 * var(--k))); font-size: clamp(13px, calc(40 * var(--k)), 17px); white-space: nowrap; }
#fo-save { background: linear-gradient(180deg, #fffaf3, #ffe6df); border-color: #f4a7a0; color: #b8574e; }
@keyframes slipin { 0% { transform: translateY(40px) rotate(-5deg) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (orientation: landscape) and (max-height: 540px) {
  #slip { --k: min(calc(94vh / 1599), calc((100vw - 150px) / 854)); }
  #fo-cols { writing-mode: horizontal-tb; text-align: center; } #fo-cols .fl { white-space: normal; letter-spacing: .04em; overflow-wrap: anywhere; text-wrap: balance; margin: .15em 0; }
  #fo-cols.one .fl { white-space: nowrap; letter-spacing: 0; }
  .slip-foot { left: calc(100% + 22px); top: auto; bottom: calc(150 * var(--k)); width: auto; height: auto; flex-direction: column; align-items: stretch; gap: 8px; }
  .slip-foot .btn { height: 38px; padding: 0 18px; font-size: 15px; }
}
#slipimg { position: absolute; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(70,40,24,.55); animation: tin .3s; }
#si-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; width: min(340px, calc(100vw - 32px)); max-height: calc(100vh - 20px); }
#si-img { display: block; max-width: 100%; max-height: calc(100vh - 150px); width: auto; height: auto; border-radius: 14px; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; pointer-events: auto; }
#si-hint { font-family: var(--font-title); font-size: var(--fs-small); color: var(--ink-2); }
@media (orientation: landscape) and (max-height: 540px) { #si-card { flex-direction: row; width: auto; max-width: calc(100vw - 32px); } #si-hint { writing-mode: vertical-rl; } #si-img { max-height: calc(100vh - 40px); } }

/* ---------- reveal card ---------- */
#reveal { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; animation: tin .4s ease-out; transition: opacity .6s; padding: 0 var(--edge); }
#reveal.out { opacity: 0; }
.card { padding: 20px 24px 22px; text-align: center; width: min(320px, calc(100vw - 40px)); position: relative; animation: pop .5s cubic-bezier(.3,1.5,.5,1); }
#rv-cat { display: block; margin: 0 auto 6px; max-width: 150px; max-height: 190px; width: auto; height: auto; filter: drop-shadow(0 8px 8px rgba(96,62,40,.25)); }
#rv-tag { display: inline-block; max-width: 100%; font-family: var(--font-title); font-size: var(--fs-btn); letter-spacing: .16em; text-indent: .16em; color: #fff; background: linear-gradient(180deg, #f6cc6c, #e3a23c); padding: 2px 16px 3px; border-radius: 999px; margin-bottom: 8px; text-shadow: 0 1px 0 rgba(130,80,10,.5); border: 2px solid #fbe9b4; box-shadow: var(--shadow-s); }
#rv-tag:empty { display: none; }
#rv-a { font-family: var(--font-title); font-size: var(--fs-title); line-height: 1.35; margin-bottom: 6px; overflow-wrap: anywhere; text-wrap: balance; }
#rv-b { font-size: var(--fs-body); color: var(--ink-2); overflow-wrap: anywhere; text-wrap: balance; }
#rv-c { font-size: var(--fs-small); color: var(--ink-2); margin-top: 8px; overflow-wrap: anywhere; text-wrap: balance; }
#rv-c:empty { display: none; }
#reveal.rare .card, #reveal.hero .card { background: linear-gradient(170deg, #fffbe9, #ffe9d6); border-color: #f1cd7a; box-shadow: 0 0 0 3px #fff2c4, 0 0 44px rgba(255,205,110,.85), var(--shadow); }
#reveal.hero #rv-a { color: #b4552f; }

/* ---------- ambience overlays ---------- */
#dim { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(90,48,30,.12), rgba(70,34,22,.5)); opacity: 0; transition: opacity 1.4s; pointer-events: none; }
#dim.on { opacity: 1; }
#flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff6d6, transparent 70%); opacity: 0; pointer-events: none; }
#flash.go { animation: fl 2.2s ease-out; }
@keyframes fl { 0% { opacity: .9; } 100% { opacity: 0; } }
#fade { position: fixed; inset: 0; background: #f3e4d0; opacity: 0; pointer-events: none; transition: opacity .35s ease; z-index: 8; }
#fade.on { opacity: 1; pointer-events: auto; }

/* ---------- name tags (DOM ribbons) ---------- */
#tags { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.ntag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 5px 0 12px; max-width: 220px; border-radius: 12px 6px 6px 12px; opacity: 0; transition: opacity .28s; will-change: transform, opacity;
  background: linear-gradient(180deg, #fffaf0, #fdecc9); border: 2px solid #f0c9a0; box-shadow: 0 2px 5px rgba(90,55,30,.28); }
.ntag.on { opacity: 1; }
.ntag::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; margin-top: -5px; background: inherit; border: inherit; border-radius: 3px; transform: rotate(45deg); border-top: 0; border-right: 0; }
.ntag .nt-t { font-family: var(--font-title); font-size: var(--fs-small); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; line-height: 1.1; padding-bottom: 1px; }
.ntag .nt-bell { flex: none; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b8, #eab84e 62%, #c58f2e); box-shadow: 0 1px 2px rgba(100,60,20,.35); }
.ntag.me { background: linear-gradient(180deg, #fff7d6, #fbe09a); border-color: #eab84e; } .ntag.me .nt-t { color: #7a4a14; }
.ntag.npc { background: linear-gradient(180deg, #f2f9e8, #dcebcb); border-color: #b4d29c; } .ntag.npc .nt-t { color: #476a3a; }
.ntag.sign { background: linear-gradient(180deg, var(--wood-l), var(--wood)); border-color: #f3dca8; } .ntag.sign .nt-t { color: #fff3d4; }
.ntag.dot { width: 16px; height: 16px; padding: 0; justify-content: center; border-radius: 50%; } .ntag.dot::before, .ntag.dot .nt-t { display: none; } .ntag.dot .nt-bell { width: 8px; height: 8px; }

/* ---------- title / cover ---------- */
#title { position: fixed; inset: 0; background: #4a4a22; z-index: 10; overflow: hidden; }
#cv-fg { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
#key { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
#cv-low { display: none; }
#title-box { position: absolute; z-index: 1; left: 50%; top: calc(7vh + var(--safe-t)); transform: translateX(-50%); width: min(92vw, 560px); text-align: center; }
#title-box h1 { margin: 0; font-family: var(--font-title); font-size: clamp(56px, 19vw, 112px); line-height: 1.1; font-weight: 400; letter-spacing: .12em; margin-right: -.12em; color: #8a3a28; text-shadow: 0 3px 0 #fff3dc, 0 6px 22px rgba(255,236,200,.95); }
html.title-in-art #title-box { display: none; }
/* portrait: a tall cover (cover art on top, painted terrace + lotus pond below) fills the screen by width, pinned to the top — no blur, no mirror */
@media (orientation: portrait) {
  #key { object-fit: cover; object-position: 50% 0; }
  #title::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: linear-gradient(180deg, transparent, rgba(45,40,24,.22)); pointer-events: none; }
}
#enter-wrap { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(3vh + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 20px; }
#mode-pick { display: flex; gap: 8px; padding: 4px; border-radius: 999px; background: rgba(255,246,227,.82); border: 2.5px solid var(--paper-edge); box-shadow: var(--shadow-s), var(--soft); max-width: 100%; }
.mpick { pointer-events: auto; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 8px; border-radius: 999px; border: 2px solid transparent; background: transparent; cursor: pointer; font-family: var(--font-title); font-size: var(--fs-btn); color: var(--ink-2); white-space: nowrap; transition: transform .16s cubic-bezier(.3,1.7,.5,1), background .2s, color .2s; min-width: 0; }
.mpick .ico { width: 24px; height: 24px; flex: none; } .mpick span { min-width: 0; }
.mpick:active { transform: scale(.92); }
.mpick.on { color: #fff; background: linear-gradient(180deg, #a9cc97, var(--matcha-d)); border-color: #dcebcf; text-shadow: 0 1px 0 rgba(50,90,50,.4); box-shadow: 0 2px 6px rgba(70,110,60,.4); }
.mpick.on .ico svg { filter: brightness(1.7) saturate(.6); }
.enter { position: relative; pointer-events: auto; cursor: pointer; width: clamp(170px, 46vw, 240px); height: clamp(56px, 7.4vh, 72px); border: 0; padding: 0; background: none; transition: transform .2s cubic-bezier(.3,1.7,.5,1); animation: breathe 3.2s ease-in-out infinite; margin-top: 12px; }
.enter::before { content: ""; position: absolute; inset: 0; border-radius: 40px 40px 22px 22px / 50% 50% 28% 28%; background: radial-gradient(circle at 18% 22%, rgba(255,255,255,.3) 0 8px, transparent 9px), linear-gradient(180deg, #fbc0b6, #f19488); border: 5px solid #f6dfae; box-shadow: 0 10px 22px rgba(110,50,30,.4), inset 0 3px 0 rgba(255,255,255,.4), inset 0 -5px 0 rgba(150,60,50,.2); }
.enter #enter-t { position: relative; z-index: 1; font-family: var(--font-title); font-size: clamp(28px, 3vw + 18px, 38px); color: #fff9ec; letter-spacing: .3em; text-indent: .3em; text-shadow: 0 3px 0 rgba(150,60,50,.6); white-space: nowrap; display: block; text-align: center; line-height: clamp(46px, 6.4vh, 62px); }
.enter .o-loop, .enter .o-tassel { display: none; }
.enter .o-loop { position: absolute; left: 50%; top: -17px; width: 30px; height: 22px; margin-left: -15px; border: 5px solid #ee8f86; border-radius: 50%; border-bottom-color: transparent; }
.enter .o-tassel { position: absolute; z-index: -1; left: 50%; bottom: -22px; width: 16px; height: 28px; margin-left: -8px; background: linear-gradient(180deg, #ee8f86, #f7b4a8); clip-path: polygon(0 0, 100% 0, 100% 72%, 85% 100%, 70% 74%, 50% 100%, 30% 74%, 15% 100%, 0 72%); }
.enter:active { transform: scale(.92); animation: none; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
#t-sub { margin: 0; max-width: 20em; text-align: center; font-size: var(--fs-body); color: #fff9ec; text-shadow: 0 1px 4px rgba(60,40,20,.9), 0 0 10px rgba(60,40,20,.7); text-wrap: balance; overflow-wrap: anywhere; }
/* portrait title: 进寺 on top is the hero (wider), the sound pick below it is a slim, quieter bar */
@media (orientation: portrait) {
  #enter-wrap { gap: 16px; }
  .enter { width: clamp(210px, 60vw, 270px); height: clamp(58px, 7.2vh, 68px); margin-top: 0; }
  #mode-pick { gap: 4px; padding: 3px; border-width: 2px; }
  .mpick { height: 32px; padding: 0 12px 0 6px; gap: 4px; font-size: 14px; }
  .mpick .ico { width: 20px; height: 20px; }
}
@media (orientation: portrait) and (max-height: 700px) { #t-sub { display: none; } #enter-wrap { gap: 10px; bottom: calc(1.6vh + var(--safe-b)); } .mpick { height: 30px; } .enter { margin-top: 0; } }
@media (orientation: landscape) { #title-box { left: 46%; top: calc(6vh + var(--safe-t)); width: min(44vw, 560px); } #title-box h1 { font-size: clamp(52px, 13vh, 118px); } #enter-wrap { left: auto; right: clamp(16px, 5vw, 80px); bottom: calc(5vh + var(--safe-b)); align-items: center; width: min(360px, 44vw); gap: 12px; padding: 0; } }
@media (orientation: landscape) and (max-height: 520px) { #t-sub { display: none; } .enter { height: 52px; margin-top: 8px; } }

/* ---------- sound menu (bell button) ---------- */
#sound-menu { position: absolute; z-index: 7; right: calc(var(--edge) + var(--safe-r)); top: calc(70px + var(--safe-t)); pointer-events: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; border-radius: 22px; animation: pop .3s cubic-bezier(.3,1.5,.5,1); transform-origin: 100% 0; }
#sound-menu::before { content: ""; position: absolute; right: 22px; top: -9px; width: 16px; height: 16px; background: #fff9ec; border-left: 3px solid var(--paper-edge); border-top: 3px solid var(--paper-edge); transform: rotate(45deg); border-radius: 6px 0 0 0; }
.smi { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 10px; border-radius: 999px; border: 2px solid transparent; background: transparent; font-family: var(--font-title); font-size: var(--fs-btn); color: var(--ink); cursor: pointer; white-space: nowrap; transition: transform .16s cubic-bezier(.3,1.7,.5,1); }
.smi .ico { width: 24px; height: 24px; flex: none; } .smi:active { transform: scale(.94); }
.smi.on { background: linear-gradient(180deg, #e3f0d6, #cfe4be); border-color: #b4d29c; color: #3f6a3c; }

/* ---------- loading + queue ---------- */
#loading, #queue { position: fixed; inset: 0; background: radial-gradient(circle at 50% 30%, #fdf1d9, #f2d5ae); z-index: 9; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 20px; }
.ld-card { width: min(320px, 100%); padding: 20px 22px 22px; }
#ld-cat { display: block; height: 100px; margin: 0 auto 6px; animation: bob 1.1s ease-in-out infinite; filter: drop-shadow(0 6px 6px rgba(96,62,40,.25)); }
@keyframes bob { 50% { transform: translateY(-7px); } }
#ld-title { font-family: var(--font-title); font-size: var(--fs-title); letter-spacing: .2em; text-indent: .2em; margin-bottom: 10px; }
.ld-beads { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; } .ld-beads .bead { position: relative; width: 18px; height: 18px; inset: auto; }
#loading-text { font-size: var(--fs-body); line-height: 1.7; color: var(--ink-2); text-wrap: balance; overflow-wrap: anywhere; }
.qbox { padding: 22px 26px 24px; max-width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; } .qbox .ico { width: 44px; height: 44px; }
#qtext { margin: 0; font-size: var(--fs-btn); line-height: 1.8; overflow-wrap: anywhere; text-wrap: balance; }

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

/* ============ social (P0): emote ring, 回礼, flash line, quests, daze ============ */
#ring { position: absolute; z-index: 6; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
#ring .rb { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0;
  background: linear-gradient(180deg, #fffaf0, var(--paper)); border: 2.5px solid var(--paper-edge); box-shadow: var(--shadow-s), var(--soft); animation: ringpop .35s cubic-bezier(.3,1.7,.5,1) backwards; font-family: var(--font-title); font-size: 11px; line-height: 1.1; color: var(--ink); white-space: nowrap; }
#ring .rb .ico { width: 26px; height: 26px; } #ring .rb:active { transform: scale(.88); }
@keyframes ringpop { from { transform: scale(.2); opacity: 0; } }
#ring .rb.cool { filter: grayscale(.8) opacity(.6); }
#ack-btn { position: absolute; z-index: 5; left: 0; top: 0; pointer-events: auto; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 8px; border-radius: 999px; cursor: pointer; font-family: var(--font-title); font-size: var(--fs-btn); color: #7a3f34;
  background: linear-gradient(180deg, #fff1ec, #fcd2c8); border: 2.5px solid #f3b4a8; box-shadow: var(--shadow-s); animation: ackpop .45s cubic-bezier(.3,1.7,.5,1); }
#ack-btn .ico { width: 24px; height: 24px; } @keyframes ackpop { from { opacity: 0; scale: .4; } }
  background: rgba(255,250,240,.88); border: 2px solid var(--paper-edge); box-shadow: var(--shadow-s); opacity: 0; transition: opacity .6s; pointer-events: none; }
@keyframes checkpop { 0% { opacity: 0; transform: scale(.3); } 15% { opacity: 1; transform: scale(1.25); } 30% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }
#qpanel { 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; }
#qcard { width: min(340px, calc(100vw - 36px)); padding: 20px 22px 20px; text-align: left; }
#q-title { font-family: var(--font-title); font-size: var(--fs-title); text-align: center; letter-spacing: .2em; text-indent: .2em; color: var(--ink); }
#q-sub { text-align: center; font-size: var(--fs-small); color: var(--ink-2); margin: 2px 0 12px; }
#q-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#q-list li { display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 9px; border-radius: 16px; background: rgba(255,255,255,.6); border: 2px solid #f1e0bd; font-size: var(--fs-body); overflow-wrap: anywhere; min-width: 0; }
#q-list li i { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid #d6c2a0; background: #fffaf0; position: relative; }
#q-list li.done { color: var(--ink-2); text-decoration: line-through; text-decoration-color: #b4d29c; } #q-list li.done i { background: var(--matcha-d); border-color: #dcebcf; }
#q-list li.done i::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(40deg); }
#qcard .btn { display: flex; margin: 0 auto; min-width: 120px; }
/* daze: all UI fades away except the way back */
#hud.daze > *:not(#daze-back):not(#game) { opacity: 0 !important; pointer-events: none !important; transition: opacity .8s; }
#hud.daze #daze-back { opacity: .85 !important; pointer-events: auto !important; }

#menu .r2 { margin-top: 8px; }


#hud.daze > *:not(#daze-back):not(#game) { opacity: 0 !important; pointer-events: none !important; transition: opacity .8s; }
#hud.daze #daze-back { opacity: .85 !important; pointer-events: auto !important; }
