/* 年収ものさし
   Layout: 源泉徴収票のような罫線の入力票（左）と、印影で結果を示す読み取り欄（右）。
   スマホでは縦に積む。 */
:root {
  --paper: #f2f4f7;
  --sheet: #ffffff;
  --ink: #131c2b;
  --ink-2: #44516a;
  --muted: #687589;
  --rule: #d5dce6;
  --rule-strong: #9ba9bf;
  --ai: #2b4c9b;          /* 藍：罫線の強調・上位側の棒 */
  --ai-wash: #e7edf8;
  --bar-low: #97a3b6;     /* あなた以下の棒 */
  --shu: #cc3a22;         /* 朱：あなたの位置・印影 */
  --shu-wash: #fcebe7;
  --focus: #2b4c9b;

  --font-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --font-data: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d121a;
    --sheet: #151c27;
    --ink: #e8edf4;
    --ink-2: #b5c0d0;
    --muted: #8d99ab;
    --rule: #283346;
    --rule-strong: #4a5970;
    --ai: #6a8bd6;
    --ai-wash: #1b2740;
    --bar-low: #56647c;
    --shu: #f0634a;
    --shu-wash: #3a1e19;
    --focus: #8fb0f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d121a;
  --sheet: #151c27;
  --ink: #e8edf4;
  --ink-2: #b5c0d0;
  --muted: #8d99ab;
  --rule: #283346;
  --rule-strong: #4a5970;
  --ai: #6a8bd6;
  --ai-wash: #1b2740;
  --bar-low: #56647c;
  --shu: #f0634a;
  --shu-wash: #3a1e19;
  --focus: #8fb0f5;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  font-feature-settings: "palt" 1;
}

a { color: var(--ai); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { text-wrap: balance; line-height: 1.35; margin: 0; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--sheet);
}
.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
}
.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: var(--fs-lg);
  letter-spacing: 0.04em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}
.edition {
  font-family: var(--font-data);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

/* ---------- Intro ---------- */
.intro { padding-block: 28px 20px; max-width: 46rem; }
.eyebrow {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.intro h1 {
  font-size: clamp(1.6rem, 4.6vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.01em;
}
.lede { margin: 10px 0 0; color: var(--ink-2); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-bottom: 40px;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 入力票（源泉徴収票ふう） ---------- */
.slip {
  background: var(--sheet);
  border: 1.5px solid var(--ai);
  border-radius: var(--radius);
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
}
@media (max-width: 860px) { .slip { position: static; } }

.slip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1.5px solid var(--ai);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ai);
  letter-spacing: 0.08em;
}
.slip-head .slip-year { font-family: var(--font-data); font-weight: 400; letter-spacing: 0.02em; }

.cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 14px 12px;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.cell-label {
  font-size: var(--fs-xs);
  color: var(--ai);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.amount-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  border-bottom: 1px dashed var(--rule-strong);
  padding-bottom: 2px;
}
.amount-row input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 2.25rem;
  font-weight: 700;
  text-align: right;
  padding: 0;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.amount-row input::-webkit-outer-spin-button,
.amount-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-row input:focus-visible { outline: none; }
.amount-row:focus-within { border-bottom-color: var(--ai); border-bottom-style: solid; }
.amount-unit { font-family: var(--font-data); font-size: var(--fs-lg); color: var(--ink-2); }

.range {
  width: 100%;
  margin: 8px 0 0;
  accent-color: var(--ai);
}
.range-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-data);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.example-chip {
  align-self: flex-start;
  font-size: var(--fs-xs);
  color: var(--shu);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 8px;
}

.slip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.slip-grid .cell:nth-child(odd):not(.span2) { border-right: 1px solid var(--rule); }
.slip-grid .span2 { grid-column: 1 / -1; }

.cell select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--rule-strong);
  border-radius: 0;
  padding: 4px 0;
  cursor: pointer;
}
.cell select:focus-visible { outline: none; border-bottom: 1px solid var(--ai); }
.cell select option { color: initial; background: initial; }

.slip-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.link-btn {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ai);
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
.link-btn:hover { border-color: var(--ai); }

/* ---------- 結果 ---------- */
.results { display: flex; flex-direction: column; gap: 28px; min-width: 0; }

.panel h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: 4px;
}
.panel-sub { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); }

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px 28px;
  align-items: center;
  padding: 22px 24px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
@media (max-width: 520px) {
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 20px 16px; }
}

/* 印影 */
.stamp {
  width: 9.5rem;
  height: 9.5rem;
  border-radius: 50%;
  border: 3px solid var(--shu);
  color: var(--shu);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-7deg);
  box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 5px var(--shu);
  line-height: 1;
  transition: transform 0.25s ease;
}
.stamp.pop { animation: stamp 0.35s ease-out; }
@keyframes stamp {
  0% { transform: rotate(-7deg) scale(1.12); }
  100% { transform: rotate(-7deg) scale(1); }
}
.stamp-top { font-size: var(--fs-md); font-weight: 900; letter-spacing: 0.3em; margin-left: 0.3em; }
.stamp-num {
  font-family: var(--font-data);
  font-weight: 700;
  font-size: 2.9rem;
  letter-spacing: -0.02em;
  margin-top: 4px;
}
.stamp-num.long { font-size: 2.1rem; }
.stamp-unit { font-size: var(--fs-lg); font-weight: 700; margin-top: 2px; }
.stamp.empty { color: var(--muted); border-color: var(--rule-strong); box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 5px var(--rule-strong); }

.hero-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hero-group {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
@media (max-width: 520px) { .hero-group { justify-content: center; } }
.hero-rank { margin: 0; font-size: var(--fs-xl); font-weight: 900; line-height: 1.45; }
.hero-rank em { font-style: normal; color: var(--shu); }
.hero-note { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 3px;
  padding: 0 6px;
  line-height: 1.6;
  white-space: nowrap;
}
.badge.official { color: var(--ai); background: var(--ai-wash); }
.badge.estimate { color: var(--ink-2); border: 1px dashed var(--rule-strong); }

/* 条件ごとの位置 */
.compare-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cmp {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 32%) 6.5rem;
  gap: 4px 16px;
  align-items: center;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
}
.cmp:hover { border-color: var(--rule-strong); }
.cmp[aria-pressed="true"] { border-color: var(--ai); box-shadow: inset 3px 0 0 var(--ai); }
.cmp-label { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmp-name { font-size: var(--fs-md); font-weight: 700; line-height: 1.45; }
.cmp-meta { font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cmp-value { text-align: right; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.cmp-value b { font-family: var(--font-data); font-size: var(--fs-xl); color: var(--ink); font-weight: 700; }
.meter { position: relative; height: 22px; }
.meter-track {
  position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px;
  border-radius: 3px; background: var(--ai-wash);
}
.meter-fill {
  position: absolute; right: 0; top: 50%; height: 6px; margin-top: -3px;
  border-radius: 0 3px 3px 0; background: var(--ai);
}
.meter-dot {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--shu); box-shadow: 0 0 0 2px var(--sheet);
}
.meter-scale {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 32%) 6.5rem;
  gap: 16px;
  padding: 0 15px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.meter-scale span:nth-child(2) { display: flex; justify-content: space-between; }
@media (max-width: 560px) {
  .cmp { grid-template-columns: minmax(0, 1fr) auto; }
  .cmp .meter { grid-column: 1 / -1; grid-row: 2; }
  .meter-scale { display: none; }
}

.estimate-note {
  margin: 10px 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* 分布グラフ */
.chart-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 16px 10px;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.above { background: var(--ai); }
.swatch.below { background: var(--bar-low); }
.swatch.you { width: 3px; height: 14px; border-radius: 1px; background: var(--shu); }

.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--rule); stroke-width: 1; }
.chart .axis text, .chart .tick { fill: var(--muted); font-family: var(--font-data); font-size: 11px; }
.chart .bar.above { fill: var(--ai); }
.chart .bar.below { fill: var(--bar-low); }
.chart .bar.hover { opacity: 0.75; }
.chart .hit { fill: transparent; cursor: default; }
.chart .you-line { stroke: var(--shu); stroke-width: 2; }
.chart .you-label { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font-body); }
.chart .you-dot { fill: var(--shu); stroke: var(--sheet); stroke-width: 2; }
.chart .baseline { stroke: var(--rule-strong); stroke-width: 1; }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: var(--sheet);
  font-size: var(--fs-xs);
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  z-index: 2;
}
.tooltip b { font-family: var(--font-data); font-size: var(--fs-sm); }

details.table-view { margin-top: 8px; font-size: var(--fs-sm); }
details.table-view summary { cursor: pointer; color: var(--ai); width: fit-content; }
.table-scroll { overflow-x: auto; max-height: 320px; overflow-y: auto; margin-top: 8px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; }
table.data th { font-weight: 700; color: var(--ink-2); font-size: var(--fs-xs); letter-spacing: 0.04em; }
table.data td.num, table.data th.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.you-row td { background: var(--shu-wash); }

.lines-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
.reach { font-size: var(--fs-xs); white-space: nowrap; }
.reach.ok { color: var(--ai); font-weight: 700; }
.reach.gap { color: var(--muted); }

.pref-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.pref-card > div { background: var(--sheet); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pref-card .k { font-size: var(--fs-xs); color: var(--muted); }
.pref-card .v { font-family: var(--font-data); font-size: var(--fs-xl); font-weight: 700; }
@media (max-width: 520px) { .pref-card { grid-template-columns: minmax(0, 1fr); } }

/* ---------- データと計算方法 ---------- */
.method {
  border-top: 1px solid var(--rule);
  padding-block: 32px 48px;
}
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px 40px;
  margin-top: 16px;
}
.method h2 { font-size: var(--fs-xl); font-weight: 900; }
.method h3 { font-size: var(--fs-md); font-weight: 700; margin-bottom: 6px; }
.method p, .method li { font-size: var(--fs-sm); color: var(--ink-2); max-width: 38rem; }
.method p { margin: 0 0 8px; }
.method ul { margin: 0; padding-left: 1.2em; }
.method li + li { margin-top: 4px; }

.site-foot {
  border-top: 1px solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.site-foot .wrap { padding-block: 16px 28px; }

@media (prefers-reduced-motion: reduce) {
  .stamp.pop { animation: none; }
  .stamp { transition: none; }
}

/* ---------- ナビ ---------- */
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-2);
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--ai-wash); }
.site-nav a[aria-current="page"] { color: var(--ai); background: var(--ai-wash); }
@media (max-width: 560px) {
  .edition { display: none; }
  .site-nav a { padding: 4px 8px; }
}
.more-link { display: inline-block; margin-top: 10px; font-size: var(--fs-sm); font-weight: 700; }

/* ---------- 都道府県マップ ---------- */
:root {
  /* 発散型：低い（赤）← 中ほど（グレー）→ 高い（青）。両端・内側の明るさをそろえている */
  --q1: #a52d2a;
  --q2: #ee8f80;
  --q3: #dcdad4;
  --q4: #86b6ef;
  --q5: #1c5cab;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* 暗い背景では、両端ほど明るくする */
    --q1: #f88d7f;
    --q2: #9a4038;
    --q3: #3b3f46;
    --q4: #2c5c9c;
    --q5: #8ab8f0;
  }
}
:root[data-theme="dark"] {
  --q1: #f88d7f;
  --q2: #9a4038;
  --q3: #3b3f46;
  --q4: #2c5c9c;
  --q5: #8ab8f0;
}

.map-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 16px; }
.seg {
  display: inline-flex;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}
.seg button {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ai); color: var(--sheet); }

.map-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.map-stats > div { background: var(--sheet); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.map-stats .k { font-size: var(--fs-xs); color: var(--muted); }
.map-stats .v { font-size: var(--fs-xl); font-weight: 900; line-height: 1.3; }
.map-stats .v small { font-family: var(--font-data); font-size: var(--fs-md); font-weight: 700; margin-left: 6px; }
.map-stats .s { font-size: var(--fs-xs); color: var(--ink-2); }
@media (max-width: 640px) { .map-stats { grid-template-columns: minmax(0, 1fr); } }

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-bottom: 28px;
}
@media (max-width: 900px) { .map-layout { grid-template-columns: minmax(0, 1fr); } }

.map-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.map-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.map-head h2 { font-size: var(--fs-lg); }
.map-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--ink-2); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-data); white-space: nowrap; }
.map-legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.map-legend .end { font-family: var(--font-body); font-weight: 700; color: var(--muted); }
.map-wrap { position: relative; }
.japan { display: block; width: 100%; height: auto; max-height: 78vh; }
.japan .pref { stroke: var(--sheet); stroke-width: 0.6; vector-effect: non-scaling-stroke; cursor: pointer; }
.japan .q1 { fill: var(--q1); }
.japan .q2 { fill: var(--q2); }
.japan .q3 { fill: var(--q3); }
.japan .q4 { fill: var(--q4); }
.japan .q5 { fill: var(--q5); }
.japan .hover-outline { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
/* 選択中：どの色の上でも見えるよう、明るい縁取りの上に濃い線 */
.japan .sel-halo { fill: none; stroke: var(--sheet); stroke-width: 5; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.japan .sel-outline { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.japan .inset { fill: none; stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.japan .inset-label { fill: var(--muted); font-size: 10px; font-family: var(--font-body); }
.map-note { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--muted); }

.side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.detail {
  background: var(--sheet);
  border: 1.5px solid var(--ai);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.detail-head h2 { font-size: var(--fs-xl); font-weight: 900; }
.chip { font-size: var(--fs-xs); font-weight: 700; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.chip.rank { color: var(--ai); background: var(--ai-wash); }
.chip.you { color: var(--shu); border: 1px solid currentColor; }
.detail-value { font-size: 2rem; font-weight: 900; line-height: 1.2; }
.detail-value small { font-size: var(--fs-md); font-weight: 700; color: var(--ink-2); margin-left: 4px; }
.detail-diff { font-size: var(--fs-sm); color: var(--ink-2); margin: 0; }
.detail table.data td, .detail table.data th { padding: 6px 8px; }

.rank-panel h2 { font-size: var(--fs-lg); margin-bottom: 4px; }
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  max-height: 560px;
  overflow-y: auto;
}
@media (max-width: 900px) { .rank-list { max-height: none; } }
.rank-row {
  width: 100%;
  display: grid;
  grid-template-columns: 2.2em 5.2em minmax(0, 1fr) 5.6em;
  gap: 8px;
  align-items: center;
  font: inherit;
  font-size: var(--fs-sm);
  color: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 6px 12px;
  text-align: left;
  cursor: pointer;
}
.rank-list li:last-child .rank-row { border-bottom: 0; }
.rank-row:hover, .rank-row.hover { background: var(--ai-wash); }
.rank-row[aria-pressed="true"] { background: var(--shu-wash); }
.rank-row .no { font-family: var(--font-data); color: var(--muted); text-align: right; }
.rank-row .nm { font-weight: 700; white-space: nowrap; }
.rank-row .track { position: relative; height: 10px; }
.rank-row .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 3px 3px 0; }
.rank-row .track b { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink-2); }
.rank-row .val { font-family: var(--font-data); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-key { display: flex; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--muted); margin: 0 0 8px; }
.rank-key i { width: 1px; height: 12px; background: var(--ink-2); display: inline-block; }
