:root {
  --gold: #f0b90b;
  --blue: #1e2329;
  --gold-soft: #f8d33a;
  --ink: #1e2329;
  --panel: #181a20;
  --line: rgba(30, 35, 41, .12);
  --muted: #f5f6f8;
  --green: #03a66d;
  --accent: #f6465d;
  --surface: #ffffff;
  --page: #f5f6f8;
  --text-muted: #707a8a;
  --border-dark: #2b3139;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: .58;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-status {
  width: min(1080px, 100%);
  margin: 0 auto 16px;
  padding: 12px 16px;
  border-radius: 6px;
  background: #fff8df;
  border: 1px solid rgba(240, 185, 11, .35);
  color: #6b4c00;
  font-weight: 800;
}

.app-status.error {
  background: #ffe9e9;
  color: #9c1422;
}

.app-status.success {
  background: #e7f8ee;
  color: #11663c;
}

.login-page {
  min-height: 100vh;
  color: #fff;
  background:
    radial-gradient(circle at 10% 14%, rgba(240, 185, 11, .24), transparent 30%),
    radial-gradient(circle at 84% 76%, rgba(3, 166, 109, .18), transparent 34%),
    linear-gradient(135deg, #181a20 0%, #1e2329 58%, #0b0e11 100%);
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: -80px auto -80px -120px;
  width: 460px;
  background: url("./assets/arvo-logo.svg") center / contain no-repeat;
  opacity: .09;
  transform: rotate(-12deg);
}

.login-stack {
  width: min(620px, 100%);
  display: grid;
  gap: 24px;
  justify-items: center;
  z-index: 1;
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  color: #f5f6f8;
  background: rgba(24, 26, 32, .86);
  border: 1px solid rgba(240, 185, 11, .24);
  border-radius: 22px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.03);
  font-weight: 700;
  white-space: nowrap;
}

.coin-mark,
.avatar-mark {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #090909;
  background: linear-gradient(135deg, #f8d33a, #f0b90b);
  font-size: 12px;
  font-weight: 900;
  padding: 0 5px;
}

.avatar-mark {
  width: 26px;
  background: linear-gradient(135deg, #03a66d, #f0b90b);
}

.login-card {
  width: min(620px, 100%);
  background: rgba(24, 26, 32, .94);
  border: 1px solid rgba(240, 185, 11, .18);
  border-radius: 8px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0,0,0,.28);
}

.login-card h1,
.login-card h2 {
  margin: 0 0 22px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 22px;
  font-size: 22px;
}

.connect-button {
  min-width: 200px;
  border: 0;
  border-radius: 7px;
  color: #181a20;
  background: linear-gradient(135deg, #f8d33a, #f0b90b);
  padding: 12px 22px;
  font-weight: 800;
  font-size: 21px;
}

.upline-form {
  display: grid;
  gap: 14px;
}

.upline-form input {
  width: 100%;
  color: #fff;
  background: #0b0e11;
  border: 2px solid #f0b90b;
  padding: 14px 12px;
  min-height: 56px;
  font-size: 22px;
}

.status-line {
  color: #f8d33a;
  min-height: 22px;
  font-weight: 700;
}

.login-meta {
  color: #e7ebff;
  font-size: 14px;
  min-height: 20px;
  overflow-wrap: anywhere;
}

.shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 4% 8%, rgba(240, 185, 11, .08), transparent 26%),
    var(--page);
  padding-bottom: 70px;
}

.topbar {
  height: 82px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 20px;
}

.logo {
  width: 190px;
  height: 64px;
  background: url("./assets/arvo-logo.svg") left center / contain no-repeat;
  border-radius: 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.social-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.social-link {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 7px;
  border: 1px solid rgba(240, 185, 11, .28);
  border-radius: 6px;
  color: #181a20;
  background: #ffffff;
}

.top-actions .social-link {
  color: #f5f6f8;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
}

.social-link svg {
  width: 24px;
  height: 24px;
  display: block;
}

.notification {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 7px;
  color: #ffffff;
  background: rgba(255,255,255,.08);
  display: grid;
  place-items: center;
  position: relative;
}

.notification::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}

.gold-button {
  border: 0;
  border-radius: 6px;
  background: var(--gold);
  color: #181a20;
  padding: 11px 18px;
  font-weight: 800;
}

.nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 1px 14px rgba(24, 26, 32, .08);
}

.nav button {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
}

.nav button.active {
  color: #181a20;
  background: var(--gold);
}

.content {
  max-width: 1640px;
  margin: 0 auto;
  padding: 18px 24px 60px;
}

.center {
  display: grid;
  justify-items: center;
}

.dark-card {
  width: min(1080px, 100%);
  background: var(--panel);
  color: #ffffff;
  border-radius: 6px;
  padding: 22px;
  margin: 22px auto 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}

.profile-list {
  display: grid;
  gap: 14px;
  line-height: 1.25;
}

.mini-stats {
  display: flex;
  gap: 22px;
  align-items: end;
  color: #f5f6f8;
  font-weight: 800;
}

.mini-stat {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  align-items: center;
}

.mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #181a20;
}

.ref-box {
  margin-top: 28px;
  padding: 12px;
  background: #fff8df;
  color: #6b4c00;
  border-radius: 8px;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 8px;
}

.copy-row input {
  background: #ffffff;
  color: var(--ink);
  border: 0;
  padding: 12px;
  min-width: 0;
}

.copy-row button,
.tiny-black {
  border: 0;
  background: var(--gold);
  color: #181a20;
  border-radius: 4px;
  font-weight: 800;
}

.section-label {
  display: inline-block;
  margin: 14px 0 16px;
  padding: 9px 16px;
  background: #ffffff;
  color: #6b4c00;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-weight: 800;
}

.packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
}

.package-card {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  font-weight: 800;
  text-align: center;
}

.package-card.unlocked {
  border-color: #03a66d;
  background: #e8f7f1;
  box-shadow: inset 0 0 0 2px rgba(3, 166, 109, .22);
}

.package-card.current {
  border-color: var(--gold);
  background: #fff8df;
  box-shadow: inset 0 0 0 3px rgba(240, 185, 11, .28), 0 10px 24px rgba(240, 185, 11, .16);
}

.package-card.locked {
  color: var(--text-muted);
  background: #f8fafc;
}

.package-card.locked .rank-pill {
  background: var(--text-muted);
}

.package-card.current .rank-pill {
  background: var(--gold);
  color: #181a20;
}

.rank-pill {
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--panel);
  color: #ffffff;
  font-size: 12px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 28px;
}

.income-tile {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 22px;
  display: grid;
  align-content: center;
  position: relative;
}

.income-tile .amount {
  font-size: 24px;
  margin-bottom: 4px;
}

.income-tile button {
  position: absolute;
  right: 28px;
  top: 26px;
  padding: 10px 12px;
}

.rank-table {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.rank-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rank-row div,
.history-row div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 38px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.history {
  width: min(700px, 100%);
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr;
  gap: 8px;
}

.footer-addresses {
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 36px;
  font-weight: 800;
}

.address-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
}

.data-panel {
  width: min(1640px, 100%);
  margin: 26px auto 0;
  background: #ffffff;
  border: 1px solid rgba(30, 35, 41, .12);
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(24, 26, 32, .08);
}

.data-panel h2 {
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

.table-filter-note {
  margin: -10px 0 16px;
  color: #6b4c00;
  font-size: 13px;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(30, 35, 41, .12);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-weight: 800;
}

th,
td {
  border: 0;
  border-bottom: 1px solid rgba(30, 35, 41, .1);
  text-align: left;
  padding: 14px 16px;
  min-height: 50px;
}

th {
  color: #f0b90b;
  background: #181a20;
  font-size: 13px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

td {
  color: #1e2329;
  background: #ffffff;
}

tbody tr:nth-child(even) td {
  background: #fafafa;
}

tbody tr:hover td {
  background: #fff8df;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.level-badge.unlocked {
  color: #0b0e11;
  background: rgba(240, 185, 11, .16);
  border: 1px solid rgba(240, 185, 11, .42);
}

.level-badge.locked {
  color: var(--text-muted);
  background: #f5f6f8;
  border: 1px solid rgba(112, 122, 138, .24);
}

.pool-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.pool-status.active {
  color: #064e3b;
  background: #d1fae5;
  border: 1px solid rgba(16, 185, 129, .34);
}

.pool-status.pending {
  color: #6b4c00;
  background: #fff8df;
  border: 1px solid rgba(240, 185, 11, .42);
}

.pool-status.inactive {
  color: var(--text-muted);
  background: #f5f6f8;
  border: 1px solid rgba(112, 122, 138, .24);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 32px;
  justify-content: flex-start;
  padding: 12px;
  border: 1px solid rgba(30, 35, 41, .12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(24, 26, 32, .06);
}

.pager button {
  min-width: 82px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(30, 35, 41, .14);
  border-radius: 8px;
  background: #f5f6f8;
  color: var(--blue);
  font-weight: 800;
}

.level-sequence button.current {
  border-color: var(--gold);
  background: #181a20;
  color: #f0b90b;
  box-shadow: inset 0 0 0 2px rgba(240, 185, 11, .32);
}

.level-sequence button.unlocked {
  border-color: rgba(240, 185, 11, .42);
  background: #fff8df;
  color: #6b4c00;
}

.level-sequence button.locked {
  border-color: rgba(112, 122, 138, .24);
  background: #f8fafc;
  color: var(--text-muted);
}

.community-tool {
  width: min(1180px, 100%);
  margin: 12px auto 0;
  padding: 18px;
  border: 1px solid rgba(30, 35, 41, .12);
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 26, 32, .08);
}

.tree-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.tree-header p {
  margin: 0 0 4px;
  color: #6b4c00;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tree-header h1,
.community-tool h1 {
  margin: 0;
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
}

.tree-count {
  display: inline-block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.search-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.search-row input {
  width: min(360px, 48vw);
  min-height: 46px;
  border: 1px solid rgba(30, 35, 41, .18);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 700;
  outline: none;
}

.search-row button {
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  color: #181a20;
  background: var(--gold);
  font-size: 16px;
  font-weight: 900;
}

.tree-board {
  width: 100%;
  margin: 0 auto;
  min-height: 340px;
  max-height: 70vh;
  position: relative;
  overflow: auto;
  border: 1px solid #2b3139;
  border-radius: 8px;
  background:
    linear-gradient(rgba(240,185,11,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,185,11,.06) 1px, transparent 1px),
    linear-gradient(180deg, #181a20, #0b0e11);
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: 0 18px 40px rgba(24, 26, 32, .16);
  padding: 16px 12px 22px;
  scrollbar-width: thin;
}

.tree-list,
.tree-list ul {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.tree-list {
  min-width: max-content;
  padding: 4px 0 18px;
}

.tree-list ul {
  padding-top: 26px;
}

.tree-list li {
  display: grid;
  justify-items: center;
  align-content: start;
  position: relative;
}

.tree-list ul::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  width: calc(100% - 104px);
  min-width: 0;
  height: 2px;
  transform: translateX(-50%);
  background: rgba(240, 185, 11, .45);
}

.tree-list ul > li::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  width: 2px;
  height: 14px;
  transform: translateX(-50%);
  background: rgba(240, 185, 11, .45);
}

.tree-list li > .tree-node + ul::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 26px;
  transform: translateX(-50%);
  background: rgba(240, 185, 11, .45);
}

.tree-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #f5f6f8;
  font-weight: 900;
}

.tree-root,
.tree-branches {
  display: flex;
  justify-content: center;
  min-width: 560px;
}

.tree-branches {
  gap: 150px;
}

.tree-node {
  width: 104px;
  min-height: 88px;
  text-align: left;
  color: #f5f6f8;
  font-size: 10px;
  font-weight: 800;
  border: 1px solid rgba(240,185,11,.22);
  border-radius: 7px;
  background: linear-gradient(180deg, #20252d, #14181f);
  padding: 7px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .22);
}

.tree-node.is-empty {
  color: var(--text-muted);
  border-style: dashed;
  background: rgba(30, 35, 41, .68);
  box-shadow: none;
}

.tree-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 5px;
}

.tree-avatar {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, #f0b90b 0 48%, #03a66d 49% 100%);
  box-shadow: inset 0 -4px 0 rgba(255,255,255,.18);
}

.tree-side {
  border: 1px solid rgba(240,185,11,.28);
  border-radius: 999px;
  color: #6b4c00;
  background: #fff8df;
  padding: 3px 5px;
  font-size: 9px;
  font-weight: 900;
}

.tree-node strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 11px;
  color: #ffffff;
  line-height: 1.15;
}

.tree-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 5px 0;
}

.tree-meta span {
  border-radius: 5px;
  background: #0b0e11;
  color: #f0b90b;
  padding: 3px;
  text-align: center;
  font-size: 9px;
  line-height: 1.1;
}

.tree-node button {
  width: 100%;
  min-height: 22px;
  background: var(--gold);
  color: #181a20;
  border: 0;
  border-radius: 4px;
  font-weight: 900;
  font-size: 10px;
}

.tree-node button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.tree-connector {
  width: 560px;
  height: 70px;
  position: relative;
  margin: 0 auto;
  pointer-events: none;
}

.tree-connector::before,
.tree-connector::after,
.tree-connector span,
.tree-connector span::before,
.tree-connector span::after {
  content: "";
  position: absolute;
  background: var(--gold);
}

.tree-connector::before {
  top: 0;
  left: 50%;
  width: 4px;
  height: 24px;
  transform: translateX(-50%);
}

.tree-connector span {
  top: 24px;
  left: 90px;
  right: 90px;
  height: 4px;
}

.tree-connector span::before,
.tree-connector span::after {
  top: 0;
  width: 4px;
  height: 46px;
}

.tree-connector span::before {
  left: 0;
}

.tree-connector span::after {
  right: 0;
}

.spinner {
  width: 22px;
  height: 22px;
  display: inline-block;
  border: 3px solid rgba(0,0,0,.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  color: #b00020;
  font-weight: 800;
}

.ok {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 12px;
  }

  .profile-grid,
  .tile-grid,
  .rank-row,
  .history-row {
    grid-template-columns: 1fr;
  }

  .packages {
    grid-template-columns: repeat(2, 1fr);
  }

  .tree-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search-row {
    justify-content: stretch;
  }

  .search-row input {
    width: 100%;
    min-width: 0;
  }

  .tree-board {
    padding: 22px 14px 28px;
  }

  .tree-root,
  .tree-branches {
    min-width: 0;
  }

  .tree-branches {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 14px;
  }

  .tree-node {
    width: min(360px, 100%);
  }

  .tree-connector {
    display: none;
  }
}
