/* iso-mvp UI: black & white only (pure #000 / #fff and their alpha). The art carries the colour. */
@font-face { font-family: "LXGW WenKai Screen"; src: url("../assets/fonts/lxgw-title.woff2") format("woff2"); font-display: swap; }
:root {
  --k: #000;
  --w: #fff;
  --k-80: rgba(0,0,0,.8);
  --k-55: rgba(0,0,0,.55);
  --k-30: rgba(0,0,0,.3);
  --k-10: rgba(0,0,0,.1);
  --k-06: rgba(0,0,0,.06);
  --glass: rgba(255,255,255,.9);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--w); color: var(--k);
  font: 500 14px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
button:focus-visible { outline: 1.5px solid var(--k); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; overflow: hidden; }
#canvas, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#canvas { touch-action: none; }
#fx { pointer-events: none; z-index: 20; }

/* ---------- top ---------- */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 14px 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-actions { display: flex; gap: 8px; }
.round-btn, .save-btn {
  height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
}
.round-btn {
  width: 44px; background: var(--glass);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px var(--k-10);
}
.round-btn svg { width: 22px; height: 22px; }
.round-btn:disabled { color: var(--k-30); }
.save-btn { padding: 0; background: var(--k); color: var(--w); font-size: 14px; }
.round-btn:active, .save-btn:active { transform: scale(.95); }

.more-menu {
  position: absolute; right: 14px; top: calc(62px + var(--safe-t));
  min-width: 148px; padding: 4px;
  border-radius: 14px; background: var(--w);
  box-shadow: 0 0 0 1px var(--k-10), 0 12px 32px rgba(0,0,0,.12);
  animation: drop .14s ease-out;
}
.more-menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; padding: 0 14px; border-radius: 10px; text-align: left; }
.more-menu button svg { width: 20px; height: 20px; flex-shrink: 0; }
.more-menu button:disabled { color: var(--k-30); }
#btn-music[aria-pressed="true"] .music-off { display: none; }
.more-menu button:active { background: var(--k-06); }
@keyframes drop { from { transform: translateY(-4px); opacity: 0; } }

/* ---------- floating menu by the selected sticker ---------- */
.sticker-menu {
  position: absolute; z-index: 9; left: 0; top: 0;
  display: flex; align-items: center; padding: 2px;
  border-radius: 999px; background: var(--k); color: var(--w);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  will-change: transform;
}
.sticker-menu button { width: 46px; height: 42px; border-radius: 999px; display: grid; place-items: center; }
.sticker-menu button svg { width: 21px; height: 21px; }
.sticker-menu button:active { background: rgba(255,255,255,.16); }
.menu-sep { width: 1px; height: 18px; background: rgba(255,255,255,.22); }
.sticker-menu.solo .menu-sep, .sticker-menu.solo [data-act="flip"] { display: none; }

.hint, .toast {
  position: absolute; z-index: 12; left: 50%; top: calc(66px + var(--safe-t));
  transform: translateX(-50%); max-width: calc(100% - 32px);
  border-radius: 999px; font-size: 13px; white-space: nowrap;
  background: var(--k); color: var(--w);
}
.hint { padding: 10px 16px; pointer-events: none; }
.toast { z-index: 25; display: flex; align-items: center; padding: 3px 3px 3px 16px; gap: 6px; }
.toast button { height: 38px; padding: 0 14px; border-radius: 999px; background: var(--w); color: var(--k); }

/* ---------- tray ---------- */
.tray-wrap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  padding-bottom: var(--safe-b);
  background: var(--w);
  box-shadow: 0 -1px 0 var(--k-10);
}
.drop-label {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  background: var(--k); color: var(--w); font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.tray-wrap.drop-hot .drop-label { opacity: 1; }
.tray {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; overflow-y: hidden; padding: 10px 8px 12px;
  scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-x;
}
.tray::-webkit-scrollbar { display: none; }
.sep { flex: 0 0 auto; width: 1px; margin: 18px 6px 26px; background: var(--k-10); }
.chip {
  flex: 0 0 auto; width: 78px; padding: 6px 0 4px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 14px; touch-action: pan-x; cursor: grab;
}
.chip img {
  width: 58px; height: 58px; object-fit: contain;
  pointer-events: none; -webkit-user-drag: none;
  transition: transform .18s, opacity .15s;
}
.chip span { font-size: 11px; color: var(--k-55); transition: color .15s; }
.chip:active img { transform: scale(1.06); }
.chip.armed { box-shadow: inset 0 0 0 1.5px var(--k); }
.chip.armed img { transform: translateY(-3px) scale(1.08); }
.chip.armed span { color: var(--k); }
.chip.picked img { opacity: .25; }

.loader {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  background: var(--w); transition: opacity .3s;
}
.loader.done { opacity: 0; pointer-events: none; }
.bar { width: 120px; height: 2px; background: var(--k-10); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--k); transition: width .15s; }

/* night: canvas goes dark gray, so black pills on it flip to white */
body.is-night .save-btn,
body.is-night .hint, body.is-night .toast { background: var(--w); color: var(--k); }
body.is-night .toast button { background: var(--k); color: var(--w); }
.save-btn, .hint, .toast { transition: background-color .4s, color .4s; }


.top { gap: 10px; }
.top-actions { flex-shrink: 0; gap: 6px; }
.room-title, .room-switcher button span, .discovery-heading small, .discovery-heading h2, .discovery-pop strong, .discovery-row strong { font-family: "LXGW WenKai Screen", "Kaiti SC", "STKaiti", "KaiTi", serif; font-weight: 400; }
.room-switcher button span { font-size: 17px; }
.room-title { min-width: 0; flex: 1; min-height: 52px; text-align: left; }
.room-heading { display: flex; align-items: center; gap: 4px; font-size: 20px; font-weight: 400; letter-spacing: 0; }
#room-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-location { display: flex; align-items: center; gap: 4px; min-width: 0; }
.room-location svg { width: 12px; height: 12px; flex-shrink: 0; }
.room-subtitle { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12px; opacity: .65; white-space: nowrap; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#achievement-count { flex-shrink: 0; font-variant-numeric: tabular-nums; }
body.is-night .room-title { color: var(--w); }
.save-btn { background: var(--k); color: var(--w); }
.room-switcher { position: absolute; left: 14px; top: calc(70px + var(--safe-t)); width: 250px; padding: 5px; border-radius: 14px; background: var(--w); color: var(--k); box-shadow: 0 0 0 1px var(--k-10), 0 12px 32px rgba(0,0,0,.15); animation: drop .14s ease-out; }
.room-switcher button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 52px; padding: 0 12px; border-radius: 9px; text-align: left; }
.room-switcher button:hover { background: var(--k-06); }
.room-switcher svg { width: 18px; height: 18px; visibility: hidden; }
.room-switcher [aria-current="true"] svg { visibility: visible; }
.more-menu { top: calc(70px + var(--safe-t)); }

body.is-night .room-title:focus-visible { outline-color: var(--w); }

.chip-label { white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.is-empty img { opacity: .25; }
.chip.is-empty { cursor: default; }
.chip.is-empty:active img { transform: none; }
.discovery-pop {
  position: absolute; z-index: 26; left: 50%; top: calc(88px + var(--safe-t));
  width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 16px 22px;
  border-radius: 16px; background: var(--k); color: var(--w);
  box-shadow: none; pointer-events: none;
}
.discovery-pop small { display: block; font-size: 11px; color: rgba(255,255,255,.65); margin-bottom: 4px; }
.discovery-pop strong { font-size: 18px; font-weight: 600; }
.discovery-spark { font-size: 32px; }
.discovery-pop.reveal { animation: discover .5s cubic-bezier(.2,.8,.2,1) both; }
.discovery-pop.reveal .discovery-spark { animation: sparkle 1.4s ease-out both; }
.discovery-confetti { position: absolute; left: 38px; top: 50%; pointer-events: none; }
.discovery-confetti i {
  position: absolute; width: 4px; height: 7px; border-radius: 1px;
  background: var(--w); box-shadow: 0 0 0 1px rgba(0,0,0,.5);
  animation: confetti .9s ease-out both;
}
.discovery-confetti i:nth-child(3n) { width: 5px; height: 5px; border-radius: 50%; }
@keyframes confetti {
  0% { opacity: 0; transform: translate(0, 0) scale(.3); }
  15% { opacity: 1; }
  65% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 24px)) rotate(var(--spin)) scale(.5); }
}
@keyframes discover { from { opacity: 0; transform: translate(-50%, 18px) scale(.88); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes sparkle { 0% { transform: scale(.3) rotate(-45deg); } 35% { transform: scale(1.25) rotate(12deg); } 100% { transform: scale(1) rotate(0); } }
.discovery-overlay { position: absolute; inset: 0; z-index: 28; display: flex; align-items: flex-end; background: rgba(0,0,0,.35); }
.discovery-sheet { width: 100%; max-height: 82%; overflow-y: auto; background: var(--w); color: var(--k); border-radius: 28px 28px 0 0; padding: 26px 22px calc(22px + var(--safe-b)); outline: none; }
.discovery-heading { display: flex; justify-content: space-between; align-items: center; }
.discovery-heading small { color: var(--k-55); }
.discovery-heading h2 { font-size: 23px; margin: 7px 0 0; font-weight: 600; }
#discoveries-close { width: 48px; height: 48px; border-radius: 50%; font-size: 28px; background: var(--k-06); flex-shrink: 0; }
#discoveries-progress { color: var(--k-55); font-size: 13px; margin: 16px 0 20px; }
.discovery-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--k-10); }
.discovery-medal { width: 42px; height: 42px; border-radius: 50%; background: var(--k-06); display: grid; place-items: center; font-size: 20px; color: var(--k-55); }
.is-unlocked .discovery-medal { background: var(--k); color: var(--w); }
.discovery-row strong { display: block; font-weight: 500; font-size: 15px; }
.discovery-row small { display: block; margin-top: 4px; color: var(--k-55); font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .discovery-pop.reveal, .discovery-pop.reveal .discovery-spark { animation: none; } }
@media (prefers-reduced-motion: reduce) { .discovery-confetti { display: none; } }

.tray-wrap { transition: background-color .4s, color .4s; }
body.is-night .tray-wrap { background: #141414; color: var(--w); box-shadow: 0 -1px 0 rgba(255,255,255,.12); }
body.is-night .chip span { color: rgba(255,255,255,.65); }
body.is-night .chip.armed { box-shadow: inset 0 0 0 1.5px var(--w); }
body.is-night .chip.armed span { color: var(--w); }
body.is-night .sep { background: rgba(255,255,255,.12); }
body.is-night .drop-label { background: var(--w); color: var(--k); }
body.is-night .discovery-sheet { background: #141414; color: var(--w); box-shadow: 0 -1px 0 rgba(255,255,255,.12); }
body.is-night .discovery-heading small,
body.is-night #discoveries-progress,
body.is-night .discovery-row small { color: rgba(255,255,255,.55); }
body.is-night #discoveries-close { background: rgba(255,255,255,.1); color: var(--w); }
body.is-night .discovery-row { border-color: rgba(255,255,255,.12); }
body.is-night .discovery-medal { background: rgba(255,255,255,.1); color: rgba(255,255,255,.65); }
body.is-night .is-unlocked .discovery-medal { background: var(--w); color: var(--k); }
body.is-night .discovery-pop { background: var(--k); color: var(--w); box-shadow: none; }
body.is-night .discovery-pop small { color: rgba(255,255,255,.65); }

/* Photo preview: the card is the surface; controls stay outside its artwork. */
.photo-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(8px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: var(--w); color: var(--k); }
.photo-sheet { width: 100%; max-width: 520px; height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 12px; outline: none; }
.photo-heading { display: flex; justify-content: flex-end; flex-shrink: 0; }
#photo-close { width: 48px; height: 48px; display: grid; place-items: center; }
#photo-close svg { width: 22px; height: 22px; }
#photo-image { width: 100%; min-height: 0; object-fit: contain; object-position: center top; flex: 1 1 auto; }
#photo-status { margin: 0; text-align: center; font-size: 13px; opacity: .6; flex: 1; display: grid; place-items: center; }
#photo-download { min-height: 52px; width: min(100%, 320px); padding: 0 28px; align-self: center; border-radius: 999px; background: var(--k); color: var(--w); flex-shrink: 0; font-size: 16px; }
#photo-download:disabled { opacity: .4; }
#photo-close:active, #photo-download:active { opacity: .65; }
body.is-night .photo-overlay { background: #141414; color: var(--w); }
body.is-night #photo-download { background: var(--w); color: var(--k); }
body.is-night .photo-sheet button:focus-visible { outline-color: var(--w); }

.discovery-heading h2, .discovery-pop strong, .discovery-row strong { font-weight: 400; }

/* 花房小店 */
.wallet-btn { height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; background: var(--w); color: var(--k); box-shadow: inset 0 0 0 1px var(--k-30, rgba(0,0,0,.3)); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-btn[hidden], .sell-btn[hidden], .sell-sep[hidden], #btn-shop-exit[hidden], .chip[hidden] { display: none; }
.wallet-btn:active { transform: scale(.95); }
.sticker-menu button.sell-btn { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: inherit; }
.buy-sheet { padding-bottom: calc(20px + var(--safe-b)); }
.buy-main { display: flex; align-items: center; gap: 16px; }
.buy-main img { width: 84px; height: 84px; object-fit: contain; flex-shrink: 0; }
.buy-main h2 { margin: 0; font-size: 22px; font-weight: 400; font-family: "LXGW WenKai Screen", "Kaiti SC", serif; }
.buy-main strong { display: block; margin-top: 4px; font-size: 26px; font-variant-numeric: tabular-nums; }
#buy-compare, #buy-status { margin: 12px 0 0; font-size: 14px; line-height: 1.5; }
#buy-compare { color: var(--k-55); }
.buy-actions { display: flex; gap: 10px; margin-top: 18px; }
.buy-actions button { flex: 1; height: 52px; border-radius: 999px; font-size: 16px; }
#buy-cancel { box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
#buy-confirm { background: var(--k); color: var(--w); }
#buy-confirm:disabled { background: rgba(0,0,0,.12); color: rgba(0,0,0,.4); }
.ledger-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.ledger-summary div { padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.05); min-width: 0; }
.ledger-summary small { display: block; font-size: 12px; color: var(--k-55); }
.ledger-summary strong { display: block; margin-top: 2px; font-size: 18px; font-variant-numeric: tabular-nums; }
#ledger-jobs { margin: 0 0 8px; font-size: 13px; color: var(--k-55); }
#ledger-list { max-height: 42vh; overflow-y: auto; }
.ledger-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid rgba(0,0,0,.08); font-size: 15px; }
.ledger-row small { display: block; margin-top: 2px; font-size: 12px; color: var(--k-55); }
.ledger-row strong { font-variant-numeric: tabular-nums; font-weight: 600; flex-shrink: 0; }
.ledger-empty { font-size: 14px; color: var(--k-55); }
