:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #62716b;
  --line: #d8e0dc;
  --paper: #f5f6f2;
  --panel: #ffffff;
  --green: #1f6a4b;
  --green-soft: #e4f1ea;
  --blue: #285b78;
  --blue-soft: #e6eef4;
  --amber: #8a6218;
  --amber-soft: #fff3d8;
  --red: #9a4038;
  --red-soft: #f8e8e5;
  --shadow: 0 12px 28px rgba(31, 45, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar-copy {
  max-width: 820px;
}

.topbar-copy p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-link,
.detail-link,
.source-button,
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--green);
  border-radius: 8px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link.active {
  background: var(--green);
  color: #fff;
}

.source-button,
.back-link {
  margin-top: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
h5,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

h4 {
  margin-bottom: 10px;
  font-size: 16px;
}

h5 {
  margin-bottom: 8px;
  font-size: 14px;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf1ee;
}

.status {
  min-width: 238px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
}

main {
  padding: 24px 32px 52px;
}

.band {
  max-width: 1280px;
  margin: 0 auto 30px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.section-head p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.summary-hero,
.ranking-card,
.axis-card,
.property-hero,
.report-section,
.report-output,
.quality-card,
.io-panel,
.source-list a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: center;
  padding: 22px;
}

.summary-hero p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.count-card {
  padding: 14px;
  border-radius: 8px;
  text-align: center;
}

.count-card span,
.count-card strong {
  display: block;
}

.count-card span {
  font-size: 13px;
  font-weight: 900;
}

.count-card strong {
  font-size: 34px;
  line-height: 1.05;
}

.decision-ok {
  color: var(--green);
  background: var(--green-soft);
}

.decision-hold {
  color: var(--amber);
  background: var(--amber-soft);
}

.decision-ng {
  color: var(--red);
  background: var(--red-soft);
}

.ranking-card {
  overflow: hidden;
}

.ranking-head,
.ranking-row {
  display: grid;
  grid-template-columns: 90px 120px minmax(270px, 1.25fr) minmax(260px, 1fr) 132px;
  gap: 14px;
  align-items: center;
}

.ranking-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fbfcfa;
  font-size: 12px;
  font-weight: 900;
}

.ranking-row {
  min-height: 102px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-row:hover {
  background: #fbfcfa;
}

.ranking-row:focus-visible {
  outline: 3px solid rgba(31, 106, 75, 0.28);
  outline-offset: -3px;
}

.decision-badge {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 900;
}

.rank-score b {
  font-size: 26px;
}

.rank-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.score-bar {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ee;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.rank-line {
  margin-bottom: 4px;
  color: var(--green) !important;
  font-size: 13px;
  font-weight: 900;
}

.ranking-row p,
.axis-card p,
.property-hero p,
.report-section p,
.report-output p,
.quality-card p,
.io-agent p,
li {
  color: var(--muted);
  line-height: 1.68;
}

.ranking-row p,
.report-section p {
  margin-bottom: 0;
}

.ranking-row strong {
  color: var(--ink);
  font-size: 13px;
}

.scoring-grid,
.quality-grid,
.source-list {
  display: grid;
  gap: 12px;
}

.scoring-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.axis-card,
.quality-card {
  padding: 16px;
}

.axis-score-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.axis-score-line span {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.property-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 20px;
  align-items: center;
  padding: 22px;
}

.hero-score {
  padding: 18px;
  border-radius: 8px;
  text-align: center;
}

.hero-score span,
.hero-score small {
  display: block;
  font-weight: 900;
}

.hero-score strong {
  display: block;
  font-size: 48px;
  line-height: 1;
}

.report-section {
  padding: 20px 22px;
}

.first-section {
  padding-top: 0;
  overflow: hidden;
}

.decision-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 -22px 20px;
}

.decision-panel div {
  padding: 20px 22px;
}

.decision-panel div + div {
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.decision-panel span,
.decision-panel small {
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.decision-panel strong {
  display: block;
  font-size: 42px;
  line-height: 1.05;
}

.reason-grid,
.breakdown-grid,
.next-action-grid,
.output-sections,
.io-layout {
  display: grid;
  gap: 14px;
}

.reason-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

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

.reason-grid article,
.breakdown-grid article,
.next-action-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.fact-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.fact-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.fact-list div:last-child {
  border-bottom: 0;
}

.fact-list dt {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.fact-list dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.output-sections {
  grid-template-columns: 1fr 1fr;
}

.report-output {
  padding: 22px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-bottom: 10px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.estimate-kicker {
  color: var(--amber);
  background: var(--amber-soft);
}

.lead {
  color: var(--ink) !important;
}

.verdict {
  margin: 14px 0;
  padding: 12px;
  border-left: 4px solid var(--red);
  background: #fffafa;
}

.estimate-verdict {
  border-left-color: var(--amber);
  background: #fffdf7;
}

.verdict span {
  display: block;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.estimate-verdict span {
  color: var(--amber);
}

.verdict strong {
  color: var(--red);
}

.estimate-verdict strong {
  color: var(--amber);
}

.report-section-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.next-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.next-action-grid strong {
  display: block;
  color: var(--green);
  font-size: 13px;
}

ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.quality-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score {
  color: var(--green);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.io-layout {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.io-panel {
  min-width: 0;
  overflow: hidden;
}

.io-panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.io-panel-head h3,
.io-panel-head p {
  margin-bottom: 0;
}

.io-panel-head p {
  color: var(--muted);
  font-size: 13px;
}

.code-panel {
  min-height: 620px;
  max-height: 820px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #27322e;
  background: #fbfcfa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.output-list {
  max-height: 900px;
  overflow: auto;
}

.io-agent {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.io-agent:last-child {
  border-bottom: 0;
}

.io-agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.io-agent-head span {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
}

.raw-line {
  margin-top: 10px;
}

.source-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.single-source {
  grid-template-columns: 1fr;
}

.research-summary {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.research-summary span,
.research-summary strong {
  display: block;
}

.research-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.research-summary strong {
  color: var(--green);
  font-size: 40px;
  line-height: 1;
}

.research-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.research-group {
  margin-bottom: 16px;
}

.research-group h3 {
  margin-bottom: 10px;
}

.source-list a {
  display: block;
  min-width: 0;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
}

.source-list a:hover {
  border-color: var(--green);
}

.source-list span,
.source-list small {
  display: block;
  overflow-wrap: anywhere;
}

.source-list span {
  margin-bottom: 8px;
  font-weight: 900;
}

.source-list small {
  color: var(--muted);
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

@media (max-width: 1080px) {
  .summary-hero,
  .ranking-head,
  .ranking-row,
  .scoring-grid,
  .property-hero,
  .reason-grid,
  .breakdown-grid,
  .next-action-grid,
  .output-sections,
  .quality-grid,
  .io-layout,
  .source-list {
    grid-template-columns: 1fr;
  }

  .ranking-head {
    display: none;
  }

  .topbar,
  .top-nav,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  main,
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 640px) {
  .count-grid,
  .decision-panel,
  .fact-list div {
    grid-template-columns: 1fr;
  }

  .decision-panel div + div {
    border-left: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .status,
  .nav-link,
  .detail-link {
    width: 100%;
    justify-content: center;
  }
}
