:root {
  --accent: #ff5d8f;
  --accent-2: #ff7da3;
  --text: #5a3a46;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #ffe3ef 0%, #fff0d8 55%, #e3f0ff 100%);
  background-attachment: fixed; -webkit-user-select: none; user-select: none;
}
.wrap { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 24px); gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 22px; font-weight: 800; margin: 0; color: var(--accent); text-shadow: 0 2px 0 #fff; }
.back-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--accent);
  text-decoration: none; font-size: 20px; font-weight: 800; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.balance { background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 16px; text-align: center; }
.balance .big { font-size: 38px; font-weight: 900; color: var(--accent); }
.balance .sub { color: #a07a86; font-weight: 600; font-size: 13px; margin-top: 2px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 60px; border: none; background: #fff; color: var(--text); font-weight: 800; font-size: 14px;
  padding: 10px 6px; border-radius: 999px; box-shadow: var(--shadow); cursor: pointer; }
.tab.active { background: var(--accent); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.item { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 14px 8px; text-align: center; }
.item .face { font-size: 34px; line-height: 1.1; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.item .face.title-face { font-size: 17px; font-weight: 900; color: var(--accent); }
.item .nm { font-size: 13px; font-weight: 700; margin: 4px 0 8px; color: #7a5a66; }
.item .buy { border: none; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 800; cursor: pointer;
  background: var(--accent); color: #fff; width: 100%; }
.item .buy.owned { background: #eee; color: #9a8a90; }
.item .buy.equipped { background: #2faa4a; color: #fff; }
.item .buy.equip { background: #fff; color: var(--accent); border: 2px solid #ffd0de; }
.item .buy[disabled] { opacity: .5; }
.item .cost { font-size: 13px; font-weight: 800; color: #e0892e; }
.item.locked .face { filter: grayscale(1); opacity: .5; }

.panel { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.panel h3 { margin: 0 0 10px; color: var(--accent); font-size: 17px; }
.pt-row { display: flex; justify-content: space-between; font-weight: 700; color: #7a5a66; padding: 6px 0; }
.pt-row b { color: var(--accent); }
.pt-buy { margin-top: 12px; width: 100%; border: none; border-radius: 14px; padding: 14px; background: var(--accent); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; box-shadow: var(--shadow); }
.pt-buy[disabled] { opacity: .5; }

.ledger { display: flex; flex-direction: column; gap: 2px; }
.lrow { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid #f3e3ea; font-weight: 600; font-size: 14px; color: #7a5a66; }
.lrow .amt.plus { color: #2faa4a; font-weight: 800; }
.lrow .amt.minus { color: #e0524f; font-weight: 800; }
.empty { text-align: center; color: #b09aa2; padding: 20px; font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: rgba(40,30,35,.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 99; }
