/* MoneyFlow Radar styles - dark mobile-first */
:root {
  --bg: #050607;
  --surface: #0c0e10;
  --surface2: #12151a;
  --border: #1c2128;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f5c542;
  --green: #2cff8f;
  --red: #ff5c5c;
  --blue: #58a6ff;
  --radius: 12px;
  --nav-h: 64px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: calc(var(--top-h) + var(--safe-t));
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

/* Top bar */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 12px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(5,6,7,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; flex-shrink: 0; }
.brand-t b { display: block; font-size: 15px; font-weight: 800; }
.brand-t small { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 18px;
  color: var(--muted);
}
.icon-btn:active { background: var(--surface2); }

/* Main */
#view { min-height: calc(100vh - var(--top-h) - var(--nav-h)); padding: 12px; }

/* Nav */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: rgba(5,6,7,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; color: var(--muted); padding: 6px 0;
}
.nav a i { font-size: 18px; font-style: normal; }
.nav a.active { color: var(--accent); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.card-h h3 { font-size: 13px; font-weight: 600; color: var(--muted); }

/* Market row */
.mkt {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mkt:last-child { border-bottom: none; }
.mkt-info { flex: 1; min-width: 0; }
.mkt-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mkt-score {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--surface2);
}
.mkt-score.hot { background: rgba(44,255,143,.15); color: var(--green); }
.mkt-score.warn { background: rgba(245,197,66,.15); color: var(--accent); }

/* Sheet */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 85vh; overflow-y: auto;
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(20px + var(--safe-b));
}
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px; background: var(--border);
  margin: 0 auto 12px;
}

/* Toast */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); left: 50%;
  transform: translateX(-50%); z-index: 60;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 20px; font-size: 13px;
  white-space: nowrap;
}

/* Filters */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.chip {
  flex-shrink: 0; padding: 6px 12px; border-radius: 20px;
  font-size: 12px; background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted);
}
.chip.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* Map */
.map-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
}
.region-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; text-align: center;
}
.region-card .flag { font-size: 28px; }
.region-card .name { font-size: 12px; font-weight: 600; margin-top: 4px; }
.region-card .flow { font-size: 11px; color: var(--muted); }

/* Empty / loading */
.empty, .loading {
  text-align: center; padding: 40px 20px; color: var(--muted); font-size: 14px;
}
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Score bar */
.bar {
  height: 4px; border-radius: 2px; background: var(--border); margin-top: 6px; overflow: hidden;
}
.bar > i { display: block; height: 100%; border-radius: 2px; background: var(--green); }

/* Topics */
.topic-list .mkt { cursor: pointer; }
.topic-list .mkt:active { background: var(--surface2); }

/* Watchlist heart */
.heart { color: var(--muted); font-size: 16px; }
.heart.on { color: var(--red); }

/* Responsive tweaks */
@media (min-width: 600px) {
  #view { max-width: 640px; margin: 0 auto; }
  .nav { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
