/* Gift Hunter panel — RTL, light + dark. */
:root {
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-xl: 16px;
  --side: 252px; --top: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.36, .5, 1);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #F9F8F7; --surface: #FFFFFF; --surface-2: #FBFAF9; --surface-3: #F0EFED; --hover: #F4F3F1;
  --side-bg: #F6F5F3; --glass: rgba(249, 248, 247, .8);
  --border: #E6E5E3; --border-strong: #D3D1CC; --control: #8C8984;
  --text: #2C2C2B; --text-2: #6B6863; --text-3: #8C8984;
  --accent: #2783DE; --accent-ink: #1F6FC0; --accent-soft: #E5F2FC; --accent-btn: #1F74CC; --on-accent: #FFFFFF;
  --green: #46A171; --green-ink: #2E7D53; --green-soft: #E8F1EC;
  --orange: #D5803B; --orange-ink: #A35A1E; --orange-soft: #FBEBDE;
  --red: #E56458; --red-ink: #C2412F; --red-soft: #FCE9E7;
  --gold: #E3A008; --gold-ink: #94650A; --gold-soft: #FDF3D7;
  --switch-off: #A29E98;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 12px rgba(0, 0, 0, .04);
  --shadow-lg: 0 18px 48px rgba(28, 25, 20, .14), 0 2px 8px rgba(0, 0, 0, .06);
  --art-shadow: 0 14px 34px rgba(40, 30, 20, .18);
  --ambient: .30;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191919; --surface: #202020; --surface-2: #1D1D1D; --surface-3: #2B2B2A; --hover: #2A2A29;
  --side-bg: #1C1C1C; --glass: rgba(25, 25, 25, .78);
  --border: rgba(255, 255, 255, .10); --border-strong: rgba(255, 255, 255, .20); --control: rgba(255, 255, 255, .45);
  --text: #FFFFFF; --text-2: rgba(255, 255, 255, .65); --text-3: rgba(255, 255, 255, .45);
  --accent: #5E9FE8; --accent-ink: #7FB4F0; --accent-soft: rgba(94, 159, 232, .13); --accent-btn: #5E9FE8; --on-accent: #08131F;
  --green: #72BC8F; --green-ink: #7CC69A; --green-soft: rgba(114, 188, 143, .12);
  --orange: #DE9255; --orange-ink: #E8A46D; --orange-soft: rgba(222, 146, 85, .12);
  --red: #E97366; --red-ink: #F08679; --red-soft: rgba(233, 115, 102, .12);
  --gold: #EAC26B; --gold-ink: #EAC26B; --gold-soft: rgba(234, 194, 107, .12);
  --switch-off: rgba(255, 255, 255, .34);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .22);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);
  --art-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  --ambient: .42;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s, color .25s;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.n { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }
.star { width: .92em; height: .92em; fill: var(--gold); flex: none; display: inline-block; vertical-align: -.1em; margin-inline-start: 2px; }
.amt { display: inline-flex; align-items: center; gap: 1px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; font-weight: 700; }
.pos { color: var(--green-ink); }
.neg { color: var(--red-ink); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block; flex: none;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor;
  animation: spin .8s linear infinite;
}
.boot { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 20px; color: var(--text-2); }
.boot img { border-radius: 16px; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px 16px; background: var(--side-bg); border-inline-end: 1px solid var(--border); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 22px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 6px 16px rgba(47, 111, 228, .28); }
.brand b { display: block; font-size: 16.5px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.brand small { display: block; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 13px; color: var(--text-3); padding: 14px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r);
  color: var(--text-2); font-weight: 600; transition: background-color .15s, color .15s;
}
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a .count {
  margin-inline-start: auto; min-width: 24px; padding: 0 8px; border-radius: 999px; text-align: center;
  font-size: 12.5px; line-height: 22px; background: var(--surface-3); color: var(--text-2);
}
.nav a.active .count { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-ink); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.acct {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 0;
}
.acct:hover { text-decoration: none; border-color: var(--border-strong); }
.acct-main { min-width: 0; flex: 1; }
.acct-main b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-main > span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: 15px; color: #fff; background: linear-gradient(135deg, #4DA3FF, #6A4FE0);
}
.demo-chip {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r);
  background: var(--orange-soft); color: var(--orange-ink); font-size: 13.5px; font-weight: 600; line-height: 1.5;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.ok { background: var(--green); }
.dot.warn { background: var(--orange); }
.dot.err { background: var(--red); }
.dot.live { background: var(--green); animation: ping 2s infinite; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 32px; background: var(--glass); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.top-logo { display: none; }
.top-title { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.top-title h1 { font-size: 18px; font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.top-title p { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.run {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding-inline: 14px 6px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s;
}
.run:hover { border-color: var(--control); }
.run .switch { pointer-events: none; }
.run.on { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green-ink); }
.view { width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 32px 80px; }
.bnav { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 14.5px; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-btn); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-btn) 88%, var(--text)); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-go { background: var(--green); border-color: transparent; color: #fff; }
html[data-theme="light"] .btn-go { background: #2E8A5C; }
.btn-go:hover { filter: brightness(1.06); background: var(--green); }
html[data-theme="light"] .btn-go:hover { background: #2E8A5C; }
.btn-stop { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red-ink); }
.btn-stop:hover { background: color-mix(in srgb, var(--red) 18%, transparent); }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: 15.5px; border-radius: 10px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none; border-radius: var(--r);
  border: 1px solid transparent; background: transparent; color: var(--text-2); transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.bordered { border-color: var(--border-strong); background: var(--surface); }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.textarea { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8984' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 12px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder, .affix input::placeholder { color: var(--text-3); opacity: 1; }
.input.ltr { direction: ltr; text-align: left; }
.affix {
  display: flex; align-items: center; direction: ltr; min-height: 40px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.affix input {
  flex: 1; min-width: 0; height: 38px; border: 0; background: transparent; outline: none; padding: 0 4px 0 10px;
  text-align: right; font-size: 14.5px; font-weight: 600;
}
.affix input::placeholder { font-weight: 400; direction: rtl; }
.affix i { font-style: normal; display: grid; place-items: center; padding: 0 10px 0 2px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.affix .star { margin: 0; width: 15px; height: 15px; }
.affix.sm { min-height: 36px; }
.affix.sm input { height: 34px; font-size: 14px; }
.affix.saved { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.affix.bad { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 14px; font-weight: 600; color: var(--text); }
.field small { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }

.switch {
  position: relative; width: 44px; height: 26px; flex: none; padding: 0; border: 0; border-radius: 999px;
  background: var(--switch-off); transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .28s var(--spring);
}
.switch[aria-checked="true"] { background: var(--accent-btn); }
.switch[aria-checked="true"]::after { transform: translateX(-18px); }
.run .switch[aria-checked="true"], .switch.go[aria-checked="true"] { background: var(--green); }
html[data-theme="light"] .run .switch[aria-checked="true"] { background: #2E8A5C; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); flex-wrap: wrap; }
.seg button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font-weight: 600; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 1px 6px rgba(0, 0, 0, .05); }
html[data-theme="dark"] .seg button[aria-pressed="true"] { background: #3A3A38; }
.seg .c { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.seg button[aria-pressed="true"] .c { color: var(--text-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.badge .i { width: 14px; height: 14px; stroke-width: 2.4; }
.badge.ok { background: var(--green-soft); color: var(--green-ink); }
.badge.err { background: var(--red-soft); color: var(--red-ink); }
.badge.busy { background: var(--accent-soft); color: var(--accent-ink); }
.badge.warn { background: var(--orange-soft); color: var(--orange-ink); }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.badge .spinner { width: 12px; height: 12px; border-width: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2);
}
.tag.ok { background: var(--green-soft); color: var(--green-ink); }
.tag.blue { background: var(--accent-soft); color: var(--accent-ink); }
.tag.warn { background: var(--orange-soft); color: var(--orange-ink); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16.5px; font-weight: 800; letter-spacing: -.01em; }
.card-head p { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.card-head a { font-size: 14px; font-weight: 600; }
.eyebrow { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.eyebrow .i { width: 15px; height: 15px; }
.empty { padding: 48px 24px; text-align: center; color: var(--text-2); display: grid; justify-items: center; gap: 10px; }
.empty .i { width: 30px; height: 30px; color: var(--text-3); stroke-width: 1.5; }
.empty b { color: var(--text); font-size: 15.5px; }
.empty p { max-width: 380px; font-size: 14px; }

.mono {
  width: 100%; height: 100%; display: grid; place-items: center; font-weight: 800; letter-spacing: .02em;
  font-size: 15px; color: hsl(var(--h) 45% 32%); background: hsl(var(--h) 55% 91%); user-select: none;
}
html[data-theme="dark"] .mono { color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 30% 20%); }
.art { position: relative; overflow: hidden; border-radius: 12px; background: var(--surface-3); flex: none; }
.art img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- dashboard ---------- */
.dash-top { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 16px; }
.hunt { display: flex; align-items: center; gap: 28px; padding: 28px; position: relative; overflow: hidden; }
.hunt-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hunt-body h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.35; }
.hunt-body p { color: var(--text-2); font-size: 14.5px; }
.hunt-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.hunt-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.radar { position: relative; width: 136px; height: 136px; flex: none; }
.radar > i { position: absolute; border-radius: 50%; border: 1px solid var(--border-strong); }
.radar > i:nth-child(1) { inset: 0; }
.radar > i:nth-child(2) { inset: 22px; border-style: dashed; }
.radar .sweep { position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .4s;
  background: conic-gradient(from 0deg, transparent 0 290deg, color-mix(in srgb, var(--green) 38%, transparent) 360deg); }
.radar.on .sweep { opacity: 1; animation: spin 3.4s linear infinite; }
.radar .core {
  position: absolute; inset: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); transition: background-color .3s, color .3s, box-shadow .3s;
}
.radar .core .i { width: 24px; height: 24px; }
.radar.on .core { background: var(--green); color: #fff; box-shadow: 0 0 0 7px var(--green-soft), 0 8px 22px color-mix(in srgb, var(--green) 40%, transparent); }
html[data-theme="light"] .radar.on .core { background: #2E8A5C; }
.blip { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--text-3); animation: blip 2.4s var(--ease) forwards; pointer-events: none; }
.blip.deal { background: var(--gold); width: 10px; height: 10px; margin: -5px; }
.blip.bought { background: var(--green); width: 12px; height: 12px; margin: -6px; box-shadow: 0 0 0 4px var(--green-soft); }

.catch { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 28px; padding: 24px 28px; min-height: 236px; }
.catch-ambient { position: absolute; inset: -30%; z-index: -1; background-size: cover; background-position: center; filter: blur(70px) saturate(1.5); opacity: var(--ambient); transform: translateZ(0); }
.catch-art { width: 188px; height: 188px; border-radius: 24px; box-shadow: var(--art-shadow); }
.catch-art img, .catch-art .lottie { position: absolute; inset: 0; width: 100%; height: 100%; }
.catch-art .lottie svg { display: block; width: 100% !important; height: 100% !important; }
.catch-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.gift-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; overflow-wrap: anywhere; }
.gift-title .gnum { color: var(--text-2); font-weight: 700; }
.gname { unicode-bidi: isolate; }
.gnum { color: var(--text-2); font-weight: 600; }
.traits { color: var(--text-2); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catch-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 10px 0 14px; }
.catch-stats div { display: flex; flex-direction: column; }
.catch-stats div > span { font-size: 13px; color: var(--text-2); }
.catch-stats b { font-size: 18px; font-weight: 800; }
.catch-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.catch .btn { background: color-mix(in srgb, var(--surface) 75%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.catch-empty { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.catch-empty h2 { font-size: 22px; font-weight: 800; }
.catch-empty p { color: var(--text-2); font-size: 14.5px; }
.catch-placeholder { width: 188px; height: 188px; border-radius: 24px; display: grid; place-items: center; flex: none;
  background: repeating-linear-gradient(135deg, var(--surface-3) 0 10px, transparent 10px 20px); border: 1px dashed var(--border-strong); color: var(--text-3); }
.catch-placeholder .i { width: 44px; height: 44px; stroke-width: 1.3; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.kpi-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.kpi-ic .i { width: 16px; height: 16px; }
.kpi-ic.gold { background: var(--gold-soft); color: var(--gold-ink); }
.kpi-ic.blue { background: var(--accent-soft); color: var(--accent-ink); }
.kpi-ic.green { background: var(--green-soft); color: var(--green-ink); }
.kpi-ic.orange { background: var(--orange-soft); color: var(--orange-ink); }
.kpi-val { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; margin-top: 6px; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.kpi-val .amt { font-weight: 800; }
.kpi-val small { font-size: 14px; font-weight: 600; color: var(--text-2); }
.kpi-sub { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.bar.hot > i { background: var(--orange); }
.bar.full > i { background: var(--red); }
.bump { animation: bump .6s var(--ease); }

.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 16px; margin-top: 16px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.feed { display: flex; flex-direction: column; max-height: 880px; overflow-y: auto; overscroll-behavior: contain; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.fi {
  position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border); transition: background-color .2s;
}
.fi:first-child { border-top: 0; }
.fi:hover { background: var(--surface-2); }
.fi::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 3px; border-radius: 3px 0 0 3px; background: transparent; }
.fi.bought::before { background: var(--green); }
.fi.failed::before { background: var(--red); }
.fi.buy::before { background: var(--accent); }
.fi.deal { background: linear-gradient(to left, var(--gold-soft), transparent 55%); }
.fi.bought { background: linear-gradient(to left, var(--green-soft), transparent 60%); }
.fi.enter { animation: feedIn .55s var(--ease); }
.fi-art { width: 58px; height: 58px; border-radius: 13px; }
.fi.skip:not(.deal) .fi-art img { filter: saturate(.75); }
.fi-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fi-name { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.fi-name h4 { font-size: 15.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fi-name h4 .gnum { font-weight: 600; }
.fi-traits { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-meta { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 3px; min-width: 0; }
.fi-meta > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fi-meta > .fi-reason { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Gift names and traits are Latin: in RTL rows truncate their end, not their beginning. */
.fi-name h4, .fi-traits, .col-title h3, .mini-main b { direction: ltr; text-align: right; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); font-weight: 600; white-space: nowrap; }
.src-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--h) 60% 52%); }
.fi-price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: end; }
.fi-price .amt { font-size: 16.5px; font-weight: 800; }
.fi-ton { font-size: 13px; color: var(--text-2); }
.disc { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.disc.good { background: var(--green-soft); color: var(--green-ink); }
.disc.over { color: var(--red-ink); }
.feed-more { padding: 14px; text-align: center; border-top: 1px solid var(--border); }

.sources { display: flex; flex-direction: column; }
.src { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); min-width: 0; }
.src:first-child { border-top: 0; }
.src-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; color: #fff; background: hsl(var(--h) 55% 50%); }
.src-main { min-width: 0; flex: 1; }
.src-main b { display: block; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-main > span { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-state { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.side-note { padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); min-width: 0; }
.mini:first-child { border-top: 0; }
.mini .art { width: 40px; height: 40px; border-radius: 10px; }
.mini-main { min-width: 0; flex: 1; }
.mini-main b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-main > span { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-end { text-align: end; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mini-end .amt { font-size: 14px; color: var(--text); }

/* ---------- collections ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; margin-bottom: 16px; position: sticky; top: calc(var(--top) + 12px); z-index: 20; box-shadow: var(--shadow); }
.search { position: relative; flex: 1 1 240px; min-width: 200px; }
.search .i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-inline-start: 40px; }
.toolbar .select { width: auto; min-width: 176px; }
.col-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.col-summary .stats { display: flex; gap: 8px; flex-wrap: wrap; }
.col-summary .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.col {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.col:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.col.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.col.flash { animation: flash 1s var(--ease); }
.col-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.col-art { width: 54px; height: 54px; border-radius: 13px; cursor: pointer; transition: transform .25s var(--spring); }
.col-art:hover { transform: scale(1.05); }
.col:not(.on) .col-art img, .col:not(.on) .col-art .mono { filter: grayscale(.9); opacity: .6; }
.col-check {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 8px; padding: 0;
  display: grid; place-items: center; border: 2px solid var(--control); background: var(--surface); color: transparent;
  opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s var(--spring), background-color .15s;
}
.col-check .i { width: 15px; height: 15px; stroke-width: 3; }
.col:hover .col-check, .col-check:focus-visible, .selecting .col-check { opacity: 1; transform: none; }
.col-check[aria-pressed="true"] { background: var(--accent-btn); border-color: var(--accent-btn); color: var(--on-accent); opacity: 1; transform: none; }
.col-title { min-width: 0; flex: 1; cursor: pointer; }
.col-title h3 { font-size: 15.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-title .col-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-field > span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.col-foot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.col-foot .tags { display: flex; gap: 6px; min-width: 0; overflow: hidden; flex: 1; }
.col-foot .icon-btn { width: 34px; height: 34px; margin-inline-start: auto; }
.bulkbar {
  position: fixed; bottom: 24px; inset-inline-start: var(--side); inset-inline-end: 0; margin-inline: auto; z-index: 45;
  width: max-content; max-width: calc(100vw - var(--side) - 32px); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 14px; background: #262624; color: #fff; box-shadow: var(--shadow-lg);
  animation: rise .35s var(--spring);
}
html[data-theme="dark"] .bulkbar { background: #F3F2F0; color: #2C2C2B; }
.bulkbar b { padding: 0 8px; font-weight: 800; white-space: nowrap; }
.bulkbar .sep { width: 1px; height: 24px; background: currentColor; opacity: .2; }
.bulkbar .btn { min-height: 36px; padding: 0 12px; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); color: inherit; font-size: 14px; }
.bulkbar .btn:hover { background: rgba(255, 255, 255, .18); }
html[data-theme="dark"] .bulkbar .btn { background: rgba(0, 0, 0, .05); border-color: rgba(0, 0, 0, .14); }
html[data-theme="dark"] .bulkbar .btn:hover { background: rgba(0, 0, 0, .1); }
.bulkbar .affix { min-height: 36px; width: 128px; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }
html[data-theme="dark"] .bulkbar .affix { background: #fff; border-color: rgba(0, 0, 0, .18); }
.bulkbar .affix input { height: 34px; color: inherit; }
.bulkbar .affix i { color: inherit; opacity: .7; }
.bulkbar .affix input::placeholder { color: currentColor; opacity: .55; }
.bulkbar .select { min-height: 36px; width: auto; background-color: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: inherit; }
.bulkbar .select option { color: #2C2C2B; background: #fff; }
html[data-theme="dark"] .bulkbar .select { background-color: #fff; border-color: rgba(0, 0, 0, .18); }

/* ---------- drawer / modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(12, 12, 12, .38); animation: fade .2s ease; }
.drawer {
  position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 61; width: min(540px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: drawerIn .38s var(--ease);
}
.dr-hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 18px; padding: 24px; border-bottom: 1px solid var(--border); }
.dr-hero .catch-ambient { inset: -60%; filter: blur(60px) saturate(1.6); }
.dr-hero .art { width: 96px; height: 96px; border-radius: 20px; box-shadow: var(--art-shadow); }
.dr-hero h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.dr-hero p { font-size: 14px; color: var(--text-2); }
.dr-hero .icon-btn { position: absolute; top: 14px; inset-inline-end: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.dr-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 22px; }
.dr-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat > span { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat > b { display: block; font-size: 15.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-sec h3 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.switch-row b { display: block; font-size: 15px; font-weight: 700; }
.switch-row p { font-size: 13.5px; color: var(--text-2); }
.dr-foot { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.dr-foot .spacer { flex: 1; }
.recent { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.recent .mini { padding: 10px 14px; }
.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal { position: relative; width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 24px; animation: pop .3s var(--spring); }
.modal h2 { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.modal p { color: var(--text-2); font-size: 14.5px; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- purchases ---------- */
.p-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { padding: 12px 16px; text-align: start; font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14.5px; vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.enter { animation: feedIn .5s var(--ease); }
.g { display: flex; align-items: center; gap: 12px; min-width: 0; }
.g .art { width: 42px; height: 42px; border-radius: 10px; }
.g > div > b { display: block; font-weight: 750; }
.g > div > span { display: block; font-size: 13px; color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.err-text { color: var(--red-ink); font-size: 13.5px; max-width: 280px; white-space: normal; line-height: 1.5; margin-top: 4px; }

/* ---------- channels ---------- */
.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ch-add { display: flex; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.ch-add .affix { flex: 1; }
.ch-add .affix input { text-align: left; font-weight: 500; }
.ch { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); min-width: 0; }
.ch:first-child { border-top: 0; }
.ch .src-av { width: 42px; height: 42px; }
.ch-main { flex: 1; min-width: 0; }
.ch-main b { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 750; min-width: 0; }
.ch-main b > span:not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-main .sub { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ch-main .err-text { max-width: none; }
.ch-actions { display: flex; align-items: center; gap: 6px; }
.log { height: 520px; overflow-y: auto; padding: 8px 0; font-size: 13.5px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.log-line { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 4px 20px; line-height: 1.6; }
.log-line time { color: var(--text-3); font-size: 12.5px; direction: ltr; }
.log-line .dot { width: 7px; height: 7px; transform: translateY(-1px); }
.log-line.warning .dot { background: var(--orange); }
.log-line.error .dot { background: var(--red); }
.log-line.info .dot { background: var(--accent); }
.log-line p { overflow-wrap: anywhere; }
.log-line.error p { color: var(--red-ink); }

/* ---------- settings ---------- */
.set-wrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; max-width: 1080px; }
.set-nav { position: sticky; top: calc(var(--top) + 28px); display: flex; flex-direction: column; gap: 2px; }
.set-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r); color: var(--text-2); font-weight: 600; font-size: 14.5px; }
.set-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.set-nav a.active { color: var(--text); background: var(--surface-3); }
.set-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.set-sec { scroll-margin-top: calc(var(--top) + 20px); }
.set-sec .card-head { position: relative; padding: 20px 24px; }
.set-sec .card-head > div { min-width: 0; }
/* Out of flow, so the hidden chip never squeezes or pushes the section subtitle. */
.saved-chip { position: absolute; top: 22px; inset-inline-end: 24px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--green-ink); opacity: 0; transition: opacity .2s; pointer-events: none; }
.saved-chip.show { opacity: 1; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: center; padding: 18px 24px; border-top: 1px solid var(--border); }
.set-row:first-child, .card-head + .set-row { border-top: 0; }
.set-row label, .set-row .lbl { display: block; font-size: 15px; font-weight: 700; }
.set-row p { font-size: 14px; color: var(--text-2); margin-top: 2px; max-width: 560px; }
.set-ctrl { display: flex; justify-content: flex-end; }
.set-ctrl .affix, .set-ctrl .select { width: 100%; }
.set-ctrl .seg { width: 100%; }
.set-ctrl .seg button { flex: 1; }
.set-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-3); }
.step i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.step.done { color: var(--text-2); }
.step.done i { background: var(--green-soft); color: var(--green-ink); }
.step.cur { color: var(--text); }
.step.cur i { background: var(--accent-btn); color: var(--on-accent); }
.step-line { width: 28px; height: 1px; background: var(--border-strong); }
.tg-form { display: grid; gap: 14px; max-width: 520px; }
.tg-form .row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.tg-form .row .field { flex: 1 1 200px; }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 14px; line-height: 1.7; }
.note .i { color: var(--accent-ink); margin-top: 3px; }
.note.warn { background: var(--orange-soft); }
.note.warn .i { color: var(--orange-ink); }
.note.err { background: var(--red-soft); }
.note.err .i { color: var(--red-ink); }
.me-card { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.me-card .avatar { width: 52px; height: 52px; font-size: 20px; }
.me-card .grow { flex: 1; min-width: 160px; }
.me-card b { display: block; font-size: 17px; font-weight: 800; }
.me-card .grow > span { font-size: 14px; color: var(--text-2); }
.me-bal { display: flex; flex-direction: column; align-items: flex-end; }
.me-bal > span { font-size: 13px; }
.me-bal .amt { font-size: 22px; font-weight: 800; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; isolation: isolate; }
.login-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.login-bg i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.login-bg i:nth-child(1) { width: 520px; height: 520px; top: -160px; right: -120px; background: #4DA3FF; }
.login-bg i:nth-child(2) { width: 420px; height: 420px; bottom: -160px; left: -80px; background: #F5B83D; animation-delay: -6s; }
.login-bg i:nth-child(3) { width: 360px; height: 360px; bottom: 10%; right: 18%; background: #8B6CF0; animation-delay: -11s; opacity: .35; }
html[data-theme="dark"] .login-bg i { opacity: .28; }
.login-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%);
}
.login-card {
  width: min(410px, 100%); padding: 36px 32px 28px; border-radius: 22px; text-align: center; display: flex; flex-direction: column; gap: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); animation: pop .5s var(--spring);
}
.login-card .logo { width: 68px; height: 68px; margin: 0 auto; border-radius: 18px; box-shadow: 0 14px 30px rgba(47, 111, 228, .35); }
.login-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login-card > p { color: var(--text-2); font-size: 14.5px; margin-top: -8px; }
.login-card .field { text-align: start; }
.pw { position: relative; }
.pw .input { padding-inline-end: 48px; direction: ltr; text-align: left; height: 46px; font-size: 16px; }
.pw .icon-btn { position: absolute; inset-inline-end: 3px; top: 3px; }
.form-error { font-size: 14px; color: var(--red-ink); font-weight: 600; }
.login-card .form-error:empty { margin-top: -16px; }
.login-foot { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.login-foot code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }
.shake { animation: shake .4s; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 100; display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 360px; max-width: calc(100vw - 32px); padding: 12px 14px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toastIn .4s var(--spring);
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast .t-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-ink); }
.toast.ok .t-ic { background: var(--green-soft); color: var(--green-ink); }
.toast.err .t-ic { background: var(--red-soft); color: var(--red-ink); }
.toast .art { width: 44px; height: 44px; border-radius: 11px; }
.toast .t-body { min-width: 0; flex: 1; }
.toast b { display: block; font-size: 14.5px; font-weight: 800; }
.toast p { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes feedIn { from { opacity: 0; transform: translateY(-10px); background: var(--accent-soft); } }
@keyframes bump { 30% { transform: scale(1.04); color: var(--accent-ink); } }
@keyframes flash { 30% { box-shadow: 0 0 0 3px var(--green-soft); border-color: var(--green); } }
@keyframes blip { 0% { opacity: 0; transform: scale(.3); } 15% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drawerIn { from { transform: translateX(-104%); } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.12); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .radar.on .sweep { animation: none; opacity: .7; }
}

/* ---------- personalisation ---------- */
/* accent colours (blue is the default palette above) */
html[data-accent="purple"][data-theme="light"] { --accent: #8D5BD8; --accent-ink: #7444BF; --accent-soft: #F1EAFB; --accent-btn: #7A4CC7; }
html[data-accent="purple"][data-theme="dark"] { --accent: #A884EE; --accent-ink: #BCA0F3; --accent-soft: rgba(168, 132, 238, .14); --accent-btn: #A884EE; --on-accent: #140A26; }
html[data-accent="green"][data-theme="light"] { --accent: #2F9E6A; --accent-ink: #23794F; --accent-soft: #E4F3EA; --accent-btn: #1F7D53; }
html[data-accent="green"][data-theme="dark"] { --accent: #5CC08B; --accent-ink: #7CD0A2; --accent-soft: rgba(92, 192, 139, .13); --accent-btn: #5CC08B; --on-accent: #06170E; }
html[data-accent="orange"][data-theme="light"] { --accent: #E07B2A; --accent-ink: #A3500F; --accent-soft: #FCEEE0; --accent-btn: #AD5610; }
html[data-accent="orange"][data-theme="dark"] { --accent: #EE9A55; --accent-ink: #F3B07A; --accent-soft: rgba(238, 154, 85, .13); --accent-btn: #EE9A55; --on-accent: #1F0F03; }
html[data-accent="pink"][data-theme="light"] { --accent: #D9468F; --accent-ink: #B53273; --accent-soft: #FBE7F1; --accent-btn: #C23A80; }
html[data-accent="pink"][data-theme="dark"] { --accent: #EC74B0; --accent-ink: #F293C2; --accent-soft: rgba(236, 116, 176, .13); --accent-btn: #EC74B0; --on-accent: #22071A; }
html[data-accent="teal"][data-theme="light"] { --accent: #1A9BA6; --accent-ink: #137984; --accent-soft: #E0F3F4; --accent-btn: #127C86; }
html[data-accent="teal"][data-theme="dark"] { --accent: #45C1CB; --accent-ink: #6FD0D8; --accent-soft: rgba(69, 193, 203, .13); --accent-btn: #45C1CB; --on-accent: #04191B; }

/* size of the page content (sidebar, top bar and overlays keep their size) */
html[data-scale="sm"] .view { zoom: .92; }
html[data-scale="lg"] .view { zoom: 1.1; }

/* corner roundness */
html[data-radius="sm"] { --r-sm: 4px; --r: 5px; --r-lg: 7px; --r-xl: 9px; }
html[data-radius="lg"] { --r-sm: 9px; --r: 12px; --r-lg: 18px; --r-xl: 24px; }

/* compact density */
html[data-density="compact"] .fi { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; padding-block: 9px; }
html[data-density="compact"] .fi-art { width: 44px; height: 44px; border-radius: 10px; }
html[data-density="compact"] .fi::before { inset-block: 9px; }
html[data-density="compact"] .src, html[data-density="compact"] .mini { padding-block: 8px; }
html[data-density="compact"] .col-grid { gap: 10px; }
html[data-density="compact"] .col { padding: 12px; gap: 10px; }
html[data-density="compact"] .col-art { width: 46px; height: 46px; border-radius: 11px; }
html[data-density="compact"] .kpi { padding-block: 14px; }
html[data-density="compact"] .kpi-val { font-size: 24px; margin-top: 2px; }
html[data-density="compact"] .card-head { padding-block: 13px; }
html[data-density="compact"] .saved-chip { top: 15px; }
html[data-density="compact"] .set-row { padding-block: 13px; }
html[data-density="compact"] .tbl td { padding-block: 8px; }
html[data-density="compact"] .dash-top, html[data-density="compact"] .dash-main, html[data-density="compact"] .dash-side,
html[data-density="compact"] .kpis, html[data-density="compact"] .p-kpis { gap: 12px; }
html[data-density="compact"] .kpis, html[data-density="compact"] .dash-main { margin-top: 12px; }
html[data-density="compact"] .set-main { gap: 14px; }
@media (min-width: 901px) {
  html[data-density="compact"] .view { padding-top: 20px; padding-inline: 24px; }
  html[data-density="compact"] .hunt { padding: 22px; gap: 22px; }
  html[data-density="compact"] .catch { padding: 20px 24px; min-height: 0; }
  html[data-density="compact"] .catch-art { width: 156px; height: 156px; }
}

/* animations / effects off */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}
html[data-motion="off"] .radar.on .sweep { animation: none; opacity: .7; }
html[data-effects="off"] .catch-ambient { display: none; }

/* privacy: blur balances and spending until tapped */
html[data-privacy="on"] .priv { cursor: pointer; transition: filter .2s; }
html[data-privacy="on"]:not([data-revealed="1"]) .priv { filter: blur(8px); user-select: none; }

/* compact collection cards */
html[data-colview="compact"] .col-fields { display: none; }
html[data-colview="compact"] .col-grid { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); }
html[data-colview="compact"] .col { gap: 10px; }

/* dashboard with hidden cards */
.dash-top.solo, .dash-main.solo { grid-template-columns: minmax(0, 1fr); }
.dash-side > :only-child { grid-column: 1 / -1; }

/* controls */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.swatch {
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--sw); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .18s var(--spring), box-shadow .15s;
}
.swatch:hover { transform: scale(1.08); }
.swatch .i { width: 16px; height: 16px; stroke-width: 3; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s var(--spring); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatch[aria-checked="true"] .i { opacity: 1; transform: none; }
.swatch[data-swatch="blue"] { --sw: #2783DE; }
.swatch[data-swatch="purple"] { --sw: #8D5BD8; }
.swatch[data-swatch="green"] { --sw: #2F9E6A; }
.swatch[data-swatch="orange"] { --sw: #E07B2A; }
.swatch[data-swatch="pink"] { --sw: #D9468F; }
.swatch[data-swatch="teal"] { --sw: #1A9BA6; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.chip-t {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.chip-t .i { width: 15px; height: 15px; stroke-width: 2.6; }
.chip-t:not([aria-pressed="true"]) .i { opacity: .3; }
.chip-t[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.stack { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.stack .btn { align-self: flex-end; }
.stat > small { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- responsive ---------- */
@media (max-width: 1220px) {
  .dash-top { grid-template-columns: 1fr; }
  .dash-main { grid-template-columns: 1fr; }
  .dash-side { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .kpis, .p-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-layout { grid-template-columns: 1fr; }
  .set-wrap { grid-template-columns: 1fr; }
  .set-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 0 16px; gap: 8px; }
  .top-logo { display: block; width: 34px; height: 34px; border-radius: 10px; }
  .top-title p, .live > span:not(.dot) { display: none; }
  .view { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 40;
    background: var(--glass); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
    -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  }
  .bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 62px; font-size: 12px; font-weight: 600; color: var(--text-2); }
  .bnav a:hover { text-decoration: none; }
  .bnav a .i { width: 22px; height: 22px; }
  .bnav a.active { color: var(--accent-ink); }
  .bulkbar { inset-inline-start: 0; max-width: calc(100vw - 24px); bottom: calc(76px + env(safe-area-inset-bottom)); }
  #toasts { inset-inline: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); align-items: center; }
  .toast { width: 100%; }
  .toolbar { top: calc(var(--top) + 8px); }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { padding: 0; border: 0; white-space: normal; }
  .tbl td[data-l]::before { content: attr(data-l) " "; color: var(--text-2); font-size: 13px; }
  .tbl td.c-gift { grid-column: 1 / -1; }
  .tbl td.c-hide { display: none; }
}
@media (max-width: 640px) {
  .run .lbl { display: none; }
  .run { padding-inline: 8px 6px; }
  .hunt { align-items: flex-start; gap: 16px; padding: 20px; }
  .hunt-body h2 { font-size: 20px; }
  .hunt-body p { font-size: 14px; }
  .radar { width: 84px; height: 84px; margin-top: 2px; }
  .radar > i:nth-child(2) { inset: 14px; }
  .radar .core { inset: 26px; }
  .radar .core .i { width: 18px; height: 18px; }
  .radar.on .core { box-shadow: 0 0 0 5px var(--green-soft), 0 6px 16px color-mix(in srgb, var(--green) 40%, transparent); }
  .catch { flex-direction: column; align-items: flex-start; padding: 22px; gap: 18px; }
  .catch-art, .catch-placeholder { width: 148px; height: 148px; border-radius: 20px; }
  .gift-title { font-size: 22px; }
  .kpis, .p-kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-val { font-size: 22px; }
  .dash-side { grid-template-columns: 1fr; }
  .fi { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; }
  .fi-art { width: 48px; height: 48px; border-radius: 11px; }
  .feed { max-height: none; }
  .card-head { padding: 16px; }
  .set-row { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
  .set-ctrl { justify-content: stretch; }
  .set-body { padding: 16px; }
  .dr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
  .dr-body { padding: 18px 16px 24px; }
  .dr-foot { padding: 12px 16px; }
  .toolbar { position: static; }
  .toolbar .seg { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; overscroll-behavior-x: contain; }
  .toolbar .seg::-webkit-scrollbar { display: none; }
  .toolbar .seg button { flex: 1 0 auto; }
  .toolbar .select { flex: 1; }
  .col-grid { grid-template-columns: 1fr; }
  .set-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav a { flex: none; }
  .swatches, .chips { justify-content: flex-start; }
  .stack .btn { align-self: flex-start; }
  .dr-foot .dr-close { display: none; }
}
@media (pointer: coarse) {
  .btn, .input, .select, .affix { min-height: 44px; }
  .affix input { height: 42px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ---------- telegram bot (settings) ---------- */
.howto { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.8; color: var(--text-2); }
.howto li::marker { color: var(--accent-ink); font-weight: 800; }
.howto a { color: var(--accent-ink); font-weight: 700; }
.bot-card .avatar { background: linear-gradient(135deg, #2AABEE, #1C8ED0); }
.bot-card .avatar .i { width: 26px; height: 26px; }
.bot-card .grow > span { display: block; }
.bot-card .grow > .tok { font-size: 12.5px; color: var(--text-3); }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-top: 4px; }
.sub-head b { font-size: 15px; font-weight: 800; }
.sub-head span { font-size: 13px; color: var(--text-3); }
.bot-chats { display: grid; gap: 10px; }
.bot-chat {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
}
.bc-info { min-width: 0; }
.bc-info b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-info > span { font-size: 13px; color: var(--text-2); }
.bc-info .badge { height: 22px; font-size: 12px; }
.bc-cats { grid-column: 1 / -1; justify-content: flex-start; }
.bc-cats .chip-t { min-height: 30px; padding: 0 10px; font-size: 13px; }
.pair-box {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-lg);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft);
}
.pb-text { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; }
.pb-text b { font-size: 14.5px; font-weight: 800; }
.pair-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; color: var(--accent-ink); overflow-wrap: anywhere; text-align: right; }
.pb-text small { font-size: 12.5px; color: var(--text-2); }
.pb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-danger-text { color: var(--red-ink); }
.btn-danger-text:hover { background: var(--red-soft); color: var(--red-ink); }
@media (max-width: 640px) {
  .bot-chat { padding: 12px; }
  .pb-actions { width: 100%; }
  .pb-actions .btn { flex: 1; }
  .btn-row .btn { flex: 1 1 auto; }
}
