/* ---------- tokens ---------- */
:root {
  --bg: oklch(97.5% 0.003 90);
  --bg-2: oklch(94% 0.004 90);
  --bg-3: oklch(90% 0.005 90);
  --line: oklch(86% 0.005 90);
  --fg: oklch(13% 0.005 90);
  --fg-2: oklch(42% 0.006 90);
  --fg-3: oklch(60% 0.006 90);
  --accent: oklch(58% 0.21 28);
  --font: "Archivo", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(12% 0.004 90);
    --bg-2: oklch(17% 0.005 90);
    --bg-3: oklch(22% 0.006 90);
    --line: oklch(26% 0.006 90);
    --fg: oklch(96% 0.004 90);
    --fg-2: oklch(70% 0.006 90);
    --fg-3: oklch(52% 0.006 90);
    --accent: oklch(68% 0.2 30);
  }
}
:root[data-theme="dark"] {
  --bg: oklch(12% 0.004 90); --bg-2: oklch(17% 0.005 90); --bg-3: oklch(22% 0.006 90); --line: oklch(26% 0.006 90);
  --fg: oklch(96% 0.004 90); --fg-2: oklch(70% 0.006 90); --fg-3: oklch(52% 0.006 90); --accent: oklch(68% 0.2 30);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--fg); color: var(--bg); }

.wide { font-variation-settings: "wdth" 115; }

/* ---------- masthead ---------- */
.mast {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; background: var(--bg);
}
.brand { text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: -.01em; font-variation-settings: "wdth" 112; text-transform: uppercase; }
.mast-nav { display: flex; gap: 22px; font-size: 13px; letter-spacing: .02em; }
.mast-nav a { text-decoration: none; color: var(--fg-2); transition: color .15s; }
.mast-nav a:hover, .mast-nav a[aria-current] { color: var(--fg); }

main { padding: 0 var(--gutter); min-height: 70vh; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1fr; gap: 24px;
  padding: clamp(32px, 6vw, 72px) 0 clamp(28px, 4vw, 48px);
  border-bottom: 1px solid var(--fg);
}
@media (min-width: 860px) { .hero { grid-template-columns: 1fr auto; align-items: end; } }
.hero-title {
  margin: 0; font-weight: 800; text-transform: uppercase; line-height: .86; letter-spacing: -.04em;
  font-size: clamp(64px, 14.5vw, 220px); font-variation-settings: "wdth" 118;
}
.hero-title span { display: block; }
.hero-side { display: flex; flex-direction: column; gap: 14px; max-width: 30ch; }
@media (min-width: 860px) { .hero-side { align-items: flex-end; text-align: right; padding-bottom: 10px; } }
.hero-num { margin: 0; font-weight: 800; font-size: clamp(40px, 5vw, 72px); line-height: 1; letter-spacing: -.03em; font-variation-settings: "wdth" 110; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: .35em; font-weight: 500; margin-left: 6px; letter-spacing: 0; font-variation-settings: "wdth" 100; color: var(--fg-2); }
.hero-sub { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.6; }

/* ---------- controls ---------- */
.controls {
  display: grid; gap: 12px 28px; grid-template-columns: minmax(0, 1fr);
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
@media (min-width: 1000px) {
  .controls { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
}
.ctl { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ctl-label { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--fg-3); font-weight: 600; white-space: nowrap; }
.pills { display: flex; gap: 4px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent; border-radius: 2px;
  padding: 6px 11px; font-size: 13px; cursor: pointer; line-height: 1.2; color: var(--fg-2);
  transition: border-color .15s, background .15s, color .15s;
}
.pill:hover { border-color: var(--fg); color: var(--fg); }
.pill[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.ctl-players .pill { min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.ctl-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.ctl-search input, .ctl-search select {
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  padding: 7px 11px; font-size: 13px; min-width: 0; color: var(--fg);
}
.ctl-search input { width: 210px; }
.ctl-search input::placeholder { color: var(--fg-3); }
.ctl-search input:focus, .ctl-search select:focus { outline: none; border-color: var(--fg); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.filter-btn { flex: 0 0 auto; font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .02em; background: transparent; color: var(--fg); border: 1px solid var(--fg); border-radius: 2px; padding: 7px 12px; cursor: pointer; transition: background .15s, color .15s; }
.filter-btn::after { content: "  +"; }
.filter-btn[aria-expanded="true"] { background: var(--fg); color: var(--bg); }
.filter-btn[aria-expanded="true"]::after { content: "  –"; }
.controls[hidden] { display: none; }
.grid { margin-top: 24px; }
.result-line { margin: 0; color: var(--fg-3); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.result-line b { color: var(--fg); font-weight: 700; }
.result-line button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0 0 0 12px; text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------- grid ---------- */
.grid {
  display: grid; gap: clamp(22px, 3vw, 40px) clamp(12px, 1.6vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-flow: dense; padding-bottom: 100px;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .tile.is-top { grid-column: span 2; grid-row: span 2; }
}
.tile {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; min-width: 0;
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 20ms);
}
.tile-art {
  position: relative; display: block; width: 100%; padding-top: 100%;
  background: var(--bg-2); border-radius: 2px;
  transition: background .25s;
}
.tile-art img { position: absolute; left: 9%; top: 9%; width: 82%; height: 82%; object-fit: contain; filter: drop-shadow(0 1px 2px oklch(0% 0 0 / .12)) drop-shadow(0 8px 12px oklch(0% 0 0 / .18)); transition: transform .5s var(--ease); }
.tile:hover .tile-art { background: var(--bg-3); }
.tile:hover .tile-art img { transform: translateY(-3px) scale(1.02); }
.tile:focus-visible { outline: none; }
.tile:focus-visible .tile-art { box-shadow: 0 0 0 2px var(--fg); }
.tile-art .ph { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: clamp(36px, 7vw, 72px); color: var(--fg-3); letter-spacing: -.04em; line-height: 1; font-variation-settings: "wdth" 115; }
.tile-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px; border-top: 1px solid var(--line); }
.tile-zh { font-weight: 700; font-size: 15px; line-height: 1.3; letter-spacing: -.005em; padding-top: 8px; }
.is-top .tile-zh { font-size: 19px; }
.tile-en { font-size: 12.5px; color: var(--fg-2); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 6px; font-size: 11px; color: var(--fg-3); letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.tile-meta .bgg { color: var(--fg); font-weight: 700; font-size: 12px; }
.tile-meta .bgg::before { content: "BGG "; font-weight: 500; color: var(--fg-3); }
.tile-meta .mine { color: var(--accent); letter-spacing: .02em; }

.empty { padding: 60px 0; color: var(--fg-2); grid-column: 1 / -1; }
.empty b { display: block; font-size: 28px; font-weight: 800; color: var(--fg); margin-bottom: 8px; letter-spacing: -.02em; }

/* ---------- detail ---------- */
.detail { padding: clamp(16px, 2.5vw, 32px) 0 80px; animation: fade .4s var(--ease) both; }
.crumb { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; color: var(--fg-2); margin-bottom: clamp(24px, 4vw, 56px); }
.crumb a { text-decoration: none; transition: color .15s; }
.crumb a:hover { color: var(--fg); }
.crumb-nav { display: flex; gap: 18px; }
.detail-top { display: grid; gap: clamp(28px, 4vw, 72px); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .detail-top { grid-template-columns: minmax(280px, 5fr) 7fr; } }
.cover { position: relative; display: block; width: 100%; padding-top: 100%; background: var(--bg-2); border-radius: 2px; }
.cover img { position: absolute; left: 8%; top: 8%; width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 2px 4px oklch(0% 0 0 / .12)) drop-shadow(0 18px 24px oklch(0% 0 0 / .22)); }
.cover .ph { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 120px; color: var(--fg-3); letter-spacing: -.04em; font-variation-settings: "wdth" 115; }

.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; margin: 0 0 14px; }
.title-zh { margin: 0; font-weight: 800; line-height: 1; letter-spacing: -.035em; font-size: clamp(40px, 6vw, 88px); font-variation-settings: "wdth" 108; text-wrap: balance; }
.title-en { margin: 12px 0 0; font-weight: 500; font-size: clamp(18px, 2vw, 26px); color: var(--fg-2); line-height: 1.2; letter-spacing: -.01em; }
.title-alt { margin: 6px 0 0; font-size: 13px; color: var(--fg-3); }
.types { display: flex; gap: 4px; flex-wrap: wrap; margin: 18px 0 0; }
.types span { font-size: 12px; border: 1px solid var(--line); border-radius: 2px; padding: 3px 9px; color: var(--fg-2); letter-spacing: .04em; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); margin: 30px 0 0; border-top: 1px solid var(--fg); }
.fact { padding: 14px 16px 16px 0; border-bottom: 1px solid var(--line); }
.fact dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; margin: 0 0 6px; }
.fact dd { margin: 0; white-space: nowrap; font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; font-variation-settings: "wdth" 108; }
.fact dd small { font-size: 12px; font-weight: 500; color: var(--fg-2); margin-left: 4px; letter-spacing: 0; font-variation-settings: "wdth" 100; }
.fact.stars dd { color: var(--accent); letter-spacing: .02em; font-size: 20px; font-variation-settings: "wdth" 100; }

.intro { font-weight: 500; font-size: clamp(19px, 2vw, 26px); line-height: 1.4; margin: 32px 0 0; text-wrap: pretty; max-width: 30em; letter-spacing: -.015em; }

.detail-body { display: grid; gap: clamp(28px, 4vw, 72px); margin-top: clamp(44px, 6vw, 96px); grid-template-columns: 1fr; }
@media (min-width: 860px) { .detail-body { grid-template-columns: 7fr 5fr; } }
.section-h { display: flex; align-items: baseline; gap: 14px; margin: 0 0 18px; padding-top: 14px; border-top: 1px solid var(--fg); }
.section-h span { font-size: 12px; font-weight: 700; color: var(--fg-3); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.section-h h2 { margin: 0; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; }
.how { font-size: 16px; line-height: 1.75; max-width: 60ch; margin: 0; }
.how + .how { margin-top: 1em; }
.meta-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.meta-list li { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.meta-list .k { color: var(--fg-3); min-width: 5em; font-size: 11px; padding-top: 3px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.chips span { font-size: 13.5px; color: var(--fg-2); }
.chips span:not(:last-child)::after { content: "/"; margin-left: 8px; color: var(--fg-3); }
.bgg-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; text-decoration: none; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 2px; font-weight: 600; font-size: 13px; letter-spacing: .02em; transition: opacity .2s; }
.bgg-link:hover { opacity: .8; }

details.orig { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 12px; }
details.orig summary { cursor: pointer; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
details.orig summary:hover { color: var(--fg); }
.orig-body { margin-top: 12px; font-size: 14px; line-height: 1.7; color: var(--fg-2); max-width: 70ch; }
.orig-body p { margin: 0 0 .8em; }

/* ---------- rules ---------- */
.rules { margin-top: clamp(44px, 6vw, 96px); }
.rules-nav { display: flex; gap: 4px; margin: 0 0 24px; overflow-x: auto; scrollbar-width: none; }
.rules-nav::-webkit-scrollbar { display: none; }
.rules-nav a { flex: 0 0 auto; font-size: 12.5px; text-decoration: none; border: 1px solid var(--line); border-radius: 2px; padding: 6px 11px; color: var(--fg-2); transition: border-color .15s, color .15s; }
.rules-nav a:hover { border-color: var(--fg); color: var(--fg); }
.rules-body { max-width: 72ch; font-size: 15.5px; line-height: 1.8; column-gap: 56px; }
@media (min-width: 1100px) { .rules-body { max-width: none; columns: 2; } }
.rules-body h3 { break-after: avoid; scroll-margin-top: 70px; margin: 1.8em 0 .6em; font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variation-settings: "wdth" 108; }
.rules-body h3:first-child { margin-top: .2em; }
.rules-body p { margin: 0 0 .8em; }
.rules-body ul, .rules-body ol { margin: 0 0 .9em; padding-left: 1.2em; }
.rules-body li { margin: 0 0 .35em; break-inside: avoid; }
.rules-body li::marker { color: var(--fg-3); }
.rules-body strong { font-weight: 700; }

.neighbors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(44px, 6vw, 96px); border-top: 1px solid var(--fg); padding-top: 18px; }
.neighbors a { text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.neighbors a:last-child { text-align: right; align-items: flex-end; }
.neighbors .dir { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
.neighbors .nm { font-weight: 700; font-size: 22px; letter-spacing: -.02em; transition: color .15s; }
.neighbors a:hover .nm { color: var(--accent); }

/* ---------- footer ---------- */
.foot { padding: 28px var(--gutter) max(40px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-3); display: flex; gap: 24px; flex-wrap: wrap; letter-spacing: .02em; }
.foot a { color: var(--fg-2); }

/* ---------- mobile ---------- */
@media (max-width: 999px) {
  .mast { position: static; }
  .hero { padding: 16px 0 14px; gap: 0; }
  .hero-title { display: none; }
  .hero-side { flex-direction: row; align-items: baseline; gap: 12px; max-width: none; }
  .hero-num { font-size: 28px; white-space: nowrap; flex: 0 0 auto; }
  .hero-num small { font-size: 12px; margin-left: 3px; }
  .hero-sub { font-size: 13px; line-height: 1.4; }
  .hero-sub br { display: none; }
  .controls { padding: 10px 0; gap: 8px; }
  .grid { margin-top: 16px; }
  .pills { margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
  .pill { padding: 8px 13px; font-size: 14px; }
  .ctl-search input { width: 100%; padding: 10px 12px; font-size: 16px; }
  .ctl-search select { padding: 10px 10px; font-size: 14px; }
  .grid { gap: 22px 10px; }
  .tile-zh { font-size: 14px; }
  .is-top .tile-zh { font-size: 17px; }
  .tile-en { font-size: 12px; }
  .tile-meta { font-size: 10.5px; gap: 2px 8px; }
  .crumb { font-size: 13px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .fact { padding: 11px 8px 12px 0; }
  .fact dd { font-size: 20px; }
  .fact.stars dd { font-size: 16px; }
  .intro { font-size: 18px; }
  .how, .rules-body { font-size: 15px; }
  .rules-body h3 { font-size: 18px; }
  .neighbors .nm { font-size: 18px; }
  .rules-nav { margin-right: calc(-1 * var(--gutter)); padding-right: var(--gutter); }
}
@media (hover: none) {
  .tile:hover .tile-art img { transform: none; }
}

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
