:root {
  color-scheme: light;
  --shell-max-width: 1440px;
  --bg: #f5f7f1;
  --ink: #20221e;
  --muted: #687064;
  --line: #d9dfd2;
  --panel: #ffffff;
  --accent: #1c6b5f;
  --accent-dark: #10483f;
  --gold: #d79b30;
  --rose: #b85c6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  padding: 24px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, var(--shell-max-width));
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand__logo {
  display: block;
  width: clamp(44px, 7vw, 64px);
  height: clamp(44px, 7vw, 64px);
  flex: 0 0 auto;
  object-fit: contain;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
}

.brand__ev {
  background: linear-gradient(90deg, var(--accent), var(--gold));
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 24px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  background: #fff;
  font-weight: 750;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  width: min(100%, var(--shell-max-width));
  margin-inline: auto;
  padding: 18px clamp(18px, 4vw, 48px) 48px;
}

.panel,
.hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.controls {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.source-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.source-box a {
  color: var(--accent-dark);
  overflow-wrap: anywhere;
}

.status-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.is-disabled {
  pointer-events: none;
  opacity: 0.48;
}

.hero {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 22px;
  min-height: 430px;
  padding: 28px;
  overflow: hidden;
}

.pack-visual {
  position: relative;
  display: grid;
  grid-row: 1 / span 3;
  min-height: 340px;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 35%),
    linear-gradient(160deg, var(--accent), #27312c 52%, var(--rose));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.pack-visual.has-image {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.28)),
    #eef1ea;
}

.pack-visual::before,
.pack-visual::after {
  position: absolute;
  right: 12%;
  left: 12%;
  height: 44px;
  content: "";
  background: repeating-linear-gradient(90deg, #f8efe1 0 12px, #d4b15a 12px 20px);
}

.pack-visual::before {
  top: 20px;
  border-radius: 8px 8px 2px 2px;
}

.pack-visual::after {
  bottom: 20px;
  border-radius: 2px 2px 8px 8px;
}

.pack-visual.has-image::before,
.pack-visual.has-image::after,
.pack-visual.has-image .pack-visual__foil,
.pack-visual.has-image .pack-visual__label {
  display: none;
}

.pack-visual__image {
  position: absolute;
  inset: 18px;
  z-index: 1;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  object-fit: contain;
}

.pack-visual__foil {
  position: absolute;
  inset: 82px 18%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02));
}

.pack-visual__label {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  width: 68%;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(15, 20, 17, 0.72);
  color: #fff;
  text-align: center;
}

.pack-visual__label span {
  color: #f6d989;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.pack-visual__label strong {
  font-size: 24px;
  line-height: 1.1;
}

.metrics {
  display: grid;
  gap: 12px;
  align-self: start;
  justify-self: start;
}

.metrics div {
  display: grid;
  gap: 8px;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  font-size: clamp(24px, 4vw, 38px);
}

.value-with-info {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.info-hint {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f8faf5;
  color: var(--accent-dark);
  cursor: help;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  vertical-align: middle;
}

.info-hint:hover,
.info-hint:focus-visible {
  border-color: var(--accent);
  outline: 0;
  background: #eef7f4;
}

.history-panel {
  display: grid;
  gap: 10px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.history-panel__heading,
.history-panel__meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.history-panel__heading span,
.history-panel__meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.history-panel__heading h2 {
  margin-top: 2px;
  font-size: 18px;
}

.history-panel__heading strong {
  color: var(--accent-dark);
  font-size: 24px;
}

.history-chart-layout {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
}

.history-chart__y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1;
  text-align: right;
}

.history-chart-frame {
  position: relative;
  min-width: 0;
}

.history-chart {
  width: 100%;
  height: 92px;
  overflow: visible;
  border-radius: 6px;
  background:
    linear-gradient(#eef1ea 1px, transparent 1px) 0 0 / 100% 50%,
    #f8faf5;
}

.history-chart polyline {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.history-chart__hover-target {
  fill: transparent;
  cursor: crosshair;
}

.history-chart__hit-target {
  fill: transparent;
  opacity: 0;
  pointer-events: none;
}

.history-chart__hit-target:focus-visible {
  outline: none;
  stroke: var(--gold);
  stroke-width: 2;
}

.history-chart__highlight {
  fill: var(--accent);
  pointer-events: none;
  stroke: var(--panel);
  stroke-width: 2;
}

.history-chart__tooltip {
  position: absolute;
  z-index: 1;
  max-width: 150px;
  transform: translate(-50%, calc(-100% - 10px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(32, 34, 30, 0.14);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
}

.history-panel__meta strong {
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-self: end;
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button--manapool {
  border-color: rgb(64 118 251);
  background: rgb(64 118 251);
  color: #fff;
}

.button--tip {
  border-color: var(--gold);
  background: #fff7e8;
  color: #65410a;
  white-space: nowrap;
}

.summary-panel,
.contributors-panel {
  grid-column: 1 / -1;
  padding: 20px;
}

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

.summary-copy {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.value-breakdown {
  display: grid;
  gap: 10px;
}

.value-breakdown__row,
.value-breakdown__total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
}

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

.value-breakdown__details {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.value-breakdown__details strong {
  overflow-wrap: anywhere;
}

.value-breakdown__details span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.value-breakdown__value,
.value-breakdown__total strong {
  font-size: 18px;
}

.value-breakdown__total {
  margin-top: 4px;
  font-weight: 800;
}

.value-breakdown__total span {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.top-contributors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.top-contributor {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.top-contributor__media {
  display: grid;
  aspect-ratio: 488 / 680;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  padding: 10px;
  background: #eef1ea;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.top-contributor__media img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.top-contributor__details {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.top-contributor__name {
  min-height: 38px;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.top-contributor h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1;
}

.top-contributor__details span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.site-footer {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .layout,
  .hero {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
    justify-self: stretch;
  }

  .pack-visual {
    grid-row: auto;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .value-breakdown__row,
  .value-breakdown__total {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
