/* Dark, quiet, dense where it matters. Inspired by openmarket.xyz: near-black canvas, hairline
   borders, big tight headlines, muted secondary text, monospace for tickers and numbers. */

:root {
  --bg: #0b0b0c;
  --panel: #111113;
  --panel-2: #16161a;
  --line: #1f1f24;
  --line-2: #2a2a31;
  --text: #ededef;
  --muted: #9a9aa3;
  --dim: #63636d;
  --accent: #ff8a3d;
  --pink: #ff5ea8;
  --violet: #7c5cff;
  --blue: #4f9bff;
  --up: #2fd58a;
  --down: #ff5a64;
  --body: #c4c4cb;
  --yellow: #ffd166;
  --lilac: #c9a7ff;
  --radius: 14px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-h: 64px;
  color-scheme: dark;
}
/* Light theme: light-gray canvas (not white), white cards. Settings → Theme, or follows the device. */
:root[data-theme="light"] { --bg: #eceef1; --panel: #ffffff; --panel-2: #f3f4f6; --line: #dfe2e7; --line-2: #cdd2da;
    --text: #121418; --body: #2e323a; --muted: #5d636e; --dim: #7d8490;
    --up: #0e9f6e; --down: #e5484d; --blue: #2563eb; --yellow: #b7791f; --lilac: #7c5cff; color-scheme: light; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --bg: #eceef1; --panel: #ffffff; --panel-2: #f3f4f6; --line: #dfe2e7; --line-2: #cdd2da;
    --text: #121418; --body: #2e323a; --muted: #5d636e; --dim: #7d8490;
    --up: #0e9f6e; --down: #e5484d; --blue: #2563eb; --yellow: #b7791f; --lilac: #7c5cff; color-scheme: light; } }

:lang(ar), :lang(ckb) { --sans: "Vazirmatn", "Inter", system-ui, sans-serif; }
/* Mono font has no Arabic glyphs: use the sans for localized words that sit in mono spots. */
:lang(ar) time, :lang(ckb) time, :lang(ar) .live, :lang(ckb) .live { font-family: var(--sans); letter-spacing: 0; }
/* Handles and tickers are always left-to-right, even inside RTL text ("@bwenews", not "bwenews@"). */
.src, bdi, .tk, .num { unicode-bidi: isolate; direction: ltr; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.mono, .tk, time, .num { font-family: var(--mono); font-feature-settings: "tnum"; }
.grow { flex: 1; }

.boot { display: grid; place-items: center; height: 100dvh; }
.logo { display: inline-block; width: 20px; height: 20px; flex: none; }
.logo svg { width: 100%; height: 100%; display: block; }
.boot .logo { width: 40px; height: 40px; animation: pulse 1.2s ease-in-out infinite; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 60px; padding: 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14px;
}
.tabs a:hover { color: var(--text); background: var(--panel-2); }
.tabs a.on { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.tabs svg, .bottom svg { width: 17px; height: 17px; }
.top-r { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }

.live { display: inline-flex; align-items: center; gap: 7px; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.live.on { color: var(--up); }
.live.on i { background: var(--up); box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); animation: ping 1.8s ease-out infinite; }

/* Fixed EN · ع · ک order in every language so the picker never rearranges under your finger. */
.langs { display: flex; direction: ltr; padding: 3px; gap: 2px; border: 1px solid var(--line-2); border-radius: 999px; }
.langs button { border: 0; background: none; color: var(--muted); padding: 4px 10px; border-radius: 999px; font-size: 13px; min-width: 34px; }
.langs button.on { background: var(--text); color: var(--bg); font-weight: 600; }

/* ---------- bottom nav (phones) ---------- */
.bottom { display: none; }
@media (max-width: 760px) {
  .top .tabs { display: none; }
  .top { gap: 12px; }
  .bottom {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-size: 11px; font-weight: 500; }
  .bottom a.on { color: var(--text); }
  .bottom svg { width: 21px; height: 21px; }
  .wrap { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px) !important; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } .side { display: none; } }
.side { position: sticky; top: 88px; display: grid; gap: 16px; }

h1.big {
  margin: 4px 0 6px; font-size: clamp(28px, 4.4vw, 44px); line-height: 1.05; font-weight: 700; letter-spacing: -0.035em;
}
:lang(ar) h1.big, :lang(ckb) h1.big { letter-spacing: 0; line-height: 1.3; }
.sub { color: var(--muted); margin: 0 0 22px; max-width: 60ch; }
h2.sec { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 12px; }
:lang(ar) h2.sec, :lang(ckb) h2.sec { letter-spacing: 0; text-transform: none; font-size: 14px; }

/* ---------- controls ---------- */
.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--text); color: var(--bg); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip.on { color: var(--text); border-color: var(--text); background: var(--panel-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.glow { position: relative; background: var(--panel); border-color: transparent; }
.btn.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(110deg, var(--violet), var(--pink), var(--accent), #c3f5d0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.btn.ghost { background: none; }
.btn.danger { color: var(--down); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--bg); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--muted); }
.addrow { display: flex; gap: 8px; }
.addrow .input { flex: 1; }
.hint { font-size: 13px; color: var(--dim); margin: 6px 0 0; }
.err { color: var(--down); font-size: 14px; min-height: 1.2em; margin: 4px 0 0; }

/* ---------- feed cards ---------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; transition: border-color .2s, background .2s;
}
.card:hover { border-color: var(--line-2); }
.card.u3::before {
  content: ""; position: absolute; inset-block: 14px; inset-inline-start: -1px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--pink));
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent);
}
.card.fresh { animation: arrive .7s cubic-bezier(.2, .8, .2, 1), glow 2.4s ease-out; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; }
.meta .src { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .sep { color: var(--dim); }
.meta time { font-size: 12px; color: var(--dim); white-space: nowrap; }
.sicon { width: 18px; height: 18px; flex: none; border-radius: 5px; display: grid; place-items: center; }
.sicon svg { width: 12px; height: 12px; }
.sicon.binance { background: #f0b90b1f; color: #f0b90b; }
.sicon.telegram { background: #2aabee1f; color: #2aabee; }
.sicon.x { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
/* source picture with a small platform badge */
.ava { position: relative; width: 22px; height: 22px; flex: none; }
.ava img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--panel-2); display: block; }
.ava .sicon { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 4px; box-shadow: 0 0 0 1.5px var(--panel); }
.ava .sicon svg { width: 8px; height: 8px; }
.srow .ava, .srow .ava img { width: 36px; height: 36px; }
.srow .ava .sicon { width: 18px; height: 18px; } .srow .ava .sicon svg { width: 11px; height: 11px; }
.tk img { width: 15px; height: 15px; border-radius: 50%; }
.sicon.feed { background: #ff8a3d1f; color: var(--accent); }
.sicon.onchain { background: #4f9bff1f; color: var(--blue); }

.pill { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line-2); color: var(--muted); }
.pill.act { color: #1a0f05; background: var(--accent); border-color: var(--accent); }
.pill.c-listing { color: var(--up); border-color: color-mix(in srgb, var(--up) 35%, transparent); }
.pill.c-delisting, .pill.c-hack { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.pill.c-volume_spike { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 35%, transparent); }
.pill.c-regulation, .pill.c-macro { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.pill.c-unlock, .pill.c-whale { color: var(--lilac); border-color: color-mix(in srgb, var(--lilac) 35%, transparent); }

.card h3 { margin: 10px 0 6px; font-size: 18px; line-height: 1.35; font-weight: 600; letter-spacing: -0.012em; overflow-wrap: anywhere; }
:lang(ar) .card h3, :lang(ckb) .card h3 { letter-spacing: 0; line-height: 1.6; font-size: 18.5px; }
.mean { margin: 0; color: var(--body); font-size: 14.5px; overflow-wrap: anywhere; }
.mean b { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
:lang(ar) .mean b, :lang(ckb) .mean b { letter-spacing: 0; font-size: 12.5px; }
.mean.shimmer {
  color: transparent; background: linear-gradient(90deg, var(--dim) 0%, var(--text) 50%, var(--dim) 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 1.6s linear infinite; font-size: 13.5px;
}
.foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.tks { display: flex; gap: 6px; flex-wrap: wrap; }
.tk {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 3px 8px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
}
.tk:hover { border-color: var(--dim); }
.tk .up { color: var(--up); } .tk .down { color: var(--down); }

.sent { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.sent i { width: 5px; height: 12px; border-radius: 2px; background: var(--line-2); }
.sent em { font-style: normal; margin-inline-start: 6px; }
.sent.pos i.f { background: var(--up); } .sent.pos em { color: var(--up); }
.sent.neg i.f { background: var(--down); } .sent.neg em { color: var(--down); }
.sent.neu i.f { background: var(--muted); }

details { margin-top: 10px; border-top: 1px dashed var(--line-2); padding-top: 8px; }
summary { cursor: pointer; color: var(--dim); font-size: 13px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸"; transition: transform .15s; }
:dir(rtl) summary::before { content: "◂"; }
details[open] summary::before { transform: rotate(90deg); }
:dir(rtl) details[open] summary::before { transform: rotate(-90deg); }
.when { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.when time { color: var(--text); }
.orig { white-space: pre-wrap; color: var(--muted); font-size: 13.5px; margin-top: 8px; overflow-wrap: anywhere; }
details img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-top: 10px; border: 1px solid var(--line); }
.ext { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--blue); }

.empty { text-align: center; color: var(--dim); padding: 56px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.more { display: block; margin: 16px auto 0; }

/* ---------- side + panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.panel h4 a { color: var(--dim); font-weight: 500; }
.panel h4 > span { display: inline-flex; align-items: center; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.row:first-of-type { border-top: 0; }
.row .r { margin-inline-start: auto; text-align: end; }
.up { color: var(--up); } .down { color: var(--down); }
.av { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--panel-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- token grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.tcard .hd { display: flex; align-items: center; gap: 10px; }
.tcard .sym { font: 600 16px var(--mono); }
.tcard .nm { color: var(--dim); font-size: 13px; }
.tcard .px { font: 500 26px/1 var(--mono); letter-spacing: -0.02em; }
.tcard .stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.tcard .acts { display: flex; gap: 8px; }
.tcard .spk { color: var(--yellow); }

.banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 18px; flex-wrap: wrap; }
.banner .sym { font: 600 22px var(--mono); }

/* ---------- sources ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.srow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; }
.srow .who { min-width: 0; flex: 1; }
.srow .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .who small { color: var(--dim); font-size: 12.5px; }
.srow .who small.bad { color: var(--down); }

/* ---------- settings ---------- */
.stack { display: grid; gap: 16px; max-width: 680px; }
.langbig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.langbig button { padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); font-weight: 600; font-size: 16px; }
.langbig button.on { border-color: var(--text); background: var(--panel-2); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.kv span:first-child { color: var(--muted); }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.2fr 1fr; position: relative; overflow: hidden; }
.auth .sky {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff9, transparent 60%),
    radial-gradient(1px 1px at 38% 70%, #fff6, transparent 60%),
    radial-gradient(1.5px 1.5px at 66% 14%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 82% 58%, #fff5, transparent 60%),
    radial-gradient(1px 1px at 22% 88%, #fff5, transparent 60%),
    radial-gradient(600px 400px at 85% 10%, #7c5cff22, transparent 70%),
    radial-gradient(500px 360px at 10% 100%, #ff8a3d14, transparent 70%);
}
.auth .curve { position: absolute; inset-inline-end: -40px; bottom: -40px; width: min(70vw, 900px); opacity: .9; pointer-events: none; }
:dir(rtl) .auth .curve { transform: scaleX(-1); }
.auth .pitch { position: relative; padding: 48px clamp(20px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; }
.auth .pitch h1 { font-size: clamp(40px, 6.4vw, 76px); line-height: 1; letter-spacing: -0.045em; font-weight: 700; margin: 24px 0 18px; max-width: 12ch; }
:lang(ar) .auth .pitch h1, :lang(ckb) .auth .pitch h1 { letter-spacing: 0; line-height: 1.25; }
.auth .pitch p { color: var(--muted); font-size: 18px; max-width: 46ch; margin: 0; }
.auth .formwrap { position: relative; display: grid; place-items: center; padding: 32px 16px; }
.auth form { width: min(100%, 400px); display: grid; gap: 14px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; backdrop-filter: blur(8px); }
.auth .switch { text-align: center; color: var(--dim); font-size: 14px; }
.auth .switch button { background: none; border: 0; color: var(--text); font-weight: 600; padding: 0 4px; }
.auth .langs { position: absolute; top: 20px; right: 20px; z-index: 2; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth .pitch { padding-top: 72px; padding-bottom: 8px; }
  .auth .pitch h1 { margin-top: 8px; }
  .auth .pitch p { font-size: 16px; }
  .auth .curve { width: 120vw; bottom: auto; top: 0; opacity: .35; }
}

/* ---------- motion ---------- */
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
@keyframes pulse { 50% { transform: scale(.82); opacity: .7; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes arrive { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
@keyframes glow { 0% { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 32px color-mix(in srgb, var(--accent) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
