:root {
  --bg: #0f1220;
  --card: #1a1f35;
  --card-hover: #222947;
  --border: #2a3152;
  --text: #e6e9f5;
  --muted: #8b92b0;
  --primary: #4f7cff;
  --up: #ff5c5c;      /* 涨 = 红（虚拟物品通常涨红跌绿） */
  --down: #2ecc71;    /* 跌 = 绿 */
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "Segoe UI", sans-serif; font-size: 14px; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: #141830; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--primary); white-space: nowrap; }
.nav-links { display: flex; gap: 6px; flex: 1; }
.nav-links a {
  color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 8px;
}
.nav-links a:hover { background: var(--card); color: var(--text); }
.nav-links a.active { background: var(--primary); color: #fff; }
.clock { color: var(--muted); font-size: 12px; }
.site-alert-badge {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px;
  align-items: center; justify-content: center; margin-left: 4px;
  border-radius: 9px; background: var(--up); color: #fff;
  font-size: 11px; line-height: 18px; font-weight: 700;
}
.site-alert-badge[hidden] { display: none; }

.container { padding: 20px 24px; max-width: 1440px; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 12px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; }

/* 控件 */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar label { color: var(--muted); font-size: 13px; }
select, input[type="number"], input[type="text"] {
  background: #10142a; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 10px; outline: none;
}
select:focus, input:focus { border-color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  background: transparent; color: var(--muted); border: none;
  padding: 6px 14px; cursor: pointer; font-size: 13px;
}
.seg button.active { background: var(--primary); color: #fff; }
.btn {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 7px 16px; cursor: pointer; font-size: 13px;
}
.btn:hover { opacity: .9; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn.danger { background: #d0453e; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* 游戏卡片组 */
.game-group { margin-bottom: 8px; }
.game-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.game-header .gname { font-size: 16px; font-weight: 700; }
.game-header .gtag { font-size: 12px; color: var(--muted); }
.game-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.item-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: border-color .15s;
}
.item-card:hover { border-color: var(--primary); }
.item-card .iname { font-weight: 600; margin-bottom: 8px; }
.item-card .price { font-size: 20px; font-weight: 700; }
.item-card .meta { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; justify-content: space-between; }
.up { color: var(--up); }
.down { color: var(--down); }
.no-data { color: var(--muted); font-style: italic; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

/* 图表 */
.chart-box { width: 100%; height: 420px; }
.chart-box.small { height: 300px; }
.chart-range-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.chart-filters .seg { flex-wrap: wrap; }
.chart-gran-help { line-height: 1.6; margin: -4px 0 16px; }
.chart-coverage { margin-bottom: 18px; line-height: 1.7; }
.chart-coverage p { margin: 4px 0; }
#chart-history-note:not([hidden]) { padding: 8px 12px; border-left: 3px solid var(--muted); background: rgba(128,128,128,.08); }

/* 提醒设置 */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #3a4063; border-radius: 22px; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.site-alert-preferences {
  display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 10px;
}
.site-alert-preference {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 12px; background: #151a30;
  border: 1px solid var(--border); border-radius: 8px;
}
.site-alert-preference > span:first-child { display: grid; gap: 5px; }
.site-alert-preference strong { font-size: 13px; color: var(--text); }
.site-alert-preference small { color: var(--muted); line-height: 1.45; }
.site-alert-volume-row {
  display: flex; align-items: center; gap: 12px; grid-column: 1 / -1;
  color: var(--muted); font-size: 13px; padding-top: 4px;
}
.site-alert-volume-row input { width: min(360px, 70vw); accent-color: var(--primary); }
.site-alert-preference-actions { margin-top: 14px; margin-bottom: 0; }

.site-alert-stack {
  position: fixed; top: 72px; right: 20px; z-index: 120;
  width: min(380px, calc(100vw - 32px)); display: grid; gap: 10px;
}
.site-alert-card {
  display: grid; gap: 8px; padding: 16px;
  background: #1d233c; border: 1px solid var(--up);
  border-left: 4px solid var(--up); border-radius: var(--radius);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .34);
  animation: alert-slide-in .22s ease-out;
}
.site-alert-card strong { font-size: 15px; }
.site-alert-summary { color: #ff8a8a; font-weight: 600; }
.site-alert-detail { color: var(--muted); font-size: 13px; }
.site-alert-actions { display: flex; gap: 8px; margin-top: 4px; }
.site-alert-actions a { text-decoration: none; }
@keyframes alert-slide-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 820px) {
  .site-alert-preferences { grid-template-columns: 1fr; }
  .site-alert-stack { top: 64px; right: 16px; }
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--primary);
  border-radius: 20px; padding: 5px 12px; margin: 3px; font-size: 13px;
}
.pill .x { cursor: pointer; color: var(--muted); }

.toast {
  position: fixed; top: 70px; right: 20px; z-index: 99;
  background: var(--card); border: 1px solid var(--primary); color: var(--text);
  padding: 12px 18px; border-radius: 8px; display: none; max-width: 360px;
}
.toast.show { display: block; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; } }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
