/* AdSense slot */
.ad-slot {
  margin: 28px auto;
  max-width: 1200px;
  min-height: 90px;
  text-align: center;
}
.ad-slot ins.adsbygoogle {
  display: block;
}

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #f3f5fb;
  --ink: #233047;
  --muted: #58677f;
  --line: #dce2ed;
  --navy: #1c2b46;
  --accent: #665098;
  --accent-dark: #483570;
  --accent-soft: #f1edf9;
  --good: #2f6f52;
  --warn: #9b5a15;
  --shadow: 0 5px 24px rgba(28, 43, 70, 0.06);
  --anchor-offset: 90px;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[id] { scroll-margin-top: var(--anchor-offset); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.75;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.site-hero {
  padding: 48px 0 30px;
  color: #f4f6ff;
  background: linear-gradient(120deg, #111c31 0%, #25314d 56%, #49326d 100%);
}

.hero-inner,
main,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero-inner {
  padding: 12px 0;
  text-align: center;
}

.site-hero .eyebrow { color: #d5c3ef; }
.site-hero h1 { font-size: clamp(1.8rem, 3.8vw, 3rem); line-height: 1.55; letter-spacing: .01em; text-wrap: balance; }
.h1-sub { display: block; margin-top: 8px; color: #d5c3ef; font-size: .57em; font-weight: 500; }
.site-hero .lead { max-width: 800px; margin: 20px auto; color: #d6deed; font-size: 1rem; line-height: 1.95; }
.hero-scope { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; padding: 9px 18px; border: 1px solid #ffffff30; border-radius: 6px; font-size: .82rem; margin: 8px 0 0; color: #f0e9ff; }
.hero-scope span { color: #c4cfe2; }
.site-hero .hero-actions { justify-content: center; margin-top: 22px; }
.site-hero .button.primary { background: #f5f2fc; color: #382857; border-color: #f5f2fc; }
.site-hero .button.ghost { background: transparent; color: #f4f6ff; border-color: #c8b7e7; }
.portal-bar { width: min(1120px, calc(100% - 32px)); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 12px 0; }
.portal-bar > a { text-decoration: none; font-size: .82rem; }
.portal-bar .portal-brand { color: var(--navy); font-weight: 800; font-size: .95rem; }
.portal-brand span { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; letter-spacing: .06em; }
.view-switcher { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 3px 12px #1c2b4608; }
.view-switcher-inner { width: min(1120px, calc(100% - 32px)); margin: auto; display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0; }
.view-switcher a { flex: 1; padding: 11px 14px; border-radius: 6px; font-size: .85rem; text-align: center; text-decoration: none; color: var(--muted); white-space: nowrap; }
.view-switcher a:hover { background: var(--surface-strong); color: var(--accent-dark); }
.view-switcher a[aria-current="page"] { color: #fff; background: var(--accent); font-weight: 700; }
.skip-link { position: absolute; left: 16px; top: -100px; padding: 12px 18px; background: #fff; z-index: 30; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.hero-visual {
  margin: 0 0 28px;
  overflow: hidden;
  border: 1px solid rgba(99, 50, 25, 0.14);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: 0 16px 42px rgba(83, 54, 27, 0.16);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 6vw, 4.3rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.35;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.lead {
  max-width: 760px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.hero-actions,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.48);
}

.button.compact {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.92rem;
}

main {
  display: grid;
  gap: 22px;
  padding-bottom: 56px;
}

main > * { min-width: 0; }
.ranking-main { padding-top: 32px; }
.controls-heading { grid-column: 1 / -1; }
.controls-heading h2 { margin-bottom: 0; }

.notice-panel,
.controls-card,
.score-card,
.request-card,
.table-card,
.data-guide {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notice-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
}

.notice-panel p,
.score-card p,
.request-card p,
.guide-grid p,
.site-footer p {
  margin-bottom: 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stats-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
}

.stats-grid dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.stats-grid dd {
  margin: 2px 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
}

.controls-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  padding: 20px;
}

.search-wide {
  grid-column: span 2;
}

.control-group {
  display: grid;
  gap: 6px;
}

.control-group label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid #9b89c9;
  outline-offset: 2px;
}

.score-card,
.request-card,
.data-guide {
  padding: 24px;
}

.score-formula {
  margin-top: 14px;
}

.score-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.score-details summary {
  padding: 11px 14px;
  color: var(--accent-dark);
  font-weight: 800;
  cursor: pointer;
}

.score-details summary:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.score-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.formula-box {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 16px;
  padding: 16px;
}

.formula-box h3 {
  margin-bottom: 6px;
  color: var(--accent-dark);
}

.formula-code {
  padding: 0.12em 0.42em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  white-space: nowrap;
}

.formula-weights ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.formula-weights li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
}

.formula-weights strong {
  color: var(--accent-dark);
}

.request-card {
  display: block;
}

.section-kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.request-actions {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.request-note {
  font-size: 0.86rem;
}

.table-card {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 12px;
}

.table-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.table-scroll {
  overflow: auto;
  max-height: 78vh;
  overscroll-behavior-x: contain;
  scrollbar-color: #b9bfd0 #f3f5fa;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px 16px;
}

.pagination.bottom {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}

.pagination:empty {
  display: none;
}

.pagination-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pagination-button {
  min-width: 42px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.pagination-button:hover:not(:disabled),
.pagination-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pagination-button:disabled {
  color: #69758b;
  cursor: not-allowed;
  opacity: 0.72;
}

.table-notes {
  display: grid;
  gap: 6px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.86rem;
}

.table-notes p {
  margin: 0;
}

.table-notes strong {
  color: var(--accent-dark);
}

.table-scroll table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.table-scroll th,
.table-scroll td {
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.cover-cell {
  width: 124px;
  min-width: 124px;
  text-align: center;
}

.cover-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.cover-image {
  width: 100px;
  height: 141px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cover-link:hover .cover-image {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
}

.cover-placeholder {
  display: inline-flex;
  width: 100px;
  height: 141px;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  background: var(--surface-strong);
}

.metric-wide {
  width: 150px;
  min-width: 150px;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-button:hover {
  color: #e1caff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.sort-button.active {
  color: #e1caff;
}

.sort-indicator {
  display: inline-block;
  min-width: 1em;
  color: #e1caff;
}

.table-scroll tbody tr:nth-child(even) {
  background: #f6f8fc;
}

.work-title {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.work-title strong {
  font-size: 1rem;
  line-height: 1.45;
}

.work-meta,
.metric-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.score-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.score-pill {
  min-width: 58px;
  padding: 7px 10px;
  background: var(--accent-dark);
  color: #fff;
}

.badge {
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
}

.badge.good {
  border-color: rgba(47, 111, 82, 0.24);
  background: rgba(47, 111, 82, 0.1);
  color: var(--good);
}

.badge.warn {
  border-color: rgba(155, 90, 21, 0.24);
  background: rgba(155, 90, 21, 0.1);
  color: var(--warn);
}

.badge.request {
  border-color: #ccbfdf;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.candidate {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--muted);
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  white-space: nowrap;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.guide-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

.related-reading {
  max-width: 1120px;
  margin: 18px auto 0;
  padding: 18px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.related-reading-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.related-reading ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-reading li {
  display: block;
}

.related-reading a {
  color: var(--accent-dark);
  text-decoration: none;
  text-underline-offset: 3px;
}

.related-reading a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.site-footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.error-box {
  padding: 18px;
  border: 1px solid rgba(155, 90, 21, 0.3);
  border-radius: 16px;
  background: rgba(155, 90, 21, 0.08);
  color: var(--warn);
}

@media (max-width: 900px) {
  .hero-inner {
    padding: 10px 0;
  }

  .hero-visual {
    margin-bottom: 22px;
    border-radius: 18px;
  }

  .notice-panel,
  .formula-box,
  .request-card,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .search-wide {
    grid-column: 1 / -1;
  }

  .controls-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-switcher a { padding: 10px 8px; font-size: .79rem; }

  .table-header {
    flex-direction: column;
  }

  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-buttons {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  :root { --anchor-offset: 140px; }
  .site-hero {
    padding-top: 28px;
  }

  .portal-bar { min-height: 66px; }
  .portal-bar .portal-brand { font-size: .82rem; }
  .portal-bar > a:not(.portal-brand) { font-size: .73rem; }
  .view-switcher-inner { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 8px 0; }
  .view-switcher a { min-width: 0; white-space: normal; font-size: .76rem; line-height: 1.5; display: grid; align-items: center; min-height: 44px; padding: 7px 4px; }
  .hero-scope { display: flex; font-size: .76rem; }
  .ranking-main { padding-top: 20px; }
  .controls-card { padding: 18px; gap: 14px 10px; }
  .control-group label { font-size: .78rem; }
  input, select { font-size: .85rem; padding: 10px 8px; }
  .formula-code { white-space: normal; overflow-wrap: anywhere; }

  .notice-panel,
  .controls-card,
  .score-card,
  .request-card,
  .data-guide {
    border-radius: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .related-reading li {
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cover-image { transition: none; }
}

@media print {
  .portal-bar, .view-switcher, .hero-actions, .ad-slot, .controls-card, .pagination { display: none; }
  body, .site-hero { background: white; color: #111; }
  .site-hero .lead, .site-hero .eyebrow, .site-hero .h1-sub, .site-hero .hero-scope, .site-hero .hero-scope span, .site-hero .num, .site-hero .cap, .site-hero .sub, .site-hero .band-source { color: #111; }
  .table-scroll { max-height: none; overflow: visible; }
}
