/* ==========================================================================
   Werq Gold — live gold price board for Ethiopia
   Design: deep obsidian + brushed gold. No frameworks, no build step.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg: #07080b;
  --bg-2: #0a0c11;
  --bg-3: #0e1117;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f4f5f7;
  --muted: #9ba1ad;
  --muted-2: #6a7180;
  --gold: #e8c46a;
  --gold-2: #f7e3a1;
  --gold-3: #c99a3c;
  --gold-deep: #8a6420;
  --up: #4ade80;
  --down: #fb7185;
  --grad-gold: linear-gradient(135deg, #fdf3cd 0%, #f0d385 28%, #d3a54a 55%, #b8892f 78%, #f2d68b 100%);
  --grad-gold-soft: linear-gradient(135deg, rgba(247, 227, 161, .16), rgba(201, 154, 60, .04));
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, .9);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --ff: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ff-am: "Noto Sans Ethiopic", "Kefa", "Nyala", "Abyssinica SIL", var(--ff);
  --wrap: 1240px;
  --ease: cubic-bezier(.22, .8, .25, 1);
}

[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-2: #fbf9f4;
  --bg-3: #ffffff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-2: rgba(255, 255, 255, 0.95);
  --line: rgba(20, 18, 12, 0.09);
  --line-2: rgba(20, 18, 12, 0.16);
  --text: #14130f;
  --muted: #6b675c;
  --muted-2: #918c7e;
  --gold: #a8791f;
  --gold-2: #8a6420;
  --gold-3: #c99a3c;
  --up: #148a4d;
  --down: #c2364f;
  --shadow: 0 22px 50px -34px rgba(70, 55, 20, .45);
  --grad-gold: linear-gradient(135deg, #8a6420 0%, #a8791f 40%, #7d5a1b 70%, #b8892f 100%);
  --grad-gold-soft: linear-gradient(135deg, rgba(201, 154, 60, .14), rgba(201, 154, 60, .03));
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ff);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[lang="am"] body, html[lang="am"] button, html[lang="am"] input, html[lang="am"] select {
  font-family: var(--ff-am);
}
img, svg, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
::selection { background: rgba(232, 196, 106, .3); color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* ---------- ambient background ---------- */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
[data-theme="light"] .grain { opacity: .28; }
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora i {
  position: absolute; display: block; border-radius: 50%; filter: blur(90px); opacity: .5;
}
.aurora i:nth-child(1) { width: 44vw; height: 44vw; left: -12vw; top: -14vw; background: radial-gradient(circle, rgba(201, 154, 60, .22), transparent 65%); animation: drift 26s var(--ease) infinite alternate; }
.aurora i:nth-child(2) { width: 38vw; height: 38vw; right: -10vw; top: 8vh; background: radial-gradient(circle, rgba(74, 222, 128, .1), transparent 65%); animation: drift 34s var(--ease) infinite alternate-reverse; }
.aurora i:nth-child(3) { width: 46vw; height: 46vw; left: 30vw; bottom: -22vw; background: radial-gradient(circle, rgba(251, 113, 133, .08), transparent 65%); animation: drift 40s var(--ease) infinite alternate; }
[data-theme="light"] .aurora i { opacity: .38; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(6vw, 4vh, 0) scale(1.15); }
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; position: relative; z-index: 1; }
.section { padding: 34px 0; }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: clamp(1.15rem, 2.2vw, 1.45rem); letter-spacing: -.03em; }
.section-head p { color: var(--muted); font-size: .875rem; margin-top: 5px; max-width: 62ch; }
.row-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.fine { font-size: .72rem; color: var(--muted-2); line-height: 1.55; }

/* ---------- ticker tape ---------- */
.tape {
  position: relative; z-index: 3; height: 34px; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(201, 154, 60, .09), rgba(201, 154, 60, .02) 40%, rgba(201, 154, 60, .09));
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.tape-track { display: flex; align-items: center; height: 100%; width: max-content; animation: tape 48s linear infinite; }
.tape:hover .tape-track { animation-play-state: paused; }
.tape-item { display: inline-flex; align-items: center; gap: 7px; padding: 0 20px; font-size: .7rem; letter-spacing: .04em; white-space: nowrap; border-right: 1px solid var(--line); }
.tape-item b { font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .63rem; }
.tape-item span { font-variant-numeric: tabular-nums; font-weight: 600; }
.tape-item .t-up { color: var(--up); }
.tape-item .t-down { color: var(--down); }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(18px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark { width: 36px; height: 36px; display: block; filter: drop-shadow(0 6px 14px rgba(201, 154, 60, .25)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark.small { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.06rem; font-weight: 700; letter-spacing: -.03em; }
.brand-dot { color: var(--gold); }
.brand-text em { font-style: normal; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a {
  padding: 8px 11px; border-radius: 9px; font-size: .8rem; color: var(--muted);
  transition: color .18s, background .18s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: .72rem; font-weight: 600; transition: .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="light"] .ico-moon { display: block; }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 0 rgba(74, 222, 128, .5); }
.status-pill .status-hz { color: var(--muted-2); font-size: .62rem; letter-spacing: .02em; text-transform: none; }
.status-pill[data-state="live"] { color: var(--up); border-color: rgba(74, 222, 128, .28); background: rgba(74, 222, 128, .07); }
.status-pill[data-state="live"] .dot { background: var(--up); animation: ping 2s infinite; }
.status-pill[data-state="polling"] { color: var(--gold); border-color: rgba(232, 196, 106, .3); background: rgba(232, 196, 106, .07); }
.status-pill[data-state="polling"] .dot { background: var(--gold); }
.status-pill[data-state="stale"], .status-pill[data-state="offline"] { color: var(--down); border-color: rgba(251, 113, 133, .3); background: rgba(251, 113, 133, .07); }
.status-pill[data-state="stale"] .dot, .status-pill[data-state="offline"] .dot { background: var(--down); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .55); } 70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

/* ---------- hero ---------- */
.hero { padding-top: 30px; padding-bottom: 6px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: stretch; }
.hero-main { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 9px; font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); flex-wrap: wrap; }
.eyebrow .sep { color: var(--muted-2); }
.eyebrow .src { letter-spacing: .02em; text-transform: none; color: var(--muted-2); font-size: .7rem; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.live-dot[data-live="1"] { background: var(--up); box-shadow: 0 0 12px rgba(74, 222, 128, .8); animation: ping 1.8s infinite; }

.price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 10px; }
.price-big {
  font-size: clamp(2.7rem, 7.4vw, 5.1rem); font-weight: 700; letter-spacing: -.045em; line-height: 1;
  font-variant-numeric: tabular-nums; background: var(--grad-gold); -webkit-background-clip: text;
  background-clip: text; color: transparent; padding-bottom: 4px;
  transition: transform .25s var(--ease);
}
.price-big.bump-up { animation: bumpUp .5s var(--ease); }
.price-big.bump-down { animation: bumpDown .5s var(--ease); }
@keyframes bumpUp { 0% { transform: translateY(0); } 30% { transform: translateY(-3px); filter: drop-shadow(0 0 18px rgba(74, 222, 128, .45)); } 100% { transform: translateY(0); } }
@keyframes bumpDown { 0% { transform: translateY(0); } 30% { transform: translateY(3px); filter: drop-shadow(0 0 18px rgba(251, 113, 133, .4)); } 100% { transform: translateY(0); } }
.price-sub { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.dotsep { color: var(--muted-2); }
.chg { font-variant-numeric: tabular-nums; font-weight: 600; }
.chg[data-dir="up"], .up { color: var(--up); }
.chg[data-dir="down"], .down { color: var(--down); }
.chg[data-dir="flat"] { color: var(--muted); }

.price-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); gap: 2px; }
.seg button {
  padding: 6px 12px; border-radius: 8px; font-size: .74rem; font-weight: 600; color: var(--muted);
  letter-spacing: .02em; transition: .16s var(--ease); white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  color: #1a1408; background: var(--grad-gold);
  box-shadow: 0 4px 14px -6px rgba(201, 154, 60, .8);
}
[data-theme="light"] .seg button.on { color: #fff; }
.seg-cur button { min-width: 46px; }

.hero-meta { display: flex; gap: 26px; margin-top: 24px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-k { font-size: .62rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted-2); }
.meta-v { font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.hero-side { display: flex; }
.spark-card {
  position: relative; width: 100%; padding: 16px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: linear-gradient(165deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.spark-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 80% 0%, rgba(201, 154, 60, .13), transparent 60%);
}
.spark-head { display: flex; align-items: center; justify-content: space-between; font-size: .68rem; letter-spacing: .11em; text-transform: uppercase; color: var(--muted-2); }
.spark-head strong { font-size: .78rem; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.spark-wrap { position: relative; flex: 1; min-height: 124px; margin: 8px -4px 0; }
.spark-wrap canvas { width: 100%; height: 120px; }
.coin-art { position: absolute; right: -12px; top: -8px; width: 84px; opacity: .16; pointer-events: none; transform: rotate(-8deg); }
[data-theme="light"] .coin-art { opacity: .3; }
.spark-foot { display: flex; align-items: center; gap: 8px; font-size: .66rem; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.spark-bar { flex: 1; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.spark-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: var(--grad-gold); transition: width .6s var(--ease); }

/* ---------- matrix ---------- */
.matrix {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}
.mx-row { display: grid; grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr)); align-items: stretch; border-top: 1px solid var(--line); }
.mx-row:first-child { border-top: 0; }
.mx-head { background: rgba(255, 255, 255, .02); }
.mx-head .mx-cell { padding: 10px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cur-code { font-size: .68rem; font-weight: 700; letter-spacing: .1em; color: var(--gold); }
.cur-name { font-size: .62rem; color: var(--muted-2); letter-spacing: .04em; }
.mx-spark { width: 56px; height: 22px; margin-left: auto; opacity: .8; }
.mx-unit { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-right: 1px solid var(--line); }
.unit-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--grad-gold-soft); border: 1px solid var(--line); color: var(--gold); flex: 0 0 auto; }
.unit-ico svg { width: 17px; height: 17px; }
.mx-unit strong { display: block; font-size: .85rem; font-weight: 600; }
.mx-unit em { display: block; font-style: normal; font-size: .64rem; color: var(--muted-2); margin-top: 1px; }
.mx-cell { padding: 13px 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-right: 1px solid var(--line); min-width: 0; }
.mx-cell:last-child { border-right: 0; }
.mx-cell.is-focus { background: linear-gradient(180deg, rgba(201, 154, 60, .07), rgba(201, 154, 60, .02)); }
.mx-v { font-size: .92rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .3s; }
.mx-v.long { font-size: .8rem; }
.mx-v.xlong { font-size: .72rem; }
.mx-chg { font-size: .64rem; font-variant-numeric: tabular-nums; color: var(--muted-2); }
.mx-chg[data-dir="up"] { color: var(--up); }
.mx-chg[data-dir="down"] { color: var(--down); }
.mx-row.is-highlight .mx-unit { background: rgba(201, 154, 60, .05); }
.mx-row.is-highlight .mx-unit strong { color: var(--gold); }
.mx-cell.flash-up { animation: flashUp .7s var(--ease); }
.mx-cell.flash-down { animation: flashDown .7s var(--ease); }
@keyframes flashUp { 0% { background: rgba(74, 222, 128, .16); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(251, 113, 133, .14); } 100% { background: transparent; } }

/* ---------- cards ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(170deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow); padding: 18px;
  position: relative; overflow: hidden;
}
.card-title { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

/* ---------- charts ---------- */
.chart-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.charts-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.chart-card { padding: 16px 16px 12px; display: flex; flex-direction: column; }
.chart-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-price { display: flex; align-items: baseline; gap: 8px; }
.chart-price-v { font-size: 1.55rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chart-price-u { font-size: .72rem; color: var(--muted-2); letter-spacing: .06em; text-transform: uppercase; }
.chart-legend { display: flex; gap: 14px; font-size: .66rem; color: var(--muted-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-line { width: 14px; height: 2px; background: var(--gold); border-radius: 2px; }
.lg-ema { width: 14px; height: 2px; background: repeating-linear-gradient(90deg, #7dd3fc 0 3px, transparent 3px 5px); }
.chart-body { position: relative; height: 372px; margin: 4px -6px 0; }
.chart-body canvas { width: 100%; height: 100%; touch-action: pan-y; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 128px;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--bg-3) 92%, transparent);
  backdrop-filter: blur(10px); box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .8);
  font-size: .68rem; color: var(--muted); transform: translate(-50%, -112%); white-space: nowrap;
}
.chart-tip strong { display: block; color: var(--text); font-size: .82rem; font-variant-numeric: tabular-nums; margin: 2px 0; }
.chart-tip .tt-time { font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.chart-tip .tt-row { display: flex; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .78rem; color: var(--muted-2); background: color-mix(in srgb, var(--bg) 55%, transparent); border-radius: 12px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .62rem; color: var(--muted-2); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 8px; flex-wrap: wrap; }
.chart-foot-src { text-align: right; }

.stats-card { display: flex; flex-direction: column; gap: 14px; }
.stat-list { display: flex; flex-direction: column; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .74rem; color: var(--muted); }
.stat:last-child { border-bottom: 0; }
.stat strong { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.range-meter { margin-top: auto; }
.rm-labels { display: flex; justify-content: space-between; font-size: .64rem; color: var(--muted-2); font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.rm-track { position: relative; height: 5px; border-radius: 4px; background: linear-gradient(90deg, rgba(251, 113, 133, .35), rgba(232, 196, 106, .3), rgba(74, 222, 128, .35)); }
.rm-track i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--grad-gold); border-radius: 4px; opacity: .25; }
.rm-track b { position: absolute; top: 50%; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--gold-2); border: 2px solid var(--bg); transform: translate(-50%, -50%); box-shadow: 0 0 10px rgba(232, 196, 106, .8); transition: left .5s var(--ease); }
.rm-caption { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-top: 7px; }
.ticker-art { height: 56px; margin: 0 -6px -6px; opacity: .8; }
.ticker-art svg { width: 100%; height: 100%; }

/* ---------- karat ---------- */
.karat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
.karat-hero { display: flex; align-items: center; gap: 20px; }
.gauge-wrap { position: relative; width: 190px; height: 190px; flex: 0 0 auto; }
.gauge-wrap canvas { width: 190px; height: 190px; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; pointer-events: none; }
.gc-karat { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gc-purity { font-size: .64rem; letter-spacing: .12em; color: var(--muted-2); text-transform: uppercase; }
.karat-hero-info { min-width: 0; }
.karat-hero-info h3 { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }
.karat-big { font-size: clamp(1.5rem, 3.6vw, 2.1rem); font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.karat-note { font-size: .74rem; color: var(--muted); line-height: 1.6; }
.karat-chips { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.karat-chips button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: .68rem;
  color: var(--muted); font-weight: 600; transition: .16s;
}
.karat-chips button:hover { color: var(--text); border-color: var(--line-2); }
.karat-chips button.on { color: #1a1408; background: var(--grad-gold); border-color: transparent; }
[data-theme="light"] .karat-chips button.on { color: #fff; }
.karat-table-card { padding: 0; display: flex; flex-direction: column; }
.kt-head, .kt-row { display: grid; grid-template-columns: 1fr 1.15fr 1.15fr; gap: 8px; align-items: center; padding: 11px 18px; }
.kt-head { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); border-bottom: 1px solid var(--line); }
.kt-head span:not(:first-child), .kt-row span:not(:first-child) { text-align: right; }
.kt-row { border-bottom: 1px solid var(--line); font-size: .78rem; transition: background .18s; cursor: pointer; }
.kt-row:hover { background: var(--panel-2); }
.kt-row.on { background: rgba(201, 154, 60, .08); }
.kt-row .kt-k { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.kt-badge { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .58rem; font-weight: 700; background: var(--grad-gold-soft); border: 1px solid var(--line); color: var(--gold); }
.kt-row span:not(.kt-k) { font-variant-numeric: tabular-nums; color: var(--text); }
.kt-row small { color: var(--muted-2); font-size: .6rem; display: block; font-weight: 400; }
.karat-table-card .fine { padding: 12px 18px 16px; margin-top: auto; }

/* ---------- tools ---------- */
.tools-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.conv-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.field input, .field select {
  width: 100%; height: 40px; padding: 0 11px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .18);
  font-size: .82rem; font-variant-numeric: tabular-nums; transition: .16s;
  appearance: none; -webkit-appearance: none;
}
[data-theme="light"] .field input, [data-theme="light"] .field select { background: rgba(255, 255, 255, .8); }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 28px;
}
.field input:focus, .field select:focus { outline: none; border-color: rgba(232, 196, 106, .55); box-shadow: 0 0 0 3px rgba(232, 196, 106, .12); }
.conv-out {
  margin-top: 14px; padding: 15px 16px; border-radius: 14px;
  border: 1px solid rgba(201, 154, 60, .22); background: var(--grad-gold-soft);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.conv-out-k { font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.conv-out-v { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.15; }
.conv-out-side { text-align: right; }
.conv-out-side strong { display: block; font-size: .9rem; font-variant-numeric: tabular-nums; margin-top: 3px; }
.conv-presets { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.conv-presets button { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); font-size: .68rem; color: var(--muted); font-weight: 600; transition: .16s; }
.conv-presets button:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }

.alert-card { display: flex; flex-direction: column; }
.alert-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.alert-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-size: .64rem; font-weight: 700; background: var(--grad-gold-soft); border: 1px solid var(--line); color: var(--gold); }
.alert-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.alert-form .btn-gold { grid-column: span 2; height: 40px; }
.btn-gold {
  border-radius: 10px; background: var(--grad-gold); color: #1a1408; font-weight: 700; font-size: .8rem;
  letter-spacing: .01em; transition: transform .16s var(--ease), box-shadow .2s; box-shadow: 0 10px 24px -14px rgba(201, 154, 60, .9);
}
[data-theme="light"] .btn-gold { color: #fff; }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -14px rgba(201, 154, 60, 1); }
.btn-gold:active { transform: translateY(0) scale(.99); }
.alert-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 210px; overflow-y: auto; }
.alert-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .14); font-size: .74rem;
}
[data-theme="light"] .alert-item { background: rgba(255, 255, 255, .7); }
.alert-item .ai-dir { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; flex: 0 0 auto; }
.alert-item[data-dir="above"] .ai-dir { color: var(--up); background: rgba(74, 222, 128, .12); }
.alert-item[data-dir="below"] .ai-dir { color: var(--down); background: rgba(251, 113, 133, .12); }
.alert-item .ai-text { min-width: 0; flex: 1; }
.alert-item .ai-text strong { display: block; font-variant-numeric: tabular-nums; }
.alert-item .ai-text small { color: var(--muted-2); font-size: .62rem; }
.alert-item.done { opacity: .55; }
.alert-item .ai-del { width: 26px; height: 26px; border-radius: 7px; color: var(--muted-2); display: grid; place-items: center; font-size: 1rem; line-height: 1; }
.alert-item .ai-del:hover { color: var(--down); background: rgba(251, 113, 133, .1); }
.alert-card .fine { margin-top: auto; padding-top: 12px; }
.alert-empty { font-size: .74rem; color: var(--muted-2); padding: 12px 0; text-align: center; border: 1px dashed var(--line); border-radius: 11px; margin-top: 12px; }

/* ---------- ethiopia ---------- */
.et-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.et-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: transform .25s var(--ease), border-color .25s; }
.et-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.et-ico { font-size: 1.15rem; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--grad-gold-soft); border: 1px solid var(--line); }
.et-card h3 { font-size: .9rem; }
.et-card p { font-size: .76rem; color: var(--muted); line-height: 1.65; }
.et-fact { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; align-items: center; justify-content: space-between; font-size: .68rem; color: var(--muted-2); }
.et-fact strong { color: var(--gold); font-variant-numeric: tabular-nums; font-size: .74rem; }

/* ---------- sources ---------- */
.sources-card { padding: 20px; }
.sources-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sources-head h3 { font-size: .9rem; }
.badge-live { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; color: var(--up); background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .25); }
.badge-live[data-state="degraded"] { color: var(--gold); background: rgba(232, 196, 106, .1); border-color: rgba(232, 196, 106, .3); }
.badge-live[data-state="offline"] { color: var(--down); background: rgba(251, 113, 133, .1); border-color: rgba(251, 113, 133, .3); }
.sources-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.source strong { font-size: .78rem; display: block; margin-bottom: 5px; }
.source p { font-size: .72rem; color: var(--muted); line-height: 1.6; }
.source-tag { display: inline-block; margin-top: 9px; font-size: .6rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--grad-gold-soft); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 26px; padding: 26px 0 40px; background: linear-gradient(180deg, transparent, rgba(201, 154, 60, .03)); }
.footer-inner { display: grid; grid-template-columns: 1.1fr 1.6fr auto; gap: 26px; align-items: center; }
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand strong { font-size: .9rem; display: block; }
.foot-brand p { font-size: .7rem; color: var(--muted-2); }
.disclaimer { font-size: .68rem; color: var(--muted-2); line-height: 1.65; }
.foot-meta { font-size: .66rem; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg-3) 94%, transparent);
  backdrop-filter: blur(14px); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .9);
  font-size: .76rem; max-width: 330px; animation: toastIn .35s var(--ease);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ti { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; background: var(--grad-gold-soft); border: 1px solid var(--line); }
.toast strong { display: block; font-size: .76rem; }
.toast small { color: var(--muted-2); font-size: .66rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }

.noscript { position: fixed; inset: auto 16px 16px; padding: 14px; border-radius: 12px; background: var(--down); color: #fff; text-align: center; z-index: 99; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { order: -1; }
  .spark-card { min-height: 0; }
  .spark-wrap { min-height: 96px; }
  .spark-wrap canvas { height: 96px; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-card { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; }
  .stats-card .card-title { grid-column: span 2; }
  .stat-list { grid-column: span 1; }
  .range-meter { grid-column: span 1; margin-top: 8px; }
  .ticker-art { display: none; }
  .karat-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .et-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr; gap: 14px; }
  .nav { display: none; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 15px; }
  .section { padding: 24px 0; }
  .header-inner { height: 58px; gap: 10px; }
  .status-pill .status-hz { display: none; }
  .brand-text em { display: none; }
  .price-row { align-items: flex-start; }
  .price-controls { flex-direction: row; align-items: center; gap: 6px; width: 100%; justify-content: space-between; }
  .price-big { font-size: clamp(2.4rem, 12vw, 3.4rem); }
  .hero-meta { gap: 16px 22px; margin-top: 18px; }
  .meta-item { flex: 0 0 calc(50% - 12px); }
  .matrix { border-radius: var(--r-md); }
  .mx-head { display: none; }
  .mx-row { grid-template-columns: 1fr; padding: 12px 14px; gap: 10px; }
  .mx-unit { border-right: 0; padding: 0; }
  .mx-cell { border-right: 0; padding: 0; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px; }
  .mx-cell::before {
    content: attr(data-cur); font-size: .62rem; letter-spacing: .1em; color: var(--muted-2);
    font-weight: 600; min-width: 34px;
  }
  .mx-row .mx-cell { border-top: 1px dashed var(--line); padding-top: 7px; }
  .mx-row .mx-cell.is-focus { background: none; }
  .mx-row .mx-cell.is-focus .mx-v { color: var(--gold); }
  .mx-row { border-top: 1px solid var(--line); }
  .chart-body { height: 290px; }
  .chart-toolbar { width: 100%; justify-content: space-between; }
  .seg-range button { padding: 6px 9px; }
  .stats-card { display: block; }
  .stat-list { margin-bottom: 14px; }
  .karat-hero { flex-direction: column; text-align: center; }
  .karat-hero-info { text-align: center; }
  .karat-chips { justify-content: center; }
  .conv-row { grid-template-columns: 1fr 1fr; }
  .et-grid { grid-template-columns: 1fr; }
  .sources-grid { grid-template-columns: 1fr; }
  .chart-price-v { font-size: 1.3rem; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 400px) {
  .price-controls { flex-direction: column; align-items: stretch; }
  .seg { justify-content: space-between; }
  .seg button { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* tooltip flips below the cursor near the top of the chart */
.chart-tip.below { transform: translate(-50%, 16%); }
