/* DeFi LP True PnL Scanner — matches DeFi kanban redesign vibe */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e14;
  --bg-glow: radial-gradient(1200px 500px at 50% -200px, rgba(80, 120, 255, 0.10), transparent 70%);
  --surface: #11161e;
  --surface-2: #161d27;
  --surface-3: #1c2532;
  --border: #222b37;
  --border-strong: #324055;
  --text: #e9eef5;
  --text-2: #b3bdcb;
  --text-3: #8591a3;
  --accent: #7c9cff;
  --accent-strong: #4f74ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 156, 255, 0.14);
  --pos: #34d399;
  --neg: #f87171;
  --gA: #22c55e; --gA-text: #4ade80;
  --hot: #ff6b6b; --hot-solid: #e5484d;
  --amber: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.10); --warn-border: #d69e1a; --warn-text: #fde68a;
  --danger-bg: rgba(248, 113, 113, 0.12); --danger-border: #ef4444; --danger-text: #fecaca;
  --ok-bg: rgba(94, 234, 212, 0.10); --ok: #5eead4;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
  --bar-bg: rgba(10, 14, 20, 0.82);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-glow: radial-gradient(1200px 500px at 50% -220px, rgba(79, 116, 255, 0.10), transparent 70%);
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --surface-3: #eceff4;
  --border: #e1e5ec;
  --border-strong: #c9d0db;
  --text: #0f1724;
  --text-2: #3d4757;
  --text-3: #5d6878;
  --accent: #2f55e4;
  --accent-strong: #2448d0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 85, 228, 0.09);
  --pos: #047857;
  --neg: #b91c1c;
  --gA: #047857; --gA-text: #047857;
  --hot: #b91c1c; --hot-solid: #c81e1e;
  --amber: #92400e;
  --warn-bg: #fff6dc; --warn-border: #d97706; --warn-text: #6b3a06;
  --danger-bg: #fee2e2; --danger-border: #dc2626; --danger-text: #7f1d1d;
  --ok-bg: #dff5f1; --ok: #0f766e;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.10);
  --bar-bg: rgba(245, 246, 248, 0.86);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "PingFang HK", "PingFang TC", "Hiragino Sans CNS", "Noto Sans HK", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }

.site-header { padding: calc(10px + env(safe-area-inset-top)) 0 6px; }
.header-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--gA) 0%, var(--accent-strong) 100%);
  box-shadow: 0 4px 14px rgba(79, 116, 255, 0.35);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 7px; right: 7px; bottom: 7px; height: 14px;
  background: rgba(255,255,255,0.92);
  clip-path: polygon(0 70%, 28% 40%, 48% 58%, 100% 10%, 100% 100%, 0 100%);
  opacity: 0.95;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-weight: 750; font-size: 16px; letter-spacing: 0.01em; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
[data-theme="dark"] .theme-icon-moon, [data-theme="light"] .theme-icon-sun { display: none; }

.app-wrap { max-width: 1100px; margin: 0 auto; padding: 4px 16px 32px; }

.hero { margin: 8px 0 16px; }
.hero-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: 0.01em; }
.hero-lead { margin: 0 0 14px; color: var(--text-2); font-size: 14.5px; max-width: 62ch; }

.scan-form { margin-bottom: 12px; }
.scan-row { display: flex; gap: 8px; flex-wrap: wrap; }
.addr-input {
  flex: 1 1 220px; min-width: 0; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
}
.addr-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary {
  height: 44px; padding: 0 18px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--accent-strong); color: var(--accent-ink); font-weight: 700; font-size: 14.5px;
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.65; cursor: progress; }
.scan-opts { margin-top: 10px; }
.check-label {
  display: inline-flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.check-label input { margin-top: 3px; accent-color: var(--accent-strong); }

.chip-row {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}

.banner {
  margin: 10px 0 14px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px;
  display: flex; flex-direction: column; gap: 4px;
}
.banner-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.banner-ok { background: var(--ok-bg); border: 1px solid var(--ok); color: var(--ok); }
.banner strong { font-weight: 750; }

.progress-panel {
  margin: 0 0 18px; padding: 14px 14px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-title { margin: 0; font-size: 18px; font-weight: 800; }
.progress-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); font-size: 14px; }
.progress-track {
  height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-bottom: 12px;
}
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--gA), var(--accent-strong));
  transition: width 0.35s ease;
}
.stage-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 6px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .stage-list { grid-template-columns: repeat(3, 1fr); }
}
.stage {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid transparent; font-size: 13px; color: var(--text-3);
}
.stage::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none;
}
.stage.is-active {
  color: var(--text); border-color: var(--accent); background: var(--accent-soft);
}
.stage.is-active::before {
  background: var(--accent); box-shadow: 0 0 0 3px rgba(124,156,255,0.25);
  animation: pulse 1.2s ease infinite;
}
.stage.is-done { color: var(--gA-text); }
.stage.is-done::before { background: var(--gA); }
.stage.is-blocked { color: var(--amber); }
.stage.is-blocked::before { background: var(--amber); }
@keyframes pulse { 50% { opacity: 0.55; } }
.progress-detail { margin: 10px 0 0; font-size: 12.5px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 4px 2px 10px; flex-wrap: wrap;
}
.section-note { margin: 0; font-size: 12.5px; color: var(--text-3); }

.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.pnl-table {
  width: 100%; border-collapse: collapse; min-width: 860px; font-size: 13px;
}
.pnl-table th, .pnl-table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top;
}
.pnl-table th {
  font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface-2);
  white-space: nowrap; position: sticky; top: 0;
}
.pnl-table tbody tr:last-child td { border-bottom: none; }
.pnl-table tbody tr:hover td { background: var(--surface-2); }
.pos-cell { min-width: 200px; }
.chain-cell { white-space: nowrap; width: 1%; }
.pos-name { font-weight: 650; line-height: 1.35; }
.pos-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
}
.tag-open { background: rgba(34,197,94,0.15); color: var(--gA-text); }
.tag-closed { background: var(--surface-3); color: var(--text-3); }
.cell-missing { color: var(--text-3); }
.cell-pos { color: var(--pos); font-weight: 650; }
.cell-neg { color: var(--neg); font-weight: 650; }
.cell-note { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); font-weight: 400; }

.summary-card {
  margin-top: 14px; padding: 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
}
.summary-title { margin: 0 0 8px; font-size: 15px; font-weight: 750; }
.summary-body { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.footnotes {
  margin: 12px 0 0; padding: 0 0 0 18px; color: var(--text-3); font-size: 12.5px;
}
.footnotes li { margin-bottom: 4px; }

.chain-notes {
  margin-top: 12px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.chain-notes summary { cursor: pointer; font-weight: 650; color: var(--text-2); }
.chain-notes ul { margin: 10px 0 4px; padding-left: 18px; color: var(--text-3); }
.chain-notes li { margin-bottom: 4px; }

.empty-hint {
  margin: 24px 0; padding: 20px; text-align: center; color: var(--text-3);
  border: 1px dashed var(--border); border-radius: 14px; background: var(--surface-2);
}
.link-btn {
  background: none; border: none; padding: 0; color: var(--accent); cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  text-decoration: underline;
}

.site-footer {
  max-width: 1100px; margin: 0 auto; padding: 8px 16px 28px;
  color: var(--text-3); font-size: 12.5px; text-align: center;
}
.site-footer p { margin: 0 0 4px; }
.footer-sub { opacity: 0.9; }

.tag-venue {
  background: rgba(124, 92, 255, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(124, 92, 255, 0.35);
}
