:root {
  --bg: #0b0b0f;
  --surface: #141419;
  --surface-2: #1a1a21;
  --surface-3: #22222b;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #f7f8fa;
  --text-dim: #9b9ba7;
  --text-faint: #6a6a77;
  --accent: #3fff66;
  --accent-2: #2ce057;
  --accent-glow: rgba(63,255,102,0.16);
  --gold: #f5c451;
  --up: #35d07f;
  --down: #ff5c6c;
  --r: 20px;
  --r-md: 16px;
  --r-sm: 12px;
  --pill: 999px;
  --maxw: 1200px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --num: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(63,255,102,0.06), transparent 60%),
    radial-gradient(800px 500px at 88% -5%, rgba(80,120,255,0.05), transparent 55%);
  background-attachment: fixed;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,11,15,0.72);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: url("/assets/perpdexrank.png") center / cover no-repeat;
  font-size: 0; color: transparent;
}
.brand .tld { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a { color: var(--text-dim); font-weight: 500; font-size: .92rem; padding: 8px 14px; border-radius: var(--pill); transition: .15s; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-cta {
  background: var(--accent); color: #06210f !important; padding: 9px 18px !important;
  border-radius: var(--pill); font-weight: 600; margin-left: 6px;
}
.nav-cta:hover { background: #57ff7c !important; color: #06210f !important; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* ---------- Tabs (Uniswap explore style) ---------- */
.tabs { display: flex; gap: 4px; margin: 8px 0 22px; }
.tab {
  font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text-faint); padding: 4px 4px; margin-right: 18px; position: relative;
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px; background: var(--accent); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 26px; }
.hero.center { text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.hero h1 .hl { color: var(--accent); }
.hero p { color: var(--text-dim); font-size: 1.12rem; max-width: 640px; margin: 18px 0 0; }
.hero.center p { margin-left: auto; margin-right: auto; }
.updated { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: .84rem; color: var(--text-faint); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-glow); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,255,102,.5);} 70% { box-shadow: 0 0 0 9px rgba(63,255,102,0);} 100% { box-shadow: 0 0 0 0 rgba(63,255,102,0);} }

/* ---------- Filter row ---------- */
.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--pill); padding: 3px; }
.seg-btn { font-size: .82rem; font-weight: 600; color: var(--text-dim); padding: 6px 14px; border-radius: var(--pill); cursor: pointer; border: 0; background: none; }
.seg-btn.active { background: var(--surface-3); color: var(--text); }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--pill); padding: 7px 14px; font-size: .85rem; font-weight: 500; color: var(--text-dim); }
.filter-spacer { flex: 1; }
.search-box { min-width: 220px; }
.search-box input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: var(--pill); font-size: .9rem; font-family: var(--font);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus { outline: none; border-color: var(--border-strong); background: var(--surface-2); }

/* ---------- Stat strip ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; }
.stat-card .label { color: var(--text-faint); font-size: .78rem; font-weight: 500; }
.stat-card .value { font-size: 1.5rem; font-weight: 650; margin-top: 6px; letter-spacing: -0.02em; }

/* ---------- Featured / Community Choice ---------- */
.featured {
  background: linear-gradient(120deg, rgba(63,255,102,.09), rgba(63,255,102,.02) 55%);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 24px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.featured .rank-badge { font-size: 2.4rem; font-weight: 700; color: var(--gold); letter-spacing: -0.03em; line-height: 1; flex-shrink: 0; }
.featured .f-logo { flex-shrink: 0; }
.featured .f-body { flex: 1 1 260px; min-width: 0; }
.featured .f-cta { flex-shrink: 0; }
.f-logo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); }
.featured .f-body h2 { font-size: 1.4rem; font-weight: 650; letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.featured .f-body p { color: var(--text-dim); margin-top: 6px; max-width: 640px; font-size: .96rem; }
.f-cta { display: flex; flex-direction: column; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 5px 11px; border-radius: var(--pill);
  background: rgba(245,196,81,.14); color: var(--gold); border: 1px solid rgba(245,196,81,.32);
}
.btn { display: inline-block; text-align: center; padding: 11px 22px; border-radius: var(--pill); font-weight: 600; transition: .15s; font-size: .95rem; }
.btn-primary { background: var(--accent); color: #06210f; }
.btn-primary:hover { background: #57ff7c; color: #06210f; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Ranking table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; flex-wrap: wrap; }
.table-tools h2 { font-size: 1.05rem; font-weight: 600; }
.table-scroll { overflow-x: auto; }
table.rank { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 920px; }
table.rank thead th {
  text-align: right; padding: 11px 16px; color: var(--text-faint); font-size: .8rem; font-weight: 500;
  white-space: nowrap; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; background: var(--bg);
}
table.rank thead th:first-child, table.rank thead th.left { text-align: left; }
table.rank thead th.sortable:hover { color: var(--text-dim); }
table.rank thead th.sort-asc, table.rank thead th.sort-desc { color: var(--text); }
table.rank thead th.sort-asc::after { content: " ↑"; color: var(--accent); }
table.rank thead th.sort-desc::after { content: " ↓"; color: var(--accent); }
table.rank tbody td { padding: 14px 16px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.rank tbody td.left { text-align: left; }
table.rank tbody tr:last-child td { border-bottom: 0; }
table.rank tbody tr { transition: background .12s; }
table.rank tbody tr:hover { background: var(--surface-2); }
table.rank tbody tr.pinned { background: linear-gradient(90deg, rgba(63,255,102,.06), transparent 55%); }
table.rank tbody tr.pinned:hover { background: linear-gradient(90deg, rgba(63,255,102,.1), transparent 55%); }
.rank-num { color: var(--text-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-num.gold { color: var(--gold); }
.ex-cell { display: flex; align-items: center; gap: 12px; }
a.ex-cell { text-decoration: none; }
a.ex-cell:hover { text-decoration: none; }
a.ex-cell:hover .ex-name { color: var(--accent); }
a.ex-cell:hover .ex-logo { border-color: var(--accent); }
.ex-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; }
.ex-name { font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.ex-name .sub { display: block; color: var(--text-faint); font-size: .78rem; font-weight: 400; letter-spacing: 0; }
.tag { display: inline-block; font-size: .74rem; font-weight: 500; padding: 4px 10px; border-radius: var(--pill); background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.tag.gold { background: rgba(245,196,81,.14); color: var(--gold); border-color: rgba(245,196,81,.32); }
.badge-mini { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--gold); display: inline-flex; align-items: center; gap: 4px; }
.mirror { color: var(--text-faint); font-size: .74rem; font-weight: 400; }
.pos { color: var(--up); } .neg { color: var(--down); }
.disclaimer { font-size: .8rem; color: var(--text-faint); padding: 16px 20px; border-top: 1px solid var(--border); }

/* ---------- Sections ---------- */
section.block { padding: 46px 0; }
section.block h2.section-title { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; }
section.block > .container > p.lead, .lead { color: var(--text-dim); max-width: 760px; margin-top: 10px; font-size: 1.05rem; }

/* ---------- Tier list ---------- */
.tier-row { display: grid; grid-template-columns: 92px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px; background: var(--surface); }
.tier-label { display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; color: #06210f; }
.tier-S { background: linear-gradient(135deg, #ffd76a, #f5a63d); }
.tier-A { background: linear-gradient(135deg, #4dff7a, #21c26a); }
.tier-B { background: linear-gradient(135deg, #57b0ff, #3a72e0); }
.tier-C { background: linear-gradient(135deg, #b98bff, #7d4fe0); color: #fff; }
.tier-D { background: linear-gradient(135deg, #8a94a8, #5a6478); color: #fff; }
.tier-items { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; align-items: center; }
.tier-pill { display: inline-flex; align-items: center; gap: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--pill); padding: 6px 15px 6px 6px; font-weight: 500; font-size: .9rem; }
.tier-pill .ex-logo { width: 26px; height: 26px; }
.tier-pill.star { border-color: rgba(245,196,81,.45); background: rgba(245,196,81,.1); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 22px; transition: .15s; display: block; }
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card h3 { font-size: 1.12rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.card p { color: var(--text-dim); margin-top: 8px; font-size: .93rem; }
.card .arrow { color: var(--accent); font-weight: 600; margin-top: 12px; display: inline-block; font-size: .9rem; }
.card ul { margin: 12px 0 0 18px; color: var(--text-dim); font-size: .93rem; }
.card li { margin-bottom: 7px; }
.vs-pill-logos { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.vs-pill-logos .ex-logo { width: 30px; height: 30px; }
.vs-pill-logos span { color: var(--text-faint); font-size: .8rem; font-weight: 600; }

/* ---------- Comparison page ---------- */
.vs-hero { text-align: center; padding: 46px 0 26px; }
.vs-logos { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 20px; }
.vs-logos .f-logo, .vs-logos .ex-logo { width: 68px; height: 68px; }
.vs-mid { font-weight: 700; color: var(--text-faint); font-size: 1.1rem; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.compare-table th, .compare-table td { padding: 15px 18px; border-bottom: 1px solid var(--border); text-align: left; font-size: .93rem; }
.compare-table thead th { font-size: .82rem; font-weight: 600; color: var(--text-dim); background: var(--bg); }
.compare-table thead th.win { color: var(--accent); }
.compare-table td.feature { color: var(--text-dim); font-weight: 500; }
.compare-table tr:last-child td { border-bottom: 0; }
.compare-table .yes { color: var(--up); font-weight: 600; }
.compare-table .no { color: var(--down); font-weight: 600; }
.col-highlight { background: rgba(63,255,102,.05); }

/* ---------- FAQ ---------- */
.faq-item { border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 10px; background: var(--surface); overflow: hidden; }
.faq-item summary { padding: 16px 18px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 400; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-body { padding: 0 18px 18px; color: var(--text-dim); }

/* ---------- Prose ---------- */
.prose { max-width: 760px; }
.prose p { color: var(--text-dim); margin-bottom: 16px; }
.prose h2 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; margin: 32px 0 12px; color: var(--text); }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
.prose ul { color: var(--text-dim); margin: 0 0 16px 22px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text); }

/* ---------- CTA banner ---------- */
.cta-banner { background: linear-gradient(120deg, rgba(63,255,102,.1), rgba(63,255,102,.02) 60%); border: 1px solid var(--border); border-radius: var(--r); padding: 40px; text-align: center; margin: 20px 0; }
.cta-banner h2 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; }
.cta-banner p { color: var(--text-dim); margin: 12px auto 22px; max-width: 560px; }

/* ---------- Breadcrumb ---------- */
.crumbs { font-size: .85rem; color: var(--text-faint); padding: 20px 0 0; }
.crumbs a { color: var(--text-dim); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 44px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; gap: 28px; }
.footer-grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 14px; font-weight: 600; }
.footer-grid a { display: block; color: var(--text-dim); font-size: .9rem; margin-bottom: 9px; }
.footer-grid a:hover { color: var(--accent); }
.footer-brand p { color: var(--text-faint); font-size: .88rem; margin-top: 12px; max-width: 300px; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px; color: var(--text-faint); font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { position: fixed; inset: 68px 0 auto 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 20px; gap: 6px; align-items: stretch; display: none; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: auto 1fr; }
  .featured .rank-badge { display: none; }
  .f-cta { grid-column: 1 / -1; flex-direction: row; }
  .f-cta .btn { flex: 1; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .featured { grid-template-columns: 1fr; text-align: center; }
  .featured .ex-cell, .featured .f-logo { margin: 0 auto; }
}
