:root {
  --bg: #050506;
  --bg-2: #0a0a0d;
  --card: #111115;
  --card-2: #17171d;
  --card-3: #1f1f27;
  --line: #26262f;
  --line-soft: #1b1b22;
  --text: #f5f6fa;
  --muted: #a0a0ac;
  --dim: #666673;
  --accent: #0a84ff;
  --accent-2: #5e5ce6;
  --red: #ff453a;
  --accent-3: #64d2ff;
  --amber: #ff9f0a;
  --green: #30d158;
  --cyan: #64d2ff;
  --radius: 24px;
  --spring: cubic-bezier(.22, 1.15, .36, 1);
  --safe: env(safe-area-inset-bottom, 0px);
  --top-safe: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.hidden { display: none !important; }
code { background: #232329; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
a { color: var(--cyan); }

.app {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px calc(150px + var(--safe));
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 400px at 88% -8%, rgba(10, 132, 255, .16), transparent 65%),
    radial-gradient(560px 360px at -10% 18%, rgba(94, 92, 230, .14), transparent 65%),
    radial-gradient(720px 520px at 50% 115%, rgba(100, 210, 255, .06), transparent 70%);
}

@media (min-width: 700px) {
  .app { border-left: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); background: rgba(5, 5, 6, .72); }
}

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; background: rgba(17, 17, 21, .9);
  border: 1px solid var(--line); border-radius: 30px; padding: 28px;
  display: grid; gap: 16px; backdrop-filter: blur(30px);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .8);
  animation: pop .5s var(--spring) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }

.brand { display: flex; align-items: center; gap: 11px; }
.brand b { display: block; font-size: 15px; letter-spacing: -.2px; }
.brand small { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; }
.logo {
  width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg, #26262e, #191920);
  border: 1px solid #34343e; font-size: 12px; font-weight: 800; letter-spacing: .5px; color: #b9b9c4;
}
.brand.big .logo { width: 50px; height: 50px; font-size: 13px; }
.hint { color: var(--dim); font-size: 12px; margin: 0; }

/* ---------- chrome ---------- */
.chrome {
  position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between;
  align-items: center; padding: calc(10px + var(--top-safe)) 2px 10px; margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(5, 5, 6, .95) 65%, rgba(5, 5, 6, .55));
  backdrop-filter: blur(20px) saturate(1.3);
}
.chrome-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 11.5px; color: var(--muted); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; background: rgba(20, 20, 26, .8);
  white-space: nowrap; transition: .3s;
}
.pill.on { color: var(--green); border-color: rgba(48, 209, 88, .4); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--text); display: grid; place-items: center;
  font-size: 15px; cursor: pointer; transition: transform .2s var(--spring), background .2s;
}
.icon-btn:active { transform: scale(.88); background: var(--card-2); }

/* ---------- typography ---------- */
h1 {
  font-size: 34px; letter-spacing: -1.4px; line-height: 1.1; margin: 8px 0 4px;
  transition: transform .35s var(--spring), opacity .3s, margin .3s;
  transform-origin: left top;
}
body.scrolled h1 { transform: scale(.82) translateY(-2px); opacity: .92; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; transition: opacity .25s; }
body.scrolled .sub { opacity: .55; }
.section-title { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 1.2px; margin: 24px 3px 10px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; }
.mt { margin-top: 14px; }

/* ---------- primitives ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  padding: 11px 16px; border-radius: 15px; font-size: 14px; font-weight: 550;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .18s var(--spring), filter .2s, background .2s;
}
.btn:active { transform: scale(.95); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0; color: #fff; font-weight: 700;
  box-shadow: 0 14px 34px rgba(10, 132, 255, .32);
}
.btn.primary:active { filter: brightness(1.08); }
.btn.ghost { background: rgba(255, 255, 255, .03); }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: 12px; }
.btn.icon { width: 35px; height: 35px; padding: 0; border-radius: 50%; }
.btn.wide { width: 100%; padding: 16px; border-radius: 18px; font-size: 15.5px; }
.btn.danger { color: #ff7b72; border-color: rgba(255, 69, 58, .3); }
.btn:disabled { opacity: .45; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .032), transparent 60%), var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; position: relative;
}
.pad { padding: 17px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 10px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stack { display: grid; gap: 13px; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; color: var(--muted); padding-left: 5px; }
input, textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 14px; padding: 13px 14px; font: inherit; font-size: 15.5px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { min-height: 96px; resize: vertical; font-size: 14.5px; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  border-color: rgba(10, 132, 255, .6);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .12);
}
::placeholder { color: #55555f; }

/* iOS switch */
input[type="checkbox"] {
  appearance: none; width: 48px; height: 29px; border-radius: 99px;
  background: #2c2c35; border: 0; position: relative; cursor: pointer;
  transition: background .25s var(--spring); flex-shrink: 0;
}
input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  transition: transform .25s var(--spring);
}
input[type="checkbox"]:checked { background: var(--green); }
input[type="checkbox"]:checked::after { transform: translateX(19px); }
.account-pick input[type="checkbox"] { width: 24px; height: 24px; }
.account-pick input[type="checkbox"]::after { width: 18px; height: 18px; top: 3px; }
.account-pick input[type="checkbox"]:checked::after { transform: translateX(-1px); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat { padding: 14px; }
.stat .label { color: var(--muted); font-size: 11px; line-height: 1.25; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -1.2px; margin-top: 6px; }
.stat .value.pink { color: var(--accent); }
.stat .value.green { color: var(--green); }
.stat .value.cyan { color: var(--cyan); }

/* ---------- segmented ---------- */
.segmented {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--card); border: 1px solid var(--line-soft); padding: 4px;
  border-radius: 17px; margin-bottom: 16px; isolation: isolate;
}
.segmented::before {
  content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / var(--seg-count, 3)); border-radius: 13px;
  background: var(--card-3); box-shadow: 0 4px 16px rgba(0, 0, 0, .45);
  transform: translateX(calc(var(--seg-index, 0) * 100%));
  transition: transform .32s var(--spring);
}
.segmented button {
  border: 0; background: none; color: var(--muted); padding: 9px 6px;
  border-radius: 13px; font: inherit; font-size: 13px; cursor: pointer; transition: color .2s;
}
.segmented button.active { color: var(--text); font-weight: 650; }

/* ---------- presets ---------- */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset {
  text-align: left; border: 1px solid var(--line); background: var(--card);
  border-radius: 20px; padding: 14px; cursor: pointer; color: var(--text); font: inherit;
  transition: transform .2s var(--spring), border-color .2s, background .2s;
}
.preset:active { transform: scale(.96); }
.preset b { display: block; font-size: 14px; margin-bottom: 3px; }
.preset small { color: var(--dim); font-size: 11.5px; line-height: 1.3; display: block; }
.preset.active {
  border-color: rgba(10, 132, 255, .7);
  background: linear-gradient(160deg, rgba(10, 132, 255, .2), var(--card));
  box-shadow: 0 10px 30px rgba(10, 132, 255, .14);
}
.preset.wide { grid-column: span 2; }

/* ---------- tasks ---------- */
.task-card { padding: 15px; display: grid; gap: 9px; transition: transform .2s var(--spring); }
.task-card:active { transform: scale(.985); }
.task-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.task-title { font-weight: 620; font-size: 14.5px; }
.task-meta { color: var(--dim); font-size: 11.5px; }
.progress { height: 5px; border-radius: 99px; background: #24242b; overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--amber));
  transition: width .5s var(--spring);
}
.badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.alive, .badge.done, .badge.success { color: var(--green); border-color: rgba(48, 209, 88, .3); background: rgba(48, 209, 88, .08); }
.badge.new, .badge.queued { color: var(--cyan); border-color: rgba(100, 210, 255, .3); background: rgba(100, 210, 255, .08); }
.badge.running { color: #1a0a10; background: var(--accent); border-color: var(--accent); }
.badge.dead, .badge.failed, .badge.cancelled, .badge.error { color: #ff6961; border-color: rgba(255, 69, 58, .3); background: rgba(255, 69, 58, .1); }
.badge.paused, .badge.warn, .badge.cooldown { color: var(--amber); border-color: rgba(255, 159, 10, .3); background: rgba(255, 159, 10, .09); }
.badge.banned { color: var(--dim); }

/* ---------- lists ---------- */
.list { display: grid; gap: 9px; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 19px;
  padding: 13px 14px; transition: transform .18s var(--spring), background .2s;
}
.item:active { transform: scale(.985); }
.item.off { opacity: .5; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-size: 14px; font-weight: 580; overflow-wrap: anywhere; }
.item .note { font-size: 11.5px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.item.col { flex-direction: column; align-items: stretch; }
.item.col .item-actions { flex-wrap: wrap; margin-top: 10px; }
.item.col .title { font-size: 15px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(150deg, #33283a, #1a1a22); border: 1px solid var(--line);
  font-size: 13px; font-weight: 750; color: var(--muted);
}

.empty { text-align: center; padding: 48px 20px; color: var(--dim); animation: fadeUp .35s var(--spring); }
.empty .emoji { font-size: 44px; display: block; margin-bottom: 12px; }
.empty b { display: block; color: var(--text); font-size: 15.5px; margin-bottom: 5px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* ---------- chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 5px; height: 96px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.chart .bar span {
  border-radius: 4px; min-height: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(10, 132, 255, .18));
  animation: grow .7s var(--spring) both;
  transform-origin: bottom;
}
.chart .bar span.likes { background: linear-gradient(180deg, var(--cyan), rgba(100, 210, 255, .18)); }
@keyframes grow { from { transform: scaleY(0); } }
.chart-labels { display: flex; gap: 5px; margin-top: 7px; }
.chart-labels div { flex: 1; text-align: center; font-size: 9.5px; color: var(--dim); }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe));
  width: min(592px, calc(100% - 24px)); z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(18, 18, 23, .82); border: 1px solid #2b2b35; border-radius: 28px;
  padding: 9px 6px; backdrop-filter: blur(26px) saturate(1.6);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .7);
}
.tab {
  display: grid; justify-items: center; gap: 2px; color: var(--dim);
  text-decoration: none; font-size: 10px; padding: 3px 0; cursor: pointer;
  transition: color .2s, transform .2s var(--spring);
}
.tab:active { transform: scale(.88); }
.tab i { font-style: normal; font-size: 20px; line-height: 1; transition: transform .3s var(--spring); }
.tab.active { color: var(--accent); }
.tab.active i { transform: translateY(-1px) scale(1.12); }
.tab-space { display: block; }
.fab {
  position: absolute; left: 50%; top: -21px; transform: translateX(-50%);
  width: 60px; height: 60px; border-radius: 50%; border: 5px solid var(--bg);
  background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 29px; font-weight: 300; line-height: 1; cursor: pointer;
  box-shadow: 0 14px 34px rgba(10, 132, 255, .45);
  animation: breathe 3.4s ease-in-out infinite;
  transition: transform .2s var(--spring);
}
.fab:active { transform: translateX(-50%) scale(.9); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 14px 34px rgba(10, 132, 255, .38); }
  50% { box-shadow: 0 14px 44px rgba(10, 132, 255, .65); }
}

/* ---------- sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end;
  justify-content: center; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px);
  animation: backdrop .25s ease both;
}
@keyframes backdrop { from { opacity: 0; } }
.sheet-card {
  width: min(620px, 100%); max-height: 92vh; overflow: auto; background: var(--bg-2);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 30px 30px 0 0;
  padding: 6px 16px calc(20px + var(--safe));
  animation: sheetUp .42s var(--spring) both;
  transition: transform .28s var(--spring);
  will-change: transform;
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: #3c3c46; margin: 6px auto 12px; touch-action: none; cursor: grab; }
.sheet-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.sheet-card header h3 { margin: 0; font-size: 20px; letter-spacing: -.5px; }
.sheet-card #sheet-body { display: grid; gap: 14px; }
.sheet-card footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.sheet-card footer:empty { display: none; }

/* ---------- misc ---------- */
.drop {
  border: 1.5px dashed #34343f; border-radius: 20px; padding: 28px; text-align: center;
  color: var(--muted); cursor: pointer; transition: .2s;
}
.drop:active, .drop.over { border-color: var(--accent); background: rgba(10, 132, 255, .08); }
.file-list { display: grid; gap: 6px; margin-top: 8px; }
.file-item { display: flex; justify-content: space-between; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 13px; padding: 10px 12px; font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 12px;
  transition: transform .18s var(--spring), opacity .2s, border-color .2s;
}
.chip:active { transform: scale(.94); }
.chip.dim { opacity: .38; }
.log-line { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; animation: fadeUp .25s ease; }
.log-line:last-child { border: 0; }
.log-line .lv { font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); padding-top: 3px; }
.log-line.success .lv { color: var(--green); }
.log-line.warn .lv { color: var(--amber); }
.log-line.error .lv { color: #ff7b72; }
.log-line time { color: var(--dim); font-size: 10.5px; white-space: nowrap; }
.account-pick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; padding: 7px; display: grid; gap: 2px; }
.account-pick label { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 12px; font-size: 13px; }
.account-pick label:active { background: var(--card-2); }
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 16px 0; }
.toasts {
  position: fixed; left: 0; right: 0; bottom: calc(126px + var(--safe)); z-index: 90;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  background: rgba(29, 29, 36, .96); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 11px 15px; border-radius: 14px; font-size: 13px; max-width: min(420px, 90vw);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .7); backdrop-filter: blur(20px);
  animation: toastIn .4s var(--spring) both;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } }
.tag-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-preview span { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; font-size: 12px; animation: fadeUp .25s ease both; }
.hr { height: 1px; background: var(--line-soft); margin: 4px 0; }
.nav-list { display: grid; gap: 9px; }
.nav-list a {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 19px;
  padding: 16px; color: var(--text); text-decoration: none; font-size: 14.5px;
  transition: transform .18s var(--spring), background .2s;
}
.nav-list a:active { transform: scale(.98); background: var(--card-2); }
.nav-list a span { color: var(--dim); }

/* ---------- skeleton / pull / transition ---------- */
.skel { border-radius: var(--radius); background: var(--card); border: 1px solid var(--line-soft); overflow: hidden; position: relative; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .055) 38%, transparent 56%);
  transform: translateX(-100%); animation: shimmer 1.25s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel.line { height: 14px; border-radius: 8px; margin: 12px; }
.skel.block { height: 88px; }

#view.enter > * { animation: viewIn .4s var(--spring) both; }
#view.enter > *:nth-child(1) { animation-delay: 0s; }
#view.enter > *:nth-child(2) { animation-delay: .03s; }
#view.enter > *:nth-child(3) { animation-delay: .06s; }
#view.enter > *:nth-child(4) { animation-delay: .09s; }
#view.enter > *:nth-child(5) { animation-delay: .12s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } }

.ptr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: grid; place-items: center;
  height: 64px; pointer-events: none; opacity: 0; transform: translateY(-20px);
  transition: opacity .2s, transform .2s var(--spring);
}
.ptr.on { opacity: 1; transform: translateY(6px); }
.ptr i {
  width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid #3a3a44;
  border-top-color: var(--accent); animation: spin .8s linear infinite; display: block;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.value-big { font-size: 34px; font-weight: 800; letter-spacing: -1.4px; line-height: 1; margin-bottom: 3px; }
.delta { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.delta.up { color: var(--green); border-color: rgba(48, 209, 88, .3); background: rgba(48, 209, 88, .08); }
.delta.down { color: var(--red); border-color: rgba(255, 69, 58, .3); background: rgba(255, 69, 58, .08); }

#sec-bait, #sec-reply { scroll-margin: 120px; }
.enter-block { animation: viewIn .3s var(--spring) both; }

#mode-area { transition: opacity .13s ease, transform .13s ease; will-change: opacity, transform; }
#mode-area.swap { opacity: 0; transform: translateX(18px) scale(.995); }
#mode-area.page-in { animation: pageIn .3s var(--spring) both; }
@keyframes pageIn { from { opacity: 0; transform: translateX(-18px) scale(.995); } }

.chip.on { background: rgba(10, 132, 255, .2); border-color: rgba(10, 132, 255, .55); color: #d7ecff; }
.chip.off { border-style: dashed; opacity: .5; }
