/* Under1B — muuqaalka (Dark + Light) */
:root, [data-theme="dark"] {
  --bg: #0B0E14; --panel: #121722; --panel2: #1A2130; --border: #252D3D;
  --text: #E6EAF2; --muted: #949EB0; --accent: #F5B83D; --accent-text: #F5B83D;
  --chip-bg: rgba(245,184,61,.12); --chip-border: rgba(245,184,61,.35);
  --up: #34C77B; --down: #F2646F; --active-bg: #F5B83D; --active-fg: #0B0E14; --orange: #FF9A3C;
}
[data-theme="light"] {
  --bg: #F4F6F9; --panel: #FFFFFF; --panel2: #E9EDF3; --border: #DCE1E9;
  --text: #111827; --muted: #566072; --accent: #E0A126; --accent-text: #A15C07;
  --chip-bg: #FFF6E0; --chip-border: #F1D28F;
  --up: #15803D; --down: #C0262D; --active-bg: #111827; --active-fg: #FFFFFF; --orange: #C2570C;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* Topbar */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { font-family: "Space Grotesk", sans-serif; font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.logo span { color: var(--accent-text); }
.tagline { font-size: 13px; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 10px; }
.live { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--up); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--panel2); }
.seg button { height: 36px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--active-bg); color: var(--active-fg); }
#metric button.on, #ranges button.on { background: var(--panel); color: var(--text); }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: var(--panel2); cursor: pointer; flex: none; }
[data-theme="dark"] .moon, [data-theme="light"] .sun { display: none; }

/* Layout */
.layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; padding: 24px 28px; max-width: 1440px; margin: 0 auto; }
.sidebar { flex: 1 1 220px; max-width: 260px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px; position: sticky; top: 92px; }
.side-title { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); padding: 4px 10px 10px; }
.cat { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.cat::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--border); }
.cat:hover { background: var(--panel2); }
.cat.on { background: var(--active-bg); color: var(--active-fg); font-weight: 700; }
.cat.on::before { background: var(--active-fg); }
.new-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; margin-bottom: 10px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--chip-bg); border: 1px solid var(--chip-border); }
.new-link > span { display: flex; align-items: center; gap: 8px; }
.new-link.on { outline: 2px solid var(--accent); }
.badge { font-size: 10px; font-weight: 800; letter-spacing: .8px; padding: 3px 7px; border-radius: 999px; background: var(--accent); color: #0B0E14; }
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* Head */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
h1 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 32px; letter-spacing: -.5px; }
h1 + p { margin: 6px 0 0; font-size: 14px; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--chip-bg); color: var(--accent-text); border: 1px solid var(--chip-border); }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font: 14px Inter, sans-serif; width: 180px; }

.rule-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--chip-border); }
.rule-text { flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.rule-text strong { font-size: 14px; }
.rule-tags { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; font-weight: 600; }
.rule-tags span { padding: 6px 10px; border-radius: 8px; background: var(--panel2); }
.ok { color: var(--up); } .no { color: var(--down); }
.status { padding: 12px 16px; border-radius: 10px; background: var(--panel2); font-size: 14px; }

/* Table */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.card.dashed { border-style: dashed; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; padding: 16px 16px 6px; }
.sec-head h2 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 18px; }
.sec-head span { font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.coins { width: 100%; border-collapse: collapse; font-size: 14px; }
.coins th { padding: 14px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; white-space: nowrap; cursor: pointer; user-select: none; }
.coins th.sorted { color: var(--text); }
.coins td { padding: 12px; text-align: right; white-space: nowrap; border-top: 1px solid var(--border); }
.coins .l { text-align: left; }
.coins tbody tr:hover { background: var(--panel2); }
.coin-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; border: 0; background: transparent; cursor: pointer; text-align: left; padding: 0; }
.logo-wrap { position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.logo-wrap img { position: absolute; inset: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--panel); }
.coin-btn .nm { font-weight: 600; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 4px; }
.coin-btn .sy { color: var(--muted); font-size: 12px; }
.coin-btn .badge { font-size: 9px; padding: 2px 6px; }
.b { font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); }
.supply { min-width: 170px; text-align: left !important; }
.supply .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.bar { height: 5px; border-radius: 3px; background: var(--panel2); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 5px; background: var(--accent); }
.inf { color: var(--accent-text); font-weight: 700; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Footer */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 16px 2px 28px; border-top: 1px solid var(--border); }
.footer .small { flex: 1 1 320px; }
.footer .small a { text-decoration: underline; }
.me { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: 14px; }
.me img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 3px solid var(--orange); background: #fff; }
.me a { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.me a span { font-size: 18px; font-weight: 700; color: var(--orange); }

/* Modal + chart */
.modal { position: fixed; inset: 0; background: rgba(5,8,14,.62); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; z-index: 50; }
.dialog { width: 100%; max-width: 1120px; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.m-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.m-id { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-id img { border-radius: 50%; }
.m-name { font-family: "Space Grotesk", sans-serif; font-size: 26px; font-weight: 700; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 6px; background: var(--panel2); color: var(--muted); }
.pill.accent { background: var(--chip-bg); color: var(--accent-text); }
.m-price { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
#mPrice { font-family: "Space Grotesk", sans-serif; font-size: 40px; font-weight: 700; letter-spacing: -1px; }
#mChg { font-size: 16px; font-weight: 700; }
.m-tools { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chart-box { position: relative; border: 1px solid var(--border); border-radius: 12px; padding-top: 8px; }
#chart { display: block; width: 100%; height: 280px; cursor: crosshair; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 6px 12px 8px; }
.tip { position: absolute; top: 10px; pointer-events: none; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.chart-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stats div { padding: 12px 14px; border-radius: 10px; background: var(--panel2); }
.stats small { display: block; font-size: 12px; color: var(--muted); }
.stats b { display: block; margin-top: 4px; }

@media (max-width: 760px) {
  .topbar, .layout { padding-left: 14px; padding-right: 14px; }
  .sidebar { max-width: none; position: static; }
  #catList { display: flex; flex-wrap: wrap; gap: 4px; }
  .tagline { display: none; }
  h1 { font-size: 26px; }
  #mPrice { font-size: 30px; }
}

/* Badhanka X ee coin-ka */
.xbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; }
.xbtn:hover { opacity: .85; }
.xbtn small { font-weight: 500; opacity: .75; }

/* Daaqadda coin-ka: chart bidix, X midig (gees) */
.m-body { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.m-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.m-side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 12px; }
.side-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--border); }
.xbig { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); min-height: 56px; }
.xbig:hover { opacity: .9; }
.xicon { width: 40px; height: 40px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--text); }
.xtext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xtext b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xtext small { font-size: 12px; opacity: .7; }
.webbtn { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Liiska xogta dhinaca (sida CoinMarketCap) */
.info-list { margin: 0; display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row:last-child { border-bottom: 0; }
.info-row dt { color: var(--muted); }
.info-row dd { margin: 0; font-weight: 700; text-align: right; }
.info-bar { padding-top: 6px; font-size: 12px; color: var(--muted); }
.info-bar .row { display: flex; justify-content: space-between; }

/* ================= Muuqaal cusub (sida RootData) ================= */
.wrap { max-width: 1400px; margin: 0 auto; padding: 20px 28px; display: flex; flex-direction: column; gap: 22px; }
.content { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.topbar { gap: 16px; }
.top-search { flex: 1 1 260px; max-width: 420px; }
.top-search input { width: 100%; }

/* Ticker */
.ticker { overflow: hidden; background: var(--panel); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ticker-track { display: inline-flex; gap: 6px; padding: 8px 0; animation: tick 70s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
.tk { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border: 0; background: transparent; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); }
.tk b { font-weight: 700; }
.logo-wrap.sm { width: 18px; height: 18px; font-size: 9px; }
.logo-wrap.sm img { width: 18px; height: 18px; }

/* Hero: gainers + summary */
.hero { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.movers { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.movers-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.movers-head h2 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 26px; letter-spacing: -.3px; }
#moverTabs button.on { background: var(--panel); color: var(--text); }

.g-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.g-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 0; border-radius: 16px; border: 1px solid var(--border); background: linear-gradient(160deg, var(--card-a), var(--card-b)); text-align: left; cursor: pointer; overflow: hidden; transition: transform .15s, box-shadow .15s; min-width: 0; }
.g-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.g-card.lg { grid-column: span 4; min-height: 190px; }
.g-card.md { grid-column: span 3; min-height: 150px; }
.g-card.sm { grid-column: span 2; min-height: 96px; padding-bottom: 14px; }
.g-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.g-sym { font-family: "Space Grotesk", sans-serif; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-card.sm .g-sym { font-size: 15px; }
.g-card.sm .logo-wrap { width: 22px; height: 22px; }
.g-card.sm .logo-wrap img { width: 22px; height: 22px; }
.crown { margin-left: auto; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--panel); color: var(--accent-text); white-space: nowrap; }
.g-rank { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.g-price { font-size: 14px; }
.g-card.sm .g-price { font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.g-spark { display: block; width: calc(100% + 32px); margin: auto -16px 0; height: 90px; }
.g-card.md .g-spark { height: 60px; }

.summary { flex: 1 1 280px; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.summary h3 { margin: 0 0 4px; font-family: "Space Grotesk", sans-serif; font-size: 18px; }
.summary .info-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; font-weight: 700; }
.mood { height: 6px; border-radius: 3px; background: var(--down); overflow: hidden; margin-top: 4px; }
.mood i { display: block; height: 6px; background: var(--up); }
.rule-mini { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.link-btn { border: 0; background: none; color: var(--accent-text); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

/* Qaybaha: tabs */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.cat-tabs .cat { flex: none; padding: 9px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.cat-tabs .cat::before { display: none; }
.cat-tabs .cat.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.cat-tabs .cat.new { border-color: var(--chip-border); background: var(--chip-bg); }

[data-theme="dark"] { --card-a: #141b28; --card-b: #101521; }
[data-theme="light"] { --card-a: #eefcfd; --card-b: #ffffff; }

@media (max-width: 1000px) {
  .g-card.lg { grid-column: span 12; } .g-card.md { grid-column: span 6; } .g-card.sm { grid-column: span 4; }
  .summary { max-width: none; }
}
@media (max-width: 600px) {
  .wrap { padding: 14px; }
  .g-card.md { grid-column: span 12; } .g-card.sm { grid-column: span 6; }
  .top-search { order: 3; max-width: none; }
}

.g-big { margin-top: auto; padding: 10px 0 16px; font-family: "Space Grotesk", sans-serif; font-size: 34px; font-weight: 700; display: flex; flex-direction: column; }
.g-card.md .g-big { font-size: 26px; }
.g-big small { font-family: Inter, sans-serif; font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 600px) { .g-spark { height: 56px; } .g-card.lg { min-height: 150px; } }

.rule-pill { display: inline-flex; vertical-align: middle; margin-left: 8px; padding: 4px 10px; border-radius: 999px; font-family: Inter, sans-serif; font-size: 13px; font-weight: 700; background: var(--chip-bg); color: var(--accent-text); border: 1px solid var(--chip-border); }
.g-max { font-size: 11px; font-weight: 700; color: var(--accent-text); }
.logo .tag1b { font-size: 11px; }

.more-btn { display: block; width: calc(100% - 32px); margin: 12px 16px 16px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel2); font-weight: 700; cursor: pointer; }
.more-btn:hover { border-color: var(--accent); }

/* Exchanges & Wallets */
.card-head { display: flex; justify-content: space-between; align-items: center; }
.count-pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--orange); color: #fff; }
.count-pill:empty { display: none; }
.ex-list, .w-list { display: flex; flex-direction: column; gap: 6px; }
.ex-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel); font-size: 13px; }
a.ex-row:hover { outline: 1px solid var(--accent); }
.ex-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-row { padding: 8px 10px; border-radius: 8px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.w-top { display: flex; align-items: center; gap: 8px; } .w-top b { text-transform: capitalize; } .w-top a { margin-left: auto; font-family: ui-monospace, monospace; font-size: 12px; }
.copy-btn { border: 1px solid var(--border); background: var(--panel2); border-radius: 6px; width: 30px; height: 30px; cursor: pointer; }
.w-chips { display: flex; flex-wrap: wrap; gap: 5px; } .w-chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--accent-text); border: 1px solid var(--chip-border); }
.w-top b.nocap { text-transform: none; }
