:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5d6670;
  --line: #e4e1da;
  --accent: #0b6e4f;
  --accent-ink: #ffffff;
  --ad-bg: #fff4d6;
  --ad-line: #e0b84a;
  --row-hover: #f3f1ea;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e8e6e1;
    --muted: #a3a9b0;
    --line: #33373d;
    --accent: #4cc49a;
    --accent-ink: #0d1f18;
    --ad-bg: #3a3014;
    --ad-line: #8a6d1e;
    --row-hover: #24282d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { padding-top: 10px; padding-bottom: 10px; }
.site-name { font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: .02em; }
main { padding-top: 16px; padding-bottom: 32px; }
h1 { font-size: 1.5rem; line-height: 1.4; margin: 12px 0 8px; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.lead { color: var(--muted); margin: 0 0 12px; }

.ad-notice {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 10px;
  background: var(--ad-bg);
  border: 1px solid var(--ad-line);
  border-radius: 4px;
  font-weight: 700;
  font-size: .95rem;
}
.fetched { margin: 0; font-size: .92rem; }
.top { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 4px; }
.filters fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.filters legend { font-size: .85rem; color: var(--muted); padding: 0; margin-bottom: 2px; width: 100%; }
.filters label { white-space: nowrap; cursor: pointer; }
.filters select { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
.count { color: var(--muted); font-size: .9rem; margin: 8px 0; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table.items { width: 100%; border-collapse: collapse; }
.items th, .items td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.items th { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.items tbody tr:last-child td { border-bottom: 0; }
.items tbody tr:hover { background: var(--row-hover); }
.items .rank { font-weight: 700; text-align: center; width: 3em; font-variant-numeric: tabular-nums; }
.items .name a { color: var(--text); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.items .name a:hover { text-decoration: underline; }
.items .name { min-width: 16em; }
.items .shop, .items .sub { display: block; font-size: .8rem; color: var(--muted); }
.items .amount, .items .price, .items .perm, .items .kind { white-space: nowrap; font-variant-numeric: tabular-nums; }
.items .perm strong { font-size: 1.1rem; }
.tag { display: inline-block; margin-left: 4px; padding: 0 6px; font-size: .75rem; border: 1px solid var(--line); border-radius: 3px; }
.btn { display: inline-block; padding: 6px 12px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; white-space: nowrap; font-size: .9rem; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.empty { color: var(--muted); }
.notes ul { padding-left: 1.2em; }
.notes li { margin: 4px 0; }

.site-footer { border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); padding: 16px 0 32px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.site-footer p { margin: 4px 0; }

/* スマホ: 表をカードにする */
@media (max-width: 720px) {
  h1 { font-size: 1.25rem; }
  .items thead { display: none; }
  .items, .items tbody, .items tr, .items td { display: block; width: 100%; }
  .items tr[hidden] { display: none; }
  .items tr {
    display: grid;
    grid-template-columns: 2.2em 1fr auto;
    grid-template-areas: "rank name name" "rank kind perm" "rank amount price" "rank go go";
    gap: 2px 10px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .items tbody tr:last-child { border-bottom: 0; }
  .items td { padding: 0; border: 0; min-width: 0; }
  .items .rank { grid-area: rank; text-align: left; width: auto; font-size: 1.1rem; }
  .items .name { grid-area: name; min-width: 0; }
  .items .kind { grid-area: kind; align-self: center; }
  .items .perm { grid-area: perm; text-align: right; }
  .items .amount { grid-area: amount; white-space: normal; }
  .items .price { grid-area: price; text-align: right; }
  .items .go { grid-area: go; margin-top: 6px; }
  .items .go .btn { display: block; text-align: center; }
  .items .price .sub { display: inline; margin-left: 4px; }
}
