/* MemeWatch — classic theme: navy + gold, serif headings, solid panels, smooth motion */
:root {
  --bg: #0a0e16;
  --bg-2: #0e1420;
  --panel: #121a28;
  --panel-2: #172133;
  --panel-3: #1c2840;
  --border: #22304a;
  --border-strong: #2f4163;
  --text: #ece8de;
  --text-2: #b9b4a7;
  --muted: #7f8799;
  --gold: #c9a54c;
  --gold-2: #e3c779;
  --gold-bg: rgba(201, 165, 76, 0.12);
  --green: #3fb68b;
  --green-bg: rgba(63, 182, 139, 0.12);
  --red: #e5534b;
  --red-bg: rgba(229, 83, 75, 0.12);
  --amber: #e0a43a;
  --accent: var(--gold);
  --accent-2: #6fa8dc;
  --radius: 10px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(201, 165, 76, 0.07), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 420px);
  background-color: var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.bg-grid, .glow { display: none; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
em.muted { font-style: normal; font-size: 12px; }
h2 { font: 600 17px/1.2 var(--serif); margin: 0; letter-spacing: 0.01em; color: var(--text); }
a { color: inherit; }

/* ---------- entrance animations */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes draw { from { stroke-dashoffset: var(--len, 1200); } to { stroke-dashoffset: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63, 182, 139, 0.55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(63, 182, 139, 0); } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }

.kpis > *, .col-main > *, .col-side > * { animation: rise 0.6s var(--ease) both; }
.kpis > :nth-child(2) { animation-delay: 0.05s; }
.kpis > :nth-child(3) { animation-delay: 0.1s; }
.kpis > :nth-child(4) { animation-delay: 0.15s; }
.col-main > :nth-child(2) { animation-delay: 0.15s; }
.col-side > :nth-child(1) { animation-delay: 0.2s; }
.col-side > :nth-child(2) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1320px) / 2));
  background: rgba(10, 14, 22, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  animation: fade 0.5s ease both;
}
.brand { font: 600 21px/1 var(--serif); display: flex; align-items: center; gap: 10px; letter-spacing: 0.01em; }
.brand b { color: var(--gold); font-weight: 700; }
.logo {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(145deg, var(--gold-2), var(--gold) 55%, #9c7b2c);
  color: #1a1408; font-size: 14px; font-family: Inter, sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 14px rgba(201, 165, 76, 0.25);
  transition: transform 0.6s var(--ease);
}
.brand:hover .logo { transform: rotate(180deg); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.pill-status {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
  white-space: nowrap; transition: color 0.3s, border-color 0.3s;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; transition: background 0.3s; }
.pill-status.live .dot { background: var(--green); animation: pulse 2s infinite; }
.pill-status.err { color: var(--red); border-color: rgba(229, 83, 75, 0.35); }
.pill-status.err .dot { background: var(--red); }

/* header switches */
.toggle-pill {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 5px 12px 5px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
  font-size: 12px; font-weight: 600; color: var(--muted);
  transition: border-color 0.25s, color 0.25s, background 0.25s, transform 0.15s;
}
.toggle-pill:active { transform: scale(0.96); }
.toggle-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.tp-switch { position: relative; width: 28px; height: 16px; border-radius: 16px; background: #2a3550; transition: background 0.3s; flex: none; }
.tp-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transition: transform 0.35s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle-pill:has(input:checked) { color: var(--text); border-color: rgba(63, 182, 139, 0.4); background: var(--green-bg); }
.toggle-pill input:checked + .tp-switch { background: var(--green); }
.toggle-pill input:checked + .tp-switch::after { transform: translateX(12px); }
.toggle-pill.warn:has(input:checked) { border-color: rgba(224, 164, 58, 0.45); background: rgba(224, 164, 58, 0.1); }
.toggle-pill.warn input:checked + .tp-switch { background: var(--amber); }
#tg-call:has(input:checked) .tp-label { display: inline-block; }
#tg-call input:checked ~ .tp-label { animation: none; }

/* ---------- layout */
.layout { max-width: 1320px; margin: 0 auto; padding: 22px 16px 60px; display: grid; gap: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.col-main { display: grid; gap: 22px; min-width: 0; }
.col-side { display: grid; gap: 20px; position: sticky; top: 76px; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.panel-head .muted { font-size: 12px; }
.panel-head .icon-btn { margin-left: auto; }

/* ---------- KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  display: grid; gap: 2px; min-width: 0; position: relative; overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--gold-2), var(--gold)); }
.kpi small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.kpi b { font: 600 24px/1.25 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- inputs & buttons */
input, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); background: #0c121d; }
input::placeholder { color: #4d566a; }
input.sm, select.sm { padding: 7px 10px; font-size: 13px; width: auto; }
select { cursor: pointer; }

button, .btn-link {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border-radius: 8px; padding: 10px 16px; border: 1px solid transparent;
  color: var(--text); background: transparent;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s, box-shadow 0.2s;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
button:active { transform: scale(0.96); }
button:disabled { opacity: 0.5; cursor: default; }
.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1b1508;
  border-color: #a8873a; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 14px rgba(201, 165, 76, 0.22);
}
.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(201, 165, 76, 0.35); transform: translateY(-1px); }
.ghost { border-color: var(--border-strong); background: var(--panel-2); }
.ghost:hover { background: var(--panel-3); border-color: #3b5078; }
.sm { padding: 6px 12px; font-size: 13px; }
.ghost.icon { padding: 6px 10px; font-size: 15px; }
.ghost.icon:hover { transform: rotate(45deg); }
.icon-btn { padding: 5px 9px; font-size: 13px; border-radius: 7px; color: var(--muted); }
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
.icon-btn.danger:hover, .icon-btn.confirm { color: var(--red); background: var(--red-bg); }

/* copy buttons */
.copy-btn {
  padding: 2px 7px; font-size: 11px; font-weight: 600; border-radius: 6px; gap: 4px;
  color: var(--gold); background: var(--gold-bg); border: 1px solid rgba(201, 165, 76, 0.3);
  vertical-align: 1px;
}
.copy-btn:hover { background: rgba(201, 165, 76, 0.2); }
.copy-btn.done { color: var(--green); background: var(--green-bg); border-color: rgba(63, 182, 139, 0.4); }
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-row .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- search */
.search-wrap { position: relative; }
.search-wrap input { padding-left: 42px; padding-right: 44px; font-size: 15px; height: 50px; }
.search-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-52%); color: var(--gold); font-size: 20px; pointer-events: none; }
kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 600 11px var(--mono); color: var(--muted); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 2px 7px; pointer-events: none; background: var(--panel);
}
.results {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55); padding: 6px; max-height: 420px; overflow-y: auto;
  animation: pop 0.25s var(--ease);
}
.result {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s, transform 0.2s var(--ease);
}
.result:hover, .result.active { background: var(--panel-3); }
.result:hover { transform: translateX(3px); }
.result .r-name { font-weight: 600; }
.result .r-sub { font-size: 12px; color: var(--muted); }
.result .r-right { text-align: right; font-family: var(--mono); font-size: 13px; }
.results .none { padding: 14px; color: var(--muted); text-align: center; }

/* ---------- preview */
#preview { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); animation: rise 0.4s var(--ease); }
.pv-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pv-title { flex: 1; min-width: 160px; display: grid; gap: 3px; }
.pv-name { font-size: 17px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-price { text-align: right; display: grid; gap: 6px; justify-items: end; }
.pv-price .price { font-size: 28px; }

.avatar {
  position: relative; width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; color: var(--gold);
  background: var(--panel-3); border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px rgba(201, 165, 76, 0.25);
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; box-shadow: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade 0.4s ease; }

.chain {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 2px 7px; border-radius: 4px; background: rgba(111, 168, 220, 0.12); color: var(--accent-2);
}
.age { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); }
.age.new { background: rgba(224, 164, 58, 0.14); color: var(--amber); }

.links { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.links a {
  font-size: 11px; font-weight: 600; text-decoration: none; color: var(--text-2);
  padding: 2px 8px; border-radius: 5px; border: 1px solid var(--border); background: var(--panel-2);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.links a:hover { color: var(--gold); border-color: rgba(201, 165, 76, 0.4); transform: translateY(-1px); }

.alert-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.field { display: grid; gap: 7px; font-size: 13px; }
.field > span { color: var(--text-2); font-weight: 500; }
.field.down input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.field.up input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 4px 10px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); }
.chips button:hover { transform: translateY(-1px); }
.field.down .chips button:hover { color: var(--red); border-color: rgba(229, 83, 75, 0.5); }
.field.up .chips button:hover { color: var(--green); border-color: rgba(63, 182, 139, 0.5); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }

.basis-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border-strong); position: relative; }
.seg button { padding: 6px 12px; font-size: 13px; border-radius: 6px; color: var(--muted); }
.seg button.on { background: var(--gold-bg); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(201, 165, 76, 0.45); }
.hint-k { font-size: 12px; }
.hint-k b { color: var(--text-2); font-family: var(--mono); font-weight: 500; }
.unit { font-style: normal; color: var(--muted); }

/* ---------- auto mode */
.auto-box { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr minmax(180px, 240px); gap: 12px; align-items: end;
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); transition: border-color 0.3s, background 0.3s; }
.auto-box:has(input[name=auto]:checked) { border-color: rgba(201, 165, 76, 0.45); background: linear-gradient(135deg, var(--gold-bg), var(--panel-2) 60%); }
.auto-toggle { display: flex; gap: 12px; align-items: center; cursor: pointer; font-size: 13px; }
.auto-toggle b { font-family: var(--serif); font-size: 15px; }
.auto-step { animation: rise 0.3s var(--ease); }
.auto-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 4px;
  color: #1b1508; background: linear-gradient(180deg, var(--gold-2), var(--gold));
}
.auto-badge i { display: inline-block; font-style: normal; animation: ring 2.5s ease-in-out infinite; }
.edit-form .auto-line { display: flex; align-items: center; gap: 10px; font-size: 13px; }
@media (max-width: 600px) { .auto-box { grid-template-columns: 1fr; } }

/* ---------- stats & pills */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin-top: 14px; }
.stat { padding: 7px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--border); min-width: 0; }
.stat small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat b { font-family: var(--mono); font-weight: 500; font-size: 13px; }

.changes { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: baseline; gap: 4px; font-family: var(--mono); font-size: 12px; font-weight: 500;
  padding: 2px 7px; border-radius: 5px; background: var(--panel-3); color: var(--muted);
  transition: background 0.4s, color 0.4s;
}
.pill.pos { background: var(--green-bg); color: var(--green); }
.pill.neg { background: var(--red-bg); color: var(--red); }
.pill small { opacity: 0.65; font-size: 10px; }

/* ---------- watchlist */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.count { font: 600 11px var(--mono); color: var(--gold); padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(201, 165, 76, 0.35); background: var(--gold-bg); }
.toolbar { margin-left: auto; display: flex; gap: 8px; }
.toolbar input { width: 150px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.card {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 6px 18px rgba(0, 0, 0, 0.22);
  transition: border-color 0.3s, opacity 0.3s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  animation: rise 0.55s var(--ease) both;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 2px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0; transition: opacity 0.35s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 14px 30px rgba(0, 0, 0, 0.35); }
.card:hover::before { opacity: 0.8; }
.card.off { opacity: 0.5; }
.card.armed-near { border-color: rgba(224, 164, 58, 0.45); }
.card.armed-near::before { opacity: 1; background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.card.flash-up { animation: flashUp 1.4s; }
.card.flash-down { animation: flashDown 1.4s; }
@keyframes flashUp { 0% { box-shadow: 0 0 0 1px var(--green), 0 0 36px rgba(63, 182, 139, 0.4); } }
@keyframes flashDown { 0% { box-shadow: 0 0 0 1px var(--red), 0 0 36px rgba(229, 83, 75, 0.4); } }

.card-top { display: flex; align-items: center; gap: 11px; }
.tok-meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tok-meta .pv-name { font-size: 15px; }
.tok-sub { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.tok-sub .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.addr { font-family: var(--mono); cursor: pointer; white-space: nowrap; }
.addr:hover { color: var(--text); }

.switch { position: relative; width: 36px; height: 21px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 21px; background: #2a3550; transition: background 0.3s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; transition: transform 0.35s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(15px); }

.price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price { font-family: var(--mono); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; transition: color 0.5s; }
.price.tick-up { color: var(--green); }
.price.tick-down { color: var(--red); }

.spark { height: 74px; margin: 0 -4px; cursor: pointer; position: relative; }
.spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spark .wait { fill: var(--muted); font-size: 11px; }
.spark.draw polyline { stroke-dasharray: var(--len, 1200); animation: draw 1.4s var(--ease) both; }
.spark.draw polygon { animation: fade 1.2s 0.4s ease both; }
.spark::after {
  content: "📈 full chart"; position: absolute; right: 6px; top: 2px; font-size: 11px; color: var(--gold);
  opacity: 0; transform: translateY(-3px); transition: opacity 0.25s, transform 0.25s var(--ease);
}
.spark:hover::after { opacity: 1; transform: none; }

.pressure { display: grid; gap: 5px; }
.pressure-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.pressure-head b { font-family: var(--mono); font-weight: 500; }
.pressure-head .buys { color: var(--green); }
.pressure-head .sells { color: var(--red); }
.bar { height: 5px; border-radius: 5px; background: var(--red); overflow: hidden; display: flex; }
.bar i { background: var(--green); height: 100%; transition: width 0.9s var(--ease); }

.thresholds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.th { padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); display: grid; gap: 1px; position: relative; overflow: hidden; }
.th small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; display: flex; justify-content: space-between; }
.th b { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.th .dist { font-family: var(--mono); font-size: 12px; }
.th .prog { position: absolute; left: 0; bottom: 0; height: 2px; transition: width 0.9s var(--ease); }
.th.below { border-color: rgba(229, 83, 75, 0.25); }
.th.below .dist { color: var(--red); }
.th.below .prog { background: var(--red); }
.th.above { border-color: rgba(63, 182, 139, 0.25); }
.th.above .dist { color: var(--green); }
.th.above .prog { background: var(--green); }
.th.move { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-color: rgba(224, 164, 58, 0.25); }
.th.move b { color: var(--amber); }
.th.unset { opacity: 0.38; }
.th.fired { background: rgba(224, 164, 58, 0.08); }
.badge { font-size: 9px; color: var(--amber); font-weight: 700; letter-spacing: 0.05em; animation: fade 0.8s ease infinite alternate; }

.note { font-size: 12px; color: var(--text-2); background: var(--panel-2); padding: 7px 10px; border-radius: 7px; border-left: 2px solid var(--gold); font-style: italic; }

.card-foot { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--border); padding-top: 10px; }
.card-foot .first { margin-right: auto; }

.edit-form { display: grid; gap: 10px; padding: 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); animation: rise 0.3s var(--ease); }
.edit-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-form .form-actions { justify-content: flex-end; }
.edit-form select { padding: 9px 10px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); animation: rise 0.6s var(--ease); }
.empty-icon { font-size: 34px; color: var(--gold); opacity: 0.6; animation: ring 3s ease-in-out infinite; display: inline-block; }
.empty b { color: var(--text-2); font-family: var(--serif); font-size: 17px; }

/* ---------- trending */
.trending { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.trending li {
  display: grid; grid-template-columns: 18px 30px 1fr auto 28px; gap: 10px; align-items: center;
  padding: 7px 6px; border-radius: 8px; transition: background 0.2s, transform 0.25s var(--ease);
  animation: rise 0.45s var(--ease) both;
}
.trending li:hover { background: var(--panel-2); transform: translateX(3px); }
.trending .rank { font: 600 13px var(--serif); color: var(--gold); text-align: center; }
.trending .t-name { min-width: 0; }
.trending .t-name b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trending .t-name span { font-size: 11px; color: var(--muted); }
.trending .t-right { text-align: right; font-family: var(--mono); font-size: 12px; display: grid; gap: 2px; justify-items: end; }
.trending .add-btn { padding: 4px 0; width: 28px; border-radius: 7px; color: var(--muted); border: 1px solid var(--border); font-size: 15px; line-height: 1; }
.trending .add-btn:hover { color: #1b1508; border-color: var(--gold); background: var(--gold); transform: rotate(90deg); }
.skel {
  padding: 10px 6px; border-radius: 8px; color: transparent !important; min-height: 38px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-3) 50%, var(--panel-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite !important;
}
.skel.msg { color: var(--muted) !important; background: none; animation: none !important; }

/* ---------- events */
.events { list-style: none; margin: 0; padding: 0; display: grid; max-height: 420px; overflow-y: auto; }
.events li { display: grid; grid-template-columns: 8px 1fr; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); animation: rise 0.4s var(--ease) both; }
.events li:last-child { border-bottom: none; }
.events .ev-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--amber); }
.events .ev-dot.above { background: var(--green); }
.events .ev-dot.below { background: var(--red); }
.events .ev-title { font-weight: 600; font-size: 13px; white-space: pre-line; }
.events .ev-meta { color: var(--muted); font-size: 11px; display: flex; gap: 8px; flex-wrap: wrap; }
.events .ok { color: var(--green); }
.events .off { color: var(--muted); }
.events .fail { color: var(--red); }
.events .none { color: var(--muted); padding: 12px 2px; display: block; font-size: 13px; }

/* ---------- dialogs */
dialog {
  width: min(540px, calc(100vw - 32px));
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 14px; padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
dialog[open] { animation: pop 0.35s var(--ease); }
dialog.wide { width: min(1100px, calc(100vw - 32px)); padding: 16px; }
dialog::backdrop { background: rgba(4, 6, 10, 0.7); backdrop-filter: blur(4px); animation: fade 0.3s ease; }
.dlg-head { display: flex; align-items: center; gap: 10px; }
.dlg-head .btn-link { margin-left: auto; }
.dlg-head h2 { font-size: 21px; margin-right: auto; }
.chart-frame { margin-top: 12px; height: min(640px, 72vh); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.chart-frame iframe { width: 100%; height: 100%; border: 0; }
#settings-form { display: grid; gap: 16px; }
.step-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 10px; background: var(--panel-2); }
.step-box > b, .box-head b { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.step-box summary { cursor: pointer; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.push-site { display: flex; gap: 14px; align-items: center; }
.qr { flex: none; background: #fff; padding: 8px; border-radius: 8px; line-height: 0; animation: pop 0.4s var(--ease); }
.qr img, .qr canvas { width: 112px !important; height: 112px !important; }
.push-site-text { display: grid; gap: 6px; min-width: 0; }
.push-site-text a { color: var(--accent-2); font-size: 13px; word-break: break-all; }

/* ---------- toast */
.toast {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--panel-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--gold);
  padding: 11px 18px; border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.35s var(--ease); max-width: calc(100vw - 32px);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.error { border-left-color: var(--red); color: #ffd0cc; }
.toast.success { border-left-color: var(--green); }

/* ---------- lock screen (VPS, opened outside Telegram) */
.lock { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(10, 14, 22, 0.96); animation: fade 0.4s ease; }
.lock-card { text-align: center; display: grid; gap: 10px; justify-items: center; max-width: 340px; animation: pop 0.5s var(--ease); }
.lock-card h2 { font-size: 24px; }
.logo.big { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; display: grid; place-items: center; }

/* ---------- inside Telegram Mini App */
body.in-tg .top { padding-top: calc(10px + var(--tg-content-safe-area-inset-top, 0px) + var(--tg-safe-area-inset-top, 0px)); }
body.in-tg kbd { display: none; }
body.in-tg .layout { padding-bottom: calc(40px + var(--tg-safe-area-inset-bottom, 0px)); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  .col-side { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .col-side { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  #status-text { display: none; }
  .pv-price { text-align: left; justify-items: start; width: 100%; }
  .toolbar { margin-left: 0; width: 100%; }
  .toolbar input { flex: 1; }
  .push-site { flex-direction: column; align-items: flex-start; }
  /* 16px stops iOS from zooming into inputs on focus */
  input, select { font-size: 16px; }
  input.sm, select.sm { font-size: 16px; }
}
@media (max-width: 520px) {
  .toggle-pill .lbl { display: none; }
  .brand { font-size: 18px; }
  .top { gap: 10px; }
  .card:hover { transform: none; }
}
