:root {
  --bg: #020617;
  --panel: #0f172a;
  --panel-2: #111827;
  --border: rgba(148, 163, 184, 0.2);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --danger: #fb7185;
  --success: #22c55e;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

body.theme-origins {
  --panel: #d8d0a4;
  --panel-2: #c7c08f;
  --border: #6c4a15;
  --text: #26364a;
  --muted: #5f655f;
  --accent: #f5a12e;
  --accent-2: #d66a17;
  --shadow: 0 6px 0 rgba(88, 58, 15, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, #0f172a 0, #020617 45%, #000 100%);
  color: var(--text);
}

body.theme-origins {
  font-family: "Silkscreen", Verdana, Tahoma, sans-serif;
  background-color: #5c9fd5;
  background-image:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.95) 0 34px, transparent 35px),
    radial-gradient(circle at 16% 11%, rgba(255, 255, 255, 0.95) 0 28px, transparent 29px),
    radial-gradient(circle at 21% 10%, rgba(255, 255, 255, 0.95) 0 32px, transparent 33px),
    radial-gradient(circle at 76% 12%, rgba(255, 255, 255, 0.92) 0 30px, transparent 31px),
    radial-gradient(circle at 81% 10%, rgba(255, 255, 255, 0.92) 0 24px, transparent 25px),
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.92) 0 28px, transparent 29px),
    linear-gradient(180deg, #8fdcff 0%, #79caf6 18%, #5fa4dc 18%, #4b86c3 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--text);
}

body.core-outage .topbar,
body.core-outage .content {
  display: none;
}

button, input, select { font: inherit; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); }
h2 { font-size: 1.05rem; }

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

body.theme-origins .topbar {
  background: linear-gradient(180deg, #ef9f34, #c86718);
  border: 3px solid #7b420f;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow:
    inset 0 2px 0 rgba(255, 214, 150, 0.6),
    0 4px 0 rgba(112, 62, 14, 0.24);
}

.topbar-brand { flex: 1 1 auto; min-width: 0; }

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 0.78rem;
}

body.theme-origins .eyebrow {
  color: #fff5d6;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-title-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.app-title-link:hover { opacity: 0.92; }
.app-title-link:visited { color: inherit; }

body.theme-origins .app-title-link {
  color: #fff7d3;
  text-shadow: 0 2px 0 rgba(115, 61, 11, 0.45);
}

body.theme-origins .app-title,
body.theme-origins h2,
body.theme-origins .top-market-name,
body.theme-origins .stat-value,
body.theme-origins button,
body.theme-origins .chip,
body.theme-origins .pill {
  letter-spacing: 0.01em;
}

.app-logo {
  height: 1.6em;
  width: auto;
  display: inline-block;
  image-rendering: pixelated;
}

.beta-wrap { position: relative; display: inline-flex; align-items: center; }

.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  line-height: 1;
  cursor: default;
}

.beta-badge-button {
  border: 0;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  cursor: pointer;
}

.beta-badge-button:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.7);
  outline-offset: 2px;
}

.beta-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  max-width: 260px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(125, 211, 252, 0.35);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #dbeafe;
  font-size: 0.82rem;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  z-index: 50;
}

.beta-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: rgba(56, 189, 248, 0.16);
  border-left: 1px solid rgba(125, 211, 252, 0.35);
  border-top: 1px solid rgba(125, 211, 252, 0.35);
  transform: translateX(-50%) rotate(45deg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.beta-wrap:hover .beta-tooltip,
.beta-wrap:focus-within .beta-tooltip,
.beta-wrap.beta-open .beta-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.beta-tooltip-image {
  width: auto;
  height: auto;
  max-width: 150px;
  max-height: 150px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: auto;
}

.beta-tooltip-text {
  text-align: center;
  font-weight: 500;
  white-space: normal;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: 0;
}

.theme-toggle-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.theme-toggle-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  min-width: 0;
}

.theme-toggle-button {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  border: 0;
  font-size: 0.84rem;
  font-weight: 800;
  min-width: 0;
}

.theme-toggle-button.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(129, 140, 248, 0.28));
  color: var(--text);
}

body.theme-origins .theme-toggle {
  background: linear-gradient(180deg, #f7efca, #d2c58f);
  border: 2px solid #8a6421;
}

body.theme-origins .theme-toggle-button {
  color: #5f5226;
  border-radius: 8px;
}

body.theme-origins .theme-toggle-button.active {
  background: linear-gradient(180deg, #f8b34e, #db741b);
  color: #fff9db;
  box-shadow: inset 0 1px 0 rgba(255, 227, 175, 0.55);
}

body.theme-origins .theme-toggle-label {
  color: #fff4d0;
}

body.theme-origins .beta-badge {
  background: linear-gradient(180deg, #73bdf0, #2f79b5);
  color: #eef8ff;
  border: 2px solid #1d557f;
  box-shadow: inset 0 1px 0 rgba(214, 239, 255, 0.35);
}

.content { display: grid; gap: 14px; }

.site-footer {
  margin-top: 22px;
  padding: 8px 10px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.site-footer p + p {
  margin-top: 6px;
}

.card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.82));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

body.theme-origins .card {
  background:
    linear-gradient(180deg, #ef9f34 0 18px, #f3e8b7 18px, #dbcf94 100%);
  border: 3px solid #6e4c17;
  border-radius: 10px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    0 4px 0 rgba(104, 71, 18, 0.18);
  backdrop-filter: none;
}

body.theme-origins .site-footer {
  color: #f8edc4;
  text-shadow: 0 1px 0 rgba(98, 57, 14, 0.35);
}

body.theme-origins .search-card,
body.theme-origins .trending-card,
body.theme-origins .recent-card,
body.theme-origins .results-card {
  padding-top: 24px;
}

body.theme-origins .top-market-card details {
  padding-top: 24px;
}

.core-outage-card {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  padding: 32px 24px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(249, 115, 22, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.86));
  border: 1px solid rgba(251, 146, 60, 0.3);
  box-shadow: var(--shadow);
}

.core-outage-card h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  max-width: 18ch;
}

.core-outage-card p {
  color: #fdba74;
  font-size: 1rem;
}

.core-outage-sign {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fb923c, #ea580c);
  color: #1c1917;
  font-size: 2.6rem;
  box-shadow: 0 18px 36px rgba(234, 88, 12, 0.28);
}

.search-form { display: grid; gap: 14px; }

.field-label,
.control-group label {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.search-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-label-row .field-label {
  margin-bottom: 0;
}

.live-search-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #bbf7d0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.live-search-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.16);
  flex-shrink: 0;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.control-group { min-width: 120px; }

input, select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  padding: 12px 14px;
}

body.theme-origins input,
body.theme-origins select {
  border: 2px solid #7b6832;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8dc, #efe4b5);
  color: #283548;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75);
}

input:focus, select:focus {
  outline: 2px solid rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.6);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
  cursor: pointer;
}

body.theme-origins button {
  border: 2px solid #8a4c15;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8b24f, #d56e1b);
  color: #fff8da;
  text-shadow: 0 1px 0 rgba(122, 70, 17, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 229, 182, 0.45),
    0 3px 0 rgba(119, 75, 16, 0.28);
}

button:disabled { opacity: 0.65; }

.ghost-button, .link-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

body.theme-origins .ghost-button,
body.theme-origins .link-button,
body.theme-origins .share-button {
  background: linear-gradient(180deg, #f7efca, #d9ce9a);
  color: #5f4f22;
  border: 2px solid #7e6934;
  text-shadow: none;
}

body.theme-origins .discord-button {
  background: linear-gradient(180deg, #f7b754, #dd751e);
  border: 2px solid #8a4c15;
  color: #fff8da;
}

.link-button { padding: 8px 12px; }

.share-button, .discord-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
}

.share-button {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
}

.share-button:hover { opacity: 0.92; }

.discord-button {
  background: #5865f2;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.discord-button:hover { opacity: 0.92; }
.discord-button:visited { color: white; }

#shareButton, .discord-button, #installButton { white-space: nowrap; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.status-text, .empty-state, .chart-subtitle, .item-class, .item-description { color: var(--muted); }

.top-market-meta-text {
  font-size: 0.74rem;
  line-height: 1.2;
  text-align: right;
}

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

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

body.theme-origins .chip {
  background: linear-gradient(180deg, #fff7d6, #eadcaa);
  color: #5f4f22;
  border: 2px solid #8b7437;
  border-radius: 8px;
}

.trending-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.24);
  color: #c7d2fe;
  font-size: 0.75rem;
  font-weight: 700;
}

body.theme-origins .chip-count {
  background: linear-gradient(180deg, #b56a1e, #7b4312);
  color: #fff4d4;
  border: 2px solid #61330d;
  min-width: 24px;
  height: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 214, 148, 0.28);
}

.suggestions-box {
  display: grid;
  gap: 8px;
  margin-top: -2px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.92);
}

body.theme-origins .suggestions-box {
  background: linear-gradient(180deg, #fff7da, #e8dbac);
  border: 2px solid #8b7437;
  border-radius: 8px;
}

.suggestion-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
}

body.theme-origins .suggestion-item,
body.theme-origins .result-item,
body.theme-origins .empty-state,
body.theme-origins .price-chart {
  background: linear-gradient(180deg, #fff7d8, #e4d6a6);
  border: 2px solid #8b7437;
  color: #2e3a4c;
  border-radius: 8px;
}

body.theme-origins .stat-card,
body.theme-origins .top-market-item {
  background: linear-gradient(180deg, #d58a2a, #a7601b);
  border: 2px solid #7f4813;
  color: #fff2c8;
}

body.theme-origins .top-market-item:hover {
  background: linear-gradient(180deg, #de973c, #ae671f);
}

body.theme-origins .status-text,
body.theme-origins .empty-state,
body.theme-origins .chart-subtitle,
body.theme-origins .item-class,
body.theme-origins .item-description,
body.theme-origins .stat-label,
body.theme-origins .top-market-meta,
body.theme-origins .top-market-subprice {
  color: #566173;
}

body.theme-origins .pill,
body.theme-origins .metric-toggle.active,
body.theme-origins .live-search-badge,
body.theme-origins .hourly-update-badge,
body.theme-origins .change-up,
body.theme-origins .change-down,
body.theme-origins .change-flat {
  border-width: 2px;
}

body.theme-origins .metric-toggle {
  background: linear-gradient(180deg, #f8edc4, #d8ca93);
  color: #5f4f22;
  border: 2px solid #8b7437;
  border-radius: 8px;
}

body.theme-origins .metric-toggle.active {
  background: linear-gradient(180deg, #f8b34e, #db741b);
  color: #fff8da;
  border-color: #8a4c15;
}

body.theme-origins .live-search-badge {
  background: linear-gradient(180deg, #f7bf62, #d9741a);
  border: 2px solid #8a4c15;
  color: #fff6db;
}

body.theme-origins .hourly-update-badge {
  background: linear-gradient(180deg, #73bdf0, #2f79b5);
  border: 2px solid #1d557f;
  color: #eef8ff;
}

body.theme-origins .live-search-dot {
  background: #d7efff;
  box-shadow: 0 0 0 4px rgba(78, 151, 211, 0.22);
}

body.theme-origins .hourly-update-dot {
  background: #ff9d1b;
  box-shadow: 0 0 0 4px rgba(255, 157, 27, 0.18);
}

body.theme-origins .stat-value,
body.theme-origins .top-market-price,
body.theme-origins .top-market-name {
  color: #fff7da;
  text-shadow: 0 1px 0 rgba(102, 57, 12, 0.45);
}

body.theme-origins .top-market-subprice,
body.theme-origins .top-market-meta,
body.theme-origins .stat-label {
  color: #ffe4a8;
}

body.theme-origins .details-panel summary {
  color: #7b420f;
  text-shadow: 0 1px 0 rgba(255, 235, 194, 0.35);
}

body.theme-origins .pill {
  background: linear-gradient(180deg, #f7bf62, #d9741a);
  border: 2px solid #8a4c15;
  color: #fff7da;
  text-shadow: 0 1px 0 rgba(102, 57, 12, 0.45);
}

body.theme-origins .change-up {
  background: linear-gradient(180deg, #1d6a52, #104235);
  color: #ecfdf5;
  border-color: #0f5132;
}

body.theme-origins .change-down {
  background: linear-gradient(180deg, #8a3023, #5a1b13);
  color: #fff1f2;
  border-color: #571716;
}

body.theme-origins .change-flat {
  background: linear-gradient(180deg, #355d86, #243c59);
  color: #eff6ff;
  border-color: #1f3b56;
}

body.theme-origins .top-market-rank,
body.theme-origins .profit-positive,
body.theme-origins .profit-negative {
  color: #1b6ca8;
}

body.theme-origins .top-market-rank {
  text-shadow:
    -1px 0 #fff7da,
    0 1px #fff7da,
    1px 0 #fff7da,
    0 -1px #fff7da,
    0 2px 0 rgba(92, 51, 12, 0.2);
}

body.theme-origins .profit-positive {
  color: #15803d;
  text-shadow:
    -1px 0 #fff7da,
    0 1px #fff7da,
    1px 0 #fff7da,
    0 -1px #fff7da,
    0 2px 0 rgba(92, 51, 12, 0.2);
}

body.theme-origins .profit-negative {
  color: #b91c1c;
  text-shadow:
    -1px 0 #fff7da,
    0 1px #fff7da,
    1px 0 #fff7da,
    0 -1px #fff7da,
    0 2px 0 rgba(92, 51, 12, 0.2);
}

body.theme-origins .top-market-price:not(.profit-positive):not(.profit-negative),
body.theme-origins .stat-value {
  text-shadow:
    -1px 0 rgba(92, 51, 12, 0.5),
    0 1px rgba(92, 51, 12, 0.5),
    1px 0 rgba(92, 51, 12, 0.5),
    0 -1px rgba(92, 51, 12, 0.5);
}

body.theme-origins .section-header,
body.theme-origins .top-market-card summary {
  align-items: flex-start;
  margin-bottom: 14px;
}

body.theme-origins .panel-title-group {
  align-items: flex-start;
  gap: 8px;
}

body.theme-origins h2 {
  line-height: 1.3;
  padding-top: 1px;
}

body.theme-origins .top-market-meta-text {
  padding-top: 2px;
}

.suggestion-thumb { width: 30px; height: 30px; object-fit: contain; }

.suggestion-thumb.placeholder {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.14);
}

.suggestion-main { display: grid; gap: 2px; }
.suggestion-name { font-weight: 700; color: var(--text); }
.suggestion-meta { font-size: 0.82rem; color: var(--muted); }

.results-list { display: grid; gap: 14px; }

.result-item {
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.42);
  border-radius: 20px;
  padding: 14px;
  display: grid;
  gap: 14px;
}

.result-top {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: start;
}

.item-thumb-wrap {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border);
}

.item-thumb { max-width: 58px; max-height: 58px; }

.item-main { display: grid; gap: 6px; }

.title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(129, 140, 248, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.24);
  color: #c7d2fe;
  font-size: 0.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.stat-label { color: var(--muted); font-size: 0.88rem; }
.stat-label-with-badge {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

.htf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1b1607, #050505);
  border: 1px solid rgba(212, 175, 55, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 221, 112, 0.2);
  color: #d4af37;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-value { font-size: 1.1rem; font-weight: 800; }

.details-panel {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.details-panel summary {
  cursor: pointer;
  color: #cbd5e1;
  font-weight: 700;
  margin-bottom: 10px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: var(--muted);
}

.chart-wrap { display: grid; gap: 10px; }

.price-chart {
  width: 100%;
  height: auto;
  display: block;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.nft-market-panel {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed var(--border);
}

.error-box {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(127, 29, 29, 0.25);
  color: #fecdd3;
}

.cache-notice {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(250, 204, 21, 0.28);
  background: rgba(113, 63, 18, 0.22);
  color: #fde68a;
  font-size: 0.9rem;
  line-height: 1.4;
}

.hidden { display: none !important; }

/* Panels */
.top-market-card { padding: 0; }
.top-market-card details { padding: 12px 14px; }

.top-market-card summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.hourly-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.24);
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.hourly-update-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);
  flex-shrink: 0;
}

.top-market-card summary::-webkit-details-marker { display: none; }

.toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 10px;
}

.metric-toggle {
  background: rgba(56, 189, 248, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.metric-toggle.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(129, 140, 248, 0.22));
  color: #e0f2fe;
  border-color: rgba(125, 211, 252, 0.4);
}

.top-market-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-market-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  transition: background 0.15s ease;
}

.top-market-item:hover { background: #1f2937; }

.top-market-rank {
  color: var(--accent);
  font-weight: 800;
  min-width: 28px;
  flex-shrink: 0;
}

.top-market-thumb {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.top-market-thumb.placeholder {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.14);
}

.top-market-main {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.top-market-name {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-market-meta {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gold-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 4px;
  padding-right: 6px;
}

.gold-bar-icon {
  width: 18px;
  height: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  margin-right: -7px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.28));
}

.top-market-metrics {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.top-market-price {
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.top-market-subprice {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.change-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 2px;
  white-space: nowrap;
}

.change-up {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.change-down {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.change-flat {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.profit-positive { color: #4ade80; }
.profit-negative { color: #f87171; }

.top-market-card + .top-market-card { margin-top: 10px; }

@media (min-width: 740px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .topbar-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-actions {
    width: 100%;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    justify-content: stretch;
    align-self: flex-start;
  }

  .topbar-actions > .theme-toggle-wrap {
    order: 3;
    grid-column: 1 / -1;
  }

  .topbar-actions > #shareButton,
  .topbar-actions > .discord-button,
  .topbar-actions > #installButton {
    width: 100%;
    min-width: 0;
  }

  .theme-toggle-wrap {
    width: 100%;
  }

  .theme-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .theme-toggle-button {
    flex: 1 1 0;
    width: 100%;
  }

  body.theme-origins .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  body.theme-origins h1 {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }

  body.theme-origins h2 {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  body.theme-origins .eyebrow,
  body.theme-origins .theme-toggle-label,
  body.theme-origins .top-market-meta-text {
    font-size: 0.62rem;
  }

  body.theme-origins .topbar {
    padding: 12px;
    gap: 10px;
  }

  body.theme-origins .topbar-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  body.theme-origins .theme-toggle {
    padding: 3px;
  }

  body.theme-origins .theme-toggle-button,
  body.theme-origins .share-button,
  body.theme-origins .discord-button,
  body.theme-origins #installButton {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.7rem;
    letter-spacing: 0;
  }

  body.theme-origins .beta-badge {
    padding: 4px 10px;
    font-size: 0.64rem;
  }

  body.theme-origins .card {
    border-radius: 8px;
  }

  body.theme-origins .search-card,
  body.theme-origins .trending-card,
  body.theme-origins .recent-card,
  body.theme-origins .results-card {
    padding-top: 20px;
  }

  body.theme-origins .top-market-card details {
    padding: 20px 10px 10px;
  }

  body.theme-origins .search-row {
    grid-template-columns: 1fr;
  }

  body.theme-origins .search-row button {
    width: 100%;
  }

  body.theme-origins .stats-grid {
    grid-template-columns: 1fr;
  }

  body.theme-origins .result-top,
  body.theme-origins .top-market-item {
    gap: 10px;
  }

  body.theme-origins .top-market-item {
    align-items: flex-start;
  }

  body.theme-origins .top-market-name,
  body.theme-origins .top-market-meta,
  body.theme-origins .top-market-price,
  body.theme-origins .top-market-subprice {
    white-space: normal;
  }

  body.theme-origins .gold-bar-row {
    margin-top: 6px;
  }

  .beta-tooltip {
    position: fixed;
    top: 72px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(8px);
    width: min(280px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    min-width: 0;
    padding: 14px 14px 12px;
    z-index: 9999;
  }

  .beta-tooltip::before { display: none; }

  .beta-wrap:hover .beta-tooltip,
  .beta-wrap:focus-within .beta-tooltip,
  .beta-wrap.beta-open .beta-tooltip {
    transform: translateX(-50%) translateY(0);
  }

  .beta-tooltip-image {
    max-width: 150px;
    max-height: 150px;
  }

  .suggestion-item { grid-template-columns: 30px 1fr; }

  .top-market-item { align-items: flex-start; }

  .top-market-metrics { min-width: 74px; }

  .top-market-card summary {
    align-items: flex-start;
  }

  .top-market-meta-text {
    font-size: 0.68rem;
  }
}
