:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Segoe UI", "Microsoft JhengHei", sans-serif;
  background: #f5f0e4;
  color: #211d17;
  --muted: #64594a;
  --line: #e2d8c6;
  --surface: #fffdf7;
  --accent: #872d20;
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; }
.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.hero {
  background: radial-gradient(ellipse at 74% 0%, #39281f, transparent 67%), #211c17;
  color: #fff6e3;
  padding: 39px 0 67px;
  border-top: 5px solid #a74731;
}
.game {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: #f1c78e;
  margin: 0 0 8px;
}
h1, h2, p { margin: 0; }
h1 {
  font-family: "DM Serif Text", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.9rem, 6vw, 5rem);
  letter-spacing: -.055em;
  line-height: 1;
}
h2 { font-size: 1.22rem; }
.intro { margin-top: 14px; color: #e1d2bc; line-height: 1.6; }
.loadout { display: grid; grid-template-columns: 1.65fr 1fr; gap: 18px; margin-top: -31px; }
.card, .total-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 18px;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-top: 1px solid var(--line); }
thead th { background: #f2ebdc; color: #4f4232; font-size: .83rem; font-weight: 700; }
.sources th, .sources td { padding: 8px 18px; }
.sources th:first-child { width: 58%; }
.sources th:nth-child(2) { width: 26%; }
.sources th:last-child, .sources td:last-child { text-align: right; }
.sources small { font-size: .73rem; font-weight: 400; color: var(--muted); margin-inline-start: 3px; }
.sources output, .rates td, .total-card dd { font-variant-numeric: tabular-nums; }
.sources output { font-weight: 650; }
.source-note, .scroll-note { padding: 9px 18px; font-size: .77rem; color: var(--muted); }
.source-note { border-top: 1px solid var(--line); }
.scroll-note { display: none; padding-top: 0; }
input, select, button {
  min-height: 34px;
  border: 1px solid #c8baa3;
  border-radius: 6px;
  font: inherit;
  color: inherit;
  background: #fffefb;
  padding: 5px 8px;
}
.sources input, .sources select { width: 100%; min-width: 64px; }
button { cursor: pointer; font-size: .85rem; font-weight: 650; color: var(--accent); }
button:hover { background: #f9eddd; }
:is(input, select, button, summary, .table-scroll):focus-visible { outline: 2px solid #a74731; outline-offset: 3px; }
input:invalid { border-color: var(--accent); }
.total-card { padding: 20px 24px; background: #f9eacb; border-color: #ddc79d; }
.total-card h2 { color: #4c3825; }
.total-card h2 span { margin-left: 5px; font-size: .8rem; font-weight: 500; }
#total {
  display: block;
  font: 400 clamp(3.15rem, 7vw, 4.7rem)/1.15 Georgia, serif;
  letter-spacing: -.055em;
  overflow-wrap: anywhere;
  color: var(--accent);
  padding-bottom: 13px;
}
.total-card dl { margin: 0; }
.total-card dl div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid #dec9a4;
  font-size: .91rem;
}
.total-card dd { margin: 0; font-weight: 700; }
summary { cursor: pointer; }
.total-card details { margin-top: 7px; font-size: .82rem; color: #584737; }
details p { margin-block: 6px; font-size: .84rem; font-weight: 400; line-height: 1.65; color: var(--muted); }
code { color: var(--muted); font: .75rem/1.5 "IBM Plex Mono", Consolas, monospace; overflow-wrap: anywhere; }
.effects { margin-top: 22px; }
.effects-heading { padding: 18px; }
.effects-heading > p { font-size: .88rem; line-height: 1.6; color: var(--muted); margin-top: 6px; }
.filters { display: grid; grid-template-columns: minmax(180px, 2.2fr) minmax(130px, 1fr) minmax(130px, 1fr); gap: 12px; margin-top: 13px; }
.filters label { display: grid; gap: 5px; font-weight: 600; font-size: .85rem; }
.filters input, .filters select { width: 100%; font-weight: 400; }
.table-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); margin-top: 8px; font-size: .77rem; }
#count { white-space: nowrap; }
.table-scroll { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.rates { min-width: 690px; }
.rates th, .rates td { padding: 9px 15px; }
.rates thead th:first-child { width: 50%; }
.rates thead th:nth-child(3) { background: #f3e2bf; }
.rates tbody th { font-size: .88rem; font-weight: 600; }
.rates td, .rates thead th:not(:first-child) { text-align: right; white-space: nowrap; }
.rates td { width: 12.5%; font-size: .88rem; }
.rates tbody tr:nth-child(even) { background: #faf6ec; }
.rates input { width: 71px; margin-inline-end: 4px; min-height: 27px; padding: 2px 5px; text-align: right; }
.rates .result { font-weight: 750; background: #f4e7cd70; }
.result[data-change="up"] { color: #275a43; }
.result[data-change="down"] { color: #91362b; }
.rates td.empty { text-align: center; color: var(--muted); padding-block: 22px; }
footer { color: var(--muted); padding-block: 18px 28px; font-size: .8rem; line-height: 1.6; }

@media (max-width: 730px) {
  .wrap { width: calc(100% - 28px); }
  .hero { padding: 27px 0 52px; }
  .loadout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .total-card { padding: 14px 16px; }
  .sources th, .sources td { padding-inline: 10px; }
  .sources small { display: block; margin-inline-start: 0; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .scroll-note { display: block; }
  .rates { min-width: 535px; }
  .rates thead th:first-child { width: 33%; }
  .rates th, .rates td { padding-inline: 8px; }
  .rates td { width: 16.75%; }
}
