:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d2129;
  --line: #2a2f3a;
  --text: #e9ebf0;
  --muted: #9aa1b0;
  --accent: #e31337;
  --accent-soft: rgba(227, 19, 55, .14);
  --engine: #4f8cff;
  --up: #2fbf71;
  --down: #f05252;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8; --panel: #ffffff; --panel-2: #f0f2f5; --line: #e1e4ea;
    --text: #151821; --muted: #5d6475; --accent-soft: rgba(227, 19, 55, .08);
    --up: #158a4f; --down: #d32f2f; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
.num, .value, .big, td { font-variant-numeric: tabular-nums; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px clamp(14px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 8px 12px; border-radius: 10px; font: inherit; font-size: 14px; cursor: pointer;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--muted); }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 12px 16px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.spin svg { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px;
}

main { max-width: 1120px; margin: 0 auto; padding: 20px clamp(14px, 4vw, 32px) 48px; }

/* login */
.login { display: grid; place-items: center; min-height: calc(100vh - 140px); }
.login-card {
  width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(22px, 5vw, 40px);
}
.login h1 { font-size: clamp(24px, 4vw, 30px); line-height: 1.2; margin: 0 0 10px; letter-spacing: -.02em; }
.lede { color: var(--muted); margin: 0 0 24px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); margin-bottom: 14px; }
.input-row:focus-within { border-color: var(--accent); }
.at { padding-left: 14px; color: var(--muted); }
.input-row input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; padding: 12px 12px 12px 4px; outline: none; }
.form-msg { min-height: 1.5em; margin: 10px 0 0; font-size: 14px; color: var(--down); }
.form-msg.ok { color: var(--muted); }
.kc-missing { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-top: 8px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* loading */
.loading { display: grid; place-items: center; gap: 14px; min-height: 50vh; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rot .9s linear infinite; }

/* banners */
.banner { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid var(--line); background: var(--panel); }
.banner.demo { border-color: var(--engine); }
.banner.warn { border-color: var(--down); }

/* hero */
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 8px 0 22px; }
.who { display: flex; gap: 14px; align-items: center; }
.who img { width: 64px; height: 64px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--line); object-fit: cover; }
.handle { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.subtle { color: var(--muted); font-size: 13.5px; }
.networth { text-align: right; }
.label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.big { font-size: clamp(34px, 6vw, 46px); font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.changes { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.chip:empty { display: none; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* split */
.split { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.split-item { background: var(--panel); padding: 14px 16px; }
.split-item .value { font-size: 20px; font-weight: 650; margin: 2px 0; }
.sharebar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; margin: 10px 0 22px; background: var(--panel-2); }
.sharebar span:first-child { background: var(--accent); }
.sharebar span:last-child { background: var(--engine); }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
.panel h3 { font-size: 14px; margin: 0 0 8px; }
.link { color: var(--muted); font-size: 13.5px; text-decoration: none; }
.link:hover { color: var(--text); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; }
.tile .value { font-size: 19px; font-weight: 650; margin: 2px 0 1px; }
.tile .unit { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tile .detail { font-size: 12.5px; color: var(--muted); }
.tile.claim { outline: 1px dashed var(--accent); outline-offset: -1px; }

.notice { margin-top: 12px; font-size: 14px; background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; }

.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.meter-top span:last-child { color: var(--text); font-weight: 600; }
.track { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.fill { height: 100%; background: var(--accent); width: 0; transition: width .6s ease; }
.fill.rc { background: var(--engine); }

/* segmented control */
.seg { display: inline-flex; background: var(--panel-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--text); }
table.data th.sorted::after { content: " ↓"; }
table.data th.sorted.asc::after { content: " ↑"; }
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.num { text-align: right !important; }
.tok { display: flex; align-items: center; gap: 10px; }
.tok img, .tok .ph { width: 26px; height: 26px; border-radius: 50%; flex: none; background: var(--panel-2); object-fit: cover; }
.tok .ph { display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--muted); }
.tok b { display: block; font-weight: 650; }
.tok small { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 24px !important; }
.he-tools { display: flex; gap: 12px; align-items: center; }
.he-tools input[type=search] { font: inherit; font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; width: 160px; }
.check { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.movers { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.movers:empty { display: none; }

.pending { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.foot { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12.5px; padding: 8px 4px; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr 1fr; }
  .networth { text-align: left; }
  .changes { justify-content: flex-start; }
  .meters { grid-template-columns: 1fr; }
  .topbar-actions .btn span { display: none; }
  .he-tools input[type=search] { width: 120px; }
  table.tokens th:nth-child(2), table.tokens td:nth-child(2),
  table.tokens th:nth-child(3), table.tokens td:nth-child(3),
  table.tokens th:nth-child(4), table.tokens td:nth-child(4),
  table.tokens th:nth-child(6), table.tokens td:nth-child(6),
  #earnTable th:nth-child(3), #earnTable td:nth-child(3) { display: none; }
  .btn { white-space: nowrap; padding: 8px 10px; }
  #earnTable td:first-child { white-space: normal; }
  table.data td, table.data th { padding-left: 6px; padding-right: 6px; }
}
