:root {
  --bg: #f8f5ef;
  --ink: #342d23;
  --muted: #62584a;
  --accent: #80521f;
  --line: #c9bcaa;
  --soft: #eee5d8;
  --blue: #1f5684;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.65 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
header {
  background: #3c3020;
  color: white;
  padding: 18px max(24px, calc((100vw - 1160px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 650;
}
header span:last-child,
.eyebrow {
  font:
    700 12px/1.6 ui-monospace,
    monospace;
  letter-spacing: 0.1em;
}
main {
  max-width: 1160px;
  padding: 34px 24px;
  margin: auto;
}
.intro {
  max-width: 930px;
  padding: 12px 0 20px;
}
h1 {
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.1;
  letter-spacing: -0.045em;
  margin: 12px 0 20px;
}
h2 {
  font-size: 23px;
  line-height: 1.3;
  margin: 0 0 15px;
}
.lead {
  font-size: 22px;
  line-height: 1.5;
}
p {
  margin: 12px 0 20px;
}
.eyebrow,
.small {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.callout,
.observation {
  padding: 18px;
  background: var(--soft);
  border-left: 4px solid var(--accent);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 22px 0;
}
.metrics > div {
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}
.metrics strong {
  display: block;
  font-size: 30px;
  line-height: 1.2;
  margin-bottom: 12px;
}
.metrics span {
  color: var(--muted);
  font-size: 14px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 22px;
}
.panel {
  min-width: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 22px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
}
label {
  display: block;
  font-weight: 650;
  margin: 16px 0 8px;
}
textarea,
input,
select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 12px;
  border: 1px solid #94836c;
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  background: white;
  margin-top: 8px;
}
textarea {
  font:
    13px/1.6 ui-monospace,
    monospace;
  resize: vertical;
}
button,
#point-download,
#rank-download {
  min-height: 46px;
  padding: 11px 16px;
  font:
    600 16px/1.4 system-ui,
    sans-serif;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  margin: 12px 8px 8px 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
#example {
  background: white;
  color: var(--accent);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
a {
  color: #6c4218;
}
summary {
  min-height: 44px;
  padding: 12px 0;
  cursor: pointer;
  font-weight: 650;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--soft);
  border-radius: 6px;
  padding: 16px;
  font-size: 13px;
}
.three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.result-metrics {
  grid-template-columns: repeat(3, 1fr);
}
ol {
  padding-left: 22px;
}
li {
  margin-bottom: 14px;
}
img {
  display: block;
  width: 100%;
  height: auto;
}
footer {
  padding: 14px 0 24px;
  color: var(--muted);
  font-size: 14px;
}
#target,
#rank-detail,
#rank-summary {
  overflow-wrap: anywhere;
}
.error {
  color: #a52317;
}
[hidden] {
  display: none !important;
}
@media (max-width: 750px) {
  main {
    padding: 24px 16px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .panel {
    padding: 20px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .metrics > div {
    padding: 16px;
  }
  .metrics strong {
    font-size: 28px;
  }
  .lead {
    font-size: 20px;
  }
  .three,
  .result-metrics {
    grid-template-columns: 1fr;
  }
  header {
    padding: 16px;
  }
  h2 {
    font-size: 21px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: filter 0.15s;
  }
  button:hover {
    filter: brightness(0.94);
  }
}
