@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  color-scheme: light;
  --paper: #f6f1e8;
  --paper-2: #efe8db;
  --ink: #15130f;
  --ink-soft: #3a332a;
  --ink-muted: #6b6153;
  --border: rgba(28, 23, 18, 0.16);
  --border-strong: rgba(28, 23, 18, 0.32);
  --accent: #a4471a;
  --accent-soft: rgba(164, 71, 26, 0.16);
  --good: #2d7a4b;
  --bad: #b5443b;
  --shadow: 0 20px 50px rgba(22, 18, 12, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(164, 71, 26, 0.12), rgba(164, 71, 26, 0) 62%),
    radial-gradient(760px 540px at 100% 6%, rgba(21, 19, 15, 0.08), rgba(21, 19, 15, 0) 60%),
    linear-gradient(135deg, rgba(21, 19, 15, 0.04) 0%, rgba(21, 19, 15, 0.02) 40%, rgba(21, 19, 15, 0.06) 100%),
    repeating-linear-gradient(0deg, rgba(21, 19, 15, 0.035), rgba(21, 19, 15, 0.035) 1px, transparent 1px, transparent 26px),
    repeating-linear-gradient(90deg, rgba(21, 19, 15, 0.03), rgba(21, 19, 15, 0.03) 1px, transparent 1px, transparent 26px);
  background-attachment: fixed;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.header {
  padding: 32px 18px 10px;
}

.brand {
  max-width: 980px;
  margin: 0 auto;
}

.brand--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand__title {
  font-weight: 750;
  letter-spacing: -0.02em;
  font-size: 18px;
}

.brand__app {
  font-family: "Fraunces", "IBM Plex Sans", serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 28px;
  color: var(--ink);
}

.brand__sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 4px;
}

.brand__sub__sub {
  color: var(--ink-muted);
  font-size: 11px;
  margin-top: 4px;
}

.main {
  padding: 12px 18px 28px;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

.compare-shell {
  display: grid;
  gap: 16px;
}

.pane {
  min-width: 0;
}

body.compare-mode .compare-shell {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}

.card {
  background: linear-gradient(180deg, rgba(246, 241, 232, 0.96), rgba(239, 232, 219, 0.92));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  animation: card-rise 520ms ease both;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(21, 19, 15, 0.08), rgba(21, 19, 15, 0));
  opacity: 0.16;
  pointer-events: none;
}

.card--score {
  position: relative;
  overflow: visible;
  z-index: 2;
}

.card--trend {
  position: relative;
  overflow: visible;
}

/* Spacing between sections in the content flow */
.wrap > * + * {
  margin-top: 12px;
}

.card__title {
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.info-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #fffaf2, #f1e8d7);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: help;
  box-shadow: 0 10px 18px rgba(22, 18, 12, 0.18);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.info-dot__icon {
  width: 16px;
  height: 16px;
  display: block;
  transform: translateX(-3px);
}

.info-dot:hover,
.info-dot:focus-visible {
  background: linear-gradient(180deg, #fff2df, #ead8be);
  border-color: rgba(21, 19, 15, 0.5);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 14px 22px rgba(22, 18, 12, 0.24);
}

.info-tip {
  position: absolute;
  top: 30px;
  right: 0;
  width: min(280px, 70vw);
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid rgba(21, 19, 15, 0.2);
  background: #fff7ea;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 16px 30px rgba(22, 18, 12, 0.22);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 8;
}

.info-dot:hover .info-tip,
.info-dot:focus-visible .info-tip {
  opacity: 1;
  transform: translateY(0);
}

.card--error {
  border-color: rgba(181, 68, 59, 0.32);
}

.error__msg {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.h1 {
  margin: 0 0 14px;
  font-family: "Fraunces", "IBM Plex Sans", serif;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.lookup__label {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.lookup__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.lookup__help {
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.35;
}

.lookup__both {
  margin-top: 12px;
}

.compare-delta-note {
  margin-top: 10px;
  border: 1px solid rgba(164, 71, 26, 0.28);
  background: rgba(255, 247, 234, 0.9);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
  display: none;
}

body.compare-mode .compare-delta-note {
  display: block;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.source {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.72);
  color: var(--ink);
  cursor: pointer;
}

.source:hover {
  border-color: var(--border-strong);
  background: rgba(255, 250, 242, 0.95);
}

.source[aria-pressed="true"] {
  border-color: rgba(164, 71, 26, 0.55);
  box-shadow: 0 0 0 4px rgba(164, 71, 26, 0.12);
}

.source__logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(21, 19, 15, 0.18);
  overflow: hidden;
}

.logo {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.source__name {
  font-weight: 650;
  font-size: 14px;
}

.source__mark {
  margin-left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(21, 19, 15, 0.12);
}

.mark {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: none;
}

.source[data-enabled="true"] .source__mark {
  color: #fffaf2;
  background: rgba(45, 122, 75, 0.95);
  border-color: rgba(45, 122, 75, 0.5);
}

.source[data-enabled="true"] .mark--ok {
  display: block;
}

.source[data-enabled="false"] .source__mark {
  color: #fffaf2;
  background: rgba(181, 68, 59, 0.82);
  border-color: rgba(181, 68, 59, 0.5);
}

.source[data-enabled="false"] .mark--no {
  display: block;
}

.input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.9);
  color: var(--ink);
  padding: 12px 12px;
  outline: none;
}

.input:focus {
  border-color: rgba(164, 71, 26, 0.55);
  box-shadow: 0 0 0 4px rgba(164, 71, 26, 0.16);
}

.btn {
  appearance: none;
  border: 1px solid rgba(21, 19, 15, 0.65);
  background: #1b1610;
  color: #fff7ea;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.02em;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 14px 24px rgba(20, 16, 11, 0.24);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(20, 16, 11, 0.28);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--ink);
  box-shadow: none;
}

.btn--ghost:hover {
  background: rgba(255, 250, 242, 0.8);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
  min-height: 18px;
}

.results {
  margin: 12px 0 0;
}

.results__columns {
  display: grid;
  gap: 12px;
}

.results__col {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

@media (min-width: 860px) {
  .results__columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.dl {
  margin: 0;
}

.dl__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dl__row:first-child {
  border-top: 0;
  padding-top: 0;
}

dt {
  margin: 0;
  color: var(--ink-muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-size: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "IBM Plex Mono", "IBM Plex Sans", monospace;
}

.score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 10px;
}

.score__value {
  font-size: 46px;
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-family: "Fraunces", "IBM Plex Sans", serif;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.score__max {
  white-space: nowrap;
  color: var(--ink-muted);
  font-weight: 600;
}

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

@media (min-width: 860px) {
  .ratings {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

body.compare-mode .ratings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rating {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 250, 242, 0.78);
}

.rating__label {
  color: var(--ink-muted);
  font-size: 12px;
}

.rating__value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  font-family: "IBM Plex Mono", "IBM Plex Sans", monospace;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.metric-delta {
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  margin-left: 4px;
}

.metric-delta--pos {
  color: var(--good);
}

.metric-delta--neg {
  color: var(--bad);
}

.metric-delta--zero {
  color: var(--ink-muted);
}

.score__value .metric-delta {
  font-size: 0.42em;
}

.rating__value .metric-delta {
  font-size: 0.72em;
}

.rating__peak {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 650;
  color: #9a6d29;
  letter-spacing: 0.01em;
}

.ratio {
  display: grid;
  gap: 10px;
}

.ratio__bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(21, 19, 15, 0.08);
  border: 1px solid rgba(21, 19, 15, 0.14);
  overflow: hidden;
  display: flex;
}

.ratio__seg {
  height: 100%;
  min-width: 6px;
  box-shadow: inset -1px 0 0 rgba(20, 16, 11, 0.3);
}

.ratio__seg:last-child {
  box-shadow: none;
}

.ratio__seg--win {
  background: linear-gradient(180deg, rgba(45, 122, 75, 0.95), rgba(45, 122, 75, 0.7));
}

.ratio__seg--draw {
  background: linear-gradient(180deg, rgba(148, 135, 118, 0.82), rgba(148, 135, 118, 0.52));
}

.ratio__seg--loss {
  background: linear-gradient(180deg, rgba(181, 68, 59, 0.92), rgba(181, 68, 59, 0.65));
}

.ratio__labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.trend {
  display: grid;
  gap: 10px;
}

.trend__chart {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.75);
  padding: 10px;
}

.trend__svg {
  width: 100%;
  height: 140px;
  display: block;
}

.trend__area {
  fill: rgba(164, 71, 26, 0.18);
}

.trend__line {
  fill: none;
  stroke: rgba(164, 71, 26, 0.95);
  stroke-width: 2.2;
  filter: drop-shadow(0 4px 10px rgba(164, 71, 26, 0.25));
}

.trend__dot {
  fill: rgba(164, 71, 26, 0.95);
  stroke: rgba(21, 19, 15, 0.6);
  stroke-width: 1;
}

.trend__note {
  font-size: 10px;
  fill: rgba(21, 19, 15, 0.7);
}

.trend__axis {
  stroke: rgba(21, 19, 15, 0.2);
  stroke-width: 1;
}

.trend__label {
  font-size: 10px;
  fill: rgba(21, 19, 15, 0.6);
}

.trend__label--time {
  fill: rgba(21, 19, 15, 0.5);
}

.trend__empty {
  font-size: 12px;
  color: var(--ink-muted);
}

.range-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.range-picker--inside {
  margin-top: 6px;
}

.range-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 250, 242, 0.8);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.range-btn[aria-pressed="true"] {
  border-color: rgba(164, 71, 26, 0.6);
  box-shadow: 0 0 0 3px rgba(164, 71, 26, 0.12);
  background: rgba(164, 71, 26, 0.14);
}

.muted {
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.35;
}

.footer {
  padding: 18px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

.link {
  color: rgba(21, 19, 15, 0.8);
  text-decoration: none;
  border-bottom: 1px solid rgba(21, 19, 15, 0.25);
}

.link:hover {
  color: rgba(21, 19, 15, 0.95);
  border-bottom-color: rgba(21, 19, 15, 0.45);
}

.sep {
  margin: 0 10px;
  color: rgba(21, 19, 15, 0.35);
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .lookup__row {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .sources {
    gap: 8px;
  }

  .source {
    width: 100%;
    justify-content: space-between;
  }

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

@media (max-width: 960px) {
  body.compare-mode .compare-shell {
    grid-template-columns: 1fr;
  }
}
