:root {
  --navy-950: #061a3a;
  --navy-900: #082550;
  --navy-700: #21436e;
  --ink: #13233d;
  --muted: #667085;
  --line: #dbe1e8;
  --soft: #f4f6f9;
  --paper: #ffffff;
  --green: #267a58;
  --green-soft: #e5f4eb;
  --red: #c5352d;
  --gold: #b7791f;
  --shadow: 0 8px 24px rgba(17, 35, 61, 0.07), 0 1px 3px rgba(17, 35, 61, 0.08);
  --radius: 12px;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #f8f9fb;
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
}

button, input, select { font: inherit; }

button, select { cursor: pointer; }

a { color: #1c5fa8; text-underline-offset: 0.2em; }

a:hover { color: var(--navy-950); }

:focus-visible {
  outline: 3px solid #f2b84b;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--navy-950);
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-header__inner {
  display: flex;
  align-items: center;
  min-height: 68px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-title {
  color: #111;
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.site-tagline, .global-nav { display: none; }

.page-shell {
  width: min(100% - 28px, 1240px);
  margin: 0 auto;
  padding: 32px 0 64px;
}

.page-intro { margin-bottom: 18px; }

.page-intro h1 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.page-intro p:last-child { margin: 6px 0 0; }

.eyebrow, .section-kicker {
  margin: 0 0 2px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.panel {
  border: 1px solid #e3e7ec;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.search-panel { padding: 14px; }

.search-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
  padding: 3px;
  border-radius: 999px;
  background: #eef1f5;
}

.search-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.search-tab.is-active {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-950));
  color: white;
  box-shadow: 0 3px 8px rgba(6, 26, 58, 0.22);
}

.search-form { display: grid; gap: 12px; }

.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.field label span { color: var(--muted); font-weight: 400; }

.field input, .field select {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid #cdd4de;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
}

.field input:hover, .field select:hover { border-color: #8794a6; }

.search-button {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-950));
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(6, 26, 58, 0.18);
}

.search-button:hover { background: var(--navy-700); }

.search-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.search-notice {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.status-message {
  margin: 18px 0;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--paper);
  text-align: center;
}

.status-message--error { color: #9c2f28; background: #fff0ef; }

.results { margin-top: 16px; }

.summary-panel, .section-panel, .guide-panel { padding: 16px; }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-heading h2, .guide-panel h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(1.2rem, 4vw, 1.55rem);
  line-height: 1.35;
}

.confidence-badge {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
}

.confidence-badge[data-level="low"] { background: #fff3dc; color: #8a5800; }
.confidence-badge[data-level="medium"] { background: #eaf2fb; color: #245b96; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(145deg, #fff, #fbfcfd);
}

.metric dt {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
}

.metric dd {
  overflow-wrap: anywhere;
  margin: 3px 0 0;
  color: var(--navy-950);
  font-size: clamp(1rem, 4.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
}

.content-grid { display: grid; gap: 16px; margin-top: 16px; }
.content-main { display: grid; gap: 16px; min-width: 0; }

.ranking-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.ranking-number {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--navy-700);
  font-size: 1.25rem;
  font-weight: 700;
}

.ranking-item:first-child .ranking-number { background: #fff4d6; color: #a86400; }

.ranking-content strong { display: block; color: var(--navy-950); font-size: 1.05rem; }
.ranking-meta { color: var(--muted); font-family: var(--sans); font-size: 0.78rem; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--soft); color: #3d4b60; font-family: var(--sans); font-size: 0.75rem; white-space: nowrap; }
td { font-size: 0.9rem; }
.table-subtext { display: block; color: var(--muted); font-size: 0.8rem; }
.sale-value { color: var(--red); font-weight: 700; white-space: nowrap; }
.article-link { white-space: nowrap; }
.empty-state { padding: 28px 12px; color: var(--muted); text-align: center; }

.record-count-label { color: var(--muted); font-family: var(--sans); font-size: 0.8rem; }
.records-note { margin: 12px 0 0; color: var(--muted); font-family: var(--sans); font-size: 0.72rem; }

.guide-panel { align-self: start; }
.guide-panel ul { display: grid; gap: 9px; margin: 14px 0 0; padding: 0; list-style: none; }
.guide-panel li { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.guide-panel li > span { color: var(--navy-900); font-size: 1.25rem; }
.guide-panel li p { margin: 0; font-size: 0.88rem; }

.site-footer {
  padding: 28px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-align: center;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

[hidden] { display: none !important; }

@media (max-width: 699px) {
  .table-wrap { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 9px; }
  tr { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
  td { padding: 5px 7px; border: 0; }
  td::before { display: block; color: var(--muted); content: attr(data-label); font-family: var(--sans); font-size: 0.65rem; font-weight: 700; }
  td:last-child { align-self: end; }
  .article-link { white-space: normal; }
}

@media (min-width: 700px) {
  .page-shell { width: min(100% - 48px, 1240px); padding-top: 46px; }
  .site-tagline { display: block; margin: 0 0 0 28px; color: var(--muted); font-size: 0.82rem; }
  .global-nav { display: flex; gap: 28px; margin-left: auto; font-family: var(--sans); font-size: 0.82rem; }
  .global-nav a { color: var(--ink); text-decoration: none; }
  .search-panel { padding: 18px; }
  .search-tabs { width: 330px; }
  .search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-button { align-self: end; }
  .summary-panel, .section-panel, .guide-panel { padding: 20px; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .ranking-item { grid-template-columns: 48px minmax(180px, 1fr); }
}

@media (min-width: 1040px) {
  .search-form { grid-template-columns: 1.15fr 1.15fr 1fr 0.8fr auto; align-items: end; }
  .search-button { padding: 0 28px; white-space: nowrap; }
  .summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
