: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;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  --tabbar-h: 52px;
  --nav-h: 52px;
}
* { 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, "Helvetica Neue", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
.tabular, .num, .odometer, .pill, .mult, .price-big, .chart-y {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
#shell { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
#views {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-bot) + 28px);
}
.view.active { display: block; }

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-top) + 8px) var(--gutter) 8px;
  min-height: calc(var(--nav-h) + var(--safe-top));
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.avatar {
  width: 36px; height: 36px; min-width: 36px;
  border: 0; border-radius: 18px;
  background: var(--card2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.nav-title {
  flex: 1;
  background: none; border: 0;
  text-align: left;
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 0;
  min-height: 44px;
}
.nav-title .chev { color: var(--tertiary); font-weight: 500; }
.nav-actions { display: flex; gap: 2px; }
.icon-btn {
  width: 44px; height: 44px;
  border: 0; background: none;
  color: var(--text);
  position: relative;
  display: grid; place-items: center;
}
.icon-btn .dot {
  position: absolute; top: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
}

/* Error bar */
#error-bar {
  position: fixed; left: 0; right: 0; top: var(--safe-top);
  z-index: 40;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  padding: 8px var(--gutter);
  text-align: center;
}
#error-bar[hidden] { display: none; }

/* Token gate */
.gate {
  min-height: 100%;
  padding: calc(var(--safe-top) + 80px) var(--gutter) 40px;
  display: flex;
  justify-content: center;
}
.gate[hidden], #shell[hidden] { display: none !important; }
.gate-card { width: 100%; max-width: 390px; }
.gate-kicker { color: var(--secondary); font-size: 13px; margin-bottom: 8px; }
.gate h1 {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-size: 28px; font-weight: 700; letter-spacing: -0.03em;
  margin: 0 0 8px;
}
.gate p { color: var(--secondary); margin: 0 0 20px; }
.gate-error { color: var(--red) !important; }
.gate input, input[type="password"], input[type="text"], input[type="number"], input[type="search"], input[type="time"], select {
  width: 100%;
  background: var(--card);
  border: 0;
  border-radius: 12px;
  padding: 14px 14px;
  min-height: 44px;
  outline: none;
  margin-bottom: 12px;
  color: var(--text);
}
.btn-primary {
  width: 100%;
  min-height: 50px;
  border: 0; border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 17px;
}
.btn-primary.danger { background: var(--red); }
.btn-text {
  background: none; border: 0;
  color: var(--blue);
  min-height: 44px;
  padding: 0 8px;
  font-weight: 500;
}
.btn-text.block { width: 100%; }

/* Home balance */
.balance-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}
.odometer {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-size: 66px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  display: flex;
  align-items: flex-start;
  height: 1em;
  overflow: hidden;
}
.odometer .digit-wrap {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  position: relative;
}
.odometer .digit-col {
  display: flex;
  flex-direction: column;
}
.odometer .digit-col .d {
  display: block;
  height: 1em;
  line-height: 1em;
}
.odometer .lit { display: inline-block; line-height: 1em; }
@media (prefers-reduced-motion: reduce) {
  .odometer .digit-col { transition: none; }
  .skel { animation: none !important; opacity: 0.7; }
}
.badge-paper {
  background: var(--orange);
  color: #000;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
  margin-top: 10px;
  line-height: 1.2;
}
.today-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
  color: var(--secondary);
  font-size: 15px;
}
.today-row .up { color: var(--green); }
.today-row .down { color: var(--red); }
.mult {
  background: var(--green);
  color: #000;
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 3px 8px;
}

/* Chart */
.chart-card { margin: 0 0 16px; }
.chart-wrap { position: relative; height: 180px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.ranges {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  gap: 4px;
}
.ranges button {
  flex: 1;
  min-height: 32px;
  border: 0; background: none;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 6px 0;
}
.ranges button.on { color: var(--green); background: rgba(0, 211, 90, 0.12); }

/* Live screen */
.screen-card {
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 18px;
}
.screen-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
}
.screen-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 160ms linear;
}
.screen-frame img.show { opacity: 1; }
.screen-tag, .screen-lane {
  position: absolute;
  top: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex; align-items: center; gap: 6px;
}
.screen-tag { left: 10px; }
.screen-lane { right: 10px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.live-dot.grey { background: #8e8e93; }
.screen-meta {
  padding: 12px 14px 14px;
  font-size: 13px;
  color: var(--secondary);
}
.checks { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }
.check {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--card2);
  display: inline-block;
}
.check.ok { background: var(--green); }
.check.no { background: var(--red); }
.check.na { background: var(--tertiary); }

/* Section heads */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 0 10px;
}
.section-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.section-head a, .section-head button.link {
  background: none; border: 0; color: var(--blue);
  font-size: 15px; min-height: 44px; padding: 0;
}

/* Carousel */
.carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 8px;
  -webkit-overflow-scrolling: touch;
}
.bot-card, .bot-full {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
}
.bot-card {
  min-width: 78%;
  scroll-snap-align: start;
  flex: 0 0 78%;
}
.bot-name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.bot-name .swatch { width: 8px; height: 8px; border-radius: 50%; }
.bot-sub { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.layers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 10px 0; }
.layer-strip { height: 6px; border-radius: 3px; background: var(--card2); }
.layer-strip.ok { background: var(--green); }
.layer-strip.no { background: var(--red); }
.ring-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.score-ring { width: 44px; height: 44px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill {
  font-size: 12px; font-weight: 600;
  padding: 4px 8px; border-radius: 999px;
  background: var(--card2); color: var(--text);
}
.pill.red { color: var(--red); }
.pill.green { color: var(--green); }
.pill.cyan { color: var(--cyan); }
.strike { color: var(--red); text-decoration: line-through; }

/* Rows */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--sep);
  text-decoration: none;
  color: inherit;
  background: none;
  width: 100%;
  border-left: 0; border-right: 0; border-top: 0;
  text-align: left;
}
.row .t { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--secondary); font-size: 13px; margin-top: 2px; }
.row .right { text-align: right; font-weight: 600; }
.row .right .sub { font-weight: 400; }
.row.kind-queued .title, .row.kind-pending .title { color: var(--orange); }
.row.kind-failed .title { color: var(--red); }
.empty {
  color: var(--secondary);
  text-align: center;
  padding: 32px 8px;
}

/* Bots tab */
.bot-full { margin-bottom: 12px; }
.bot-full-head { display: flex; align-items: center; gap: 10px; }
.bot-full-head .bot-name { flex: 1; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot.off { background: var(--tertiary); }
.status-dot.warn { background: var(--orange); }
.switch {
  width: 51px; height: 31px; min-width: 51px;
  border-radius: 16px; border: 0;
  background: var(--card2);
  position: relative;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 14px;
  background: #fff;
  transition: transform 200ms ease;
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.4; }
.decisions { margin-top: 8px; }
.decision { padding: 8px 0; border-top: 0.5px solid var(--sep); font-size: 13px; }
.decision a { color: var(--blue); text-decoration: none; }

/* Account */
.seg {
  display: flex; background: var(--card); border-radius: 12px; padding: 2px; margin: 8px 0 16px;
}
.seg button {
  flex: 1; min-height: 36px; border: 0; background: none;
  border-radius: 10px; color: var(--secondary); font-weight: 600;
}
.seg button.on { background: var(--card2); color: var(--text); }
.cash-block { margin-bottom: 16px; }
.cash-block .label { color: var(--secondary); font-size: 13px; }
.cash-block .val {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-size: 34px; font-weight: 700; letter-spacing: -0.03em;
  margin: 4px 0;
}
.acct-links { display: flex; flex-direction: column; }
.acct-links .row { min-height: 48px; }
.group { margin: 22px 0 8px; }
.group h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.setting { padding: 12px 0; border-bottom: 0.5px solid var(--sep); }
.setting .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.setting .lab span:last-child { color: var(--secondary); }
.setting input[type="range"] {
  width: 100%; margin: 8px 0 4px; padding: 0; min-height: 24px;
  background: transparent; accent-color: var(--blue);
}
.setting .exact {
  display: flex; gap: 8px; align-items: center;
}
.setting .exact input { margin: 0; flex: 1; }
.setting .err { color: var(--red); font-size: 12px; margin-top: 4px; }
.hook { color: var(--secondary); font-size: 13px; }

/* Copy picks (Account tab) */
.copy-picks { margin: 8px 0 24px; }
.copy-picks > h3 {
  margin: 16px 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.copy-pick-card {
  background: #1c1c1e;
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 0 10px;
}
.copy-pick-card .head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.copy-pick-card .handle { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.copy-pick-card .rank { color: var(--secondary); font-weight: 600; margin-right: 6px; }
.copy-pick-pnls { display: flex; gap: 12px; margin: 8px 0 4px; }
.copy-pick-pnls .pnl { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.copy-pick-meta { color: var(--secondary); font-size: 13px; margin: 2px 0; }
.copy-pick-why { color: var(--secondary); font-size: 13px; margin: 8px 0 4px; line-height: 1.35; }
.copy-pick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 8px; }
.copy-pick-actions a {
  flex: 1; min-height: 44px; min-width: 120px;
  border-radius: 12px; background: var(--card2);
  color: var(--text); text-decoration: none; font-weight: 600;
  display: grid; place-items: center; padding: 0 12px;
}
.copy-pick-copy {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 44px; padding-top: 4px;
  border-top: 0.5px solid var(--sep);
}
.copy-pick-copy .lab { font-size: 15px; font-weight: 600; }
.copy-pick-copy .sub { color: var(--secondary); font-size: 12px; margin-top: 2px; }
.copy-picks .note { color: var(--orange, #ff9f0a); font-size: 13px; margin: 6px 0 10px; }
.copy-picks-history { margin-top: 8px; }
.copy-picks-history h4 {
  margin: 16px 0 8px; font-size: 17px; font-weight: 700;
}
.copy-hist {
  background: #1c1c1e; border-radius: 14px; padding: 12px 16px; margin: 0 0 8px;
}
.copy-hist .when { font-weight: 600; }
.copy-hist .who { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.copy-picks-foot { margin: 12px 0 8px; }
.copy-picks-foot a { color: var(--blue); text-decoration: none; font-weight: 600; }


/* Coin / audit */
.back {
  background: none; border: 0; color: var(--blue);
  min-height: 44px; padding: 0; margin: 0 0 4px;
  font-size: 17px;
}
.coin-head { display: flex; align-items: flex-start; gap: 8px; }
.coin-head h1 { font-size: 28px; margin: 0; letter-spacing: -0.03em; flex: 1; }
.shield {
  background: var(--card2); color: var(--cyan);
  border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 700;
  margin-top: 6px;
}
.price-big {
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, system-ui, sans-serif;
  font-size: 40px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0 4px;
}
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 14px 0; }
.stat { background: var(--card); border-radius: 12px; padding: 10px; }
.stat .k { color: var(--secondary); font-size: 11px; }
.stat .v { font-weight: 600; margin-top: 4px; }
.two-btns { display: flex; gap: 10px; margin: 16px 0; }
.two-btns a, .two-btns button {
  flex: 1; min-height: 50px; border-radius: 14px; border: 0;
  display: grid; place-items: center; text-decoration: none;
  font-weight: 600;
}
.btn-card { background: var(--card2); color: var(--text); }
.btn-sell { background: var(--red); color: #fff; }

/* Audit discs */
.discs { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0 8px; }
.disc {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  position: relative;
}
.disc.ok { background: var(--green); color: #000; }
.disc.no { background: var(--red); color: #fff; }
.disc.beam { box-shadow: 0 0 0 3px rgba(100, 210, 255, 0.45); }
.layer-list .item { padding: 10px 0; border-bottom: 0.5px solid var(--sep); }
.layer-list .item .n { color: var(--secondary); font-size: 12px; }

/* Sheets / fullscreen */
.sheet {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end;
}
.sheet[hidden], .fullscreen[hidden] { display: none !important; }
.sheet-card {
  width: 100%;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 12px var(--gutter) calc(var(--safe-bot) + 16px);
}
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: var(--card2); margin: 4px auto 12px; }
.sheet-card h2 { margin: 0 0 6px; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input { margin: 0; flex: 1; }
.pct-row { display: flex; gap: 8px; margin: 16px 0; }
.pct-row button {
  flex: 1; min-height: 44px; border: 0; border-radius: 12px;
  background: var(--card2); font-weight: 600;
}
.pct-row button.on { background: var(--red); color: #fff; }
.fullscreen {
  position: fixed; inset: 0; z-index: 35;
  background: #000;
  display: flex; flex-direction: column;
}
.fs-bar {
  display: flex; justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) var(--gutter) 8px;
}
#fs-img { flex: 1; width: 100%; object-fit: contain; touch-action: pinch-zoom; }

/* Skeletons */
.skel {
  background: var(--card);
  border-radius: 12px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bot));
  padding: 4px 8px var(--safe-bot);
  display: flex;
  justify-content: space-around;
  background: #000;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  z-index: 10;
}
.tab {
  flex: 1;
  border: 0; background: none;
  color: var(--tertiary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 44px;
  font-size: 10px;
  font-weight: 500;
}
.tab.on { color: var(--blue); }
.tab.hidden-by-sub { visibility: visible; }

.muted { color: var(--secondary); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bot) + 16px);
  transform: translateX(-50%);
  background: var(--card2);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  z-index: 50;
  font-size: 14px;
  max-width: 90%;
}
