:root {
  --bg: #0b1120;
  --panel: #111a2e;
  --panel-2: #16223c;
  --line: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --dim: #64748b;
  --accent: #6366f1;
  --up: #16a34a;
  --down: #dc2626;
  --warn: #d97706;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16223c 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: #818cf8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; backdrop-filter: blur(8px);
  background: rgba(11,17,32,.82); z-index: 10;
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo { font-size: 28px; color: var(--accent); }
h1 { font-size: 18px; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 12px; }
.meta { display: flex; gap: 10px; align-items: center; }
.pill { background: var(--panel-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 12px; }
.pill.ghost { color: var(--muted); }
.btn { background: var(--accent); color: #fff; border: 0; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { filter: brightness(1.1); }

.controls { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; flex-wrap: wrap; }
#search { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 9px 14px; border-radius: 8px; width: min(360px, 60vw); }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.bull { background: var(--up); } .dot.neut { background: var(--warn); } .dot.bear { background: var(--down); }

main { padding: 0 24px 40px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 22px; }
.card h2 { margin: 0 0 14px; font-size: 15px; }
.card.error { color: #fca5a5; border-color: #7f1d1d; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--panel-2); }
.up { color: var(--up); } .down { color: var(--down); }
.tag, .badge { color: #fff; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }

#cards { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
@media (max-width: 520px) { #cards { grid-template-columns: 1fr; } }

.metal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.metal-name { margin: 0; font-size: 15px; }
.metal-sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.verdict { text-align: right; }
.verdict .score { display: block; color: var(--dim); font-size: 11px; margin-top: 4px; }

.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.gauge label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.gauge .bar { background: var(--panel-2); border-radius: 6px; height: 9px; overflow: hidden; position: relative; }
.gauge .bar i { display: block; height: 100%; width: 0; transition: width .4s ease; }
.gauge b { font-size: 13px; }

.charts { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 6px; }
.chart-box { background: var(--panel-2); border-radius: 10px; padding: 10px; height: 230px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.reason-list { margin: 10px 0 0; padding-left: 18px; color: var(--text); }
.reason-list li { margin-bottom: 6px; font-size: 13px; }

.foot { padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.disclaimer { color: var(--dim); }

.loader { position: fixed; inset: 0; background: rgba(11,17,32,.7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 50; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
