:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #8a93a6;
  --line: #e7ebf3;
  --brand: #ff8a3d;
  --brand-2: #ffb070;
  --accent: #4c8dff;
  --green: #25b865;
  --red: #ef5b5b;
  --shadow: 0 4px 18px rgba(31, 36, 48, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 64px;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* 顶部栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { font-weight: 800; font-size: 17px; }
.stats { margin-left: auto; display: flex; gap: 12px; font-size: 14px; }
.stats b { font-variant-numeric: tabular-nums; }
.save-hint {
  font-size: 11px; background: rgba(255,255,255,.25);
  padding: 3px 8px; border-radius: 10px; white-space: nowrap;
}

/* 主体 */
.tab-panel { padding: 14px; flex: 1; }
.hidden { display: none !important; }

.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.act {
  border: none; border-radius: 12px; padding: 12px 10px;
  background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .08s;
}
.act:active { transform: scale(.96); }
.act.primary { background: var(--accent); color: #fff; }
.act.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.act:disabled { opacity: .5; cursor: not-allowed; }

.hint { font-size: 12px; color: var(--muted); margin: 4px 2px 12px; }

/* 货架网格 */
.shelves { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.shelf {
  background: var(--card); border-radius: 16px; padding: 12px;
  box-shadow: var(--shadow); cursor: pointer; position: relative;
  border: 2px solid transparent; transition: border-color .1s, transform .08s;
}
.shelf:active { transform: scale(.97); }
.shelf.selected { border-color: var(--accent); }
.shelf .emoji { font-size: 34px; }
.shelf .name { font-weight: 700; margin-top: 4px; }
.shelf .lv { position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 700; color: var(--brand); }
.shelf .price { font-size: 13px; color: var(--green); margin-top: 2px; }
.bar { height: 8px; background: var(--line); border-radius: 6px; margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.shelf .stock { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* 排行榜 */
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.rank-list .no { font-weight: 800; width: 26px; color: var(--muted); }
.rank-list .nm { flex: 1; font-weight: 600; }
.rank-list .cn { color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums; }

/* 账号 */
.input {
  width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 10px; font-size: 14px; background: var(--card);
}
.row { display: flex; gap: 10px; }
.row .act { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(31,36,48,.06);
}
.tab {
  flex: 1; border: none; background: none; padding: 10px 0;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.tab.active { color: var(--brand); font-weight: 700; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(20,24,34,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-card {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 380px;
  padding: 16px; box-shadow: var(--shadow); animation: pop .15s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; font-weight: 800; margin-bottom: 10px; }
.modal-head .x { margin-left: auto; border: none; background: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.modal-foot { margin-top: 12px; }
.modal-foot .act { width: 100%; }
.modal-body { font-size: 14px; }
.modal-body .kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.modal-body input[type=range] { width: 100%; }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; cursor: pointer; font-size: 12px; }
.pick.sel { border-color: var(--accent); background: #eef4ff; }
.fullbtn { width: 100%; margin-top: 8px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(31,36,48,.92); color: #fff; padding: 10px 16px;
  border-radius: 20px; font-size: 13px; z-index: 99; max-width: 80%; text-align: center;
}

h2 { font-size: 18px; margin: 4px 0 12px; }
