/* ===== Steam 特价雷达 · 样式（零构建，纯 CSS） ===== */

/* 兜底：任何带 hidden 属性的元素都必须隐藏。
   否则 .toast { display:flex } 这类类选择器会覆盖 UA 样式表的 [hidden]{display:none}，
   导致「本应隐藏的提示条一直显示在页面上」。 */
[hidden] { display: none !important; }

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --border: #e3e6eb;
  --border-strong: #d3d8e0;
  --text: #14171c;
  --text-2: #5b626e;
  --text-3: #8a919d;
  /* 国内习惯：折扣 / 降价 / 现价使用红色 */
  --red: #d92d20;
  --red-hover: #b42318;
  --red-soft: #fef3f2;
  --red-border: #fecdca;
  --green: #0f8a5f;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1220px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #191c21;
    --surface-2: #21252b;
    --border: #2a2f37;
    --border-strong: #3a414b;
    --text: #e9ecf1;
    --text-2: #a2aab6;
    --text-3: #7b838f;
    --red: #ff6b60;
    --red-hover: #ff8b82;
    --red-soft: #2c1a19;
    --red-border: #52241f;
    --green: #3dd598;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 32px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.brand-name { font-size: 15px; letter-spacing: -.01em; }
.brand-region {
  font-size: 11px;
  font-weight: 500;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: 999px;
  padding: 1px 8px;
}
.statusline {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2);
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.tb-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 6px 13px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .14s ease;
}
.tb-btn:hover { border-color: var(--red); color: var(--red); }
.tb-btn:disabled { opacity: .6; cursor: default; }
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent);
  animation: pulse 2.4s ease-out infinite;
}
.pulse.offline { background: var(--text-3); animation: none; }
.pulse.warn { background: #e8a33d; animation: none; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------------- Hero ---------------- */

.hero { padding: 44px 0 8px; }
.hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.hero-sub {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 14.5px;
  max-width: 660px;
}
.hero-sub b { color: var(--red); font-weight: 600; }

.searchbar {
  position: relative;
  display: flex; align-items: center;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.search-icon { width: 18px; height: 18px; margin: 0 4px 0 14px; color: var(--text-3); flex: none; }
.searchbar.loading .search-icon { display: none; }
.searchbar input {
  flex: 1;
  border: 0; outline: 0; background: none;
  padding: 12px 4px;
  font-size: 14.5px;
  min-width: 0;
}
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  margin: 0 4px 0 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: qspin .7s linear infinite;
  flex: none;
}
.searchbar:not(.loading) .spinner { display: none; }
@keyframes qspin { to { transform: rotate(360deg); } }
.search-count {
  flex: none;
  margin-right: 8px;
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 999px;
  background: #f0f2f6;
  color: #4b5563;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.search-count.empty { background: rgba(217,45,32,.12); color: var(--red); }
.search-count b { color: #1f2328; font-weight: 600; }
.clear-q {
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 20px; line-height: 1;
  padding: 0 14px;
}

.statrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.stat {
  display: flex; align-items: baseline; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12.5px;
  color: var(--text-2);
}
.stat b { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.stat.accent b { color: var(--red); }

/* ---------------- 分节标题 ---------------- */

.section-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 34px 0 14px;
}
.section-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.section-note { font-size: 12.5px; color: var(--text-3); }

/* ---------------- 精选轨道 ---------------- */

.featured-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.featured-rail::-webkit-scrollbar { height: 6px; }
.featured-rail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.fcard {
  scroll-snap-align: start;
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.fcard .thumb { aspect-ratio: 460 / 215; }

/* ---------------- 工具栏 ---------------- */

.main-section { padding-bottom: 56px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  align-items: center; justify-content: flex-end;
  margin: 40px 0 14px;
}
.toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar-right select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  max-width: 190px;
}
.toggle {
  border: 1px dashed var(--border-strong);
  background: none;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-2);
  transition: all .14s ease;
}
.toggle:hover { border-color: var(--red); color: var(--red); }
.toggle[aria-pressed="true"] {
  border-style: solid;
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}

.resultbar {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-2);
  margin-bottom: 16px;
  min-height: 20px;
}
.resultbar b { color: var(--text); font-weight: 600; }
.mode-note { font-size: 12px; color: var(--text-3); }

/* ---------------- 卡片网格 ---------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }

.thumb {
  position: relative;
  background: var(--surface-2);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.badge {
  position: absolute; left: 10px; top: 10px;
  background: var(--red);
  color: #fff;
  font-size: 14px; font-weight: 700;
  letter-spacing: -.02em;
  padding: 4px 9px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}
/* 史低徽标：金色，叠在折扣角标下方 */
.badge.hist {
  top: 44px;
  background: linear-gradient(135deg, #b45309, #d97706);
  font-size: 12px;
  padding: 3px 9px;
  box-shadow: 0 2px 8px rgba(180, 83, 9, .45);
}
.pill {
  position: absolute; right: 10px; top: 10px;
  background: rgba(12, 14, 18, .74);
  color: #fff;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.pill.good { background: rgba(15, 138, 95, .88); }

.flag-new {
  position: absolute; left: 10px; bottom: 10px;
  background: var(--surface);
  color: var(--red);
  border: 1px solid var(--red-border);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }

.card-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
  letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.8em;
}
.card-meta {
  font-size: 11.5px; color: var(--text-3);
  margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tagrow {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 7px;
}
.tag {
  font-size: 10.5px; font-weight: 600; line-height: 1.6;
  color: #9a3412;
  background: #fdf3e7;
  border: 1px solid #f0d9bf;
  border-radius: 5px;
  padding: 0 6px;
  white-space: nowrap;
}
.card-desc {
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
  margin-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 3.75em;
}
.card-desc.empty { color: var(--text-3); font-style: normal; }
/* 本站整理的中文摘要标记（与 Steam 原文区分） */
.desc-tag {
  display: inline-block; vertical-align: 1px;
  margin-right: 5px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  font-size: 10.5px; line-height: 15px; color: var(--text-3); font-style: normal;
}

.price-row {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  margin-top: auto; padding-top: 12px;
}
.price-now { color: var(--red); font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.price-was { color: var(--text-3); font-size: 12.5px; text-decoration: line-through; }
.price-save {
  margin-left: auto;
  font-size: 11.5px; font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-3);
  flex-wrap: nowrap;
}
.plat { display: flex; gap: 5px; flex-shrink: 0; }
.plat span {
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10.5px;
  line-height: 16px;
  color: var(--text-2);
}
.countdown { color: var(--red); font-weight: 600; }
.rating { color: var(--green); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rating.mid { color: var(--text-2); font-weight: 400; }
.heat { color: #d97706; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.go { margin-left: auto; color: var(--text-2); font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.countdown { white-space: nowrap; flex-shrink: 0; }
.card:hover .go { color: var(--red); }

/* 骨架屏 */
.skeleton { border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border); }
.sk-line {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
}
.sk-thumb { aspect-ratio: 460 / 215; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk-line { animation: none; } }

/* ---------------- 空态 / 更多 ---------------- */

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 64px 20px;
  color: var(--text-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty strong { font-size: 15px; color: var(--text); }
.empty span { font-size: 13px; }

.more-wrap { display: flex; justify-content: center; margin-top: 26px; }
.btn-more {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 30px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-more:hover { border-color: var(--red); color: var(--red); }
.btn-more:disabled { opacity: .55; cursor: default; }

/* ---------------- 页脚 ---------------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer a:hover { color: var(--red); }
/* ICP 备案号（工信部要求悬挂，内容由 ICP_BEIAN 环境变量注入） */
.footer-beian { margin-top: 8px; font-size: 12px; }
.footer-beian:empty { display: none; }

/* ---------------- 提示条 ---------------- */

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: var(--text);
  color: var(--bg);
  border-radius: 12px;
  padding: 11px 14px 11px 18px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: rise .22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
.toast-action {
  border: 0; cursor: pointer;
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .hero h1 { font-size: 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 28px 0 4px; }
  .hero h1 { font-size: 21px; }
  .topbar-inner { height: 52px; }
  .brand-region { display: none; }
  .topbar-right { gap: 10px; }
  .statusline { font-size: 11.5px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .tb-btn { padding: 5px 10px; font-size: 11.5px; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar-right select { max-width: none; width: 100%; }
  .featured-rail { grid-auto-columns: minmax(200px, 78%); }
  .toast { left: 16px; right: 16px; transform: none; justify-content: space-between; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}
