:root {
  --bg: #ffffff;
  --bg-sub: #f6f7f9;
  --row-bg: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --dim: #9aa1ac;
  --line: #e6e8ec;
  --gold: #c9a227;
  --gold-deep: #a8851a;
  --green: #0a8754;
  --green-bg: rgba(10, 135, 84, 0.08);
  --red: #c92a2a;
  --red-bg: rgba(201, 42, 42, 0.07);
  --blue: #2563eb;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --serif: Georgia, "Times New Roman", Times, serif;
}

body.theme-dark {
  --bg: #05070c;
  --bg-sub: #12161f;
  --row-bg: #0e121a;
  --text: #e8ecf3;
  --muted: #8a93a6;
  --dim: #667082;
  --line: rgba(255, 255, 255, 0.08);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.09);
  background: #05070c;
  color: #e8ecf3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scrollbar-color: #c9cdd4 transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 13px; }

.logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
  color: #fff;
  background: linear-gradient(135deg, #d8b544, var(--gold-deep));
  box-shadow: 0 3px 14px rgba(168, 133, 26, 0.35);
}

.brand-text .title { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.brand-text .title span { color: var(--gold-deep); }
.brand-text .subtitle { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--green);
  border: 1px solid rgba(10, 135, 84, 0.35);
  background: var(--green-bg);
  padding: 5px 11px;
  border-radius: 999px;
  margin-left: 6px;
}

.live-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s ease-out infinite;
}

.live-chip.delayed { color: #a16207; border-color: rgba(161, 98, 7, 0.4); background: rgba(161, 98, 7, 0.08); }
.live-chip.delayed .dot { background: #a16207; animation: none; }

.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg-sub);
  padding: 5px 11px;
  border-radius: 999px;
  margin-left: 6px;
}

.watch-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  animation: pulse-blue 2s ease-out infinite;
}

@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
  100% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(10, 135, 84, 0.4); }
  100% { box-shadow: 0 0 0 8px rgba(10, 135, 84, 0); }
}

.header-stats { display: flex; gap: 34px; align-items: center; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat.right { text-align: right; align-items: flex-end; }

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  font-weight: 700;
}

.stat-value {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.stat-value.small { font-size: 15px; font-weight: 700; }
.stat-value.small span, .stat-sub span { color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ---------- search ---------- */

.search { position: relative; flex: 1 1 220px; max-width: 340px; min-width: 170px; }

.search input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search input:focus {
  border-color: rgba(168, 133, 26, 0.55);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}

.search input::placeholder { color: var(--dim); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(10, 12, 16, 0.18);
  z-index: 45;
  max-height: 430px;
  overflow-y: auto;
}

.sr-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-family: inherit;
}

.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg-sub); }

.avatar.mini { width: 36px; height: 36px; border-radius: 9px; font-size: 11px; }
.avatar.mini .avatar-badge { width: 10px; height: 10px; right: -1px; bottom: -1px; }

.sr-name { font-size: 13.5px; font-weight: 700; display: block; color: var(--text); }
.sr-sub { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }

.sr-right { text-align: right; }
.sr-nw { font-family: var(--mono); font-weight: 700; font-size: 13px; display: block; color: var(--text); }
.sr-rank { font-size: 10.5px; color: var(--dim); font-family: var(--mono); }

.sr-empty { padding: 14px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- chips (light mode base; dark overrides in modal) ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chip.up { color: var(--green); background: var(--green-bg); }
.chip.down { color: var(--red); background: var(--red-bg); }
.chip.flat { color: var(--muted); background: var(--bg-sub); }

/* ---------- movers strip ---------- */

.movers-wrap { border-bottom: 1px solid var(--line); background: var(--bg-sub); }

.movers {
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 26px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.movers b { color: var(--text); font-weight: 700; }
.movers .chip { font-size: 12px; padding: 2px 8px; }

/* ---------- view toggle ---------- */

.view-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1060px;
  margin: 16px auto 12px;
  padding: 0 26px;
}

.view-toggle button {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}

.view-toggle button:hover { color: var(--text); border-color: #c9cdd4; }

.view-toggle button.active {
  color: var(--gold-deep);
  background: rgba(201, 162, 39, 0.1);
  border-color: rgba(168, 133, 26, 0.45);
}

/* ---------- layout ---------- */

main { max-width: 1060px; margin: 0 auto; padding: 0 26px 70px; }

.board, .bars { list-style: none; }

/* ---------- table head ---------- */

.table-head {
  display: grid;
  grid-template-columns: 48px 56px 1fr 60px 280px;
  gap: 16px;
  padding: 10px 18px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--dim);
  border-bottom: 2px solid #e9eaee;
}

.th-name { grid-column: 2 / 4; }
.th-age { grid-column: 4; }
.th-change { grid-column: 5; white-space: nowrap; }

/* ---------- rows ---------- */

.row {
  display: grid;
  grid-template-columns: 48px 56px 1fr 60px 280px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s;
  background: var(--row-bg);
}

.row:hover { background: var(--bg-sub); }
.row:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: -2px; }

@keyframes flashUp { from { background: rgba(10, 135, 84, 0.12); } to { background: var(--row-bg); } }
@keyframes flashDown { from { background: rgba(201, 42, 42, 0.10); } to { background: var(--row-bg); } }

.row.flash-up { animation: flashUp 1.4s ease-out; }
.row.flash-down { animation: flashDown 1.4s ease-out; }

.rank-chip {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--dim);
  text-align: center;
}

.rank-chip.top1 { color: var(--gold-deep); }
.rank-chip.top2 { color: #7d8794; }
.rank-chip.top3 { color: #b06f37; }

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e3e6ea, #cfd4da);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #5b6472;
  position: relative;
  overflow: hidden;
  flex: none;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 2;
  cursor: help;
}

.avatar-badge.live { background: #0a8754; animation: badgePulse 1.8s ease-out infinite; }
.avatar-badge.est { background: #d97706; }

@keyframes badgePulse {
  0% { box-shadow: 0 0 0 0 rgba(10, 135, 84, 0.45); }
  100% { box-shadow: 0 0 0 6px rgba(10, 135, 84, 0); }
}

.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 18px 12px;
  font-size: 11.5px;
  color: var(--muted);
}

.lg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.lg-dot.live { background: #0a8754; }
.lg-dot.est { background: #d97706; }
.legend b { color: var(--text); font-weight: 700; }

.name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.name { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }

.cc {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 1px;
}

.source-line { font-size: 13px; color: var(--muted); margin-top: 2px; }

.stake-line {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stake-line.bio {
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-bio {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #c3ccdb;
}

.modal-note {
  margin-top: 22px;
  font-size: 11.5px;
  color: #667082;
  line-height: 1.65;
}

.age-col { font-family: var(--mono); font-size: 14px; color: var(--muted); text-align: center; }

.wealth { text-align: right; }
.who { min-width: 0; }

.nw {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.row-chips { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }

.chip.hint {
  color: var(--dim);
  background: none;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  padding: 2px 8px;
}

/* ---------- bars view ---------- */

.bar-row {
  margin-bottom: 15px;
  padding: 10px 12px 13px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}

.bar-row:hover { background: var(--bg-sub); border-color: var(--line); }
.bar-row:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

.bar-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.bar-rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex: none;
}

.bar-rank.r1 { background: linear-gradient(135deg, #d8b544, var(--gold-deep)); }
.bar-rank.r2 { background: linear-gradient(135deg, #aab3c0, #7d8794); }
.bar-rank.r3 { background: linear-gradient(135deg, #c98a54, #a05f2c); }
.bar-rank.r { background: linear-gradient(135deg, #7ea2f0, #4f6fc4); }

.bar-name { font-size: 15px; font-weight: 700; }
.bar-src { font-size: 12px; color: var(--muted); }

.bar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.bar-nw { font-family: var(--mono); font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }

.bar-track {
  height: 42px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  color: #14161a;
  white-space: nowrap;
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 9px 0 0 9px;
}

.bar-fill.r1 { background: linear-gradient(90deg, rgba(216, 181, 68, 0.5), #e6c65c); }
.bar-fill.r2 { background: linear-gradient(90deg, rgba(170, 179, 192, 0.5), #aab3c0); }
.bar-fill.r3 { background: linear-gradient(90deg, rgba(201, 138, 84, 0.5), #c98a54); }
.bar-fill.r { background: linear-gradient(90deg, rgba(126, 162, 240, 0.4), #9bb4ee); }

/* ---------- footnote ---------- */

.footnote { margin-top: 30px; font-size: 11.5px; line-height: 1.65; color: var(--dim); max-width: 780px; }

/* ---------- modal (dark window) ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 16, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  overflow-y: auto;
}

.backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  width: min(780px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #10141d, #0b0e15);
  border: 1px solid rgba(245, 196, 81, 0.2);
  border-radius: 24px;
  padding: 28px 30px 30px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);
  position: relative;
  transform: translateY(18px) scale(0.97);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  color: #e8ecf3;
}

.backdrop.open .modal { transform: none; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #aab4c8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover { color: #fff; border-color: #f5c451; }

.modal .chip.up { color: #34d399; background: rgba(52, 211, 153, 0.12); }
.modal .chip.down { color: #f87171; background: rgba(248, 113, 113, 0.12); }
.modal .chip.flat { color: #8a93a6; background: rgba(255, 255, 255, 0.05); }

.modal-head { display: flex; gap: 16px; align-items: center; }

.modal .avatar {
  width: 58px;
  height: 58px;
  font-size: 19px;
  background: linear-gradient(135deg, #e3e6ea, #cfd4da);
}

.modal-rank-row { display: flex; gap: 8px; align-items: center; }

.live-flag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 999px;
}

.live-flag.live { color: #34d399; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.35); }
.live-flag.est { color: #fbbf24; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35); }

.modal-rank {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #f5c451;
}

.modal-name { font-size: 26px; font-weight: 800; letter-spacing: -0.4px; margin: 2px 0; }
.modal-sub { font-size: 13.5px; color: #8a93a6; }

.modal-main { margin-top: 18px; }

.nw-big {
  font-family: var(--mono);
  font-size: clamp(40px, 7.5vw, 62px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.modal-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.modal-chips .chip { font-size: 13.5px; padding: 5px 12px; }

.rate-line { margin-top: 12px; font-size: 14.5px; color: #8a93a6; }
.rate-line .chip { font-size: 13.5px; }
.rate-line.up { color: #34d399; }
.rate-line.down { color: #f87171; }

.fun-fact {
  margin-top: 14px;
  padding: 12px 16px;
  border-left: 3px solid #f5c451;
  background: rgba(245, 196, 81, 0.07);
  border-radius: 0 12px 12px 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: #d7deea;
}

#m-fun-line { color: #d7deea; }

.salary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #aab4c8;
  flex-wrap: wrap;
}

.salary-row input {
  width: 120px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: var(--mono);
  font-size: 13.5px;
  outline: none;
}

.salary-row input:focus { border-color: #f5c451; }

.earn-line { margin-top: 9px; font-size: 13.5px; color: #aab4c8; font-style: italic; }

.chart-wrap {
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px 16px 10px;
}

.chart-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: #8a93a6; margin-bottom: 8px; }
.chart-head .chart-note { font-size: 11px; color: #667082; }

#m-chart { width: 100%; height: 250px; display: block; }

.modal h3 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8a93a6;
  margin: 24px 0 12px;
}

.hold-row {
  display: grid;
  grid-template-columns: 170px 1fr 96px;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
}

.hold-label { color: #c3ccdb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hold-value { font-family: var(--mono); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: #dfe5f0; }

.hold-track { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.hold-fill { height: 100%; border-radius: 999px; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1); }

.stocks { display: flex; flex-wrap: wrap; gap: 8px; }

.stock-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px;
}

.stock-chip .tick { font-size: 11px; font-weight: 800; color: #8a93a6; letter-spacing: 1px; }
.stock-chip .px { font-weight: 700; font-variant-numeric: tabular-nums; }

.stock-chip .pct { font-size: 11.5px; font-weight: 700; }
.stock-chip .pct.up { color: #34d399; }
.stock-chip .pct.down { color: #f87171; }
.stock-chip .pct.flat { color: #8a93a6; }

/* ---------- race to $1 trillion ---------- */

.trillion-wrap {
  border: 1px solid rgba(168, 133, 26, 0.35);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.09), rgba(201, 162, 39, 0.03));
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.tr-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }

.tr-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--gold-deep);
}

.tr-eta { font-size: 12px; color: var(--muted); font-family: var(--mono); }

.tr-body { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.tr-body .avatar { width: 48px; height: 48px; border-radius: 12px; }

.tr-main { flex: 1; min-width: 0; }

.tr-who { font-size: 14.5px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tr-who b { font-size: 16px; }
.tr-nw { font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--gold-deep); }

.tr-bar { height: 12px; border-radius: 999px; background: var(--bg-sub); overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.tr-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #d8b544, #a8851a); transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1); }

.tr-sub { margin-top: 7px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }

/* ---------- recent flips feed ---------- */

.flips-wrap { margin-top: 18px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 14px; }

.flips-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.flips { list-style: none; }
.flips li { font-size: 13.5px; color: var(--muted); padding: 5px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.flips li:last-child { border-bottom: none; }
.flips .flip-time { font-family: var(--mono); color: var(--dim); font-size: 12px; }
.flips b { color: var(--text); }
.flips .flip-rank { color: var(--gold-deep); font-family: var(--mono); font-weight: 700; }

/* ---------- market context strip ---------- */

.market-strip {
  max-width: 1060px;
  margin: 0 auto;
  padding: 8px 26px 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mkt-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--muted);
}

.mkt-pill b { font-family: var(--mono); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.mkt-chg { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.mkt-chg.up { color: var(--green); }
.mkt-chg.down { color: var(--red); }
.mkt-chg.flat { color: var(--muted); }

/* ---------- theme toggle ---------- */

.view-toggle .theme-btn {
  margin-left: auto;
  border: 1px dashed rgba(168, 133, 26, 0.5);
  color: var(--gold-deep);
  background: none;
}

.view-toggle .theme-btn:hover { color: var(--gold); }

/* ---------- Berkshire portfolio (modal) ---------- */

.brk-wrap { margin-top: 6px; }

.brk-row {
  display: grid;
  grid-template-columns: 64px 1fr 110px 96px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  margin: 4px 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12.5px;
}

.brk-tick { font-family: var(--mono); font-weight: 800; color: #f5c451; letter-spacing: 0.5px; }
.brk-name { color: #c3ccdb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brk-name small { display: block; color: #8a93a6; font-size: 11px; }
.brk-px { font-family: var(--mono); text-align: right; color: #dfe5f0; font-variant-numeric: tabular-nums; }
.brk-px .pct { display: block; font-size: 11px; }
.brk-px .pct.up { color: #34d399; }
.brk-px .pct.down { color: #f87171; }
.brk-px .pct.flat { color: #8a93a6; }
.brk-val { font-family: var(--mono); font-weight: 700; text-align: right; color: #dfe5f0; font-variant-numeric: tabular-nums; }
.brk-note { margin-top: 10px; font-size: 11px; color: #667082; line-height: 1.6; }

/* ---------- spend buttons ---------- */

.stk { white-space: nowrap; }
.spend-btn {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #c9a227;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.spend-btn:hover { background: #a8851a; }

.spend-open-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 11px 26px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #d8b544, var(--gold-deep));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(168, 133, 26, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}

.spend-open-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(168, 133, 26, 0.45); }

/* ---------- spend layer ---------- */

.spend-layer {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--bg);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.spend-layer.open { opacity: 1; pointer-events: auto; }

.spend-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.spend-back {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.spend-back:hover { border-color: #c9cdd4; }

.spend-person { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; }
.spend-person .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 15px; }

.spend-name { font-size: 17px; font-weight: 800; }

.spend-fortune { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-family: var(--mono); font-weight: 700; font-size: 14px; }

.spend-share {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(168, 133, 26, 0.45);
  background: rgba(201, 162, 39, 0.08);
  color: var(--gold-deep);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.spend-share:hover { background: rgba(201, 162, 39, 0.18); }

.spend-budget { max-width: 1060px; margin: 0 auto; padding: 22px 26px 0; }

.spend-remaining {
  font-family: var(--mono);
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  color: var(--gold-deep);
}

.spend-meta { display: flex; gap: 14px; margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--muted); }

.spend-bar { height: 12px; border-radius: 999px; background: var(--bg-sub); border: 1px solid var(--line); overflow: hidden; margin-top: 10px; }
.spend-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #d8b544, #a8851a); transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1); }

.spend-grid {
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 26px 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.sp-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--row-bg);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.sp-tile:hover { border-color: rgba(168, 133, 26, 0.4); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08); }

.sp-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #e3e6ea, #cfd4da);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 30px;
  color: #5b6472;
  overflow: hidden;
}

.sp-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.sp-info { padding: 12px 14px 4px; }
.sp-name { font-size: 14.5px; font-weight: 700; display: block; }
.sp-price { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--gold-deep); display: block; margin-top: 3px; }
.sp-price em { font-style: normal; font-weight: 500; font-size: 11px; color: var(--dim); margin-left: 5px; }
.sp-afford { font-size: 11.5px; color: var(--muted); display: block; margin-top: 3px; font-family: var(--mono); }
.sp-line { font-size: 11.5px; color: var(--gold-deep); font-weight: 700; display: block; min-height: 17px; margin-top: 2px; }

.sp-step { display: flex; align-items: center; gap: 10px; padding: 8px 14px 14px; }
.sp-step button {
  flex: 1;
  padding: 9px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}
.sp-step button:hover:not(:disabled) { border-color: var(--gold-deep); color: var(--gold-deep); }
.sp-step button:disabled { opacity: 0.3; cursor: default; }
.sp-step .sp-count { font-family: var(--mono); font-size: 15px; font-weight: 700; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

.spend-foot {
  max-width: 1060px;
  margin: 0 auto;
  padding: 6px 26px 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.spend-foot button {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-sub);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.spend-foot button:hover { border-color: #c9cdd4; }

.game-hint { font-size: 11.5px; color: var(--dim); font-style: italic; }

/* ---------- share row ---------- */

.share-row { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.share-row button {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #c3ccdb;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.share-row button:hover { border-color: #f5c451; color: #f5c451; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  top: 84px;
  right: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, 90vw);
}

.toast {
  background: linear-gradient(180deg, #171c26, #10141d);
  border: 1px solid rgba(245, 196, 81, 0.4);
  border-left: 4px solid #f5c451;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: #e8ecf3;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: toast-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast .toast-sub { display: block; font-size: 11.5px; font-weight: 500; color: #8a93a6; margin-top: 3px; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.toast.gone { opacity: 0; transform: translateX(24px); transition: all 0.3s; }

.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  font-size: 14px;
  color: var(--muted);
  transition: opacity 0.4s;
}

.loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(168, 133, 26, 0.2);
  border-top-color: var(--gold-deep);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .topbar { padding: 12px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .header-stats { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .stat.right { text-align: left; align-items: flex-start; }
  .view-toggle { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .view-toggle button { flex: none; }
  .stat-value { font-size: 17px; }
  .stat-sub { font-size: 11px; }

  .table-head { grid-template-columns: 26px 42px 1fr 112px; }
  .th-age { display: none; }
  .th-change { grid-column: 4; }

  .row { grid-template-columns: 26px 42px 1fr 112px; gap: 6px; padding: 12px 8px; }
  .avatar { width: 42px; height: 42px; }
  .age-col { display: none; }
  .nw { font-size: 17px; }
  .chip.hint { display: none; }
  .stake-line { white-space: normal; font-size: 10.5px; }
  .stake-line .pct { display: none; }
  .row-chips { flex-wrap: wrap; }

  .hold-row { grid-template-columns: 120px 1fr 84px; font-size: 12px; gap: 8px; }
  .nw-big { letter-spacing: -1px; }
  .view-toggle { padding: 0 16px; }
  .movers { padding: 8px 16px; }
  main { padding: 0 16px 60px; }
}
