/* src/ui/menus.css — menus: characters, wish, quests, map, notice board, food stall (Homeward Lanterns) */
#menus { position: absolute; inset: 0; z-index: 40; display: none; pointer-events: none; color: #fff4e0; font-family: var(--font, "Noto Serif", Georgia, serif); font-size: 16px; line-height: 1.35;
  --bw: 22px; --pad: 32px; --hd: 56px; --gold: #e8c27a; --ink: #1b1430; --glass: #1c1640cc; --deep: #120c28; --cream: #f7e8c4; --good: #9be38a; --bad: #ff9a8a; }
#menus.on { display: block; pointer-events: auto; animation: mFade .22s ease both; }
#menus *, #menus *::before, #menus *::after { box-sizing: border-box; }
/* reset with zero specificity: an id selector here used to beat .m-btn / .m-port (border: 0 removed the 9-slice art) */
:where(#menus) :where(button) { font: inherit; color: inherit; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#menus img { -webkit-user-drag: none; user-select: none; }
#menus b { font-weight: 700; }
@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }

/* backdrop with drifting lantern embers */
.m-bg { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 38%, rgba(48, 30, 100, .55), rgba(8, 4, 22, .9) 78%); }
.m-fire { position: absolute; bottom: -30px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(circle at 50% 70%, #fff0b0, #ff9a3a 55%, transparent 76%); opacity: 0; animation: mFire linear infinite; pointer-events: none; }
@keyframes mFire { 0% { transform: translate(0, 0) scale(.8); opacity: 0; } 12% { opacity: .85; } 88% { opacity: .45; } 100% { transform: translate(var(--sw, 0px), -112vh) scale(.4); opacity: 0; } }

.m-host { position: absolute; inset: 0; display: grid; place-items: center; }
.m-panel { position: relative; width: min(calc(100% - 56px), 1180px); height: min(calc(100% - 36px), 668px); animation: mPop .3s cubic-bezier(.2, 1.5, .4, 1) both; transform-origin: 50% 55%; }
.m-panel.nopop { animation: none; }
.m-panel::before { content: ""; position: absolute; inset: 8px; border-radius: 14px; background: linear-gradient(180deg, #1e1646f2, #120c2af5); box-shadow: inset 0 0 40px #0008; }
.m-frame { position: absolute; inset: 0; border: var(--bw) solid transparent; border-image: url(../../assets/ui-panel.webp) 64 fill / var(--bw) stretch; pointer-events: none; z-index: 1; }
@keyframes mPop { from { opacity: 0; transform: scale(.86) translateY(16px); } to { opacity: 1; transform: none; } }

/* header: title · tabs · extra · close */
.m-head { position: absolute; z-index: 4; left: var(--pad); right: var(--pad); top: calc(var(--bw) - 2px); height: var(--hd); display: flex; align-items: center; gap: 14px; }
.m-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: linear-gradient(90deg, transparent, var(--gold) 10%, var(--gold) 90%, transparent); opacity: .65; pointer-events: none; }
.m-title { flex: none; font: 700 26px/1.1 var(--font); letter-spacing: .12em; color: #ffd9a0; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); white-space: nowrap; animation: mSlideL .35s cubic-bezier(.2, 1.4, .4, 1) .08s backwards; }
.m-title::before { content: "◆"; font-size: .6em; margin-right: .5em; color: var(--gold); -webkit-text-stroke: 0; vertical-align: .12em; }
.m-htabs { flex: 1; min-width: 0; display: flex; justify-content: center; }
.m-htabs .m-tabs { margin: 0; }
.m-hextra { flex: none; display: flex; align-items: center; margin-left: auto; }
.m-htabs:empty + .m-hextra { margin-left: auto; }
.m-htabs:empty { flex: 1; }
.m-x { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--gold); background: radial-gradient(circle at 35% 30%, #5a49a8, #2a2058 70%); box-shadow: 0 3px 0 var(--ink), 0 0 10px #0008; color: #ffe9c0; font-size: 22px; line-height: 1; display: grid; place-items: center; transition: transform .15s cubic-bezier(.2, 1.5, .4, 1), filter .15s; }
.m-x:active { transform: scale(.86); }
@keyframes mSlideL { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }

.m-body { position: absolute; z-index: 2; left: var(--pad); right: var(--pad); bottom: var(--pad); top: calc(var(--bw) + var(--hd) + 8px); display: flex; gap: 14px; min-height: 0; }
.m-body > * { min-height: 0; }
.m-characters, .m-wish { gap: 16px; }
.m-quests, .m-board, .m-stall { flex-direction: column; }

/* shared: scroll, stagger, focus */
.m-scroll { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #e8c27a77 transparent; }
.m-scroll::-webkit-scrollbar { width: 6px; }
.m-scroll::-webkit-scrollbar-thumb { background: #e8c27a77; border-radius: 3px; }
.m-scroll::-webkit-scrollbar-track { background: transparent; }
.st { animation: mIn .3s cubic-bezier(.2, 1.4, .4, 1) calc(min(var(--i, 0), 9) * 30ms) backwards; }
@keyframes mIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
#menus .kf { outline: 3px solid #fff1b8; outline-offset: 3px; z-index: 2; }
#menus .m-btn.kf { outline: none; filter: brightness(1.3) drop-shadow(0 0 8px #ffd27a); transform: scale(1.05); }
#menus .m-x.kf { filter: brightness(1.3); }

/* icons, text bits */
.m-ico { width: 24px; height: 24px; object-fit: contain; flex: none; vertical-align: middle; }
.m-ico.s { width: 18px; height: 18px; }
.m-ico.l { width: 32px; height: 32px; }
.m-ico.xl { width: 48px; height: 48px; }
.m-ico.xxl { width: 72px; height: 72px; }
.m-dim { color: #cfc4ec; }
.m-dim.sm { font-size: 13px; line-height: 1.4; }
.m-stars { color: #ffd45a; font-size: 15px; letter-spacing: 1px; text-shadow: 0 1px 0 var(--ink), 0 0 6px #ff9a1a88; white-space: nowrap; }
.m-tag { display: inline-block; padding: 1px 9px; border-radius: 9px; background: var(--deep); border: 1px solid var(--gold); color: #ffe0a0; font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.m-tag.big { font-size: 18px; padding: 1px 12px; border-radius: 12px; }
.m-tag.active { background: #3a2f76; color: #fff4c0; }
.m-tag.done { background: #2e6a3a; border-color: var(--good); color: #eaffdf; }
.m-tag.locked { opacity: .6; }
.m-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 14px; border-radius: 14px; background: #3a2f76; border: 2px solid var(--gold); color: #ffe9c0; font-size: 15px; font-weight: 700; text-align: center; }
.m-badge.ok { background: #2e6a3a; border-color: var(--good); color: #eaffdf; }
.m-note { padding: 18px 14px; text-align: center; color: #d8ccf0; font-size: 16px; line-height: 1.55; }
.m-note.big { font-size: 21px; color: #ffe9c0; padding: 26px 16px; text-shadow: 0 2px 0 var(--ink); }
.m-lab { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; font-size: 14px; font-weight: 700; letter-spacing: .1em; color: var(--gold); }
.m-lab::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, #e8c27a88, transparent); }
.m-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.m-acts > .m-btn { flex: 1 1 120px; }
.m-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 14px; color: #ffe0a0; }
.m-pass { font-size: 14px; line-height: 1.5; color: #f0e4ff; }
.m-pass b { color: #ffd27a; }
.m-pass em { color: var(--good); font-style: normal; }
.m-hi { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.m-hi em { font-style: normal; font-size: 13px; font-weight: 400; opacity: .8; }
.m-hi.lack, .m-hi.lack b { color: var(--bad); }
.m-btn .m-hi { text-shadow: 0 2px 0 var(--ink), 0 0 3px var(--ink); }

/* buttons: ui-button art as a 9-slice */
.m-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 96px; min-height: 52px; padding: 2px 10px; border: 14px solid transparent; border-image: url(../../assets/ui-button.webp) 40 fill / 14px stretch; font: 700 16px/1.2 var(--font); color: #fff4e0; text-align: center; text-shadow: 0 2px 0 var(--ink), 0 0 3px var(--ink); transition: transform .14s cubic-bezier(.2, 1.5, .4, 1), filter .14s; }
.m-btn.gold { filter: brightness(1.14) saturate(1.25) drop-shadow(0 0 5px #ffd27a77); }
.m-btn.big { min-height: 72px; font-size: 20px; }
.m-btn.off { filter: grayscale(.9) brightness(.62); }
.m-btn:active { transform: scale(.92); }
@media (hover: hover) {
  .m-btn:hover { filter: brightness(1.3) drop-shadow(0 0 8px #ffd27a); transform: scale(1.04); }
  .m-btn.off:hover { filter: grayscale(.9) brightness(.7); transform: none; }
  .m-chip:hover, .m-port:hover, .m-slot:hover, .m-cslot:hover { filter: brightness(1.2); }
  .m-x:hover { filter: brightness(1.25); }
}

/* chips = tabs */
.m-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.m-chip { flex: 1 1 auto; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; border: 2px solid #e8c27a66; background: linear-gradient(180deg, #43388a, #271f58); color: #ffe9c0; font: 700 16px var(--font); text-shadow: 0 2px 0 var(--ink); white-space: nowrap; transition: transform .16s cubic-bezier(.2, 1.5, .4, 1), filter .16s, background .2s; }
.m-chip.on { background: linear-gradient(180deg, #fbe0a0, #d9a24e); color: var(--ink); text-shadow: none; border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold), 0 3px 8px #0009; transform: translateY(-1px); }
.m-chip:active { transform: scale(.92); }

/* ═════ characters ═════ */
.m-list { flex: none; width: 88px; padding: 8px 8px 8px 6px; display: flex; flex-direction: column; gap: 12px; }
.m-port { position: relative; flex: none; width: 100%; aspect-ratio: 1; min-height: 52px; border-radius: 14px; border: 3px solid var(--ink); background: #2a2058 center 8% / 260% auto no-repeat; box-shadow: 0 2px 6px #000a; transition: transform .16s cubic-bezier(.2, 1.5, .4, 1), box-shadow .2s, filter .2s; }
.m-port.on { border-color: var(--el, #fff); box-shadow: 0 0 0 2px var(--ink), 0 0 16px var(--el, #fff); transform: scale(1.06); }
.m-port:active { transform: scale(.93); }
.m-elb { position: absolute; left: -7px; top: -7px; width: 24px; height: 24px; padding: 2px; border-radius: 50%; background: var(--ink); border: 1px solid var(--gold); object-fit: contain; }
.m-pn { position: absolute; right: -5px; bottom: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--gold); border: 2px solid var(--ink); color: var(--ink); font: 700 12px/16px var(--font); text-align: center; text-shadow: none; pointer-events: none; }

.m-stage { flex: 1 1 0; min-width: 0; position: relative; overflow: hidden; border-radius: 16px; border: 2px solid #e8c27a55; background: linear-gradient(180deg, #2a2058aa, #120c28cc); }
.m-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 62%, var(--el, #ffd27a), transparent 68%); opacity: .42; pointer-events: none; }
.m-art { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 8px 14px #000b); animation: mArt .45s cubic-bezier(.2, 1.3, .4, 1) both, mFloat 5s ease-in-out .45s infinite alternate; pointer-events: none; }
@keyframes mArt { from { opacity: 0; transform: translateX(-26px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes mFloat { from { transform: translateY(0); } to { transform: translateY(-6px); } }
.m-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 14px 12px; background: linear-gradient(180deg, transparent, #120c28d8 46%); pointer-events: none; }
.m-name { font: 700 30px/1.1 var(--font); color: #fff4e0; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); letter-spacing: .06em; }
.m-sub { font-size: 15px; color: #ffd9a0; text-shadow: 0 2px 3px #000; margin-bottom: 4px; }
.m-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; text-shadow: 0 2px 3px #000; }
.m-lvb { margin-left: auto; padding: 1px 10px; border-radius: 10px; background: var(--deep); border: 1px solid var(--gold); color: #ffe0a0; font-weight: 700; font-size: 14px; }

.m-side { flex: 0 0 46%; min-width: 0; display: flex; flex-direction: column; }
.m-side > .m-tabs { flex: none; }
.m-tabbody { flex: 1; min-height: 0; padding: 4px 6px 8px 2px; }

/* attributes */
.m-lvrow { display: flex; align-items: baseline; gap: 6px; margin: 0 0 8px; }
.m-lvbig { font: 700 30px/1 var(--font); color: #ffd9a0; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.m-stats > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 38px; padding: 4px 10px; border-radius: 9px; background: linear-gradient(90deg, #ffffff16, #ffffff08); border-left: 3px solid #e8c27a88; font-size: 15px; }
.m-stats span { display: inline-flex; align-items: center; gap: 5px; color: #dcd0f6; min-width: 0; }
.m-stats b { color: #fff4e0; font-size: 17px; }
.m-stats b.up { color: var(--good); text-shadow: 0 0 8px #6ae06a; animation: mUp .9s ease; }
@keyframes mUp { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
.m-lu { margin: 12px 0 4px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.m-cost { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.m-cost .m-hi { padding: 4px 14px; border-radius: 18px; background: #120c28bb; border: 1px solid #e8c27a66; }
.m-warn { text-align: center; font-size: 13px; color: var(--bad); }
.m-party { margin-top: 6px; }
.m-slots { display: flex; gap: 12px; margin: 6px 0; }
.m-slot { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--ink); background: #2a2058 center 8% / 260% auto no-repeat; box-shadow: 0 2px 6px #000a; color: var(--gold); font: 700 26px/1 var(--font); display: grid; place-items: center; transition: transform .16s cubic-bezier(.2, 1.5, .4, 1), box-shadow .2s; }
.m-slot:not([style*="url"]) { border: 3px dashed #e8c27a99; }
.m-slot.me { box-shadow: 0 0 0 3px var(--gold), 0 0 14px #ffd27a99; transform: scale(1.06); }
.m-slot:active { transform: scale(.92); }

/* weapons / charms */
.m-card { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(180deg, #2f2566dd, #1c1640dd); border: 1px solid #e8c27a55; box-shadow: 0 2px 8px #0006; }
.m-card.eq { border-color: var(--gold); box-shadow: 0 0 0 1px #e8c27a66, 0 0 14px #e8c27a44; }
.m-card-ico { flex: none; width: 68px; height: 68px; border-radius: 12px; display: grid; place-items: center; border: 2px solid #8a9ee0; background: radial-gradient(circle at 50% 40%, #5a74c0, #1c2458); }
.m-card-ico.r4 { border-color: #c9a0ff; background: radial-gradient(circle at 50% 40%, #8a5ac8, #2c1a58); }
.m-card-ico.r5 { border-color: #ffd45a; background: radial-gradient(circle at 50% 40%, #e8a83a, #5a3412); }
.m-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-card-t { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 17px; }
.m-card-t b { color: #fff4e0; }
.m-charm { --t4: clamp(0, calc(var(--r, 3) - 3), 1); --t5: clamp(0, calc(var(--r, 3) - 4), 1);
  --cr: calc(90 + 70 * var(--t4) + 80 * var(--t5)); --cg: calc(140 - 40 * var(--t4) + 80 * var(--t5)); --cb: calc(220 - 150 * var(--t5));
  padding: 4px 8px 6px 10px; border-left: 4px solid rgb(var(--cr) var(--cg) var(--cb)); border-radius: 4px 10px 10px 4px; background: linear-gradient(90deg, rgb(var(--cr) var(--cg) var(--cb) / .26), transparent 80%); }
.m-charm.lvl { animation: mLvl 1.4s ease; }
@keyframes mLvl { 0% { box-shadow: 0 0 0 0 #ffe28a; } 25% { box-shadow: 0 0 0 4px #ffe28a, 0 0 22px #ffd27a; } 100% { box-shadow: 0 0 0 0 transparent; } }
.m-charm-h { display: flex; align-items: center; gap: 8px; }
.m-charm-n { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.m-charm-n b { font-size: 16px; color: #fff4e0; }
.m-main { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 2px 2px; font-size: 15px; color: #ffe9c0; }
.m-main b { font-size: 20px; color: #ffd27a; }
.m-subs { font-size: 14px; }
.m-sub-r { display: flex; justify-content: space-between; gap: 8px; padding: 1px 6px; border-radius: 5px; color: #dcd0f6; }
.m-sub-r b { color: #fff4e0; }
.m-sub-r.flash { animation: mFlash 1.3s ease; }
@keyframes mFlash { 0%, 100% { background: transparent; } 20%, 60% { background: #9be38a66; } }
.m-cslots { display: flex; flex-wrap: wrap; gap: 10px; }
.m-cslot { position: relative; flex: none; width: 58px; height: 58px; border-radius: 14px; border: 2px solid #e8c27a44; background: #241c52cc; display: grid; place-items: center; transition: transform .16s cubic-bezier(.2, 1.5, .4, 1), box-shadow .2s, background .2s; }
.m-cslot .m-ico { width: 40px; height: 40px; opacity: .5; }
.m-cslot.has .m-ico { opacity: 1; }
.m-cslot.on { border-color: var(--gold); background: #4a3a86; box-shadow: 0 0 12px #e8c27a88; transform: scale(1.06); }
.m-cslot:active { transform: scale(.92); }
.m-setb { margin: 6px 0 2px; font-size: 13px; line-height: 1.45; color: #a99fcf; }
.m-setb > div.on { color: var(--good); }
.m-setb b { color: inherit; }

/* story */
.m-story { margin: 0 0 10px; font-size: 15px; line-height: 1.7; color: #f3e9ff; }
.m-vsub { min-height: 44px; margin: 8px 2px 4px; font-size: 15px; font-style: italic; line-height: 1.5; color: #ffe0a0; opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.m-vsub.on { opacity: 1; transform: none; }

/* ═════ wish ═════ */
.m-wish-art { position: relative; flex: 1.05 1 0; min-width: 0; overflow: hidden; border-radius: 16px; border: 2px solid var(--gold); background: linear-gradient(165deg, #141048, #33248a 48%, #6a4ad0); box-shadow: inset 0 0 40px #0009, 0 0 18px #7a5ae055; }
.m-bolt { position: absolute; left: -40%; top: -40%; width: 180%; height: 180%; background: repeating-conic-gradient(from 0deg at 50% 62%, #ffffff18 0 7deg, transparent 7deg 18deg); animation: mSpin 40s linear infinite; pointer-events: none; }
@keyframes mSpin { to { transform: rotate(360deg); } }
.m-wish-chiyo { position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; max-width: 110%; object-fit: contain; transform: translateX(-50%); filter: drop-shadow(0 0 14px #b69aff) drop-shadow(0 8px 12px #000a); animation: mChiyo .6s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes mChiyo { from { opacity: 0; transform: translateX(-50%) translateY(30px) scale(.94); } to { opacity: 1; transform: translateX(-50%); } }
.m-wish-blade { position: absolute; right: 5%; bottom: 14%; width: 27%; height: auto; transform: rotate(-18deg); filter: drop-shadow(0 0 12px #ffe28a) drop-shadow(0 6px 8px #000a); animation: mBlade 3.2s ease-in-out infinite alternate; }
@keyframes mBlade { from { transform: rotate(-18deg) translateY(0); } to { transform: rotate(-14deg) translateY(-10px); } }
.m-wish-info { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.m-banner-t { font: 700 34px/1.2 var(--font); letter-spacing: .06em; color: #ffe3a0; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink), 0 0 20px #ffb85a88; animation: mSlam .4s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes mSlam { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }
.m-rate { font-size: 15px; line-height: 1.5; color: #ffe9c0; }
.m-bal { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 4px 18px 4px 6px; border-radius: 28px; background: #120c28dd; border: 2px solid var(--gold); font: 700 22px var(--font); text-shadow: 0 2px 0 var(--ink); }
.m-bal .m-dim { font-weight: 400; }
.m-wbtns { display: flex; flex-wrap: wrap; gap: 12px; }
.m-wbtns > .m-btn { flex: 1 1 140px; }
.m-wbtns.big > .m-btn, .m-wbtns .m-btn.big { flex-direction: column; gap: 2px; }
.m-wbtns.busy { pointer-events: none; }
.m-wbtns.small > .m-btn { flex: 1 1 120px; min-height: 48px; }
.m-bl { font-size: 20px; letter-spacing: .05em; }
.m-over { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px; background: radial-gradient(ellipse at 50% 45%, rgba(70, 44, 150, .7), rgba(6, 2, 18, .94) 80%); animation: mFade .25s ease both; }
.m-prizes { display: grid; gap: 14px; justify-content: center; grid-template-columns: repeat(5, 132px); }
.m-prizes.n1 { grid-template-columns: 170px; }
.m-prizes.n2 { grid-template-columns: repeat(2, 150px); }
.m-prizes.n3 { grid-template-columns: repeat(3, 150px); }
.m-prizes.n4 { grid-template-columns: repeat(4, 140px); }
.m-pcard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; padding: 12px 6px 8px; border-radius: 14px; background: linear-gradient(180deg, #3a2f86, #1c1646); border: 2px solid #e8c27a88; box-shadow: 0 4px 10px #0009; animation: mFlip .55s cubic-bezier(.2, 1.4, .4, 1) calc(var(--i, 0) * 110ms + 100ms) backwards; }
.m-pcard.rare { border-color: #ffe28a; background: linear-gradient(180deg, #e8a83a, #6a3a14); box-shadow: 0 0 0 2px #fff1b8, 0 0 28px #ffd27a; }
.m-pcard.rare::after { content: ""; position: absolute; inset: 0; border-radius: 12px; background: linear-gradient(115deg, transparent 30%, #ffffff77 50%, transparent 70%); background-size: 250% 100%; animation: mShine 1.8s ease-in-out .8s infinite; pointer-events: none; }
@keyframes mFlip { from { opacity: 0; transform: perspective(500px) rotateY(90deg) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes mShine { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.m-pn2 { max-width: 100%; text-align: center; font-size: 14px; font-weight: 700; line-height: 1.25; color: #fff4e0; text-shadow: 0 2px 0 var(--ink), 0 0 3px var(--ink); overflow-wrap: anywhere; }

/* effects */
.m-spark { position: fixed; width: 9px; height: 9px; margin: -4px 0 0 -4px; border-radius: 2px; background: #ffe28a; box-shadow: 0 0 8px #ffd27a, 0 0 2px #fff; pointer-events: none; z-index: 100; animation: mSpark .85s cubic-bezier(.2, .8, .4, 1) forwards; }
@keyframes mSpark { from { opacity: 1; transform: translate(0, 0) rotate(45deg) scale(1.1); } to { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -60px)) rotate(260deg) scale(.2); } }
.m-rw { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; }
.m-rwi { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: #ffe9a0; }
.m-rwi .m-ico { width: 22px; height: 22px; }
.m-held { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.m-held .m-hi { padding: 4px 14px 4px 8px; border-radius: 18px; background: #120c28cc; border: 1px solid #e8c27a77; font-size: 17px; }

/* ═════ quests / board ═════ */
.m-qlist { flex: 1; min-height: 0; padding: 4px 8px 8px 4px; display: flex; flex-direction: column; gap: 10px; }
.m-qlist > * { flex: none; }
.m-quest { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 14px; border-radius: 12px; background: linear-gradient(90deg, #2f2566dd, #1c1640dd); border: 1px solid #e8c27a44; }
.m-quest.cur { border-color: var(--gold); background: linear-gradient(90deg, #4d3c8ecc, #2a2058dd); box-shadow: 0 0 16px #e8c27a44; }
.m-quest.done { opacity: .62; }
.m-chk { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #e8c27a99; display: grid; place-items: center; color: var(--gold); font-weight: 700; font-size: 16px; }
.m-quest.cur .m-chk { background: #ffd27a; color: var(--ink); border-color: var(--ink); animation: mPulse 1.4s ease-in-out infinite; }
.m-quest.done .m-chk { background: #2e6a3a; border-color: var(--good); color: #eaffdf; }
@keyframes mPulse { 0%, 100% { box-shadow: 0 0 0 0 #ffd27a99; } 50% { box-shadow: 0 0 0 6px #ffd27a00; } }
.m-qmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.m-qmain > b { font-size: 17px; color: #ffe9c0; }
.m-quest > .m-btn { flex: none; min-width: 110px; }
.m-bar { position: relative; height: 18px; margin-top: 4px; border-radius: 9px; background: var(--deep); border: 1px solid #e8c27a99; overflow: hidden; }
.m-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(180deg, #ffe28a, #e8962a); transition: width .5s ease; }
.m-bar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px/1 var(--font); text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.m-boss { display: flex; align-items: stretch; gap: 16px; padding: 14px; border-radius: 14px; background: linear-gradient(90deg, #4a2046cc, #1c1640dd); border: 1px solid #e8a27a; box-shadow: 0 0 18px #c0402a44; }
.m-boss > img { flex: none; width: 36%; max-width: 250px; border-radius: 10px; object-fit: cover; border: 2px solid #e8a27a; }
.m-boss .m-qmain { gap: 6px; justify-content: center; }
.m-boss .m-btn { align-self: flex-start; }
.m-bt { font-size: 24px !important; color: #ffb89a !important; text-shadow: 0 2px 0 var(--ink); }
.m-note-paper { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px 12px 26px; border-radius: 4px; background: linear-gradient(180deg, #f9ebc9, #ecd5a2); color: #3a2a1a; box-shadow: 0 4px 10px #0008, inset 0 0 18px #c8a05a55; transform: rotate(-.35deg); }
.m-note-paper:nth-child(even) { transform: rotate(.4deg); }
.m-note-paper .m-qmain > b { color: #3a2a1a; text-shadow: none; }
.m-note-paper .m-dim { color: #6a5538; }
.m-note-paper .m-rwi { color: #6a2a10; }
.m-note-paper .m-bar { background: #d9bf8a; border-color: #8a6a3a; }
.m-note-paper .m-bar span { text-shadow: 0 1px 1px #fff8; color: #3a2a1a; }
.m-note-paper .m-bar i { background: linear-gradient(180deg, #ff9a5a, #d8402a); }
.m-note-paper.claimed { opacity: .55; filter: grayscale(.4); }
.m-note-paper.bonus { background: linear-gradient(180deg, #ffeaa0, #f0c060); border: 2px solid #c08a2a; }
.m-pin { position: absolute; left: 9px; top: 8px; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff9a8a, #c0302a 70%); box-shadow: 0 2px 3px #0006; }
.m-qlist.wood { padding: 14px 16px; border-radius: 12px; border: 4px solid #3a2414; box-shadow: inset 0 0 44px #000a; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .07) 0 2px, transparent 2px 9px), repeating-linear-gradient(180deg, #7e5230 0 70px, #4a2c18 70px 74px), #6a4428; }
.wood .m-note-paper { width: min(100%, 760px); align-self: center; }
.m-boardhint { text-align: center; font-size: 16px; font-weight: 700; color: #ffe9c0; text-shadow: 0 2px 0 #2a1608, 0 0 4px #2a1608; }

/* ═════ map ═════ */
.m-body.m-map { gap: 0; }
.m-body > .m-map { position: relative; flex: 1; min-width: 0; overflow: hidden; border-radius: 12px; border: 3px solid var(--gold); background: #0d1a2a; box-shadow: inset 0 0 30px #000a; touch-action: none; cursor: grab; user-select: none; }
.m-body > .m-map:active { cursor: grabbing; }
.m-world { position: absolute; left: 0; top: 0; }
.m-map-cv { display: block; width: 100%; height: 100%; pointer-events: none; }
.m-cross { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; opacity: .4; background: linear-gradient(#fff, #fff) center / 2px 100% no-repeat, linear-gradient(#fff, #fff) center / 100% 2px no-repeat; filter: drop-shadow(0 0 2px #000); z-index: 3; }
.m-rg { position: absolute; transform: translate(-50%, -50%); pointer-events: none; font: 700 15px/1 var(--font); letter-spacing: .1em; color: #fff4e0; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 2px 0 var(--ink); white-space: nowrap; opacity: .94; z-index: 1; }
.m-rg.town { font-size: 19px; color: #ffd9a0; }
.m-mk { position: absolute; z-index: 2; width: 30px; height: 30px; margin: -15px 0 0 -15px; display: grid; place-items: center; color: #fff; font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 2px #000a); pointer-events: none; }
.m-mk svg { width: 100%; height: 100%; display: block; }
button.m-mk { pointer-events: auto; }
.m-mk.tower { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
.m-mk.tower.lit { color: #ffb23a; filter: drop-shadow(0 0 8px #ff9a1a) drop-shadow(0 2px 2px #000a); animation: mFlick 1.6s ease-in-out infinite alternate; }
.m-mk.tower.unlit { color: #6a70a0; }
@keyframes mFlick { from { filter: drop-shadow(0 0 5px #ff9a1a) drop-shadow(0 2px 2px #000a); } to { filter: drop-shadow(0 0 11px #ffc23a) drop-shadow(0 2px 2px #000a); } }
.m-mk.wp { width: 46px; height: 46px; margin: -23px 0 0 -23px; padding: 9px; color: #ffe9a0; border-radius: 50%; background: radial-gradient(circle, #1b1430cc 55%, transparent 74%); transition: transform .16s cubic-bezier(.2, 1.5, .4, 1); }
.m-mk.wp::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 2px solid #ffe9a0; opacity: 0; animation: mRing 2s ease-out infinite; pointer-events: none; }
@keyframes mRing { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.m-mk.wp:active { transform: scale(.88); }
.m-mk.kf { transform: scale(1.18); }
@media (hover: hover) { .m-mk.wp:hover { transform: scale(1.2); } }
.m-mk.boss { font-size: 28px; color: #ff6a5a; text-shadow: 0 0 10px #ff2a2a, 0 2px 0 var(--ink); }
.m-mk.seal { font-size: 26px; color: #c9a0ff; text-shadow: 0 0 10px #8a4aff, 0 2px 0 var(--ink); }
.m-mk.npcq { width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: linear-gradient(180deg, #ffe28a, #e8962a); border: 2px solid var(--ink); color: var(--ink); font: 700 16px/1 var(--font); }
.m-mk.obj { width: 26px; height: 26px; margin: -13px 0 0 -13px; color: #7ae0ff; animation: mBob 1.1s ease-in-out infinite alternate; filter: drop-shadow(0 0 8px #5ad0ff); }
@keyframes mBob { from { transform: translateY(2px) scale(.95); } to { transform: translateY(-4px) scale(1.08); } }
.m-mk.player { z-index: 4; width: 34px; height: 34px; margin: -17px 0 0 -17px; filter: drop-shadow(0 0 8px #fffa) drop-shadow(0 2px 2px #000a); }
.m-zoom { display: flex; align-items: center; gap: 8px; }
.m-zoom > span { min-width: 46px; text-align: center; font: 700 16px var(--font); color: #ffe9c0; text-shadow: 0 2px 0 var(--ink); }
.m-zoom .m-chip { flex: none; width: 48px; height: 48px; padding: 0; font-size: 26px; line-height: 1; border-radius: 50%; }
.m-pop { position: absolute; left: 50%; top: 50%; z-index: 6; width: min(86%, 400px); padding: 20px 22px 18px; border-radius: 16px; background: #1c1640f4; border: 2px solid var(--gold); box-shadow: 0 0 0 4px #1b1430, 0 10px 34px #000b; text-align: center; transform: translate(-50%, -50%); animation: mPopC .24s cubic-bezier(.2, 1.5, .4, 1) both; cursor: default; }
@keyframes mPopC { from { opacity: 0; transform: translate(-50%, -46%) scale(.8); } to { opacity: 1; transform: translate(-50%, -50%); } }
.m-pop-t { margin-bottom: 14px; font-size: 18px; font-weight: 700; line-height: 1.4; color: #ffe9c0; text-shadow: 0 2px 0 var(--ink); }
.m-pop .m-acts { justify-content: center; margin-top: 4px; }

/* ═════ food stall ═════ */
.m-stallw { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 2px 4px; overflow-y: auto; touch-action: pan-y; scrollbar-width: none; }
.m-stallw::-webkit-scrollbar { display: none; }
.m-stallw.m-mkt { justify-content: flex-start; padding-top: 8px; padding-bottom: 16px; }
.m-mkt .m-offer { width: 210px; }
.m-mkt .m-sect { flex: none; font-size: 18px; color: #ffe9c0; text-shadow: 0 2px 0 #1c1646, 0 0 6px #0008; letter-spacing: 1px; margin-top: 6px; }
.m-sellg { flex: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; width: min(100%, 1120px); }
.m-sellr { display: flex; flex-direction: column; gap: 6px; }
.m-sellr > .m-btn { align-self: stretch; }
.m-stallline { position: relative; flex: none; max-width: 600px; padding: 10px 24px; border-radius: 24px; background: linear-gradient(180deg, #f9ebc9, #ecd5a2); color: #3a2a1a; font-size: 16px; line-height: 1.45; text-align: center; box-shadow: 0 4px 10px #0008; }
.m-stallline::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -9px; width: 18px; height: 18px; background: #ecd5a2; transform: rotate(45deg); border-radius: 0 0 4px 0; }
.m-offers { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.m-offer { width: 250px; padding: 14px 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border-radius: 16px; background: linear-gradient(180deg, #3a2f86dd, #1c1646dd); border: 2px solid #e8c27a77; box-shadow: 0 4px 12px #0008; }
.m-offer > b { font-size: 18px; color: #ffe9c0; }
.m-offer > .m-btn { align-self: stretch; margin-top: 4px; }
.m-offer-i { position: relative; display: grid; place-items: center; }
.m-offer-i .m-tag { position: absolute; right: -22px; bottom: -4px; }

/* ═════ compact: phones held sideways, small frames ═════ */
@media (max-height: 560px) {
  #menus { --bw: 14px; --pad: 20px; --hd: 48px; font-size: 14px; }
  .m-panel { width: calc(100% - 8px); height: calc(100% - 8px); }
  .m-panel::before { inset: 5px; }
  .m-head { gap: 8px; padding-left: 46px; padding-right: 56px; }
  .m-title { font-size: 22px; }
  .m-body { gap: 10px; }
  .m-characters, .m-wish { gap: 10px; }
  .m-x { width: 46px; height: 46px; }
  .m-chip { font-size: 15px; padding: 0 10px; }
  .m-btn { min-height: 48px; font-size: 15px; }
  .m-btn.big { min-height: 62px; font-size: 18px; }
  .m-list { width: 66px; padding: 6px 6px 6px 4px; gap: 10px; }
  .m-port { min-height: 52px; }
  .m-side { flex-basis: 54%; }
  .m-tabs { margin-bottom: 6px; }
  .m-name { font-size: 22px; -webkit-text-stroke-width: 4px; }
  .m-sub { font-size: 14px; }
  .m-meta { font-size: 13px; gap: 2px 6px; }
  .m-info { padding: 22px 10px 8px; }
  .m-lvbig { font-size: 24px; }
  .m-stats > div { min-height: 34px; padding: 2px 8px; font-size: 14px; }
  .m-stats b { font-size: 15px; }
  .m-card { padding: 8px 10px; gap: 10px; margin-bottom: 8px; }
  .m-card-ico { width: 56px; height: 56px; }
  .m-card-ico .m-ico.xl { width: 40px; height: 40px; }
  .m-card-t { font-size: 15px; }
  .m-slot { width: 52px; height: 52px; }
  .m-cslot { width: 54px; height: 54px; }
  .m-banner-t { font-size: 26px; -webkit-text-stroke-width: 5px; }
  .m-wish-info { gap: 8px; }
  .m-rate { font-size: 14px; }
  .m-bal { font-size: 19px; }
  .m-bl { font-size: 17px; }
  .m-prizes { gap: 8px; grid-template-columns: repeat(5, 112px); }
  .m-prizes.n1 { grid-template-columns: 150px; }
  .m-prizes.n2 { grid-template-columns: repeat(2, 130px); }
  .m-prizes.n3 { grid-template-columns: repeat(3, 130px); }
  .m-prizes.n4 { grid-template-columns: repeat(4, 118px); }
  .m-pcard { min-height: 96px; padding: 8px 4px 6px; gap: 3px; }
  .m-pcard .m-ico.xxl { width: 52px; height: 52px; }
  .m-pn2 { font-size: 13px; }
  .m-over { gap: 12px; padding: 10px; }
  .m-quest { min-height: 58px; padding: 8px 12px; }
  .m-qmain > b { font-size: 16px; }
  .m-note-paper { padding: 10px 14px 8px 24px; gap: 10px; }
  .m-bt { font-size: 20px !important; }
  .m-rg { font-size: 14px; }
  .m-rg.town { font-size: 17px; }
  .m-stallw { gap: 10px; }
  .m-stallline { padding: 6px 18px; font-size: 15px; }
  .m-offers { gap: 12px; }
  .m-offer { width: 340px; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "i t" "i d" "b b"; column-gap: 14px; row-gap: 2px; text-align: left; align-items: center; padding: 10px 14px; }
  .m-offer > :nth-child(1) { grid-area: i; }
  .m-offer > :nth-child(2) { grid-area: t; align-self: end; }
  .m-offer > :nth-child(3) { grid-area: d; align-self: start; }
  .m-offer > :nth-child(4) { grid-area: b; }
  .m-offer-i .m-ico.xxl { width: 56px; height: 56px; }
  .m-offer-i .m-tag { right: -16px; }
  .m-held .m-hi { font-size: 16px; padding: 3px 12px 3px 6px; }
}
@media (max-height: 420px) {
  .m-offer { width: 310px; }
  .m-offers { gap: 8px; }
}
@media (max-width: 760px) and (max-height: 560px) {
  .m-side { flex-basis: 58%; }
  .m-list { width: 62px; }
  .m-stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .m-fire, .m-bolt, .m-art, .m-wish-blade { animation: none; }
}
