:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #5d6778;
  --line: #dfe4ec;
  --accent: #18864b;
  --accent-soft: #e8f7ee;
  --accent-2: #2357d8;
  --warn: #8a5300;
  --danger: #9e2f2f;
  --shadow: 0 12px 30px rgba(20, 32, 56, 0.06);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent-2); }

.page {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

header {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero,
.method-card,
.controls,
.rankings,
.panel,
.list-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero,
.method-card,
.controls,
.rankings {
  padding: 18px;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #166534;
  background: var(--accent-soft);
  border: 1px solid #b8dfc7;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  margin: 14px 0 14px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.hero p,
.method-card p,
.desc,
footer {
  color: var(--muted);
  line-height: 1.55;
}

.hero p,
.method-card p {
  margin: 0 0 10px;
}

.method-card h2,
.panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}

.stat {
  border-radius: 16px;
  padding: 12px;
  background: var(--panel);
}

.stat strong {
  display: block;
  color: var(--text);
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.controls {
  margin-bottom: 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

input,
select,
button {
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(24, 134, 75, 0.13);
}

.button-row,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

button:hover { filter: brightness(0.97); }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 0.84rem;
}

.pill.active {
  color: #166534;
  background: var(--accent-soft);
  border-color: #b8dfc7;
}

.rankings {
  margin-bottom: 18px;
}

.rankings summary {
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 700;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.panel {
  padding: 14px;
  box-shadow: none;
}

.rank-list {
  display: grid;
  gap: 8px;
}

.rank-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
  text-decoration: none;
}

.rank-no {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  color: #166534;
  background: var(--accent-soft);
  font-size: 0.76rem;
}

.rank-name {
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 0.84rem;
}

.list-wrap {
  overflow: hidden;
}

.source-item + .source-item {
  border-top: 1px solid var(--line);
}

.source-row {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  text-align: left;
}

.source-row:hover {
  background: #f8faff;
}

.source-main {
  min-width: 0;
}

.source-title {
  margin: 0 0 6px;
  font-weight: 750;
}

.source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.summary-chip,
.score-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #fff;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-chip {
  color: #166534;
  background: var(--accent-soft);
  border-color: #b8dfc7;
  font-family: var(--mono);
}

.source-arrow {
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 0.16s ease;
}

.source-row[aria-expanded="true"] .source-arrow {
  transform: rotate(90deg);
}

.source-detail {
  margin: 0 16px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcff;
}

.detail-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-top a {
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.detail-field {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.detail-field strong {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-field span {
  display: block;
  margin-top: 4px;
}

.load-more {
  display: block;
  margin: 16px auto;
}

.empty,
.error {
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.error {
  color: var(--danger);
  background: #fde8e8;
  border: 1px solid #f6b7b7;
  border-radius: var(--radius);
  margin-bottom: 18px;
}

footer {
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding-top: 18px;
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  header,
  .ranking-grid {
    grid-template-columns: 1fr;
  }

  .control-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 20px, 1400px);
    padding-top: 18px;
  }

  .control-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .hero,
  .method-card,
  .controls,
  .rankings,
  .list-wrap {
    border-radius: 14px;
  }

  .source-row {
    padding: 13px;
  }

  .source-detail {
    margin: 0 13px 13px;
    padding: 13px;
  }
}
