/* ── FLR Distribution (Deep Sea Rich List) ───────────────────── */
#richlist {
  background:
    radial-gradient(ellipse 900px 500px at 20% 0%, rgba(253,193,52,0.06), transparent 60%),
    radial-gradient(ellipse 800px 600px at 80% 100%, rgba(46,196,182,0.05), transparent 60%),
    #040608;
  position: relative;
  overflow: hidden;
}
#richlist::before {
  /* Subtle caustic light ripples */
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(105deg, transparent 0 80px, rgba(253,193,52,0.012) 80px 82px),
    repeating-linear-gradient(75deg, transparent 0 120px, rgba(46,196,182,0.012) 120px 122px);
  pointer-events: none;
}

.rl-card {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
}
.rl-loading {
  text-align: center;
  padding: 60px 0;
  color: var(--pk-text-muted);
}
.rl-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--pk-text-muted);
}
.rl-empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── HERO ──────────────────────────────────────── */
.rl-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 36px;
  align-items: end;
  padding: 0 8px 32px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.rl-hero-eyebrow {
  font-family: "Courier New", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--pk-gold);
  margin-bottom: 10px;
}
.rl-hero-title {
  font-family: "Raleway", sans-serif;
  font-size: 44px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin: 0 0 14px;
  letter-spacing: -1px;
}
.rl-hero-title span {
  background: linear-gradient(120deg, var(--pk-gold) 20%, #fde38b 50%, var(--pk-gold) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
}
.rl-hero-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--pk-text-muted);
  max-width: 480px;
  margin: 0;
}
.rl-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, auto));
  gap: 18px;
  text-align: right;
}
.rl-stat {
  padding-left: 18px;
  border-left: 1px solid rgba(255,255,255,0.1);
}
.rl-stat-num {
  font-family: "Raleway", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.rl-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--pk-text-muted);
}
.rl-stat-accent .rl-stat-num {
  color: var(--pk-gold);
  text-shadow: 0 0 20px rgba(253,193,52,0.4);
}

/* ── Percentile thresholds panel ───────────────── */
.rl-thresholds {
  margin: 0 0 20px;
  padding: 22px 24px;
  background: linear-gradient(180deg, #0e1114 0%, #0a0d10 100%);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.rl-thresh-head {
  font-family: "Raleway", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--pk-text-muted);
  margin-bottom: 14px;
}
.rl-thresh-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.rl-thresh {
  padding: 16px 18px;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.05);
  border-left: 2px solid var(--tier-accent);
  border-radius: 8px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.rl-thresh:hover {
  background: rgba(255,255,255,0.035);
  border-color: rgba(255,255,255,0.08);
  border-left-color: var(--tier-accent);
}
.rl-thresh-pct {
  font-family: "Raleway", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--pk-text-muted);
  margin-bottom: 6px;
}
.rl-thresh-val {
  font-family: "Raleway", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}
.rl-thresh-tier {
  font-size: 11px;
  color: var(--tier-accent);
  font-weight: 600;
}
@media (max-width: 768px) {
  .rl-thresh-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .rl-thresholds { padding: 16px; }
  .rl-thresh { padding: 12px 14px; }
  .rl-thresh-val { font-size: 17px; }
}

/* ── TABLE ─────────────────────────────────────── */
.rl-table-wrap {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #0e1114 0%, #0a0d10 100%);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.rl-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Raleway", sans-serif;
  font-size: 13px;
  color: #e8ecf1;
}
.rl-table thead th {
  background: rgba(6,8,10,0.85);
  padding: 16px 18px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--pk-text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.rl-table thead th.rl-th-num { text-align: right; }
.rl-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}
.rl-table tbody tr:last-child td { border-bottom: none; }

.rl-row {
  opacity: 0;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.rl-row-ready {
  animation: rlRowIn 0.5s ease forwards;
}
@keyframes rlRowIn {
  to { opacity: 1; }
}
/* Hover only on devices with a real pointer. Touch devices otherwise
   get "sticky hover" where the last tapped row stays visually
   highlighted until another tap clears it. */
@media (hover: hover) {
  .rl-row:hover {
    background: rgba(255,255,255,0.02);
  }
  .rl-row:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--tier-accent);
  }
}

.rl-td-rank {
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--pk-text-muted);
  width: 36px;
  text-align: center;
}
.rl-td-tier {
  min-width: 220px;
  vertical-align: middle;
}
.rl-td-text {
  display: inline-block;
  vertical-align: middle;
  margin-left: 14px;
  line-height: 1.2;
}
.rl-td-text .rl-td-name { display: block; margin-left: 0; }
.rl-td-subrange {
  display: none;              /* desktop: hidden, shown on mobile */
  margin-top: 3px;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 10px;
  color: var(--pk-text-muted);
  letter-spacing: 0.2px;
}
.rl-td-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  vertical-align: middle;
  color: var(--tier-accent);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--tier-accent) 40%, transparent));
}
.rl-td-name { vertical-align: middle; display: inline-block; }
.rl-td-icon .rl-icon-svg {
  width: 38px;
  height: 38px;
  filter: none;
  color: inherit;
}
.rl-td-icon .rl-emoji {
  font-size: 32px;
  filter: none;
}
.rl-td-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: #fff;
}
.rl-th-range,
.rl-td-range {
  width: 150px;
}
.rl-td-range {
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  color: var(--pk-text-muted);
  background: rgba(0,0,0,0.25);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

/* User's own tier: fill the range pill from the left up to where the
   user sits within the bucket (0–100%). The --rl-fill custom property
   is set inline by the highlight code. */
.rl-row-mine .rl-td-range {
  position: relative;
  background: #05070a !important;
  border-color: var(--tier-accent) !important;
  border-radius: 3px !important;
  color: #fff3c4 !important;
  overflow: hidden;
  isolation: isolate;
}
.rl-row-mine .rl-td-range::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--rl-fill, 0%);
  background: var(--tier-accent);
  z-index: -1;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rl-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.rl-td-flr {
  color: #fff;
  font-weight: 600;
}
.rl-td-pct {
  color: var(--pk-gold);
  font-weight: 600;
}
.rl-dim {
  color: var(--pk-text-muted);
  opacity: 0.4;
}

.rl-delta {
  display: inline-block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rl-delta-up { color: #2ec4b6; }
.rl-delta-down { color: #ff5576; }
.rl-delta-none { color: var(--pk-text-muted); opacity: 0.4; }

/* ── Top tier (#1 Kraken) ──────────────────────────
   All text in pk-gold. Skipped when the row is ALSO the user's own
   highlight (rl-row-mine) — in that case the treasure/range rules
   take over and the text inverts to readable cream/gold-on-gold. */
.rl-row-top:not(.rl-row-mine) td,
.rl-row-top:not(.rl-row-mine) .rl-td-name,
.rl-row-top:not(.rl-row-mine) .rl-td-subrange,
.rl-row-top:not(.rl-row-mine) .rl-td-rank,
.rl-row-top:not(.rl-row-mine) .rl-td-range,
.rl-row-top:not(.rl-row-mine) .rl-td-num,
.rl-row-top:not(.rl-row-mine) .rl-td-flr,
.rl-row-top:not(.rl-row-mine) .rl-td-pct {
  color: var(--pk-gold);
}
.rl-row-top:not(.rl-row-mine) .rl-td-icon {
  filter: drop-shadow(0 0 8px rgba(253, 193, 52, 0.45));
}

/* ── Footer ────────────────────────────────────── */
.rl-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  padding: 16px 20px;
  font-size: 11px;
  color: var(--pk-text-muted);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.rl-footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ec4b6;
  box-shadow: 0 0 8px #2ec4b6;
  animation: rlPulse 2s ease-in-out infinite;
}
@keyframes rlPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.rl-footer a {
  color: var(--pk-gold);
  text-decoration: none;
  font-weight: 600;
}
.rl-footer a:hover { text-decoration: underline; }
.rl-footer-note {
  text-align: center;
  font-size: 10px;
  color: var(--pk-text-muted);
  opacity: 0.7;
  padding: 6px 20px 0;
  font-style: italic;
}

/* ── Responsive ────────────────────────────────── */
/* Tablet / landscape mobile — hide 1d/7d/30d deltas.
   Breakpoint 900px covers phone-landscape (≈844px) so the table
   compacts before it can overflow the rounded wrapper. */
@media (max-width: 900px) {
  .rl-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 0 4px 24px;
  }
  .rl-hero-title { font-size: 32px; }
  .rl-hero-stats {
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
    gap: 12px;
  }
  .rl-stat {
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.1);
  }
  .rl-stat-num { font-size: 18px; }

  .rl-hide-md { display: none; }

  .rl-table { font-size: 12px; }
  .rl-table thead th { padding: 12px 12px; font-size: 9px; letter-spacing: 1.1px; }
  .rl-table tbody td { padding: 12px 12px; }
  .rl-td-tier { min-width: 160px; }
  .rl-td-icon { width: 36px; height: 36px; }
  .rl-td-icon .rl-icon-svg { width: 32px; height: 32px; }
  .rl-td-name { font-size: 13px; }
  .rl-td-range { font-size: 10px; padding: 3px 8px; }
}

/* Mobile — hide Range column (moves under Tier name), Contracts, Total FLR.
   Visible: # · Tier (with range subtitle) · Holders · Top % */
@media (max-width: 560px) {
  .rl-hide-sm { display: none; }

  .rl-td-subrange { display: block; }     /* unveil the inline range */

  .rl-table { font-size: 11px; }
  .rl-table thead th { padding: 11px 8px; font-size: 8px; letter-spacing: 0.9px; }
  .rl-table tbody td { padding: 11px 8px; vertical-align: middle; }

  .rl-td-rank { width: 22px; font-size: 12px; }
  .rl-td-tier { min-width: 0; }
  .rl-td-text { margin-left: 10px; }
  .rl-td-icon {
    width: 30px;
    height: 30px;
    /* Drop the expensive outer glow on tiny screens — each row repaints on scroll. */
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tier-accent) 35%, transparent));
  }
  .rl-td-icon .rl-icon-svg { width: 26px; height: 26px; }
  .rl-td-name { font-size: 12px; letter-spacing: -0.1px; }
  .rl-td-subrange { font-size: 9px; }
}

/* Narrow phones — drop the rank number entirely, keep 3 cols:
   Tier (with range) · Holders · Top %. */
@media (max-width: 400px) {
  .rl-th-rank, .rl-td-rank { display: none; }
  .rl-table thead th,
  .rl-table tbody td { padding: 10px 6px; }
  .rl-td-text { margin-left: 8px; }
}

/* ── Your Tier: glowing treasure highlight ──────────────────── */
/* When the connected wallet's FLR+WFLR+sFLR total lands this row,
   we mark it with .rl-row-mine. Overrides the tier-accent stripe
   with a gold shimmer and adds a pulsing radial glow. */
.rl-row-mine,
.rl-row-mine:hover {
  position: relative;
  opacity: 1 !important;
  background: rgba(253, 193, 52, 0.06) !important;
  box-shadow:
    inset 0 0 0 1px rgba(253, 193, 52, 0.55),
    0 0 0 1px rgba(253, 193, 52, 0.35),
    0 0 22px rgba(253, 193, 52, 0.28);
  /* Run the treasure pulse in parallel with the row-in fade. Without
     re-declaring rlRowIn here the CSS animation shorthand would
     replace it and the row would stay at opacity:0 from .rl-row. */
  animation:
    rlRowIn 0.5s ease forwards,
    rlTreasurePulse 3.6s ease-in-out infinite;
  z-index: 1;
}
.rl-row-mine td {
  color: #fff6d8;
}
.rl-row-mine .rl-td-name,
.rl-row-mine .rl-td-pct,
.rl-row-mine .rl-td-flr {
  color: var(--pk-gold);
  text-shadow: 0 0 12px rgba(253, 193, 52, 0.55);
}
.rl-row-mine .rl-td-subrange {
  color: rgba(253, 193, 52, 0.75);
}
.rl-row-mine td:first-child {
  box-shadow: inset 4px 0 0 var(--pk-gold) !important;
}
.rl-row-mine .rl-td-icon {
  /* Only a single tight glow — stacking two drop-shadows makes the
     SVG look soft/smudged instead of crisp. */
  filter: drop-shadow(0 0 6px rgba(253, 193, 52, 0.75));
}

@keyframes rlTreasurePulse {
  0%, 100% {
    box-shadow:
      inset 0 0 0 1px rgba(253, 193, 52, 0.55),
      0 0 0 1px rgba(253, 193, 52, 0.35),
      0 0 22px rgba(253, 193, 52, 0.28);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px rgba(253, 193, 52, 0.85),
      0 0 0 1px rgba(253, 193, 52, 0.55),
      0 0 34px rgba(253, 193, 52, 0.5);
  }
}

/* "You" badge pinned next to the tier name */
.rl-you-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 3px 10px 3px 9px;
  font-family: "Raleway", sans-serif;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: #1a1205;
  background: linear-gradient(135deg, #fff0b8 0%, #fdc134 45%, #d99200 100%);
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(255, 240, 180, 0.6),
    0 0 14px rgba(253, 193, 52, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(120, 70, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  vertical-align: middle;
  animation: rlBadgeFloat 3.2s ease-in-out infinite;
}
.rl-you-badge .bi {
  font-size: 11px;
  line-height: 1;
}
@keyframes rlBadgeFloat {
  0%, 100% { transform: translateY(0); box-shadow:
    0 0 0 1px rgba(255, 240, 180, 0.6),
    0 0 14px rgba(253, 193, 52, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(120, 70, 0, 0.35); }
  50%      { transform: translateY(-1px); box-shadow:
    0 0 0 1px rgba(255, 240, 180, 0.9),
    0 0 22px rgba(253, 193, 52, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(120, 70, 0, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  .rl-row-mine { animation: none; }
  .rl-row-mine::after { animation: none; display: none; }
  .rl-you-badge { animation: none; }
}
