:root {
  --bg: #0d0d0c;
  --surface: #141412;
  --surface-2: #1a1a17;
  --surface-3: #22221e;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f2eb;
  --muted: #97978d;
  --accent: #d8ff45;
  --accent-soft: rgba(216, 255, 69, 0.11);
  --orange: #ff9f43;
  --red: #ff6868;
  --cyan: #7ed8df;
  --radius: 18px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 5%, rgba(157, 184, 55, 0.09), transparent 30rem),
    radial-gradient(circle at 15% 38%, rgba(79, 119, 116, 0.05), transparent 34rem),
    var(--bg);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #0b0b09;
  background: var(--accent);
  border-radius: 12px 4px 12px 4px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.04em;
  transform: rotate(-3deg);
}

.brand > span:last-child { display: grid; }
.brand strong { font-size: 15px; letter-spacing: 0.01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 18px; }
.freshness { color: var(--muted); font-size: 12px; text-align: right; }

.button {
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: 0.55; }
.button-primary { color: #0c0d08; background: var(--accent); box-shadow: 0 8px 24px rgba(216, 255, 69, 0.12); }
.button-primary:hover:not(:disabled) { background: #e2ff72; }
.button-secondary { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }
.button-icon { font-size: 19px; line-height: 1; }
.is-spinning .button-icon { animation: spin 900ms linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  min-height: 390px;
  padding: 68px 4px 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  overflow: hidden;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(216, 255, 69, 0.08), 0 0 18px rgba(216, 255, 69, 0.55);
}

.hero h1 {
  margin: 20px 0 20px;
  max-width: 720px;
  font-size: clamp(54px, 7.1vw, 98px);
  line-height: 0.88;
  letter-spacing: -0.072em;
  font-weight: 780;
}

.hero h1 em { color: var(--accent); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-copy > p { max-width: 590px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }

.hero-orbit {
  position: relative;
  width: 100%;
  min-height: 300px;
}

.orbit-ring {
  position: absolute;
  border: 1px solid rgba(216, 255, 69, 0.18);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.orbit-one { width: 330px; height: 190px; top: 54px; right: 6px; }
.orbit-two { width: 250px; height: 250px; top: 22px; right: 45px; border-color: rgba(255, 255, 255, 0.06); }

.knife-glyph {
  position: absolute;
  top: 72px;
  right: 108px;
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 72px;
  border-radius: 46% 54% 44% 56%;
  background: linear-gradient(145deg, rgba(216, 255, 69, 0.1), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(216, 255, 69, 0.12);
  box-shadow: inset 0 0 42px rgba(216, 255, 69, 0.035), 0 28px 80px rgba(0, 0, 0, 0.35);
  animation: float 5s ease-in-out infinite;
}

@keyframes float { 50% { transform: translateY(-8px) rotate(3deg); } }

.price-chip {
  position: absolute;
  z-index: 2;
  width: 112px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(26, 26, 23, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.price-chip small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; letter-spacing: 0.14em; }
.price-chip strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.chip-one { top: 26px; right: 4px; transform: rotate(4deg); }
.chip-two { top: 213px; right: 238px; transform: rotate(-4deg); }

.notice {
  margin: 0 0 24px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255, 159, 67, 0.22);
  border-radius: 13px;
  background: rgba(255, 159, 67, 0.055);
}

.notice-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--orange);
  border: 1px solid rgba(255, 159, 67, 0.3);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
}

.notice strong { display: block; margin-bottom: 3px; font-size: 13px; }
.notice p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice a { color: var(--orange); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 20, 18, 0.72);
  overflow: hidden;
}

.metric { min-height: 126px; padding: 24px 26px; display: grid; align-content: center; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.metric > strong { margin: 9px 0 5px; font-size: clamp(25px, 3vw, 36px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.metric > small { color: #96968d; font-size: 11px; }
.metric-status > strong { display: flex; align-items: center; gap: 9px; font-size: 18px; letter-spacing: -0.02em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--accent); box-shadow: 0 0 12px rgba(216, 255, 69, 0.45); }
.status-dot.busy { background: var(--orange); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.error { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.35; } }

.market-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  min-height: 88px;
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div:first-child { display: flex; align-items: baseline; gap: 12px; }
.section-index { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.panel-heading h2 { margin: 0; font-size: 22px; letter-spacing: -0.035em; }
.result-count { color: var(--muted); font-size: 11px; }
.view-toggle { padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #10100f; }
.view-toggle span { width: 32px; height: 29px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; background: transparent; }
.view-toggle span.active { color: var(--text); background: var(--surface-3); }

.filters {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(130px, auto));
  gap: 9px;
  border-bottom: 1px solid var(--line);
  background: #11110f;
}

.filters select, .search-field {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.filters select {
  width: 100%;
  padding: 0 32px 0 12px;
  color: #c9c9c0;
  outline: none;
}

.filters select:focus, .search-field:focus-within { border-color: rgba(216, 255, 69, 0.38); box-shadow: 0 0 0 3px rgba(216, 255, 69, 0.06); }
.search-field { padding: 0 12px; display: flex; align-items: center; gap: 9px; }
.search-field > span { color: var(--muted); font-size: 21px; transform: translateY(-1px); }
.search-field input { width: 100%; height: 100%; color: var(--text); border: 0; outline: 0; background: transparent; }
.search-field input::placeholder { color: #96968d; }
.search-field kbd { padding: 3px 6px; color: #686861; border: 1px solid var(--line); border-radius: 5px; background: #10100f; font-family: inherit; font-size: 9px; white-space: nowrap; }

.progress { padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 9px; color: #dfe7c1; font-size: 11px; }
.progress-track { height: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); box-shadow: 0 0 12px var(--accent); transition: width 260ms ease; }

.table-wrap { min-height: 300px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 42px; padding: 0 18px; color: #9c9c93; background: #11110f; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 700; letter-spacing: 0.13em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { height: 73px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 12px; }
tbody tr { transition: background 150ms ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: 0; }

.item-cell { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.item-avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, #20201d, #151513); font-size: 16px; }
.item-name { display: grid; gap: 3px; }
.item-name strong { font-size: 13px; font-weight: 720; }
.item-name small { color: var(--muted); font-size: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; min-width: 150px; }
.tag { padding: 4px 7px; color: #aaa99f; border: 1px solid var(--line); border-radius: 5px; background: rgba(255, 255, 255, 0.025); font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tag.godly, .tag.ancient { color: #ddbf75; border-color: rgba(221, 191, 117, 0.2); background: rgba(221, 191, 117, 0.06); }
.tag.chroma { color: var(--cyan); border-color: rgba(126, 216, 223, 0.2); background: rgba(126, 216, 223, 0.06); }
.price { font-size: 14px; font-weight: 760; font-variant-numeric: tabular-nums; }
.price.min { color: var(--accent); }
.price-note { display: block; margin-top: 3px; color: #98988f; font-size: 9px; }
.count-cell { color: #cccac1; font-variant-numeric: tabular-nums; }
.count-cell small { color: #6c6c64; }
.change { margin-left: 6px; font-size: 9px; }
.change.up { color: var(--red); }
.change.down { color: var(--accent); }
.row-action { width: 31px; height: 31px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.row-action:hover { color: var(--accent); border-color: rgba(216, 255, 69, 0.25); }

.empty-state { min-height: 310px; padding: 50px 20px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-symbol { width: 64px; height: 64px; display: grid; place-items: center; color: var(--accent); border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); font-size: 30px; }
.empty-state h3 { margin: 18px 0 7px; font-size: 18px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.loading-state { padding: 18px; }
.skeleton { height: 58px; margin-bottom: 8px; border-radius: 8px; background: linear-gradient(90deg, #191917 25%, #22221f 50%, #191917 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pagination { min-height: 64px; padding: 12px 18px; display: flex; align-items: center; justify-content: center; gap: 18px; border-top: 1px solid var(--line); background: #11110f; }
.pagination button { padding: 8px 12px; color: #b9b8ae; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 11px; }
.pagination button:disabled { cursor: default; opacity: 0.35; }
.pagination span { min-width: 90px; color: var(--muted); font-size: 10px; text-align: center; }

footer { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #94948b; font-size: 10px; }
footer a { color: #97978d; text-decoration: none; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 22px; }
.modal[hidden], [hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(4, 4, 3, 0.76); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(820px, 100%); max-height: min(760px, calc(100vh - 44px)); overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; background: #151513; box-shadow: 0 35px 100px rgba(0, 0, 0, 0.58); }
.modal-close { position: absolute; top: 16px; right: 16px; z-index: 1; width: 34px; height: 34px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 21px; }
.detail-header { padding: 34px 34px 28px; border-bottom: 1px solid var(--line); }
.detail-header .eyebrow { margin-bottom: 14px; }
.detail-header h2 { margin: 0 0 8px; padding-right: 40px; font-size: 32px; letter-spacing: -0.05em; }
.detail-header p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-header .detail-warning { margin-top: 10px; color: var(--orange); }
.detail-metrics { padding: 22px 34px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-bottom: 1px solid var(--line); }
.detail-metric { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #11110f; }
.detail-metric span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.detail-metric strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.offers-list { padding: 24px 34px 34px; }
.offers-list h3 { margin: 0 0 14px; font-size: 13px; }
.offer-row { min-height: 58px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); }
.offer-row:first-of-type { border-top: 1px solid var(--line); }
.offer-seller { display: grid; gap: 3px; min-width: 0; }
.offer-seller strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.offer-seller small { color: var(--muted); font-size: 9px; }
.offer-row .price { text-align: right; }
.offer-link { color: var(--accent); font-size: 10px; font-weight: 700; text-decoration: none; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; width: min(380px, calc(100% - 44px)); padding: 14px 16px; color: #e9e8de; border: 1px solid var(--line-strong); border-radius: 11px; background: #22221e; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; }
.toast.error { border-color: rgba(255, 104, 104, 0.35); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1040px) {
  .filters { grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(145px, auto)); }
  .filters label:nth-child(4), .filters label:nth-child(5) { grid-column: span 1; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 780px) {
  .shell { width: min(100% - 24px, 1240px); }
  .topbar { height: 74px; }
  .freshness { display: none; }
  .button { padding-inline: 14px; }
  .hero { min-height: auto; padding: 56px 4px 46px; grid-template-columns: 1fr; }
  .hero-orbit { display: none; }
  .hero h1 { font-size: clamp(52px, 15vw, 82px); }
  .notice { grid-template-columns: auto 1fr; }
  .notice a { grid-column: 2; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .metric { min-height: 108px; padding: 20px; }
  .panel-heading { padding-inline: 18px; }
  th, td { padding-inline: 13px; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .detail-header, .detail-metrics, .offers-list { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .topbar-actions { gap: 8px; }
  #refreshLabel { display: none; }
  .button-primary { width: 42px; padding: 0; }
  .hero h1 { font-size: 50px; }
  .hero-copy > p { font-size: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 17px 15px; }
  .metric > strong { font-size: 24px; }
  .metric-status > strong { font-size: 13px; }
  .filters { grid-template-columns: 1fr; }
  .search-field, .filters label { grid-column: auto !important; }
  .panel-heading > div:first-child { flex-wrap: wrap; }
  .notice { padding: 14px; }
  .notice a { grid-column: 1 / -1; margin-left: 44px; }
  footer { padding: 28px 0; align-items: flex-start; flex-direction: column; }
  .modal { padding: 8px; }
  .modal-card { max-height: calc(100vh - 16px); border-radius: 14px; }
  .detail-metrics { grid-template-columns: 1fr 1fr; }
  .offer-row { grid-template-columns: 1fr auto; }
  .offer-link { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
