:root {
  --bg-deep:      #070b14;
  --glass-bg:     rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-shine:  rgba(255, 255, 255, 0.06);

  --gold:         #f5c842;
  --gold-glow:    rgba(245, 200, 66, 0.35);
  --gold-dim:     #c9a230;
  --green:        #39d98a;
  --green-bg:     rgba(57, 217, 138, 0.12);
  --red:          #ff5f6d;
  --red-bg:       rgba(255, 95, 109, 0.12);

  --text:         #f0f2f8;
  --text-dim:     rgba(240, 242, 248, 0.45);
  --text-mute:    rgba(240, 242, 248, 0.18);

  --font-head:    'Syne', sans-serif;
  --font-body:    'Space Grotesk', sans-serif;

  --radius-sm:    10px;
  --radius-md:    16px;
  --blur:         blur(18px);
  --transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── ORBS ────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}
.orb-1 { width: 600px; height: 600px; background: #2d5be3; top: -180px; left: -160px; animation-duration: 16s; }
.orb-2 { width: 500px; height: 500px; background: #8b22d4; bottom: 0; right: -100px; animation-duration: 20s; animation-delay: -6s; }
.orb-3 { width: 320px; height: 320px; background: #c9a230; top: 50%; left: 50%; transform: translate(-50%,-50%); opacity: 0.10; animation-duration: 24s; animation-delay: -10s; }

/* ── GLASS ────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--glass-shine) 0%, transparent 60%);
  pointer-events: none;
}

/* ── HEADER ───────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 200;
  border-radius: 0;
  border-top: none; border-left: none; border-right: none;
}
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 28px;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; color: var(--gold); filter: drop-shadow(0 0 8px var(--gold-glow)); }
.logo-text { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-text em { font-style: normal; color: var(--gold); }
.header-center { text-align: center; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: 100px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
  font-size: 12px; font-weight: 500; letter-spacing: 0.5px; color: var(--text-dim);
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
  transition: background var(--transition), box-shadow var(--transition);
}
.badge-dot.open   { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge-dot.closed { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.header-right { text-align: right; }
.clock { font-family: var(--font-head); font-size: 13px; font-weight: 600; color: var(--text-dim); letter-spacing: 1.5px; }

/* ── MAIN ─────────────────────────────────── */
.main {
  max-width: 1100px; margin: 0 auto;
  padding: 48px 28px 100px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 28px;
}

/* ── HERO ─────────────────────────────────── */
.hero { text-align: center; padding: 48px 0 20px; }
.hero-eyebrow {
  font-family: var(--font-head); font-size: 11px; font-weight: 600;
  letter-spacing: 4px; color: var(--gold-dim); margin-bottom: 20px; text-transform: uppercase;
}
.hero-row {
  display: flex; align-items: center; justify-content: center;
  gap: 24px; flex-wrap: wrap; margin-bottom: 12px;
}
.hero-price {
  font-family: var(--font-head);
  font-size: clamp(56px, 9vw, 96px);
  font-weight: 800; color: var(--gold);
  letter-spacing: -3px; line-height: 1;
  text-shadow: 0 0 60px var(--gold-glow);
}
.hero-change {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
  padding: 6px 16px; border-radius: 100px;
}
.hero-change.up   { background: var(--green-bg); color: var(--green); }
.hero-change.down { background: var(--red-bg);   color: var(--red);   }
.hero-sub { font-size: 12px; color: var(--text-dim); letter-spacing: 0.5px; }

/* ── CARDS ────────────────────────────────── */
.card {
  border-radius: var(--radius-md); padding: 22px 24px;
  transition: border-color var(--transition), transform var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); }
.card-label { font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px; }
.card-value { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--text); }

/* ── STAT GRID ────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── CHART ────────────────────────────────── */
.chart-card { padding: 24px; }
.card-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--text); }
.card-meta { font-size: 11px; color: var(--text-dim); }
.chart-wrap { position: relative; height: 230px; }
#trend-chart { width: 100% !important; height: 100% !important; }
.chart-loader {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-dim); font-size: 13px;
}

/* ── NEWS ─────────────────────────────────── */
.news-section { display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px; }
.news-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.news-card {
  padding: 20px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition);
}
.news-card:hover { border-color: rgba(245,200,66,0.3); transform: translateY(-2px); }

.news-source {
  font-size: 10px; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--gold-dim); margin-bottom: 8px;
}
.news-headline {
  font-family: var(--font-head); font-size: 14px; font-weight: 600;
  color: var(--text); line-height: 1.4; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
}
.news-summary {
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden;
  margin-bottom: 12px;
}
.news-footer { display: flex; align-items: center; justify-content: space-between; }
.news-time { font-size: 11px; color: var(--text-mute); }
.news-arrow { font-size: 14px; color: var(--gold-dim); }

/* ── ERROR ────────────────────────────────── */
.error-box {
  border-radius: var(--radius-md); padding: 20px 24px;
  display: flex; align-items: center; gap: 14px;
  border-color: rgba(255, 95, 109, 0.3);
}
.error-icon { font-size: 20px; color: var(--red); }
.error-box p { flex: 1; font-size: 13px; color: var(--text-dim); }
.error-box button {
  background: var(--red-bg); border: 1px solid rgba(255,95,109,0.3);
  color: var(--red); padding: 7px 18px; border-radius: 8px;
  cursor: pointer; font-family: var(--font-body); font-size: 13px; font-weight: 600;
  transition: background var(--transition);
}
.error-box button:hover { background: rgba(255,95,109,0.22); }

/* ── SKELETON ─────────────────────────────── */
.skeleton {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
.sk-price  { width: 300px; height: 80px; border-radius: 12px; }
.sk-change { width: 100px; height: 36px; border-radius: 100px; }
.sk-sub    { width: 180px; height: 14px; margin: 6px auto 0; }
.sk-val    { width: 100%;  height: 26px; }
.sk-news   { width: 100%;  height: 120px; border-radius: var(--radius-sm); }

/* ── SPINNER ──────────────────────────────── */
.spinner {
  width: 30px; height: 30px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── FOOTER ───────────────────────────────── */
.footer {
  text-align: center; padding: 28px;
  font-size: 12px; color: var(--text-mute);
  border-top: 1px solid var(--glass-border);
  position: relative; z-index: 1;
}
.footer a { color: var(--gold-dim); text-decoration: none; }
.footer a:hover { color: var(--gold); }

/* ── ANIMATIONS ───────────────────────────── */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(30px,20px) scale(1.05); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 0.4s ease forwards; }

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 900px) {
  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
  .news-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .header-inner { grid-template-columns: 1fr auto; }
  .header-center { display: none; }
  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
  .hero-price { font-size: 52px; }
  .main       { padding: 28px 16px 80px; }
}
/* ── MULTI-MARKET GRID & CONTROLS ───────────────── */
.controls-bar {
  display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; position: relative; z-index: 10;
}
.search-wrap { flex: 1; min-width: 280px; }
.sort-wrap { width: 220px; }
.search-input, .sort-select {
  width: 100%; padding: 14px 20px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); color: var(--text);
  font-family: var(--font-body); font-size: 15px; outline: none;
  backdrop-filter: var(--blur); transition: border-color var(--transition);
}
.search-input:focus, .sort-select:focus { border-color: var(--gold-glow); }
.sort-select option { background: var(--bg-deep); color: var(--text); }

.grid-container {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px;
}
.market-card {
  display: flex; flex-direction: column; gap: 6px; padding: 20px;
}
.market-symbol { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--gold-dim); }
.market-price { font-family: var(--font-head); font-size: 32px; font-weight: 800; color: var(--text); transition: color 0.15s ease-out; }
.market-time { font-size: 11px; color: var(--text-mute); font-family: monospace; margin-top: auto; }
/* ── LIGHT MODE ───────────────────────────── */
body.light {
  background: #f0f2f8;
  color: #0d1117;
}
body.light .glass {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.10);
}
body.light .glass::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, transparent 60%);
}
body.light .market-symbol { color: #8a6a00; }
body.light #detail-price  { color: #0d1117 !important; }
body.light .market-time   { color: #888; }
body.light .search-input,
body.light .sort-select {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.12);
  color: #0d1117;
}
body.light .card-title    { color: #0d1117; }
body.light .news-headline { color: #0d1117; }
body.light .news-summary  { color: #555; }
body.light .footer        { color: #888; border-color: rgba(0,0,0,0.10); }
body.light .logo-text     { color: #0d1117; }
body.light .clock         { color: #555; }
body.light .pill          { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.10); color: #555; }
body.light .hero-price    { color: #8a6a00; }
body.light .bg-orb        { opacity: 0.08; }
body.light #theme-toggle  {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.12);
  color: #0d1117;
}
body.light .logo-tick { color: #0d1117 !important; }
body.light .market-price { color: #0d1117 !important; }
body.light .market-time  { color: #555 !important; }
body.light .market-symbol { color: #8a6a00 !important; }