:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --line: #ebe8e1;
  --line-strong: #d8d4cb;
  --text: #1a1917;
  --text-2: #63615b;
  --text-3: #97958d;
  --accent: #c8442f;
  --gold: #b07d18;
  --silver: #7c7a74;
  --bronze: #9c5a2c;
  --up: #2f7d4f;
  --down: #c0392b;
  --flat: #8a8880;
  --row-hover: #f7f5f0;
  --maxw: 840px;
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Yu Gothic UI",
    "Noto Sans JP", "Meiryo", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1e1c17;
    --line: #322f28;
    --line-strong: #423e35;
    --text: #efece4;
    --text-2: #a8a59b;
    --text-3: #73716a;
    --accent: #e2674f;
    --gold: #d6a23e;
    --silver: #aaa79d;
    --bronze: #c8824a;
    --up: #5fb37e;
    --down: #e26a59;
    --flat: #8f8d84;
    --row-hover: #23211b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 48px 24px 88px; }

/* ---- header ---- */
.site-head { border-bottom: 2px solid var(--text); padding-bottom: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--text); }
.nav .soon { color: var(--text-3); font-size: 14px; font-weight: 500; cursor: default; }
.nav .soon::after { content: "近日"; font-size: 9px; color: var(--bg); background: var(--text-3); border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: 2px; letter-spacing: .04em; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark { width: 20px; height: 20px; border-radius: 4px; background: var(--accent); display: inline-block; }
.brand-name { font-size: 28px; font-weight: 700; letter-spacing: 0.01em; }
.tagline { margin: 15px 0 0; color: var(--text-2); font-size: 16px; }
.updated { margin: 6px 0 0; color: var(--text-3); font-size: 13.5px; letter-spacing: 0.02em; }

/* ---- hero (今日の急上昇) ---- */
.hero { display: block; margin-top: 34px; border-left: 4px solid var(--accent); padding: 8px 0 12px 20px; text-decoration: none; color: inherit; border-radius: 0 8px 8px 0; }
.hero:hover { background: var(--row-hover); }
.hero-label { font-size: 12px; letter-spacing: .16em; color: var(--accent); font-weight: 700; }
.hero-name { margin: 9px 0 0; font-size: 30px; font-weight: 700; letter-spacing: 0.01em; }
.hero-blurb { margin: 8px 0 0; font-size: 14px; color: var(--text-2); line-height: 1.6; }
.hero-meta { margin-top: 14px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.hero-type { font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 9px; }
.hero-idx { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- ranking block ---- */
.rank-block { margin-top: 52px; }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line-strong); padding-bottom: 11px; }
.block-head h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: 0.02em; }
.block-head h2::before { content: ""; display: inline-block; width: 5px; height: 21px; background: var(--accent); margin-right: 11px; vertical-align: -3px; }
.block-sub { margin: 0; color: var(--text-3); font-size: 13.5px; }

/* ---- ranking list ---- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row {
  display: grid;
  grid-template-columns: 50px 1fr auto 96px;
  align-items: center;
  gap: 20px;
  padding: 19px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
.rank-row:last-child { border-bottom: none; }
a.rank-row:hover { background: var(--row-hover); }

.rk { font-size: 31px; font-weight: 700; text-align: center; color: var(--text-3); font-variant-numeric: tabular-nums; line-height: 1; }
.rk-1 { color: var(--gold); }
.rk-2 { color: var(--silver); }
.rk-3 { color: var(--bronze); }

/* 1位は一回り大きく見せる（誌面の主役感） */
.rank-list .rank-row:first-child { padding: 22px 6px; }
.rank-list .rank-row:first-child .rk { font-size: 38px; }
.rank-list .rank-row:first-child .rname { font-size: 20px; }

.rmain { min-width: 0; }
.rname { font-size: 18px; font-weight: 700; }
.rname .since { font-size: 12.5px; font-weight: 400; color: var(--text-3); margin-left: 10px; letter-spacing: 0.02em; }
.rdesc { margin: 5px 0 0; font-size: 14px; color: var(--text-2); line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* trend (CSS-drawn caret, no emoji) */
.trend { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }
.trend.flat { color: var(--flat); }
.car { width: 0; height: 0; }
.trend.up .car { border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid currentColor; }
.trend.down .car { border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid currentColor; }
.trend.flat .car { width: 11px; height: 2px; background: currentColor; }

.rindex { font-size: 20px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- see all ---- */
.see-all { margin-top: 14px; text-align: right; }
.see-all a { font-size: 13.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.see-all a:hover { color: var(--text); }
.see-all a::after { content: ""; display: inline-block; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid currentColor; margin-left: 8px; vertical-align: 1px; }

/* ---- back link ---- */
.back { display: inline-block; margin: 4px 0 18px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.back:hover { color: var(--text); }
.back::before { content: ""; display: inline-block; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-right: 6px solid currentColor; margin-right: 8px; vertical-align: 1px; }

/* ---- detail page ---- */
.detail { margin-top: 6px; }
.d-type { display: inline-block; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 10px; }
.d-name { margin: 16px 0 0; font-size: 30px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.35; }
.d-blurb { margin: 16px 0 0; font-size: 16px; color: var(--text-2); line-height: 1.85; }
.d-stats { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.d-stat { border: 1px solid var(--line-strong); border-radius: 10px; padding: 16px 18px; }
.d-lab { display: block; font-size: 12px; color: var(--text-3); letter-spacing: .04em; }
.d-val { display: block; margin-top: 8px; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.d-val .trend { font-size: 19px; }
.d-note { margin-top: 24px; font-size: 12.5px; color: var(--text-3); line-height: 1.8; }

/* ---- discover (辞典 / アーカイブ) ---- */
.discover { margin-top: 56px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.disc-card { border: 1px solid var(--line-strong); border-radius: 12px; padding: 22px 24px; }
.disc-card h3 { margin: 0; font-size: 18px; font-weight: 700; }
.disc-card p { margin: 9px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.soon-pill { display: inline-block; margin-top: 14px; font-size: 11.5px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 11px; letter-spacing: .04em; }
@media (max-width: 600px) { .discover { grid-template-columns: 1fr; } }

/* ---- dictionary ---- */
.dict-intro { margin: 6px 0 4px; font-size: 14.5px; color: var(--text-2); line-height: 1.8; }
.dict-intro b { font-weight: 700; color: var(--text); }
.dict-block { margin-top: 44px; }
.dict-row { display: block; padding: 16px 10px; border-bottom: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: inherit; }
.dict-row:last-child { border-bottom: none; }
a.dict-row:hover { background: var(--row-hover); }
.dict-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dict-name { font-size: 18px; font-weight: 700; }
.dict-since { font-size: 12px; color: var(--text-3); margin-left: auto; }
.dict-meaning { margin: 6px 0 0; font-size: 14px; color: var(--text-2); line-height: 1.7; }

/* status badges */
.status { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-new { background: #faece7; color: #993c1d; }
.st-hall { background: #f6ecd0; color: #7a5510; }
.st-dead { background: #eceae3; color: #6b6a64; }

/* entry detail */
.entry { margin-top: 6px; }
.entry-tags { display: flex; align-items: center; gap: 10px; }
.entry-name { margin: 14px 0 0; font-size: 30px; font-weight: 700; letter-spacing: 0.01em; line-height: 1.3; }
.entry-field { margin-top: 22px; }
.ef-lab { display: inline-block; font-size: 12px; color: var(--text-3); letter-spacing: .06em; border-left: 3px solid var(--accent); padding-left: 9px; }
.ef-val { margin: 9px 0 0; font-size: 16px; color: var(--text); line-height: 1.85; }

/* ---- footer ---- */
.site-foot { margin-top: 64px; padding-top: 26px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text-3); line-height: 1.95; }
.foot-nav { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.foot-nav a { color: var(--text-2); text-decoration: none; font-weight: 500; }
.foot-nav a:hover { color: var(--text); }
.foot-nav span { color: var(--text-3); }
.site-foot .note { color: var(--text-2); }
