/* earn tab: styles only this tab uses. Shared tokens and components live in app.css
   (.tbl, .tag, .lbl, .btn, .err-box, .skel come from there).

   Layout: one centred column that scrolls, not panes edge to edge. Header,
   totals, the cycle bar, three cards (SOL earned | payout | HUSK held), the
   payout list, the pool. On a phone the cards stack, payout first.
   States, set on the section by screens/earn.js:
     (none)    loading: loading bars
     .is-live  live
     .is-pre   token not launched
     .is-down  the Earn service did not answer */

.v-earn.is-on { display: block; overflow-y: auto; overflow-x: hidden; background: var(--ink-0); scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.v-earn::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 420px; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 79, 24, .07), transparent 70%);
}
.e-page { position: relative; max-width: 1180px; margin: 0 auto; padding: 36px 24px 56px; display: flex; flex-direction: column; gap: 18px; }

/* ── header ───────────────────────────────────── */
.e-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-bottom: 6px; }
.e-mark { width: 52px; height: 52px; fill: var(--paper); margin-bottom: 4px; }
.e-head h1 { font-size: 34px; font-weight: 800; font-stretch: 87.5%; letter-spacing: -.02em; color: var(--paper); line-height: 1.05; }
.e-sub { font-size: 16px; color: var(--mute); max-width: 520px; }
.e-state:empty { display: none; }
.e-state .tag { font-size: 12px; }

/* ── totals and the cycle bar ─────────────────── */
.e-sum { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 6px; }
.e-figs { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.e-fig { display: inline-flex; align-items: center; gap: 8px; }
.e-fig b { font-size: 26px; font-weight: 800; font-stretch: 87.5%; letter-spacing: -.02em; color: var(--paper); line-height: 1; }
.e-fig > span { font-size: 15px; color: var(--mute); font-weight: 600; }
.e-sol { width: 22px; height: 22px; border-radius: 50%; }
.e-mint { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--mute); }
.e-mint span { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; color: var(--dim); }
.e-mint .ic { width: 14px; height: 14px; }
.e-mint:hover, .e-mint:hover span { color: var(--paper); }

.e-cycle { display: flex; flex-direction: column; gap: 10px; }
.e-cycle-t { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text); }
.e-cycle-t b { color: var(--paper); font-variant-numeric: tabular-nums; }
.e-cycle-r { margin-left: auto; color: var(--dim); font-size: 14px; }
.e-bar { height: 6px; border-radius: 3px; background: var(--ink-3); overflow: hidden; }
.e-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--orange); transition: width 1s linear; }
.v-earn.is-pre .e-bar i { background: var(--line-3); }

.e-page > .err-box { margin: 0; }

/* ── cards ─────────────────────────────────────── */
.e-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 6px; }
.e-card { background: var(--ink-1); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.e-card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.e-card-h h2 { font-size: 16px; font-weight: 700; color: var(--paper); }
.e-card-h .meta { margin-left: auto; font-size: 13px; color: var(--dim); white-space: nowrap; }
.e-grid .e-card { min-height: 340px; }

/* SOL earned: a cumulative line, axis on the left */
.e-plot { position: relative; flex: none; height: 214px; margin: 16px 18px 0 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.e-ay { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-right: 10px; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.e-ay:empty { visibility: hidden; }
.e-svg { width: 100%; height: 100%; display: block; }
.e-svg .grid-l { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.e-empty { position: absolute; inset: 0 0 0 64px; display: grid; place-items: center; font-size: 14px; color: var(--dim); text-align: center; padding: 0 12px; }
.e-empty:empty { display: none; }
.e-empty::before { content: ""; position: absolute; left: 0; right: 0; bottom: 18px; border-top: 1px dashed var(--line-3); }
.e-ax { display: flex; justify-content: space-between; gap: 8px; padding: 8px 18px 14px 82px; font-size: 12px; color: var(--dim); white-space: nowrap; min-height: 34px; }

/* payout: the middle card, the one with the button */
.e-claim { border-color: var(--line-2); background:
  radial-gradient(circle, rgba(255,255,255,.045) 1px, transparent 1.2px) 0 0 / 16px 16px,
  var(--ink-1); }
.e-claim-b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; text-align: center; }
.e-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.e-pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px 10px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--ink-0); max-width: 100%; }
.e-pill img { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.e-pill b { font-size: 30px; font-weight: 800; font-stretch: 87.5%; letter-spacing: -.02em; color: var(--paper); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-pill b .unit { font-size: 15px; font-weight: 700; color: var(--mute); margin-left: 5px; letter-spacing: 0; }
.e-pill.is-up { border-color: rgba(74, 222, 128, .45); }
.e-pill.is-up b { color: var(--green); }
.e-pill.is-zero b { color: var(--dim); }
.e-pill-sm { padding: 7px 14px 7px 9px; }
.e-pill-sm img { width: 20px; height: 20px; }
.e-pill-sm b { font-size: 18px; color: var(--text); }
.e-pill-l { font-size: 13px; font-weight: 600; color: var(--dim); }
.e-est-s { font-size: 14px; color: var(--mute); max-width: 280px; }
.e-claim-f { display: flex; flex-direction: column; gap: 10px; padding: 0 18px 18px; }
.e-to { font-size: 13px; color: var(--dim); text-align: center; }
.e-to span { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; color: var(--mute); }
.e-go { width: 100%; height: 46px; border-radius: 10px; font-size: 16px; justify-content: center; }
.e-go.is-off { background: var(--ink-3); border-color: var(--line-2); color: var(--paper); font-weight: 650; }
.e-go.is-off:hover { background: var(--ink-4); border-color: var(--line-3); }
.e-go:disabled { opacity: 1; background: var(--ink-3); border-color: var(--line-2); color: var(--dim); cursor: not-allowed; }
.e-go.is-busy { color: var(--paper); }
.e-err { font-size: 14px; color: var(--red); text-align: center; }

/* HUSK held */
.e-held-b { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 8px; min-width: 0; }
.e-big { font-size: 34px; font-weight: 800; font-stretch: 87.5%; letter-spacing: -.02em; color: var(--paper); line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-big .unit { font-size: 16px; font-weight: 700; color: var(--mute); margin-left: 6px; letter-spacing: 0; }
.e-big .dim { color: var(--dim); }
.e-held-s { font-size: 14px; color: var(--mute); }
.e-kv { margin-top: auto; padding: 4px 18px 14px; }
.e-kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.e-kv dt { color: var(--dim); }
.e-kv dd { color: var(--paper); font-weight: 650; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-kv dd .dim { color: var(--dim); font-weight: 600; }
.e-warn { margin: 0 18px 16px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(232,197,71,.35); background: rgba(232,197,71,.07); color: var(--text); font-size: 14px; }
.e-warn p.act { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.e-warn .btn { margin-left: auto; }

/* payout list */
.e-act-b { padding: 8px 0 4px; max-height: 420px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.e-act .tbl th:first-child, .e-act .tbl td:first-child { padding-left: 18px; }
.e-act .tbl th:last-child, .e-act .tbl td:last-child { padding-right: 18px; text-align: right; }
.e-act .tbl thead th { background: var(--ink-1); }
.e-act .tbl .tx { justify-content: flex-end; }
.e-act .err-box { margin: 12px 18px; }
.e-none { padding: 14px 18px 16px; font-size: 15px; color: var(--mute); }

/* pool, with the rules under it */
.e-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.e-facts > div { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.e-facts > div + div { border-left: 1px solid var(--line); }
.e-facts .v { font-size: 21px; font-weight: 700; font-stretch: 87.5%; letter-spacing: -.02em; line-height: 1.1; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-facts .v .unit { font-size: 13px; color: var(--mute); margin-left: 4px; letter-spacing: 0; }
.e-rules { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 12px 18px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--dim); }
.e-rules li { position: relative; padding-left: 12px; }
.e-rules li::before { content: ""; position: absolute; left: 0; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: var(--line-3); }

/* the service is down: header, the error, the rules */
.v-earn.is-down .e-sum, .v-earn.is-down .e-cycle, .v-earn.is-down .e-grid, .v-earn.is-down .e-act, .v-earn.is-down .e-facts { display: none; }
.v-earn.is-down .e-page > .err-box { justify-content: center; }

/* entrance: the cards rise in, one after another */
.v-earn.is-enter > * { animation: none; }
.v-earn.is-enter .e-page > * { animation: paneIn .44s var(--ease-out) both; }
.v-earn.is-enter .e-page > *:nth-child(2) { animation-delay: 40ms; }
.v-earn.is-enter .e-page > *:nth-child(3) { animation-delay: 70ms; }
.v-earn.is-enter .e-page > *:nth-child(n+4) { animation-delay: 100ms; }
.v-earn.is-enter .e-grid > .e-card { animation: paneIn .5s var(--ease-out) both; }
.v-earn.is-enter .e-grid > .e-card:nth-child(2) { animation-delay: 60ms; }
.v-earn.is-enter .e-grid > .e-card:nth-child(3) { animation-delay: 120ms; }
@media (prefers-reduced-motion: reduce) {
  .v-earn.is-enter .e-page > *, .v-earn.is-enter .e-grid > .e-card { animation: none; }
  .e-bar i { transition: none; }
}

/* ── laptop ───────────────────────────────────── */
@media (max-width: 1199px) {
  .e-pill b { font-size: 26px; }
  .e-big { font-size: 28px; }
  .e-facts .v { font-size: 19px; }
}

/* ── tablet: payout and held side by side, the chart under ── */
@media (max-width: 999px) {
  .e-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-chart { grid-column: 1 / -1; order: 3; }
  .e-grid .e-chart { min-height: 260px; }
}

/* ── phone: one column, payout first ──────────── */
@media (max-width: 767px) {
  .e-page { padding: 22px 16px 40px; gap: 14px; }
  .e-mark { width: 40px; height: 40px; }
  .e-head h1 { font-size: 28px; }
  .e-sub { font-size: 15px; }
  .e-figs { gap: 18px; }
  .e-fig b { font-size: 22px; }
  .e-mint { margin-left: 0; }
  .e-cycle-t { flex-wrap: wrap; row-gap: 2px; }
  .v-earn.is-pre .e-cycle-r { display: none; }
  .e-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .e-grid .e-card { min-height: 0; }
  .e-claim { order: 1; }
  .e-held { order: 2; }
  .e-chart { order: 3; }
  .e-claim-b { padding: 22px 16px 16px; }
  .e-plot { height: 170px; }
  .e-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-facts > div:nth-child(3) { border-left: 0; }
  .e-facts > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .e-act .tbl .tx-a { display: none; }
  .e-act .tbl .tx .ic { width: 18px; height: 18px; }
}
