: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;
  --card-2: #2c2c2e;
  --green: #00d35a;
  --red: #ff453a;
  --orange: #ff9f0a;
  --cyan: #64d2ff;
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --pink: #ff6b9a;
  --gutter: 16px;
  --tabbar-h: 49px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.3;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body { height: 100dvh; height: 100vh; }
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}
button, input, select { font: inherit; color: inherit; background: none; border: none; }
.tap { min-width: 44px; min-height: 44px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.tabular, .odometer, .today-pct, .multiplier-pill, .price-big, .stat-val, .activity-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.error-banner {
  position: sticky; top: 0; z-index: 40;
  padding: 8px var(--gutter);
  padding-top: calc(8px + var(--safe-top));
  background: #1c0b0b;
  color: var(--red);
  font-size: 13px;
}
.error-banner.hidden { display: none !important; }

.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(6px + var(--safe-top)) var(--gutter) 6px;
  min-height: calc(44px + var(--safe-top));
  gap: 8px;
}
.nav-title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.back-btn { font-size: 28px; line-height: 1; color: var(--blue); min-width: 44px; text-align: left; }
.navbar-right { display: flex; align-items: center; gap: 2px; }
.avatar-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
}
.avatar-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card-2); display: grid; place-items: center;
  font-weight: 600; font-size: 15px;
}
.brand {
  flex: 1; text-align: left; font-size: 17px; font-weight: 600;
  min-height: 44px;
}
.brand .chev { color: var(--secondary); font-weight: 400; }
.icon-btn { position: relative; color: var(--text); display: grid; place-items: center; }
.bell-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
}

.view {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bot) + 16px);
}
.tab-view { display: none; }
.tab-view.is-active { display: block; }
.overlay-view {
  position: absolute; inset: 0; background: var(--bg); z-index: 20;
  overflow-y: auto;
  padding-bottom: calc(16px + var(--safe-bot));
}

.home-hero { padding: 8px var(--gutter) 4px; }
.balance-row { display: flex; align-items: flex-start; gap: 10px; }
.odometer {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 600;
  letter-spacing: -2px;
  line-height: 1;
  display: flex;
}
.odometer .digit {
  display: inline-block; height: 1em; overflow: hidden; position: relative;
}
.odometer .digit span {
  display: flex; flex-direction: column; transition: transform 600ms ease-out;
}
.paper-badge {
  align-self: center;
  background: var(--orange);
  color: #000;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
}
.hero-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 28px; }
.today-pct { font-size: 17px; font-weight: 500; color: var(--secondary); }
.today-pct.up { color: var(--green); }
.today-pct.down { color: var(--red); }
.multiplier-pill {
  background: rgba(0, 211, 90, 0.16);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}

.chart-wrap { position: relative; height: 180px; margin: 12px 0 4px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 28px;
  color: var(--secondary); font-size: 13px; pointer-events: none;
}

.range-switch {
  display: flex; justify-content: space-between;
  padding: 4px var(--gutter);
  gap: 4px;
}
.range-btn {
  flex: 1; min-height: 44px;
  color: var(--secondary); font-size: 13px; font-weight: 600;
  border-radius: 8px;
}
.range-btn.is-active { color: var(--green); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px var(--gutter) 10px;
}
.section-head h2 { font-size: 20px; font-weight: 650; }
.see-all { color: var(--secondary); font-size: 15px; min-width: auto; padding: 0 4px; }

.agent-carousel {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 var(--gutter) 8px;
  -webkit-overflow-scrolling: touch;
}
.agent-carousel::-webkit-scrollbar { display: none; }
.agent-card {
  flex: 0 0 auto;
  width: calc(100vw - 32px);
  aspect-ratio: 504 / 470;
  border-radius: calc(42 * (100vw - 32px) / 504 * 1px);
  background: var(--card);
  padding: 18px;
  scroll-snap-align: start;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.agent-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.agent-card .card-count { font-size: 28px; font-weight: 650; font-family: var(--font-display); margin-bottom: 10px; }
.agent-card .card-sub { color: var(--secondary); font-size: 13px; margin-bottom: 8px; }
.feed { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 6px; }
.feed-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.feed-row.killed { color: var(--tertiary); }
.feed-row.killed .feed-name { text-decoration: line-through; color: var(--tertiary); }
.feed-reason { color: var(--red); font-size: 12px; }
.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.layer-strip { height: 8px; border-radius: 4px; background: var(--card-2); }
.layer-strip.ok { background: var(--green); }
.layer-strip.bad { background: var(--red); }
.layer-strip.pending { background: var(--card-2); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.pill {
  font-family: var(--font-mono);
  font-size: 11px; padding: 4px 7px; border-radius: 6px;
  background: var(--card-2); color: var(--secondary);
}
.pill.red { color: var(--red); }
.pill.green { color: var(--green); }
.progress-bar { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress-bar > i { display: block; height: 100%; background: var(--green); width: 0; }
.empty-line { color: var(--secondary); font-size: 14px; padding: 8px 0; }

.activity-list { padding: 0 var(--gutter); }
.activity-list.padded { padding-top: 4px; }
.activity-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 12px;
  border-bottom: 0.5px solid var(--sep);
  padding: 10px 0;
  width: 100%; text-align: left;
}
.activity-row:last-child { border-bottom: none; }
.activity-title { font-size: 16px; font-weight: 500; }
.activity-sub { font-size: 13px; color: var(--secondary); margin-top: 2px; }
.activity-value { font-size: 16px; font-weight: 500; text-align: right; white-space: nowrap; }
.activity-value.up { color: var(--green); }
.activity-value.down { color: var(--red); }

.agents-list { padding: 0 var(--gutter) 24px; display: flex; flex-direction: column; gap: 12px; }
.agent-full {
  background: var(--card); border-radius: 16px; padding: 16px;
}
.agent-full-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-full-name { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot.paused { background: var(--orange); }
.switch {
  width: 51px; height: 31px; border-radius: 16px;
  background: var(--card-2); position: relative; flex-shrink: 0;
}
.switch.on { background: var(--green); }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  transition: transform 180ms ease;
}
.switch.on::after { transform: translateX(20px); }
.switch.locked { opacity: 0.4; }
.agent-count { color: var(--secondary); font-size: 13px; margin: 8px 0; }
.decision {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px;
  padding: 8px 0; border-top: 0.5px solid var(--sep);
  font-size: 13px;
}
.decision time { color: var(--tertiary); font-variant-numeric: tabular-nums; }
.decision a, .decision .coin-link { color: var(--blue); text-decoration: none; }
.settings-link { color: var(--blue); font-size: 15px; margin-top: 8px; display: inline-flex; align-items: center; min-height: 44px; }

.account-body { padding: 0 var(--gutter) 40px; }
.row-card, .group-card { background: var(--card); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; padding: 12px 14px;
  border-bottom: 0.5px solid var(--sep); gap: 12px;
  width: 100%; text-align: left; color: inherit; text-decoration: none;
}
.row:last-child { border-bottom: none; }
.row-label { font-size: 16px; }
.row-value { color: var(--secondary); font-size: 15px; }
.mode-switch { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.mode-switch button {
  flex: 1; min-height: 44px; border-radius: 10px; font-weight: 600;
  color: var(--secondary);
}
.mode-switch button.is-active { background: var(--card-2); color: var(--text); }
.group-title { font-size: 13px; color: var(--secondary); margin: 8px 4px; }
.setting { padding: 10px 14px 14px; border-bottom: 0.5px solid var(--sep); }
.setting:last-child { border-bottom: none; }
.setting-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.setting-key { font-size: 14px; }
.setting input[type="number"], .setting input[type="text"], .setting select, .stack-field {
  background: var(--card-2); border-radius: 8px; padding: 8px 10px;
  min-height: 44px; width: 110px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.stack-field { width: 100%; text-align: left; margin-top: 8px; }
.setting input[type="range"] { width: 100%; accent-color: var(--blue); min-height: 44px; }
.copied { color: var(--green); font-size: 13px; }

.auditor-body, .coin-body { padding: 0 var(--gutter) 32px; }
.disc-stack { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 12px 0 20px; position: relative; height: 200px; }
.disc {
  width: 72%; height: 28px; border-radius: 50%;
  background: var(--card-2);
  position: absolute; left: 14%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--tertiary);
  transition: background 150ms ease, color 150ms ease;
}
.disc.ok { background: rgba(0, 211, 90, 0.35); color: var(--green); }
.disc.bad { background: rgba(255, 69, 58, 0.35); color: var(--red); }
.disc.active { outline: 1.5px solid var(--cyan); }
.beam {
  position: absolute; left: 8%; right: 8%; height: 3px;
  background: var(--cyan); border-radius: 2px; opacity: 0;
  pointer-events: none;
}
.layer-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 0.5px solid var(--sep);
  font-size: 15px;
}
.layer-row .val { color: var(--secondary); text-align: right; }
.layer-row.ok .val { color: var(--green); }
.layer-row.bad .val { color: var(--red); }
.layer-row.skip .val { color: var(--tertiary); }
.auditor-result { margin: 16px 0; }
.auditor-result h2 { font-size: 22px; font-weight: 650; margin-bottom: 4px; }
.auditor-result p { color: var(--secondary); }
.fomo-btn, .primary-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; border-radius: 14px;
  background: var(--blue); color: #fff; font-size: 17px; font-weight: 600;
  margin-top: 20px; text-decoration: none;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; min-height: 44px; }

.coin-sub { color: var(--secondary); font-size: 14px; margin-top: 2px; }
.shield { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border-radius: 8px; padding: 4px 8px; font-size: 13px; margin-top: 8px; }
.price-big { font-family: var(--font-display); font-size: 40px; font-weight: 650; letter-spacing: -1px; margin: 12px 0 4px; }
.since-entry { font-size: 15px; color: var(--secondary); }
.since-entry.up { color: var(--green); }
.since-entry.down { color: var(--red); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; }
.stat-label { color: var(--secondary); font-size: 12px; margin-bottom: 4px; }
.stat-val { font-size: 17px; font-weight: 600; }
.exit-card { background: var(--card); border-radius: 12px; padding: 14px; margin-top: 12px; }
.exit-card h3 { font-size: 15px; margin-bottom: 8px; }
.candle-wrap { height: 220px; margin: 12px 0; position: relative; }
.candle-wrap canvas { width: 100%; height: 100%; display: block; }

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  padding-bottom: var(--safe-bot);
  min-height: calc(var(--tabbar-h) + var(--safe-bot));
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--tertiary); font-size: 10px; gap: 2px; min-height: 44px;
}
.tab-btn.is-active { color: var(--blue); }
.tab-icon { font-size: 18px; line-height: 1; }

.loading-block {
  background: var(--card);
  border-radius: 8px;
  animation: pulse 1.2s ease-in-out infinite;
  color: transparent !important;
  min-height: 1em;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .loading-block { animation: none; opacity: 0.7; }
  .odometer .digit span { transition: none !important; }
}

.search-overlay {
  position: absolute; inset: 0; background: var(--bg); z-index: 25;
  padding: calc(8px + var(--safe-top)) var(--gutter) calc(16px + var(--safe-bot));
}
.search-bar { display: flex; align-items: center; gap: 8px; }
.search-bar input {
  flex: 1; background: var(--card); border-radius: 10px;
  padding: 0 12px; min-height: 44px; font-size: 16px;
}
.search-results { margin-top: 12px; }
.search-hit {
  display: block; width: 100%; text-align: left;
  padding: 12px 0; border-bottom: 0.5px solid var(--sep);
  min-height: 44px; color: inherit; text-decoration: none;
}

.modal {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; background: var(--card); border-radius: 16px 16px 0 0;
  padding: 20px var(--gutter) calc(20px + var(--safe-bot));
}
.modal-sheet h3 { font-size: 17px; margin-bottom: 8px; }
.modal-sheet p { color: var(--secondary); margin-bottom: 16px; }
.modal-sheet input {
  width: 100%; background: var(--card-2); border-radius: 10px;
  padding: 0 12px; min-height: 44px; margin-bottom: 12px;
}
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { flex: 1; border-radius: 12px; background: var(--card-2); font-weight: 600; }

.empty-state { color: var(--secondary); padding: 24px 0; font-size: 15px; text-align: left; }
