/* ===========================================================================
   AirdropCalc — estilos. Dark, look "terminal de trading".
   =========================================================================== */
:root {
  --bg: #07080b;
  --bg-soft: #0e1118;
  --card: #12151d;
  --card-2: #181c27;
  --border: #232838;
  --text: #e7eaf0;
  --text-dim: #8a93a6;
  --text-faint: #5b6273;
  /* tema dinámico: lo sobreescribe app.js por proyecto */
  --accent: #6f9cf5;
  --accent2: #8fb6ff;
  --tint: 111, 156, 245;
  --green: #46d191;
  --red: #ff5d6c;
  --yellow: #f5c451;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  /* base is black; only a whisper of depth at the top */
  background:
    radial-gradient(1100px 600px at 50% -20%, rgba(255, 255, 255, 0.035), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.45s ease;
}
/* only the calculator gets the per-DEX colored backdrop */
body.calc-bg {
  background:
    radial-gradient(1300px 760px at 82% -16%, rgba(var(--tint), 0.40), transparent 60%),
    radial-gradient(1050px 680px at -8% 110%, rgba(var(--tint), 0.22), transparent 58%),
    linear-gradient(180deg, rgba(var(--tint), 0.11) 0%, rgba(var(--tint), 0.04) 42%, transparent 100%),
    var(--bg);
  background-attachment: fixed;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 22px 80px; position: relative; z-index: 1; }

/* ---------- animated space backdrop ---------- */
#appbg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#appbg .neb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.45; will-change: transform; }
#appbg .neb1 { width: 540px; height: 540px; top: -150px; right: -90px;
  background: radial-gradient(circle, rgba(var(--tint), 0.55), transparent 70%);
  animation: nebDrift1 28s ease-in-out infinite; }
#appbg .neb2 { width: 460px; height: 460px; bottom: -170px; left: -110px;
  background: radial-gradient(circle, rgba(var(--tint), 0.4), transparent 70%);
  animation: nebDrift2 34s ease-in-out infinite; }
@keyframes nebDrift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-46px,34px) scale(1.08); } }
@keyframes nebDrift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(52px,-30px) scale(1.1); } }
#appbg .astar { position: absolute; border-radius: 50%; background: #fff;
  animation: aTwinkle var(--tw, 4s) ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes aTwinkle { 0%,100% { opacity: var(--op, 0.5); } 50% { opacity: 0.08; } }
#appbg .acomet { position: absolute; width: 120px; height: 2px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(180,210,255,0.85)); border-radius: 2px; transform: rotate(18deg); }
#appbg .acomet::after { content: ""; position: absolute; right: -1px; top: -2px;
  width: 5px; height: 5px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 2px rgba(255,255,255,0.9), 0 0 14px 4px rgba(120,180,255,0.5); }
@keyframes aShoot { 0% { opacity: 0; transform: translate(0,0) rotate(18deg); }
  12% { opacity: 1; } 100% { opacity: 0; transform: translate(440px, 143px) rotate(18deg); } }

/* ---------- entrance animations ---------- */
@keyframes appUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
header.app { animation: appUp 0.5s cubic-bezier(.2,.7,.2,1) both; }
.head-rule { animation: appUp 0.5s 0.05s cubic-bezier(.2,.7,.2,1) both; }
.sections { animation: appUp 0.5s 0.1s cubic-bezier(.2,.7,.2,1) both; }
@keyframes secIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sec-in { animation: secIn 0.34s ease both; }

@media (prefers-reduced-motion: reduce) {
  #appbg .neb, #appbg .astar, header.app, .head-rule, .sections, .sec-in { animation: none !important; }
}

/* ---------- Header ---------- */
header.app {
  position: relative;
  text-align: center;
  margin: 6px 0 26px;
  padding-top: 2px;
}
a.brand { display: inline-block; text-decoration: none; color: inherit; cursor: pointer; }
.brand h1 {
  font-family: "Chakra Petch", "Sora", sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 3.5vw, 40px);
  letter-spacing: 0.16em;
  background: linear-gradient(180deg, #ffffff 0%, #c8d1e4 62%, #8c99ba 112%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 18px rgba(255, 255, 255, 0.07));
}
.brand .slogan {
  margin-top: 9px;
  font-size: 11.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-faint);
}
a.brand:hover .slogan { color: var(--text-dim); }
.header-actions { position: absolute; top: 0; right: 0; display: flex; gap: 8px; }
@media (max-width: 720px) {
  .header-actions { position: static; justify-content: center; margin-top: 14px; }
}

/* premium hairline under the header */
.head-rule {
  height: 1px; margin: 0 0 22px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10) 18%, rgba(255,255,255,0.10) 82%, transparent);
}

/* ---------- Section switcher ---------- */
.sections { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0 auto 22px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 5px; width: fit-content; }
.section-tab {
  display: flex; align-items: center; justify-content: center; gap: 9px; border: none; cursor: pointer;
  background: transparent; color: var(--text-dim); font-family: "Sora", sans-serif;
  font-size: 14px; font-weight: 600; padding: 9px 18px; border-radius: 999px; transition: all 0.18s;
}
.section-tab .si { font-size: 15px; opacity: 0.85; display: inline-flex; align-items: center; }
.section-tab .si svg { width: 15px; height: 15px; display: block; }
.section-tab:hover { color: var(--text); }
.section-tab.active {
  color: var(--bg); background: var(--accent);
  box-shadow: 0 0 18px rgba(var(--tint), 0.45);
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
/* project tabs = same pill style as the Social protocol pills, for coherence */
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-size: 13px; font-weight: 600;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}
.tab:hover { color: var(--text); border-color: #2f3650; }
.tab .glyph { width: 16px; height: 16px; display: inline-flex; }
.tab .glyph svg { width: 100%; height: 100%; display: block; }
.tab .glyph.logo-glyph img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.tab.active {
  color: var(--text); background: var(--card-2);
  border-color: rgba(var(--tint), .55);
  box-shadow: 0 0 16px rgba(var(--tint), .2);
}

/* ---------- Layout ---------- */
.grid { display: grid; grid-template-columns: 1fr 0.85fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }

.card {
  background:
    linear-gradient(180deg, rgba(var(--tint), 0.05), rgba(var(--tint), 0.015)),
    var(--card);
  border: 1px solid rgba(var(--tint), 0.16);
  border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset,
              0 18px 44px -30px rgba(0, 0, 0, 0.95);
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.card + .card { margin-top: 16px; }
.card h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); margin-bottom: 14px; display: flex;
  align-items: center; gap: 8px;
}
.card h3 .pill {
  margin-left: auto; font-size: 10.5px; text-transform: none; letter-spacing: 0;
  background: var(--card-2); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 20px; color: var(--text-faint); font-weight: 600;
}

.note {
  font-size: 12.5px; color: var(--text-dim); background: var(--bg-soft);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 16px;
}

/* ---------- Inputs ---------- */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--text); margin-bottom: 7px;
}
.field label .hint { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.input-row { display: flex; align-items: center; gap: 10px; }
.input-affix {
  position: relative; flex: 1; display: flex; align-items: center;
}
.input-affix .prefix, .input-affix .suffix {
  position: absolute; color: var(--text-faint); font-size: 13px; pointer-events: none;
}
.input-affix .prefix { left: 12px; }
.input-affix .suffix { right: 12px; }
.input-affix.has-prefix input { padding-left: 26px; }
.input-affix.has-suffix input { padding-right: 30px; }

input[type="number"], input[type="text"], select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 10px 12px;
  font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--tint), 0.18);
}
input[type="range"] {
  -webkit-appearance: none; width: 130px; height: 4px; border-radius: 4px;
  background: var(--border); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px rgba(124,92,255,0.6); cursor: pointer;
}

/* segmented toggle — fully rounded "pill" group, coherent with the other pills */
.seg { display: inline-flex; gap: 3px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.seg button {
  border: none; background: transparent; color: var(--text-dim);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--card-2); color: var(--text); box-shadow: 0 0 12px rgba(var(--tint), 0.18); }

/* Rankings toggles: standalone rounded pills (matching .tab), all equal width
   within each group. Grid with equal columns sizes every button to the widest. */
#metricToggle, #oiRange {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 8px; background: transparent; border: none; padding: 0;
}
#metricToggle button, #oiRange button {
  border: 1px solid var(--border); background: var(--card); text-align: center;
}
#metricToggle button:hover, #oiRange button:hover { border-color: #2f3650; }
#metricToggle button.active, #oiRange button.active { border-color: rgba(var(--tint), .55); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

details.adv { margin-top: 4px; }
details.adv summary {
  cursor: pointer; font-size: 13px; color: var(--text-dim); padding: 6px 0;
  user-select: none; list-style: none;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: "▸ "; color: var(--accent); }
details.adv[open] summary::before { content: "▾ "; }

/* ---------- Results ---------- */
.hero {
  background: linear-gradient(135deg, var(--card-2), var(--card));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; margin-bottom: 16px;
}
.hero-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stat { flex: 1; min-width: 130px; }
.hero-stat + .hero-stat { border-left: 1px solid var(--border); }
@media (max-width: 520px) { .hero-stat + .hero-stat { border-left: none; } }
.hero .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.hero .big {
  font-family: var(--mono);
  font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -1.2px; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  transition: background 0.3s;
}
.hero .sub { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px;
}
.stat .k { font-size: 11.5px; color: var(--text-dim); margin-bottom: 4px; }
.stat .v { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .v.green { color: var(--green); }
.stat .v.red { color: var(--red); }

/* scenario table */
table.scn { width: 100%; border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
table.scn th, table.scn td { padding: 9px 8px; text-align: right; font-size: 13px; }
table.scn td { font-family: var(--mono); letter-spacing: -0.4px; }
table.scn td:first-child { font-family: "Sora", sans-serif; letter-spacing: 0; }
table.scn th:first-child, table.scn td:first-child { text-align: left; color: var(--text-dim); }
table.scn thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); border-bottom: 1px solid var(--border); }
table.scn tbody tr + tr td { border-top: 1px solid var(--border); }
table.scn .col-bear { color: var(--red); }
table.scn .col-bull { color: var(--green); }
table.scn .row-strong td { font-weight: 700; }

.btn {
  background: var(--card-2); border: 1px solid var(--border); color: var(--text-dim);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn:hover { color: var(--text); border-color: #2f3650; }
.btn.danger:hover { color: var(--red); border-color: var(--red); }

/* ---------- Rankings ---------- */
.rank-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rank-meta { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.rank-meta .live { color: var(--green); }
.rank-meta .snap { color: var(--yellow); }
.rank-meta .upd { color: var(--text-faint); }

.rank-grid { display: grid; grid-template-columns: 1fr 0.62fr; gap: 18px; align-items: stretch; margin-bottom: 16px; }
.rank-grid > .card { display: flex; flex-direction: column; margin-top: 0; }
@media (max-width: 880px) { .rank-grid { grid-template-columns: 1fr; } }

/* horizontal bars */
.rank-bars { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; flex: 1; justify-content: flex-start; }
.rbar { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: center; }
.rbar .rk { font-family: var(--mono); font-size: 13px; color: var(--text-faint); text-align: right; }
.rbar .body { min-width: 0; }
.rbar .top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rbar .ico { width: 18px; height: 18px; border-radius: 5px; flex: none; background: var(--card-2); object-fit: cover; }
.rbar .nm { font-size: 13.5px; font-weight: 600; }
.rbar .val { margin-left: auto; font-family: var(--mono); font-size: 13.5px; font-weight: 700; letter-spacing: -0.4px; }
.rbar .track { height: 10px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--border); }
.rbar .fill { height: 100%; border-radius: 6px; width: 0; transition: width 0.6s cubic-bezier(.2,.7,.2,1); box-shadow: 0 0 12px -2px currentColor; }

/* donut */
.donut-card { display: flex; flex-direction: column; }
/* title stays at top; donut + legend are centered as a group in the rest */
.donut-wrap { position: relative; width: 205px; height: 205px; margin: 8px auto 14px; flex: none; }
.donut-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.donut-wrap circle {
  fill: none; stroke-width: 16; cursor: pointer;
  transition: stroke-dasharray 0.6s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}
.donut-wrap circle.hi { stroke-width: 23; }
.donut-wrap circle.dim { opacity: 0.28; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center .dc-val { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.donut-center .dc-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); }
.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; justify-content: space-between; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .li .pc { margin-left: auto; font-family: var(--mono); color: var(--text-dim); }

/* detail table */
table.rank-table { width: 100%; border-collapse: collapse; }
table.rank-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
table.rank-table th.num, table.rank-table td.num { text-align: right; }
table.rank-table th.c-rank, table.rank-table td.c-rank { text-align: center; width: 34px; }
table.rank-table td { padding: 11px 8px; font-size: 13.5px; border-top: 1px solid var(--border); }
table.rank-table tbody tr:first-child td { border-top: none; }
table.rank-table td.num { font-family: var(--mono); letter-spacing: -0.4px; }
table.rank-table .proto { display: flex; align-items: center; gap: 9px; font-weight: 600; }
table.rank-table .proto img { width: 20px; height: 20px; border-radius: 6px; background: var(--card-2); }
table.rank-table .rkn { font-family: var(--mono); color: var(--text-faint); }
/* grouped header over Δ1d / Δ7d / Share — labels which metric they refer to */
.rank-grouprow .group-empty { border-bottom: none; padding-bottom: 0; }
.rank-grouprow .group-label {
  text-align: center; color: var(--text-dim); font-weight: 700;
  padding-bottom: 4px; border-bottom: 1px solid rgba(var(--tint), 0.45);
}
.chg-up { color: var(--green); }
.chg-dn { color: var(--red); }
.chg-na { color: var(--text-faint); }
.vdot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 6px var(--green); }
.spark-cell { width: 92px; padding-top: 6px !important; padding-bottom: 6px !important; }
.spark { width: 80px; height: 22px; display: block; }
.spark-empty { color: var(--text-faint); font-family: var(--mono); }

/* OI history line chart widget */
.oi-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.oi-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.oi-legend .lg {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 12.5px; font-weight: 600;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
  user-select: none;
}
.oi-legend .lg .lgi { width: 15px; height: 15px; border-radius: 4px; flex: none; object-fit: cover; background: var(--card-2); }
.oi-legend .lg:hover { border-color: #2f3650; }
.oi-legend .lg.off { opacity: 0.4; }
.oi-chart-wrap { position: relative; margin-top: 6px; }
#oiChart { width: 100%; height: auto; display: block; overflow: visible; }
#oiChart .axis { stroke: var(--border); stroke-width: 1; }
#oiChart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.5; }
#oiChart .lbl { fill: var(--text-faint); font-family: var(--mono); font-size: 10px; }
#oiChart .ln { fill: none; stroke-width: 2; }
#oiChart .dot { stroke: var(--bg); stroke-width: 1.5; }
.oi-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; color: var(--text-dim); font-size: 13px; padding: 20px;
}
.oi-range button { padding: 5px 11px; font-size: 12px; }
#oiChart .hitbox { fill: transparent; }
#oiChart .cross { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.7; }
#oiChart .hdot { stroke: var(--bg); stroke-width: 1.5; }
.oi-tip {
  position: absolute; z-index: 8; pointer-events: none;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 150px;
  box-shadow: var(--shadow); font-size: 12px;
}
.oi-tip .tt { color: var(--text-dim); font-family: var(--mono); font-size: 11px; margin-bottom: 6px; }
.oi-tip .tr { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.oi-tip .tr .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.oi-tip .tr .tv { margin-left: auto; font-family: var(--mono); font-weight: 700; }
.prokey { margin-top: 4px; }
.prokey input { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Social ---------- */
.social-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.social-protos { display: flex; gap: 6px; flex-wrap: wrap; }
.social-protos .sp {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text-dim);
  cursor: pointer; font-size: 13px; font-weight: 600; transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}
.social-protos .sp .spg { width: 16px; height: 16px; display: inline-flex; }
.social-protos .sp .spg svg { width: 100%; height: 100%; display: block; }
.social-protos .sp:hover { color: var(--text); border-color: #2f3650; }
.social-protos .sp.active { color: var(--text); background: var(--card-2); border-color: rgba(var(--tint), .55); box-shadow: 0 0 16px rgba(var(--tint), .2); }
.social-note {
  font-size: 12px; color: var(--yellow); background: var(--bg-soft);
  border: 1px solid var(--border); border-left: 3px solid var(--yellow);
  padding: 9px 12px; border-radius: 8px; margin-bottom: 14px;
}
table.social-table { width: 100%; border-collapse: collapse; }
table.social-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
table.social-table th.num, table.social-table td.num { text-align: right; }
table.social-table th.c-rank, table.social-table td.c-rank { text-align: center; width: 34px; }
table.social-table td { padding: 11px 8px; font-size: 13.5px; border-top: 1px solid var(--border); }
table.social-table tbody tr:first-child td { border-top: none; }
table.social-table td.num { font-family: var(--mono); letter-spacing: -.4px; }
table.social-table .rkn { font-family: var(--mono); color: var(--text-faint); }
.su { display: flex; align-items: center; gap: 10px; }
.su .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #06070b; flex: none; text-transform: uppercase; }
.su .uh { font-weight: 600; }
.su .un { color: var(--text-faint); font-size: 12px; margin-left: 4px; }
table.social-table .eng { color: var(--green); font-weight: 700; }

/* big "coming soon" placeholder (line charts + social) */
.cs-big {
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(30px, 5.5vw, 56px);
  font-weight: 700; letter-spacing: 3px; text-transform: uppercase; text-align: center;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  opacity: 0.92;
}
.soon-screen { display: grid; place-items: center; min-height: 52vh; }

/* ranking bars: grow + highlight on hover (like the donut segments) */
.rbar { transition: transform .16s ease, opacity .16s ease; transform-origin: left center; }
.rank-bars:hover .rbar { opacity: 0.4; }
.rank-bars .rbar:hover { opacity: 1; transform: scale(1.04); }
.rbar .fill { transition: width 0.6s cubic-bezier(.2,.7,.2,1), box-shadow .16s ease; }
.rbar:hover .fill { box-shadow: 0 0 18px -1px currentColor; }

/* sortable detail-table headers */
th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
th.sortable:hover { color: var(--text-dim); }
.sort-ar { font-size: 9px; color: var(--accent); margin-left: 2px; }

footer.app { margin-top: 30px; font-size: 11.5px; color: var(--text-faint); text-align: center; }

/* always-on watermark — shows up in any screenshot of the page */
.watermark {
  position: fixed; right: 14px; bottom: 11px; z-index: 40;
  display: flex; align-items: center; gap: 6px;
  font-family: "Sora", sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--text); opacity: 0.32; pointer-events: none; user-select: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.watermark svg { width: 13px; height: 13px; fill: currentColor; }

/* ===================== FAVOURITES ===================== */
.fav-head { text-align: center; margin: 4px auto 22px; }
.fav-title {
  font-family: "Chakra Petch", sans-serif; font-size: 26px; font-weight: 700;
  letter-spacing: 0.5px; margin: 0; text-transform: uppercase;
  background: linear-gradient(90deg, #fff 0%, #cdd5e6 55%, #f5c451 120%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.fav-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--text-faint); }

.fav-list { list-style: none; margin: 0 auto; padding: 0; max-width: 720px; display: flex; flex-direction: column; gap: 12px; }
.fav-item {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.fav-item:hover { transform: translateY(-2px); border-color: rgba(var(--tint), .5); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
/* gold-tinted accent line down the left edge, brightest for the top ranks */
.fav-item::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 3px; background: rgba(255, 255, 255, 0.12);
}
.fav-item.rank-1::before { background: linear-gradient(180deg, #ffe39a, #f5c451); box-shadow: 0 0 12px rgba(245, 196, 81, 0.6); }
.fav-item.rank-2::before { background: linear-gradient(180deg, #e8edf7, #aab4cc); box-shadow: 0 0 10px rgba(200, 210, 230, 0.45); }
.fav-item.rank-3::before { background: linear-gradient(180deg, #e8b888, #c98a52); }

.fav-rank {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Martian Mono", monospace; font-size: 15px; font-weight: 700;
  color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border);
}
.fav-item.rank-1 .fav-rank { color: #1a1407; background: linear-gradient(180deg, #ffe39a, #f5c451); border-color: #f5c451; box-shadow: 0 0 14px rgba(245, 196, 81, 0.5); }
.fav-item.rank-2 .fav-rank { color: #11151f; background: linear-gradient(180deg, #eef2fa, #b7c1d8); border-color: #cdd5e6; }

.fav-logo {
  flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.fav-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fav-logo.glyph { color: #cfd6e6; }
.fav-logo.glyph svg { width: 60%; height: 60%; display: block; }

.fav-body { flex: 1; min-width: 0; }
.fav-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.fav-name { font-family: "Sora", sans-serif; font-size: 16px; font-weight: 600; color: var(--text); }
.fav-name-wrap { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; min-width: 0; }
/* small grey category label under the protocol name */
.fav-cat { font-size: 11.5px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-faint); }

.fav-rating { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.fav-stars { font-size: 14px; letter-spacing: 1px; line-height: 1; }
.fav-stars .st { color: #3a4256; }
.fav-stars .st.on { color: #f5c451; text-shadow: 0 0 8px rgba(245, 196, 81, 0.55); }
/* half star: left half gold, right half dim */
.fav-stars .st.half {
  background: linear-gradient(90deg, #f5c451 50%, #3a4256 50%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
/* initials fallback logo (protocols without a llamao icon, e.g. TrueNorth) */
.fav-logo.initials { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }

/* stage tag below the stars — uppercase, bold, colour-coded by farming timing */
.fav-stage {
  font-family: "Chakra Petch", sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: 1.4px; text-transform: uppercase; line-height: 1;
}
.stage-ultra  { color: #2ce6da; text-shadow: 0 0 9px rgba(44, 230, 218, 0.55); }
.stage-early  { color: #6bff78; text-shadow: 0 0 9px rgba(107, 255, 120, 0.60); }
.stage-ontime { color: #ffb057; text-shadow: 0 0 9px rgba(255, 176, 87, 0.50); }
.stage-late   { color: #ff626e; text-shadow: 0 0 9px rgba(255, 98, 110, 0.50); }

.fav-points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.fav-points li { position: relative; padding-left: 16px; font-size: 12.5px; color: var(--text-dim); }
.fav-points li::before {
  content: ""; position: absolute; left: 2px; top: 6px; width: 5px; height: 5px;
  border-radius: 1px; transform: rotate(45deg);
  background: var(--accent); box-shadow: 0 0 6px rgba(var(--tint), 0.7);
}

.fav-foot { text-align: center; margin: 18px 0 0; font-size: 11.5px; color: var(--text-faint); font-style: italic; }

/* "Start here" referral pill on the right of each card (same pill look as the
   .tab/section pills). Compact rows: it sits inline at the end of the item. */
.fav-cta {
  flex: none; margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text-dim); font-family: "Sora", sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}
/* grey border always; only the glow is tinted with the project's colour (--fc) */
.fav-cta { box-shadow: 0 0 9px -4px var(--fc, transparent); }
.fav-cta:hover { color: #fff; background: var(--card-2); box-shadow: 0 0 18px -2px var(--fc, transparent); }

/* ===================== TIER LIST ===================== */
.tier-head { text-align: center; margin: 4px auto 18px; }
.tier-title {
  font-family: "Chakra Petch", sans-serif; font-size: 26px; font-weight: 700; letter-spacing: 0.5px; margin: 0;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fff 0%, #cdd5e6 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tier-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--text-faint); }
.tier-reset { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.tier-share {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 9px 18px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: var(--bg);
  font-family: "Sora", sans-serif; font-size: 13px; font-weight: 700;
  box-shadow: 0 0 18px rgba(var(--tint), .35); transition: transform .12s, box-shadow .12s, opacity .12s;
}
.tier-share:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(var(--tint), .5); }
.tier-share:disabled { opacity: .6; cursor: default; transform: none; }
.tier-share svg { width: 15px; height: 15px; }

/* share preview modal */
.tier-modal {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(3, 5, 10, 0.82); backdrop-filter: blur(6px);
}
.tier-modal[hidden] { display: none; }
.tier-modal-inner {
  position: relative; width: min(760px, 100%); max-height: 92vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 14px;
}
.tier-modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text-dim);
  cursor: pointer; font-size: 13px; line-height: 1;
}
.tier-modal-close:hover { color: var(--text); border-color: #2f3650; }
.tier-modal-img { width: 100%; border-radius: 12px; border: 1px solid var(--border); display: block; }
.tier-modal-text {
  width: 100%; resize: vertical; min-height: 52px; box-sizing: border-box;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: "Sora", sans-serif; font-size: 13.5px; line-height: 1.45; padding: 10px 12px;
}
.tier-modal-text:focus { outline: none; border-color: rgba(var(--tint), .6); }
.tier-modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tier-modal-hint { margin: 2px 0 0; text-align: center; font-size: 11.5px; color: var(--text-faint); }
.tier-share.solid-x { background: #000; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); text-decoration: none; }
.tier-share.solid-x:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 0 18px rgba(255, 255, 255, .14); }

.tier-board { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: flex; gap: 8px; align-items: stretch; }
.tier-label {
  flex: none; width: 56px; display: grid; place-items: center; border-radius: 12px;
  font-family: "Chakra Petch", sans-serif; font-size: 23px; font-weight: 700;
  color: #14141c; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}
.tier-dropzone {
  flex: 1; min-height: 62px; display: flex; flex-wrap: wrap; gap: 8px; align-content: center;
  padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.tier-dropzone.drop-hover { border-color: rgba(var(--tint), .65); background: var(--card-2); }

.tier-pool-wrap { max-width: 840px; margin: 18px auto 0; }
.tier-pool-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--text-faint); margin: 0 0 8px 2px; }
.tier-pool {
  min-height: 62px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
  padding: 10px; border-radius: 12px; background: var(--bg-soft); border: 1px dashed var(--border);
  transition: border-color .15s, background .15s;
}
.tier-pool.drop-hover { border-color: rgba(var(--tint), .65); background: var(--card); }

.tier-chip {
  display: inline-flex; flex-direction: column; align-items: center; gap: 7px;
  width: 88px; padding: 11px 8px 9px; border-radius: 18px;
  background: var(--card-2); border: 1px solid var(--border); cursor: grab; user-select: none;
  font-family: "Sora", sans-serif; font-size: 10.5px; font-weight: 600; color: #fff;
  text-align: center; line-height: 1.2; text-transform: uppercase; letter-spacing: 0.4px;
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
/* fixed 2-line name area so every chip ends up the exact same size */
.tier-chip > span:last-child { display: flex; align-items: center; justify-content: center; height: 26px; }
.tier-chip:hover { border-color: #2f3650; box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4); color: #fff; transform: translateY(-1px); }
.tier-chip:active { cursor: grabbing; }
.tier-chip.dragging { opacity: .4; }
.tchip-ic { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--bg-soft); }
.tchip-ic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tchip-ic.glyph svg { width: 62%; height: 62%; display: block; }

/* clickable rankings (bars, donut legend, table rows) -> DEX / referral link */
.rbar { cursor: pointer; border-radius: 9px; transition: background .12s; }
.rbar:hover { background: rgba(255, 255, 255, 0.045); }
.legend .li { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; transition: background .12s; }
.legend .li:hover { background: rgba(255, 255, 255, 0.05); }
table.rank-table tbody tr { cursor: pointer; transition: background .12s; }
table.rank-table tbody tr:hover { background: rgba(255, 255, 255, 0.045); }

/* ===================== MOBILE / RESPONSIVE ===================== */
@media (max-width: 640px) {
  .wrap { padding: 16px 13px 60px; }
  .brand h1 { font-size: clamp(22px, 8vw, 32px); letter-spacing: 0.1em; }
  .brand .slogan { letter-spacing: 0.2em; }

  /* section nav: individual wrapping pills so all tabs stay visible (no overflow) */
  .sections {
    display: flex; flex-wrap: wrap; justify-content: center;
    width: 100%; gap: 7px; padding: 0; background: transparent; border: none; border-radius: 0;
  }
  .section-tab {
    padding: 8px 13px; font-size: 12.5px; gap: 7px;
    border: 1px solid var(--border); background: var(--card); color: var(--text-dim);
  }
  .section-tab.active { border-color: transparent; }

  /* rankings detail table -> horizontal scroll instead of overflowing the page */
  .rank-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rank-table-wrap table.rank-table { min-width: 600px; }

  .rank-head { gap: 8px; }
  .tier-modal { padding: 14px; }
  .tier-modal-inner { padding: 16px; }
}

@media (max-width: 430px) {
  .two-col { grid-template-columns: 1fr; gap: 10px; }
  .brand h1 { font-size: 22px; }

  /* favourites: let the CTA drop to its own full-width row so nothing overlaps */
  .fav-item { flex-wrap: wrap; gap: 11px; padding: 13px; }
  .fav-cta { position: static; width: 100%; margin-top: 8px; justify-content: center; }
}

/* touch tier picker (bottom sheet) */
.tier-sheet { position: fixed; inset: 0; z-index: 210; display: flex; align-items: flex-end; justify-content: center; background: rgba(3, 5, 10, 0.72); backdrop-filter: blur(4px); }
.tier-sheet[hidden] { display: none; }
.tier-sheet-card {
  width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 11px; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
}
.tier-sheet-title { font-family: "Sora", sans-serif; font-weight: 700; font-size: 15px; text-align: center; color: var(--text); }
.tier-sheet-tiers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tsh-tier {
  min-width: 52px; padding: 11px 15px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--text); font-family: "Chakra Petch", sans-serif;
  font-weight: 700; font-size: 16px; cursor: pointer;
}
.tsh-tier.on { border-color: var(--tc, var(--accent)); box-shadow: inset 0 0 0 2px var(--tc, var(--accent)); }
.tsh-un { font-family: "Sora", sans-serif; font-size: 13px; font-weight: 600; }
.tier-sheet-open, .tier-sheet-cancel {
  padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-2);
  color: var(--text-dim); font-family: "Sora", sans-serif; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.tier-sheet-open { color: var(--text); }
