:root {
  --bg: #12141A;
  --surface: #1A1D27;
  --border: #2A2F3D;
  --text: #F4F5F7;
  --text-muted: #9AA3B5;
  --accent: #5B8CFF;
  --accent-soft: #8B7CFF;
  --success: #3DDC97;
  --danger: #FF6B7A;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 20, 26, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
}

.wordmark img {
  height: 36px;
  width: auto;
}

.wordmark span {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-muted);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav a img.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

/* Main */
main { flex: 1; padding: 1.75rem 0 3rem; }

.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
}

.hero p {
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
  max-width: 36rem;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 560px;
  margin: 0 auto;
}

.search-bar input[type="search"],
.search-bar input[type="text"],
.filters input,
.filters select {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font: inherit;
  outline: none;
}

.search-bar input:focus,
.filters input:focus,
.filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.08); text-decoration: none; color: #fff; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-soft {
  background: rgba(139, 124, 255, 0.15);
  color: var(--accent-soft);
  border: 1px solid rgba(139, 124, 255, 0.35);
}

.btn-soft.active,
.btn-soft[aria-pressed="true"] {
  background: var(--accent-soft);
  color: #fff;
  border-color: var(--accent-soft);
}

.btn img.icon {
  width: 18px;
  height: 18px;
}

/* Sections */
.section { margin-top: 2.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.muted { color: var(--text-muted); font-size: 0.9rem; }

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.note-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.note-card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.card-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.card-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-thumb {
  aspect-ratio: 63 / 88;
  background: #0d0f14;
  overflow: hidden;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.card-meta {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.card-meta .name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}

.card-meta .set {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.price {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.price .currency-tag {
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(91, 140, 255, 0.25);
}

.badge-seed {
  background: rgba(139, 124, 255, 0.12);
  color: var(--accent-soft);
  border-color: rgba(139, 124, 255, 0.3);
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.filters > * { min-width: 140px; }

/* Detail */
.detail {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: 2rem;
  align-items: start;
}

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

.detail-art {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.detail-art img {
  width: 100%;
  border-radius: var(--radius-sm);
}

.detail-info h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
}

.detail-info .sub {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.price-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.price-block .market {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.price-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.price-rows div {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.price-rows .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.price-rows .val { font-weight: 600; }

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-top: 1rem;
}

.chart-wrap h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-wrap h3 img { width: 18px; height: 18px; }

.chart-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sparkline {
  width: 100%;
  height: 120px;
  display: block;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* Empty */
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty img {
  width: min(280px, 80%);
  margin: 0 auto 1.25rem;
  border-radius: var(--radius);
}

.empty h2 { margin: 0 0 0.5rem; }
.empty p { color: var(--text-muted); margin: 0 0 1.25rem; }

/* About */
.prose {
  max-width: 42rem;
}

.prose h1 { margin-top: 0; }
.prose h2 { margin-top: 1.75rem; font-size: 1.15rem; }
.prose p, .prose li { color: var(--text-muted); }
.prose ul { padding-left: 1.2rem; }
.prose code {
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.status-bar {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.error-banner {
  background: rgba(255, 107, 122, 0.1);
  border: 1px solid rgba(255, 107, 122, 0.35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
