:root {
  color-scheme: dark;
  --bg: #101417;
  --panel: #171d21;
  --panel-strong: #20282d;
  --line: #303a40;
  --text: #edf3f1;
  --muted: #9eaaa7;
  --green: #4fc982;
  --red: #ff6b6b;
  --gold: #f0c15f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.controls,
.summary {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.status {
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  text-align: right;
}

.status[data-tone="ok"] {
  color: var(--green);
}

.status[data-tone="warning"] {
  color: var(--gold);
}

.status[data-tone="error"] {
  color: var(--red);
}

.controls {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

select,
input,
button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
}

select,
input {
  padding: 0 10px;
}

input {
  width: 84px;
}

button {
  padding: 0 14px;
  color: var(--bg);
  background: var(--green);
  border-color: transparent;
  font-weight: 700;
  cursor: pointer;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.summary span,
.summary b {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.summary strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 18px;
}

.routes {
  display: grid;
  gap: 14px;
}

.route {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.route-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel-strong);
}

.route h2,
.route h3,
.route p {
  margin: 0;
}

.route h2 {
  font-size: 18px;
}

.route p,
.route-meta,
.shopping span {
  color: var(--muted);
  font-size: 12px;
}

.route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.item-icon-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 6px;
}

.item-icon {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  object-fit: contain;
}

.item-icon.fallback {
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #2a343a;
  color: var(--text);
  font-weight: 800;
}

.item-glint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(37%) sepia(95%) saturate(1626%) hue-rotate(247deg) brightness(111%) contrast(105%);
  mix-blend-mode: screen;
  opacity: 0.32;
  animation: glint 3.4s ease-in-out infinite;
}

.item-glint--soft {
  opacity: 0.18;
  animation-name: glint-soft;
}

@keyframes glint {
  0%,
  100% {
    filter: brightness(0) saturate(100%) invert(28%) sepia(75%) saturate(1430%) hue-rotate(248deg) brightness(98%) contrast(96%);
    opacity: 0.18;
  }

  38% {
    filter: brightness(0) saturate(100%) invert(55%) sepia(81%) saturate(2389%) hue-rotate(250deg) brightness(118%) contrast(111%);
    opacity: 0.48;
  }

  68% {
    filter: brightness(0) saturate(100%) invert(44%) sepia(96%) saturate(2159%) hue-rotate(285deg) brightness(113%) contrast(106%);
    opacity: 0.34;
  }
}

@keyframes glint-soft {
  0%,
  100% {
    filter: brightness(0) saturate(100%) invert(30%) sepia(56%) saturate(1000%) hue-rotate(248deg) brightness(92%) contrast(94%);
    opacity: 0.1;
  }

  38% {
    filter: brightness(0) saturate(100%) invert(50%) sepia(68%) saturate(1400%) hue-rotate(253deg) brightness(108%) contrast(102%);
    opacity: 0.27;
  }

  68% {
    filter: brightness(0) saturate(100%) invert(41%) sepia(68%) saturate(1300%) hue-rotate(286deg) brightness(104%) contrast(100%);
    opacity: 0.2;
  }
}

.rank {
  text-align: right;
}

.rank span {
  display: block;
  color: var(--green);
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rank small {
  color: var(--muted);
}

.rank em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 78px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.market-trends {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #192126;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.metric .trend-badge {
  margin-top: 8px;
}

.trend-badge[data-tone="cheap"],
.trend-badge[data-tone="strong"] {
  border-color: rgba(79, 201, 130, 0.45);
  background: rgba(79, 201, 130, 0.12);
  color: var(--green);
}

.trend-badge[data-tone="elevated"],
.trend-badge[data-tone="soft"] {
  border-color: rgba(240, 193, 95, 0.5);
  background: rgba(240, 193, 95, 0.13);
  color: var(--gold);
}

.trend-badge[data-tone="inflated"],
.trend-badge[data-tone="weak"] {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: var(--red);
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.muted {
  color: var(--muted);
}

.shopping {
  padding: 14px;
}

.shopping h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.shopping ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shopping li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #12181b;
}

.shopping li strong,
.shopping li span {
  display: block;
}

@media (max-width: 900px) {
  .metric:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    min-width: 0;
    text-align: left;
  }

  .summary,
  .metrics {
    grid-template-columns: 1fr;
  }

  .route-head {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .rank {
    grid-column: 1 / -1;
    text-align: left;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }
}
