:root {
  color-scheme: light;
  --ink: #2e2118;
  --muted: #79695d;
  --paper: #f3eee5;
  --panel: #fffdf8;
  --line: #ded2c1;
  --accent: #7b2f21;
  --gold: #b1843e;
  --green: #2f6a4f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(177,132,62,.18), transparent 32rem),
    linear-gradient(180deg, #ede4d6 0, var(--paper) 26rem);
}

button, select, input { font: inherit; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 80px; }
.hero { display: flex; justify-content: space-between; gap: 32px; align-items: end; padding: 34px 38px; background: #291b14; color: #fff8ed; border-radius: 28px; box-shadow: 0 22px 60px rgba(55,35,20,.16); }
.eyebrow, #boardKicker { margin: 0 0 10px; color: #d6af6e; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(36px, 7vw, 72px); line-height: .95; font-weight: 500; }
.lede { max-width: 620px; margin: 18px 0 0; color: #d9cec2; font-size: 16px; line-height: 1.7; }
.freshness { min-width: 170px; padding: 20px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.06); }
.freshness span, .freshness small { display: block; color: #cbbcaf; font-size: 12px; }
.freshness strong { display: block; margin: 7px 0; font-size: 22px; }

.view-tabs { display: flex; gap: 8px; margin: 26px 0 12px; }
.view-tab { border: 1px solid #34241b; background: #34241b; color: #e7d7c4; padding: 13px 22px; border-radius: 999px; cursor: pointer; }
.view-tab.active { background: var(--gold); border-color: var(--gold); color: #21160f; font-weight: 800; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab { border: 1px solid var(--line); background: rgba(255,253,248,.65); color: var(--muted); padding: 12px 18px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.filters { position: sticky; top: 12px; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 12px; align-items: end; padding: 18px; background: rgba(255,253,248,.92); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 36px rgba(69,45,25,.09); backdrop-filter: blur(14px); }
.filters label span { display: block; margin: 0 0 7px 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
select, input, .reset { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); padding: 0 13px; }
.reset { width: auto; padding: 0 18px; background: #efe5d7; cursor: pointer; }
.search-filters { grid-template-columns: 1fr 1.4fr 1fr auto; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.summary div { padding: 18px 20px; background: rgba(255,253,248,.68); border: 1px solid var(--line); border-radius: 16px; }
.summary span { color: var(--muted); font-size: 12px; }
.summary strong { display: block; margin-top: 6px; font-family: Georgia, serif; font-size: 27px; }

.board { padding: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; }
.board-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 18px; }
.board-head h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(25px, 4vw, 39px); font-weight: 500; }
.note { max-width: 430px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: right; }
.cards { display: grid; gap: 10px; }
.card { display: grid; grid-template-columns: 58px minmax(240px, 1fr) 118px 96px 130px; gap: 16px; align-items: center; padding: 16px; border: 1px solid #eadfce; border-radius: 16px; background: #fff; transition: transform .16s ease, box-shadow .16s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(63,39,21,.09); }
.rank { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #f1e4d2; color: var(--accent); font-family: Georgia, serif; font-size: 18px; }
.product a { color: var(--ink); font-weight: 750; text-decoration: none; line-height: 1.45; }
.product a:hover { color: var(--accent); text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.pill { padding: 4px 8px; border-radius: 999px; background: #f3eee7; color: var(--muted); font-size: 11px; }
.metric span { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; margin-top: 4px; font-size: 15px; }
.price strong { color: var(--green); font-size: 20px; }
.status { color: var(--green); font-size: 12px; line-height: 1.45; }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty strong, .empty span { display: block; }
.empty strong { color: var(--ink); font-size: 20px; margin-bottom: 7px; }
.empty.compact { padding: 34px 18px; }
.search-board { display: grid; gap: 18px; min-width: 0; }
.search-board > .board { min-width: 0; }
.board-head > div > p { margin: 0 0 10px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.price-table, .history-table { overflow-x: auto; }
.table-row { display: grid; grid-template-columns: 130px minmax(300px, 1fr) 130px 140px 150px; gap: 14px; align-items: center; min-width: 890px; padding: 14px 12px; border-top: 1px solid #eadfce; font-size: 13px; }
.table-row:first-child { border-top: 0; }
.table-row a { color: var(--ink); font-weight: 750; text-decoration: none; }
.table-row a:hover { color: var(--accent); text-decoration: underline; }
.table-row small { display: block; margin-top: 4px; color: var(--muted); }
.table-head-row, .history-head { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.green { color: var(--green); }
.history-chart { position: relative; min-width: 0; max-width: 100%; min-height: 260px; overflow-x: auto; }
.price-chart { display: block; width: 100%; min-width: 720px; color: var(--muted); font-size: 11px; }
.history-point { cursor: crosshair; outline: none; }
.history-point:hover, .history-point:focus { stroke: #24170f; stroke-width: 2.5; }
.chart-tooltip { position: absolute; z-index: 4; width: 212px; padding: 12px 14px; border: 1px solid #d8c8b2; border-radius: 12px; background: rgba(41,27,20,.96); color: #fff8ed; box-shadow: 0 12px 30px rgba(42,27,17,.22); pointer-events: none; }
.chart-tooltip strong, .chart-tooltip span, .chart-tooltip b, .chart-tooltip small { display: block; }
.chart-tooltip span { margin-top: 4px; color: #decfbe; font-size: 12px; line-height: 1.35; }
.chart-tooltip b { margin-top: 7px; color: #e7bb71; font-size: 16px; }
.chart-tooltip small { margin-top: 5px; color: #bfae9e; font-size: 10px; }
.grid-line { stroke: #e8ddcd; stroke-width: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 9px 16px; margin: 8px 0 20px 64px; color: var(--muted); font-size: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; }
.chart-note { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: -6px 0 20px 64px; color: var(--muted); font-size: 11px; }
.chart-note span { display: inline-flex; align-items: center; gap: 6px; }
.chart-note b { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.solid-dot { background: var(--accent); }
.hollow-dot { background: var(--panel); border: 2px solid var(--accent); }
.history-table details { border-top: 1px solid var(--line); padding-top: 16px; }
.history-table summary { cursor: pointer; color: var(--accent); font-weight: 750; }
.history-row { grid-template-columns: 120px 130px minmax(320px, 1fr) 130px 130px; }
[hidden] { display: none !important; }

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 700px); padding-top: 10px; }
  .hero { display: block; padding: 28px 24px; border-radius: 20px; }
  .freshness { margin-top: 22px; }
  .filters { grid-template-columns: 1fr 1fr; top: 6px; }
  .search-filters { grid-template-columns: 1fr 1fr; }
  .filters label:nth-child(3), .reset { grid-column: span 1; }
  .card { grid-template-columns: 44px 1fr 100px; gap: 10px; }
  .card .metric:nth-of-type(2), .status { display: none; }
  .price { text-align: right; }
  .board-head { display: block; }
  .note { margin-top: 12px; text-align: left; }
}

@media (max-width: 540px) {
  .filters { grid-template-columns: 1fr; position: static; }
  .search-filters { grid-template-columns: 1fr; }
  .filters label:nth-child(3), .reset { grid-column: auto; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary div:last-child { display: none; }
  .board { padding: 15px; }
  .card { grid-template-columns: 36px 1fr; padding: 13px; }
  .card > .metric, .card > .price, .card > .status { grid-column: 2; text-align: left; }
  .price-table { overflow: visible; }
  .price-table .table-head-row { display: none; }
  .price-table .table-row { min-width: 0; grid-template-columns: 1fr 1fr; margin-bottom: 10px; padding: 14px; border: 1px solid #eadfce; border-radius: 14px; }
  .price-table .table-row > :nth-child(2), .price-table .table-row > :nth-child(5) { grid-column: 1 / -1; }
  .price-table .table-row > :nth-child(4) { text-align: right; }
}
