:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-alt: #1c2230;
  --line: #262d3a;
  --text: #d7dde7;
  --dim: #7d8798;
  --up: #4ade80;
  --down: #f87171;
  --accent: #f0a04b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}

.brand {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.statbar {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 12.5px;
}

.statbar b {
  color: var(--text);
  font-weight: 600;
}

.statbar .live {
  color: var(--up);
}

.statbar .stale {
  color: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.filters input[type="number"] { width: 92px; }

.toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--dim);
  cursor: pointer;
}

.toggle input { width: auto; }

.meta-cell {
  font-size: 12.5px;
  color: var(--dim);
  white-space: nowrap;
}

.meta-cell small {
  display: block;
  font-size: 11px;
  opacity: 0.75;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  color: var(--dim);
}

.hero {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.hero-art {
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tint) 26%, transparent), transparent 68%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 170px;
}

.hero-art img {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.hero-info h2 {
  margin: 0 30px 0 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

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

.hero-price .big {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.badge {
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-alt);
}

.badge.up { color: var(--up); }
.badge.down { color: var(--down); }
.badge.flat { color: var(--dim); }

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 16px;
}

.hero-grid label {
  display: block;
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 2px;
}

.hero-grid b {
  font-size: 14px;
  font-weight: 600;
}

.detail-section {
  margin-top: 26px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.detail-section h3 small {
  color: var(--dim);
  font-weight: 400;
  margin-left: 6px;
}

.chart-box {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}

.chart {
  width: 100%;
  display: block;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart .axis {
  fill: var(--dim);
  font-size: 10px;
}

.chart .cursor-line {
  stroke: var(--dim);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart-tip {
  position: absolute;
  top: 8px;
  display: none;
  transform: translateX(-50%);
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 9px;
  pointer-events: none;
  white-space: nowrap;
}

.chart-tip b {
  display: block;
  font-size: 13px;
}

.chart-tip span {
  font-size: 11px;
  color: var(--dim);
}

.depth-head {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 12px;
}

.depth-head b {
  color: var(--text);
  font-weight: 600;
  margin-left: 4px;
}

.depth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.depth h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
}

.depth-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  font-size: 12px;
  border-radius: 3px;
  overflow: hidden;
}

.depth-bar {
  position: absolute;
  inset: 0 auto 0 0;
  opacity: 0.18;
}

.depth-bar.buy { background: var(--up); }
.depth-bar.sell { background: var(--down); }

.depth-price, .depth-qty { position: relative; }
.depth-qty { color: var(--dim); }

.steam-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: none;
}

.steam-link:hover { text-decoration: underline; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px 22px 40px;
  align-items: start;
}

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

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.feed-title {
  font-weight: 600;
  font-size: 13px;
}

input, select, button {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 5px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
}

input { width: 260px; }

button {
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--dim);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 12.5px;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th.num, td.num { text-align: right; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.active { color: var(--accent); }

tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

tbody tr:hover { background: var(--panel-alt); }

tbody td {
  padding: 8px 14px;
  vertical-align: middle;
}

.item-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-cell img {
  width: 36px;
  height: 28px;
  object-fit: contain;
  flex: none;
}

.item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--dim); }

#feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 78vh;
  overflow-y: auto;
}

#feed li {
  display: flex;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

#feed li:hover { background: var(--panel-alt); }

#feed img {
  width: 34px;
  height: 26px;
  object-fit: contain;
  flex: none;
}

.feed-text {
  min-width: 0;
  flex: 1;
}

.feed-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.feed-meta {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 2px;
}

.tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 6px;
}

.tag.new { background: #2b3f5c; color: #93c5fd; }
.tag.indexed { background: #2c3140; color: #a8b3c7; }
.tag.spike { background: #1f3d2c; color: var(--up); }
.tag.drop { background: #43222a; color: var(--down); }
.tag.drain { background: #43371f; color: var(--accent); }

.empty {
  padding: 22px 14px;
  color: var(--dim);
  text-align: center;
  font-size: 13px;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 13, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#overlay.hidden { display: none; }

.detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  width: min(800px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}

#close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.detail h2 {
  margin: 0 26px 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.detail-stats {
  display: flex;
  gap: 24px;
  color: var(--dim);
  font-size: 12.5px;
  margin: 12px 0 16px;
  flex-wrap: wrap;
}

.detail-stats b {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.chart {
  width: 100%;
  height: 180px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); }
  input { width: 100%; }
  .panel-head { flex-wrap: wrap; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .depth { grid-template-columns: minmax(0, 1fr); }
}
