:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --surface-2: #1a232e;
  --line: #243040;
  --text: #e6edf3;
  --muted: #8b98a7;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #f05252;
  --red-soft: rgba(240, 82, 82, 0.14);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, 0.14);
  --blue: #4c9cff;
  --radius: 14px;
  --tabs-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

button, input { font: inherit; color: inherit; }

a { color: var(--blue); text-decoration: none; }

.hidden { display: none !important; }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.back {
  border: 0; background: none; font-size: 30px; line-height: 1; padding: 0 6px 0 0; cursor: pointer; color: var(--blue);
}
.feed { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.feed.on .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.feed.off .dot { background: var(--red); }

main {
  padding: 12px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 640px;
  margin: 0 auto;
}

/* Bottom tabs */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(19, 26, 34, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.tabs a.active { color: var(--text); }

/* Cards and lists */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card h2 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

.alert {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 8px; color: var(--text);
}
.alert:active { background: var(--surface-2); }
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--muted); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.alert .main { flex: 1; min-width: 0; }
.alert .line1 { display: flex; gap: 8px; align-items: baseline; }
.alert .token { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert .line2 { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert .right { text-align: right; flex: none; }
.alert .right span { display: block; }
.alert .sol { font-weight: 700; font-variant-numeric: tabular-nums; }
.alert .when { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.badge.buy, .badge.watch, .badge.ok { background: var(--green-soft); color: var(--green); }
.badge.sell, .badge.insider, .badge.bad { background: var(--red-soft); color: var(--red); }
.badge.maybe, .badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }

/* Token page */
.token-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.token-head .avatar { width: 56px; height: 56px; font-size: 16px; }
.token-head h2 { margin: 0; font-size: 20px; }
.mint { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }

.links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #04130a; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

input[type="text"] {
  width: 100%; min-height: 44px; padding: 10px 12px; margin-bottom: 8px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
}
input[type="text"]:focus { outline: 2px solid var(--blue); outline-offset: 0; }

.wallet { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.wallet:first-child { border-top: 0; }
.wallet .main { flex: 1; min-width: 0; }
.wallet .name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet .meta { display: block; color: var(--muted); font-size: 12px; }
.wallet .sol { font-weight: 700; font-variant-numeric: tabular-nums; }
.wallet .score { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.icon-btn {
  border: 0; background: none; color: var(--muted); font-size: 20px; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
}

.strategy summary { list-style: none; cursor: pointer; }
.strategy summary::-webkit-details-marker { display: none; }
.strategy-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.strategy-head .name { font-weight: 700; font-size: 16px; }
.strategy-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.strategy[open] .checks { margin-top: 10px; }
.ok-text { color: var(--green); }
.bad-text { color: var(--red); }
.neutral-text { color: var(--text); }
a.wallet { color: var(--text); }

.icon-btn.bell { display: inline-flex; align-items: center; justify-content: center; color: var(--green); }
.icon-btn.bell.muted { color: var(--muted); }

.steps { margin: 6px 0 0; padding-left: 20px; }
.steps li { margin: 4px 0; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px);
  max-width: 520px; margin: 0 auto; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); z-index: 20;
}
