:root {
  --bg: #000;
  --text: #fff;
  --secondary: rgba(235, 235, 245, 0.6);
  --tertiary: rgba(235, 235, 245, 0.3);
  --sep: rgba(84, 84, 88, 0.55);
  --card: #1c1c1e;
  --card2: #2c2c2e;
  --green: #00d35a;
  --red: #ff453a;
  --orange: #ff9f0a;
  --cyan: #64d2ff;
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --pink: #ff6b9a;
  --purple: #bf5af2;
  --gutter: 16px;
  --tab-h: 56px;
  --nav-h: 52px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); height: 100%; }
body {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
#app { height: 100%; display: flex; flex-direction: column; background: var(--bg); }

/* navbar */
.navbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 8px) var(--gutter) 8px;
  min-height: calc(var(--nav-h) + var(--safe-t));
}
.nav-avatar, .nav-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; color: var(--text); position: relative;
}
.nav-title { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.nav-title span { color: var(--tertiary); font-weight: 400; }
.nav-icon svg { width: 20px; height: 20px; stroke: var(--text); fill: none; stroke-width: 1.8; }
.nav-bell-dot {
  position: absolute; top: 10px; right: 10px; width: 8px; height: 8px;
  background: var(--red); border-radius: 50%; border: 2px solid var(--bg);
}
.error-row {
  flex: 0 0 auto;
  background: #3a1515;
  color: var(--red);
  font-size: 13px;
  padding: 8px var(--gutter);
}

/* main + tabs */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 calc(var(--tab-h) + var(--safe-b) + 16px);
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 0 8px var(--safe-b);
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(22, 22, 24, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  z-index: 20;
}
.tab {
  flex: 1; min-height: 44px; padding-top: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--tertiary); font-size: 10px;
}
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.tab.on { color: var(--text); }

/* typography helpers */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px var(--gutter) 10px;
  font-size: 20px; font-weight: 700; letter-spacing: -0.3px;
}
.section-head a, .section-head .see { font-size: 15px; font-weight: 500; color: var(--blue); }
.muted { color: var(--secondary); }
.dim { color: var(--tertiary); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* HOME: balance */
.balance-block { padding: 8px var(--gutter) 4px; }
.balance-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.odometer {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 66px;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: flex-end;
}
.odometer .sym { font-size: 36px; line-height: 1; margin-right: 2px; margin-bottom: 6px; font-weight: 600; }
.odometer .digit {
  display: inline-block; height: 1em; overflow: hidden; width: 0.68em; position: relative;
  vertical-align: bottom;
}
.odometer .digit i {
  display: block; text-align: center; line-height: 1;
  transition: transform 600ms ease-out;
}
.odometer .digit b { display: block; height: 1em; line-height: 1; font-weight: inherit; }
.odometer .dot { width: 0.28em; display: inline-block; }
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 22px; padding: 2px 8px; border-radius: 999px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px; font-weight: 600;
}
.pill.paper { background: var(--orange); color: #000; }
.pill.mult { background: rgba(0, 211, 90, 0.16); color: var(--green); }
.today-line { margin-top: 6px; font-size: 17px; font-weight: 600; }
.today-line .mult-pill { margin-left: 8px; }

/* chart */
.chart-wrap { padding: 8px 0 0; }
.chart-canvas {
  width: 100%; height: 180px; display: block;
}
.range-switch {
  display: flex; gap: 4px; padding: 8px var(--gutter) 4px; flex-wrap: wrap;
}
.range-switch button {
  min-height: 32px; min-width: 44px; padding: 6px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--secondary);
}
.range-switch button.on { background: var(--card2); color: var(--text); }

/* live screen card */
.live-card {
  margin: 12px var(--gutter) 0;
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
}
.live-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; background: #111;
}
.live-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.live-frame img.show { opacity: 1; transition: opacity 200ms linear; }
.live-tag, .live-lane {
  position: absolute; top: 10px; z-index: 1;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  text-shadow: none;
  background: rgba(0,0,0,0.45);
  padding: 4px 8px; border-radius: 999px;
}
.live-tag { left: 10px; }
.live-lane { right: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); }
.dot.live { background: var(--red); }
.live-meta { padding: 12px 14px 14px; font-size: 14px; }
.checks { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.check {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--sep); display: inline-block;
}
.check.ok { background: var(--green); border-color: var(--green); }
.check.no { background: transparent; border-color: var(--red); }

/* bot carousel */
.carousel {
  display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 var(--gutter) 8px;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }
.bot-card {
  flex: 0 0 78%;
  scroll-snap-align: start;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  min-height: 132px;
}
.bot-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.bot-card .head { color: var(--secondary); font-size: 13px; margin-top: 2px; }
.bot-card .body { margin-top: 10px; font-size: 14px; }
.strike { color: var(--red); text-decoration: line-through; }
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); margin-right: 6px;
}
.status-dot.off { background: var(--tertiary); }

/* lists / activity */
.list { padding: 0 var(--gutter); }
.row {
  display: flex; align-items: center; gap: 10px;
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--sep);
}
.row:last-child { border-bottom: 0; }
.row .mid { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 600; }
.row .sub { font-size: 13px; color: var(--secondary); margin-top: 1px; }
.row .right { text-align: right; font-size: 15px; font-weight: 600; }
.row .right .sub { font-weight: 400; }
.fomo-link { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 500; min-height: 32px; line-height: 32px; }

/* bots tab */
.bot-full {
  margin: 10px var(--gutter);
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
}
.bot-full-head { display: flex; align-items: center; gap: 10px; }
.bot-full-head h3 { flex: 1; margin: 0; font-size: 18px; }
.switch {
  position: relative; width: 51px; height: 31px; border-radius: 999px;
  background: var(--card2); flex: 0 0 51px;
}
.switch.on { background: var(--green); }
.switch.locked { opacity: 0.4; }
.switch i {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff;
  transition: transform 200ms ease;
}
.switch.on i { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) {
  .switch i { transition: none; }
}
.decisions { margin-top: 10px; }
.settings-shortcut { display: block; margin-top: 8px; font-size: 15px; color: var(--blue); min-height: 44px; line-height: 44px; }

/* audit */
.audit-discs {
  display: flex; justify-content: space-between; gap: 6px;
  padding: 16px var(--gutter) 8px;
}
.disc {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--sep);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; position: relative;
}
.disc.ok { border-color: var(--green); color: var(--green); }
.disc.no { border-color: var(--red); color: var(--red); }
.disc.beam { box-shadow: 0 0 0 2px var(--cyan); border-color: var(--cyan); }
.layer-row {
  margin: 0 var(--gutter);
  padding: 12px 0;
  border-bottom: 0.5px solid var(--sep);
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  font-size: 15px;
}
.social-row {
  margin: 14px var(--gutter) 0;
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  font-size: 15px;
}

/* coin */
.coin-head { padding: 8px var(--gutter) 0; }
.coin-head .name { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coin-meta { color: var(--secondary); margin-top: 4px; font-size: 14px; }
.shield { background: var(--card2); color: var(--text); }
.coin-price {
  font-family: "SF Pro Display", -apple-system, sans-serif;
  font-size: 40px; font-weight: 700; letter-spacing: -1px;
  padding: 10px var(--gutter) 0;
}
.since { padding: 4px var(--gutter) 0; font-size: 16px; font-weight: 600; }
.stats { display: flex; gap: 8px; padding: 14px var(--gutter); flex-wrap: wrap; }
.stat { flex: 1 1 30%; background: var(--card); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--secondary); }
.stat .v { font-size: 16px; font-weight: 600; margin-top: 2px; }
.pos-card { margin: 0 var(--gutter); background: var(--card); border-radius: 14px; padding: 14px; }
.coin-actions { display: flex; gap: 8px; padding: 16px var(--gutter); }
.btn {
  flex: 1; min-height: 48px; border-radius: 12px;
  font-size: 16px; font-weight: 600;
  background: var(--card2); color: var(--text);
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.4; }

/* sheets / overlays */
.sheet-backdrop, .overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay { align-items: center; background: #000; }
.sheet {
  width: 100%; background: var(--card); border-radius: 16px 16px 0 0;
  padding: 12px var(--gutter) calc(20px + var(--safe-b));
}
.sheet h2 { margin: 8px 0 14px; font-size: 20px; }
.pct-row { display: flex; gap: 8px; margin-bottom: 12px; }
.pct-row button { flex: 1; min-height: 48px; border-radius: 12px; background: var(--card2); font-weight: 700; }
.pct-row button.on { background: var(--blue); }
.fs-img { width: 100%; height: 100%; object-fit: contain; }
.fs-bar {
  position: absolute; top: calc(var(--safe-t) + 8px); left: 12px; right: 12px;
  display: flex; justify-content: space-between; z-index: 2;
}

/* account */
.account { padding: 8px var(--gutter) 24px; }
.mode-row { display: flex; gap: 8px; margin: 8px 0 16px; }
.mode-row button { flex: 1; min-height: 44px; border-radius: 12px; background: var(--card); font-weight: 700; }
.mode-row button.on { background: var(--orange); color: #000; }
.mode-row button.on.live { background: var(--green); }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--secondary); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: 44px; background: var(--card); border: 0; border-radius: 10px;
  padding: 0 12px; outline: none;
}
.group { margin: 22px 0 8px; font-size: 20px; font-weight: 700; }
.slider-row { padding: 10px 0; border-bottom: 0.5px solid var(--sep); }
.slider-row .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.slider-row input[type=range] { width: 100%; }
.link-row, .action-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; border-bottom: 0.5px solid var(--sep); font-size: 16px;
}

/* states */
.empty { padding: 48px var(--gutter); text-align: center; color: var(--secondary); font-size: 17px; }
.skel {
  background: var(--card);
  border-radius: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}
.skel-block { margin: 10px var(--gutter); }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; opacity: 0.7; }
  .odometer .digit i { transition: none; }
  .live-frame img.show { transition: none; }
}

/* search panel */
.search-panel {
  padding: 0 var(--gutter) 16px;
}
.search-panel input {
  width: 100%; min-height: 44px; background: var(--card); border: 0; border-radius: 10px;
  padding: 0 12px; margin-bottom: 8px; outline: none;
}

.live-type { margin-top: 8px; }
