@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn.woff2") format("woff2-variations"), url("../fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #03050a;
  --bg-1: #070b14;
  --bg-2: #0b1120;
  --bg-3: #111a2e;
  --line: rgba(160, 180, 220, .12);
  --line-2: rgba(160, 180, 220, .2);
  --text: #e8edf7;
  --text-2: #b8c2d6;
  --muted: #7d8aa3;
  --blue: #2f6bff;
  --blue-2: #1d4ed8;
  --blue-3: #60a5fa;
  --blue-glow: rgba(47, 107, 255, .45);
  --silver: linear-gradient(180deg, #ffffff 0%, #dfe5ef 38%, #9aa6ba 62%, #eef2f8 100%);
  --ok: #22c55e;
  --warn: #f5a524;
  --bad: #f43f5e;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --glass: rgba(18, 26, 44, .5);
  --glass-2: rgba(24, 34, 58, .62);
  --glass-border: rgba(170, 195, 255, .12);
  --clay-bg: linear-gradient(150deg, #18223a 0%, #0f1628 100%);
  --clay-shadow: inset 1.5px 1.5px 0 rgba(255, 255, 255, .07), inset -6px -8px 16px rgba(0, 0, 0, .45), 0 18px 34px -12px rgba(0, 0, 0, .7);
  --clay-blue: linear-gradient(150deg, #4f86ff 0%, #2f6bff 45%, #1b46c9 100%);
  --clay-blue-shadow: inset 2px 2px 0 rgba(255, 255, 255, .28), inset -6px -8px 14px rgba(10, 25, 90, .55), 0 14px 30px -8px rgba(47, 107, 255, .55);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --ease: cubic-bezier(.22, .9, .3, 1);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--blue-3); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(47, 107, 255, .45); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140, 160, 200, .18); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; letter-spacing: .02em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- backdrop: liquid chrome (WebGL, see js/bg.js) ---------- */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: #03050b; }
.bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; filter: saturate(1.05); }
.scene.fallback { background: radial-gradient(90% 60% at 80% 0%, rgba(150, 175, 220, .22), transparent 60%),
  radial-gradient(70% 60% at 10% 100%, rgba(47, 107, 255, .3), transparent 65%), linear-gradient(160deg, #0b1120, #03050b 60%); }
.vignette { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 5, 11, .35) 0%, transparent 18%, transparent 70%, rgba(3, 5, 11, .55) 100%); }
.orb, .aurora, .grain { display: none; }

/* ---------- surfaces ---------- */
.glass {
  position: relative;
  background: linear-gradient(160deg, rgba(30, 42, 70, .55), rgba(12, 18, 32, .45));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 24px 60px -24px rgba(0, 0, 0, .8);
}
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px), rgba(47, 107, 255, .10), transparent 42%),
              linear-gradient(135deg, rgba(255, 255, 255, .07), transparent 35%); }
.glass::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), rgba(120, 170, 255, .75), transparent 45%),
              linear-gradient(160deg, rgba(160, 190, 255, .22), rgba(160, 190, 255, .02) 40%, rgba(160, 190, 255, .02) 60%, rgba(160, 190, 255, .14));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
:where(.glass) > :where(:not(.glow):not(.glow2):not(.tip)) { position: relative; }
.clay {
  background: var(--clay-bg);
  border-radius: var(--radius);
  box-shadow: var(--clay-shadow);
  border: 1px solid rgba(255, 255, 255, .03);
}
.pressed {
  background: linear-gradient(150deg, #070b15, #0c1324);
  box-shadow: inset 4px 5px 10px rgba(0, 0, 0, .6), inset -2px -2px 6px rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .04);
}
.silver-text { background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }
.blue-text { background: linear-gradient(90deg, #8fb5ff, #2f6bff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand-mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 6px 14px rgba(47, 107, 255, .35)); }
.brand-word { font-family: var(--font); font-weight: 800; letter-spacing: .28em; font-size: 17px; direction: ltr; }
.brand-word b { color: var(--blue); font-weight: 900; }

/* ---------- buttons ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .05);
  background: var(--clay-bg); box-shadow: var(--clay-shadow);
  color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), filter .2s; user-select: none; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: inset 3px 4px 10px rgba(0, 0, 0, .55); }
.btn:disabled, .btn.loading { opacity: .55; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--clay-blue); box-shadow: var(--clay-blue-shadow); color: #fff; border-color: rgba(255, 255, 255, .12); }
.btn-primary:hover { box-shadow: var(--clay-blue-shadow), 0 0 0 4px rgba(47, 107, 255, .14), 0 0 34px rgba(47, 107, 255, .45); }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transition: left .7s var(--ease); pointer-events: none; }
.btn-primary:hover::after { left: 130%; }
.ico { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.17em; flex: none; }
.ico.ok { color: #4ade80; } .ico.bad { color: #fb7185; } .ico.warn { color: #fbbf24; } .ico.info { color: #93b4ff; }
.btn-ok { background: linear-gradient(150deg, #34d399, #16a34a 55%, #0f7a37); color: #fff;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .25), inset -6px -8px 14px rgba(5, 60, 30, .5), 0 12px 26px -10px rgba(34, 197, 94, .5); }
.btn-danger { background: linear-gradient(150deg, #fb7185, #e11d48 55%, #9f1239); color: #fff;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .22), inset -6px -8px 14px rgba(90, 5, 30, .5), 0 12px 26px -10px rgba(244, 63, 94, .5); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--line-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); }
.btn-sm { --h: 36px; padding: 0 13px; font-size: 13px; border-radius: 12px; }
.btn-xs { --h: 30px; padding: 0 10px; font-size: 12px; border-radius: 10px; }
.btn-lg { --h: 54px; padding: 0 26px; font-size: 16px; border-radius: 18px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; }
.field > label, .label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 15px; border-radius: 14px; outline: none;
  background: linear-gradient(150deg, #060a13, #0b1222);
  border: 1px solid rgba(160, 185, 240, .1);
  box-shadow: inset 3px 4px 9px rgba(0, 0, 0, .55), inset -1px -1px 0 rgba(255, 255, 255, .03);
  transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.8; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(47, 107, 255, .6);
  box-shadow: inset 3px 4px 9px rgba(0, 0, 0, .55), 0 0 0 4px rgba(47, 107, 255, .14); }
.input::placeholder, .textarea::placeholder { color: #56627a; }
.select { appearance: none; -webkit-appearance: none; padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8aa3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"), linear-gradient(150deg, #060a13, #0b1222);
  background-position: 13px 50%, 0 0; background-size: 16px 16px, 100% 100%; background-repeat: no-repeat; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; }

.switch { position: relative; width: 50px; height: 28px; flex: none; cursor: pointer; display: inline-block; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch span { position: absolute; inset: 0; border-radius: 30px; background: linear-gradient(150deg, #060a13, #0e1628);
  box-shadow: inset 3px 3px 8px rgba(0, 0, 0, .6), inset -1px -1px 0 rgba(255, 255, 255, .04); transition: background .25s; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(150deg, #e6ebf5, #98a3b8); box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset -2px -2px 4px rgba(0, 0, 0, .2);
  transition: transform .3s var(--ease); }
.switch input:checked + span { background: var(--clay-blue); box-shadow: inset 2px 2px 5px rgba(0, 0, 0, .3), 0 0 16px rgba(47, 107, 255, .4); }
.switch input:checked + span::after { transform: translateX(-22px); background: linear-gradient(150deg, #fff, #dbe6ff); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 7px; margin: 0; flex: none; cursor: pointer;
  background: linear-gradient(150deg, #060a13, #0e1628); box-shadow: inset 2px 2px 5px rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .06);
  display: grid; place-items: center; transition: background .2s; }
.check input:checked { background: var(--clay-blue); box-shadow: 0 0 10px rgba(47, 107, 255, .45); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- chips / badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 30px; font-size: 12px; font-weight: 600;
  background: rgba(125, 138, 163, .12); color: var(--text-2); border: 1px solid rgba(125, 138, 163, .16); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { color: #4ade80; background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .25); }
.badge.warn { color: #fbbf24; background: rgba(245, 165, 36, .1); border-color: rgba(245, 165, 36, .25); }
.badge.bad { color: #fb7185; background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .25); }
.badge.blue { color: #93b4ff; background: rgba(47, 107, 255, .12); border-color: rgba(47, 107, 255, .3); }
.badge.muted { color: var(--muted); }
.badge.live::before { animation: pulse 1.8s infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); } 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 15px; border-radius: 30px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--text-2);
  cursor: pointer; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; transition: all .2s var(--ease); }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.on { background: var(--clay-blue); color: #fff; border-color: transparent; box-shadow: var(--clay-blue-shadow); }
.chip .n { font-size: 11px; background: rgba(0, 0, 0, .25); padding: 0 7px; border-radius: 20px; }

/* ---------- toast / modal ---------- */
.toasts { position: fixed; z-index: 100; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 10px; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 13px 16px; display: flex; gap: 11px; align-items: center; font-size: 14px; animation: toastIn .4s var(--ease); }
.toast.out { animation: toastOut .3s forwards; }
.toast i { width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center; }
.toast i svg { width: 17px; height: 17px; }
.toast.ok i { background: rgba(34, 197, 94, .15); color: #4ade80; }
.toast.err i { background: rgba(244, 63, 94, .15); color: #fb7185; }
.toast.info i { background: rgba(47, 107, 255, .15); color: #93b4ff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }

.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(2, 4, 10, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 16px; animation: fade .25s; }
.overlay.out { animation: fadeOut .2s forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px; animation: pop .35s var(--ease); }
.modal.wide { width: min(860px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 19px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 22px; flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.drawer-wrap { place-items: stretch end; padding: 0; }
.drawer { width: min(640px, 100vw); height: 100vh; overflow: auto; border-radius: 0; padding: 26px; animation: slide .4s var(--ease); border-width: 0 1px 0 0; }
@keyframes slide { from { transform: translateX(-40px); opacity: 0; } }
.lightbox img { max-width: min(92vw, 900px); max-height: 86vh; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }

/* ---------- skeleton ---------- */
.sk { border-radius: 12px; background: linear-gradient(90deg, rgba(255, 255, 255, .03) 25%, rgba(255, 255, 255, .08) 37%, rgba(255, 255, 255, .03) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- misc ---------- */
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); margin: 18px 0; border: 0; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 7px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.copy { cursor: pointer; }
.fade-up { animation: fadeUp .6s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } }
.stagger > * { animation: fadeUp .55s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(n+7) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- back to top ---------- */
.to-top { position: fixed; left: 24px; bottom: 24px; z-index: 45; width: 54px; height: 54px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; color: #fff;
  display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #3f74ff, #1a3fae 70%);
  box-shadow: inset 1.5px 1.5px 0 rgba(255, 255, 255, .28), inset -4px -6px 12px rgba(5, 15, 60, .55), 0 14px 30px -10px rgba(47, 107, 255, .75);
  opacity: 0; transform: translateY(24px) scale(.7); pointer-events: none;
  transition: opacity .35s var(--ease), transform .45s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s; -webkit-tap-highlight-color: transparent; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-4px); box-shadow: inset 1.5px 1.5px 0 rgba(255, 255, 255, .28), inset -4px -6px 12px rgba(5, 15, 60, .55), 0 18px 40px -10px rgba(47, 107, 255, .95), 0 0 0 6px rgba(47, 107, 255, .14); }
.to-top:active { transform: scale(.94); }
.to-top > svg:not(.tt-ring) { width: 22px; height: 22px; position: relative; transition: transform .3s var(--ease); }
.to-top:hover > svg:not(.tt-ring), .to-top.go > svg:not(.tt-ring) { transform: translateY(-3px); }
.to-top.go > svg:not(.tt-ring) { animation: ttLift .7s ease-in-out infinite alternate; }
@keyframes ttLift { to { transform: translateY(-6px); } }
.tt-ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.tt-ring circle { fill: none; stroke-width: 2.5; stroke: rgba(160, 190, 255, .16); }
.tt-ring circle.p { stroke: #93b4ff; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(96, 165, 250, .9)); transition: stroke-dashoffset .12s linear; }
@media (max-width: 1000px) { .to-top { left: 16px; bottom: 18px; width: 48px; height: 48px; } }
