/* ============================================================
   绿地桌游库 — 设计系统
   深色主题，暖色强调，为「快速扫视 + 多维筛选」优化
   ============================================================ */

/* 导航上的想玩数量角标 */
.nav a b {
  display: inline-block;
  min-width: 17px;
  margin-left: 3px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

/* B 站玩法视频 */
.video-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 9px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.video-row:hover { background: var(--bg-elev-2); }
.video-thumb {
  position: relative;
  width: 92px; height: 58px; flex: none;
  border-radius: 7px;
  background: var(--bg-elev-2);
  overflow: hidden;
}
.video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-dur {
  position: absolute; right: 3px; bottom: 3px;
  padding: 1px 4px; border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff; font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.video-title {
  font-size: 13px; font-weight: 550; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }


:root {
  --bg: #0e1014;
  --bg-elev: #161922;
  --bg-elev-2: #1d212c;
  --bg-hover: #232838;
  --border: #2a3040;
  --border-soft: #212633;
  --text: #e9ecf1;
  --text-dim: #98a1b3;
  --text-faint: #6a7387;
  --accent: #f0a63c;
  --accent-soft: rgba(240, 166, 60, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --blue: #5fa8fa;
  --blue-soft: rgba(95, 168, 250, 0.14);
  --purple: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --header-h: 60px;
}

* { box-sizing: border-box; }

/* 视图切换靠 hidden 属性，但 .layout 的 display:grid 会盖掉浏览器的默认规则 */
[hidden] { display: none !important; }

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

body { min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

/* ---------------- 顶部导航 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(14, 16, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #d97706);
  display: grid; place-items: center;
  font-size: 14px;
  color: #1a1204;
  flex: none;
}

.nav { display: flex; gap: 4px; margin-left: 8px; }

.nav a {
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.nav a:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.14s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap::before {
  content: "🔍";
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.55;
  pointer-events: none;
}

/* ---------------- 布局 ---------------- */

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
  max-width: 1680px;
  margin: 0 auto;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 620;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
}
.panel-head .chev { font-size: 10px; opacity: 0.55; transition: transform 0.16s; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .chev { transform: rotate(-90deg); }

/* ---------------- 表单元素 ---------------- */

.field { margin-bottom: 11px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--text-dim); margin-bottom: 5px;
}
.field-label b { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

select {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
select:focus { border-color: var(--accent); }

/* 筹码按钮 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 4px 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.14s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 560;
}
.chip.sm { padding: 3px 8px; font-size: 11px; }

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.tag.amber { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.tag.blue  { background: var(--blue-soft);  color: var(--blue);  border-color: transparent; }
.tag.red   { background: var(--red-soft);   color: var(--red);   border-color: transparent; }

/* ---------------- 主内容区 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.result-count { color: var(--text-dim); font-size: 13px; }
.result-count b { color: var(--text); font-variant-numeric: tabular-nums; }

.btn {
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 550;
  transition: all 0.14s;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1204;
  font-weight: 620;
}
.btn.primary:hover { filter: brightness(1.1); color: #1a1204; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

.spacer { flex: 1; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.active-filters:empty { display: none; }
.pill-x {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(240, 166, 60, 0.3);
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent);
}
.pill-x button {
  background: none; border: none; padding: 0;
  color: inherit; opacity: 0.65; font-size: 13px; line-height: 1;
}
.pill-x button:hover { opacity: 1; }

/* ---------------- 游戏卡片 ---------------- */

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

.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.thumb {
  position: relative;
  /* 竖版：桌游封面基本都是竖的。
     之前用 3/2 横版配 object-fit: cover，只会显示封面中间一条横带，
     等于把一小条放大铺满，既看不清内容又发糊。 */
  aspect-ratio: 3 / 4;
  background: var(--bg-elev-2);
  overflow: hidden;
}

/* 占位图始终垫在最底下，有封面时 <img> 叠在它上面；
   图片加载失败会把自己移除，露出占位图，不会出现碎图图标 */
.thumb .ph,
.thumb img,
.vthumb .ph,
.vthumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.thumb .ph,
.vthumb .ph { display: grid; place-items: center; }
.thumb img,
.vthumb img { object-fit: cover; display: block; }

.thumb .ph {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.22);
  text-transform: uppercase;
}
.thumb .rank-badge {
  position: absolute; top: 7px; left: 7px;
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.thumb .myrating {
  position: absolute; top: 7px; right: 7px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.thumb .myrating.unrated { color: var(--text-faint); font-weight: 500; font-size: 11px; }

/* 想玩星标：封面右下角，不挡排名和评分 */
.thumb .want-btn {
  position: absolute; right: 7px; bottom: 7px;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  transition: color 0.12s, background 0.12s, transform 0.12s;
}
.thumb .want-btn:hover { background: rgba(0, 0, 0, 0.78); transform: scale(1.08); }
.thumb .want-btn.on { color: #ffd166; background: rgba(0, 0, 0, 0.72); }

.card-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 7px; flex: 1; }

.card-title { font-weight: 620; font-size: 14px; line-height: 1.3; }
.card-title .orig {
  display: block;
  font-weight: 450;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.card-meta .best { color: var(--green); font-weight: 600; }
.card-meta .warn { color: var(--red); }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }

/* 难度小条 */
.wbar {
  display: inline-flex; gap: 2px; align-items: center;
}
.wbar i {
  width: 5px; height: 9px; border-radius: 1.5px;
  background: var(--border); display: block;
}
.wbar i.on { background: var(--accent); }

/* ---------------- 详情抽屉 ---------------- */

.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(760px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 91;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.drawer-body { overflow-y: auto; padding: 18px; flex: 1; }
.drawer-body::-webkit-scrollbar { width: 10px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }

.close-btn {
  margin-left: auto;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  flex: none;
}
.close-btn:hover { color: var(--text); border-color: var(--accent); }

.detail-hero { display: flex; gap: 16px; margin-bottom: 18px; }
.detail-hero .art {
  width: 200px; flex: none;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  display: grid; place-items: center;
  overflow: hidden;
}
.detail-hero .art img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .art .ph { font-size: 30px; font-weight: 700; color: rgba(255,255,255,0.2); }
.detail-hero h1 { margin: 0 0 2px; font-size: 21px; font-weight: 680; line-height: 1.25; }
.detail-hero .orig-name { color: var(--text-faint); font-size: 12.5px; margin-bottom: 9px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 7px; }
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.35;
}
.stat .k { color: var(--text-faint); display: block; font-size: 10.5px; }
.stat .v { font-weight: 620; font-variant-numeric: tabular-nums; }

.section { margin-top: 22px; }
.section > h3 {
  margin: 0 0 9px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}
.section > h3::after {
  content: ""; flex: 1; height: 1px; background: var(--border-soft);
}

.zh-summary {
  background: linear-gradient(180deg, rgba(240,166,60,0.07), rgba(240,166,60,0.02));
  border: 1px solid rgba(240, 166, 60, 0.22);
  border-radius: var(--radius);
  padding: 14px 15px;
}
.zh-summary .tagline {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
}
.zh-summary .what { color: var(--text); margin-bottom: 12px; }

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .pros-cons { grid-template-columns: 1fr; } }
.pros-cons ul { margin: 0; padding-left: 17px; }
.pros-cons li { margin-bottom: 3px; }
.pros-cons .pros li::marker { color: var(--green); }
.pros-cons .cons li::marker { color: var(--red); }

.player-fit { display: flex; flex-direction: column; gap: 5px; }
.fit-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.fit-row .lbl { width: 46px; flex: none; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fit-bars { flex: 1; display: flex; gap: 3px; height: 17px; }
.fit-bars .seg { border-radius: 3px; display: grid; place-items: center; font-size: 10px; color: rgba(0,0,0,0.7); font-weight: 700; min-width: 2px; }
.fit-tag { width: 62px; flex: none; font-size: 11px; text-align: right; }

.comment {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.comment .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-faint); margin-bottom: 5px;
}
.comment .score { color: var(--green); font-weight: 650; font-variant-numeric: tabular-nums; }

.original-text {
  white-space: pre-wrap;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  max-height: 340px;
  overflow-y: auto;
}

details.fold > summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  padding: 7px 0;
  user-select: none;
}
details.fold > summary:hover { color: var(--accent); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: 0.5; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 200;
  transition: transform 0.25s;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%); }
.toast.err { border-color: var(--red); color: var(--red); }

.mobile-filter-btn { display: none; }

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

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(310px, 88vw);
    max-height: none;
    background: var(--bg);
    border-right: 1px solid var(--border);
    z-index: 95;
    padding: 16px;
    transform: translateX(-100%);
    transition: transform 0.22s;
    overflow-y: auto;
  }
  .sidebar.open { transform: none; }
  .mobile-filter-btn { display: inline-flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 11px; }
  .detail-hero { flex-direction: column; }
  .detail-hero .art { width: 100%; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .brand span { display: none; }
}
