:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #8b93a3;
  --pass: #3fb950;
  --fail: #f85149;
  --warn: #d29922;
  --accent: #4c8dff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}
header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.header-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.header-button:hover {
  border-color: var(--accent);
  color: #fff;
}
.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}
.support-button {
  border-color: #ff8b88;
  background: #ff5e5b;
  color: #171a21;
}
.support-button:hover {
  border-color: #ffb1af;
  background: #ff7774;
  color: #0f1115;
}
header h1 {
  margin: 0 0 4px;
  font-size: 20px;
}
header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}
main {
  padding: 24px 28px;
  max-width: 1200px;
  margin: 0 auto;
}
.about-page {
  max-width: 800px;
}
.about-content {
  padding: clamp(22px, 5vw, 44px);
}
.about-content h1 {
  margin: 0 0 24px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.2;
}
.about-content h2 {
  margin: 34px 0 12px;
  color: var(--text);
  font-size: 20px;
  text-transform: none;
  letter-spacing: normal;
}
.about-content p,
.about-content li {
  color: #c7ccd6;
  font-size: 16px;
  line-height: 1.75;
}
.about-content p {
  margin: 0 0 18px;
}
.about-content ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.about-content li + li {
  margin-top: 12px;
}
.about-content a {
  color: #76a7ff;
}
.about-content .support-button {
  color: #171a21;
}
.support-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 34px;
  padding: 22px;
  border: 1px solid #5c3538;
  border-radius: 10px;
  background: #221b20;
}
.support-callout h2 {
  margin: 0 0 6px;
}
.support-callout p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.support-callout .support-button {
  white-space: nowrap;
}
@media (max-width: 600px) {
  header {
    padding-inline: 18px;
  }
  main {
    padding: 20px 18px;
  }
  .header-inner {
    gap: 14px;
  }
  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions .header-button {
    justify-content: center;
  }
  .support-callout {
    align-items: stretch;
    flex-direction: column;
  }
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.grid > .card {
  min-width: 0;
}
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
canvas {
  max-height: 320px;
}
.correlation-note {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.correlation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.correlation-chart {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
}
.correlation-chart canvas {
  width: 100%;
  height: 250px;
  max-height: 250px;
}
.correlation-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.correlation-heading h3 {
  margin: 0;
  font-size: 13px;
}
.correlation-heading span {
  flex: none;
  color: var(--muted);
  font: 11px var(--mono);
}
@media (max-width: 800px) {
  .correlation-grid {
    grid-template-columns: 1fr;
  }
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  top: 0;
  background: var(--panel);
}
.matrix td {
  text-align: center;
  font-family: var(--mono);
  cursor: pointer;
}
.matrix td.heat {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.matrix td.heat:hover {
  border: 1px solid var(--accent);
}
.matrix td.heat-dim {
  opacity: 0.35;
}
.matrix td.heat-active,
.matrix th.heat-active {
  border: 2px solid var(--accent);
  color: var(--accent);
}
.matrix th.heat-head {
  cursor: pointer;
}
.matrix th.heat-head:hover {
  color: var(--text);
}
.matrix td.name {
  text-align: left;
  cursor: default;
  white-space: nowrap;
}
.settings-table td {
  text-align: left;
  vertical-align: top;
  cursor: default;
}
.settings-table td.name {
  min-width: 220px;
  white-space: normal;
}
#heatWrap {
  overflow-x: auto;
}
.matrix td.cell {
  position: relative;
}
.cell-img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel-2);
}
.cell-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  text-shadow: 0 0 3px #000;
}
.modal-img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin: 0 0 12px;
}
.showcase table {
  width: 100%;
  border-collapse: collapse;
}
.showcase th,
.showcase td {
  padding: 12px;
  text-align: center;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.showcase th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.showcase td.col {
  cursor: pointer;
}
.showcase td.col:hover {
  background: var(--panel-2);
}
.showcase .decodefail {
  color: var(--warn);
  font-size: 12px;
  padding: 18px 0;
}
.showcase .hint {
  color: var(--muted);
  font-size: 11px;
}
.cell-pass {
  color: var(--pass);
}
.cell-fail {
  color: var(--fail);
}
.cell-err {
  color: var(--warn);
}
.cell:hover {
  background: var(--panel-2);
}
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
}
.pill.pass {
  background: rgba(63, 185, 80, 0.15);
  color: var(--pass);
}
.pill.fail {
  background: rgba(248, 81, 73, 0.15);
  color: var(--fail);
}
.pill.err {
  background: rgba(210, 153, 34, 0.15);
  color: var(--warn);
}
section.full {
  margin-top: 20px;
}
/* modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.overlay.open {
  display: flex;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(900px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 22px;
}
.modal h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.modal .sub {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 16px;
  font-family: var(--mono);
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
pre {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
}
.close {
  float: right;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  border: none;
  background: none;
}
.close:hover {
  color: var(--text);
}
.empty {
  color: var(--muted);
  font-style: italic;
  padding: 40px;
  text-align: center;
}
.legend {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.legend span {
  margin-right: 14px;
}
/* metric toggle (tokens / cost) */
.toggle {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 14px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.toggle-btn:hover {
  color: var(--text);
}
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}
.cost-note {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  padding: 8px 0;
}
