@font-face {
  font-family: Vazirmatn;
  src: url("/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #060f1e;
  --bg-2: #0a1a2e;
  --card: rgba(13, 31, 52, .72);
  --card-solid: #0d1f34;
  --line: rgba(120, 170, 220, .16);
  --line-strong: rgba(110, 190, 255, .34);
  --ink: #f2f7ff;
  --muted: #9fb3cc;
  --faint: #6f86a3;
  --cyan: #2ee6f2;
  --cyan-deep: #0bbfd6;
  --blue: #1a8cff;
  --ok: #3ee39a;
  --danger: #ff9f95;
  --radius: 20px;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; color: var(--ink); background: var(--bg); }
input, button { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
bdi { unicode-bidi: isolate; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.shell {
  position: relative; isolation: isolate; overflow: hidden;
  width: min(100%, 460px); min-height: 100dvh; margin-inline: auto;
  padding: calc(18px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    calc(28px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(120% 60% at 70% -10%, #0e3358 0%, transparent 55%),
    radial-gradient(90% 50% at 0% 100%, #071d38 0%, transparent 60%),
    var(--bg);
}

/* Light trails behind the logo */
.aurora { position: absolute; inset: 0 0 auto; height: 300px; z-index: -1; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.aurora span { position: absolute; left: -25%; width: 150%; height: 150px; border-radius: 50%;
  border-bottom: 1.5px solid #1aa2ff; filter: drop-shadow(0 3px 6px rgba(10, 140, 255, .7)); transform: rotate(-21deg); opacity: .75; }
.aurora span:nth-child(1) { top: 26px; }
.aurora span:nth-child(2) { top: 6px; left: -8%; width: 130%; border-color: #5fd6ff; transform: rotate(-27deg); opacity: .9; }
.aurora span:nth-child(3) { top: 44px; left: -35%; width: 120%; border-color: #0f5c9a; transform: rotate(-16deg); opacity: .6; }
.aurora i { position: absolute; top: 112px; left: 52%; width: 40%; height: 2px; transform: rotate(-23deg);
  background: linear-gradient(90deg, transparent, #b5f3ff, transparent); box-shadow: 0 0 16px 2px #0aa0ff; opacity: .8; }

.top { display: flex; align-items: center; justify-content: center; min-height: 196px; }
.brand { display: block; width: 176px; height: 87px; object-fit: contain; filter: drop-shadow(0 6px 22px rgba(0, 166, 252, .38)); }
.signed-in .top { justify-content: space-between; min-height: 56px; margin-bottom: 18px; }
.signed-in .brand { width: 96px; height: 48px; }
.signed-in .aurora { opacity: .4; transform: translateY(-118px); }

.view { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

h1 { margin: 0; font-size: clamp(30px, 8.4vw, 38px); line-height: 1.4; font-weight: 850; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 16px; font-weight: 800; }
#login { max-width: 380px; margin-inline: auto; }
#login h1, .lead { text-align: center; }
.lead { margin: 10px auto 26px; max-width: 320px; color: var(--muted); font-size: 14.5px; line-height: 1.9; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 40%), var(--card);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -24px rgba(0, 0, 0, .8);
}

/* Sign-in */
.form-card { padding: 18px 16px 16px; }
label { display: block; margin: 0 2px 9px; font-size: 14px; font-weight: 700; color: var(--muted); }
.input-wrap { position: relative; margin-bottom: 14px; }
.field-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
#token {
  width: 100%; min-height: 54px; padding: 10px 46px 10px 76px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: rgba(4, 14, 28, .75);
  color: var(--ink); font-size: 16px; letter-spacing: .02em; transition: border-color .2s, box-shadow .2s;
}
#token::placeholder { color: var(--faint); font-family: Vazirmatn, Tahoma, sans-serif; letter-spacing: 0; direction: rtl; }
#token:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(46, 230, 242, .14); }
.toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 10px; background: rgba(46, 230, 242, .08); color: var(--cyan); font-size: 13px; font-weight: 700; }

.action {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 10px 16px; border: 0; border-radius: 16px;
  color: #00202b; background: linear-gradient(180deg, #3ff0fb, #0bd8ec);
  font-size: 17px; font-weight: 850; text-decoration: none;
  box-shadow: inset 0 1px rgba(255, 255, 255, .35), 0 10px 28px -10px rgba(18, 210, 235, .55);
  transition: transform .12s, filter .2s;
}
.action .icon { width: 21px; height: 21px; stroke-width: 2.3; }
.action:active { transform: scale(.985); filter: brightness(.94); }
.action:disabled { opacity: .6; }
.alert { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 110, 95, .1); color: var(--danger); font-size: 13.5px; line-height: 1.8; }
#profile-error { margin-top: 12px; }

.perks { display: flex; justify-content: center; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.perks li { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 12px; background: rgba(13, 31, 52, .5); }
.perks .icon { width: 15px; height: 15px; color: var(--cyan); }

/* Account */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(62, 227, 154, .3); background: rgba(62, 227, 154, .08); color: var(--ok); font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(62, 227, 154, .16); }
.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(13, 31, 52, .7); font-size: 13.5px; font-weight: 600; }
.pill .icon { width: 17px; height: 17px; }

.balance { margin: 16px 0; padding: 18px 18px 4px; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 50% -20%, rgba(26, 140, 255, .28), transparent 60%), var(--card);
  border-color: var(--line-strong); }
.balance dt { color: var(--muted); font-size: 14px; }
.balance dd { margin: 0; font-weight: 800; }
.balance-main { text-align: center; }
#remaining { margin: 2px 0 12px; font-size: 48px; line-height: 1.45; font-weight: 900; letter-spacing: -.01em;
  color: var(--cyan); text-shadow: 0 0 24px rgba(46, 230, 242, .35); }
.balance-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }

.hint { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(46, 230, 242, .16); background: rgba(46, 230, 242, .05); color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.hint .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--cyan); }
.note { display: flex; gap: 9px; align-items: flex-start; margin: 12px 2px 0; color: var(--muted); font-size: 12.5px; line-height: 1.95; }
.note .icon { width: 17px; height: 17px; margin-top: 3px; color: var(--faint); }

.servers { margin-top: 16px; padding: 14px 14px 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ghost { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--cyan); font-size: 13px; font-weight: 600; }
.ghost .icon { width: 16px; height: 16px; }
.ghost:disabled .icon { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
#servers-status { margin: 2px 2px 10px; color: var(--faint); font-size: 12px; line-height: 1.8; }
#servers-list { display: grid; gap: 8px; max-height: 340px; overflow: auto; overscroll-behavior: contain; }
.server-choice {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 15px; background: rgba(6, 18, 34, .6); text-align: start;
  transition: border-color .2s, background .2s;
}
.server-choice:disabled { opacity: .55; }
.server-choice[aria-pressed=true] { border-color: rgba(46, 230, 242, .55); background: linear-gradient(90deg, rgba(46, 230, 242, .12), rgba(46, 230, 242, .03)); }
.server-code { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px;
  background: #11304c; color: #cfe9ff; font: 800 12px/1 ui-rounded, -apple-system, system-ui, sans-serif; letter-spacing: .04em; direction: ltr; }
.server-choice[aria-pressed=true] .server-code { background: rgba(46, 230, 242, .18); color: var(--cyan); }
.server-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 650; overflow-wrap: anywhere; }
.server-name small { display: block; margin-top: 1px; color: var(--faint); font-size: 11.5px; font-weight: 500; }
.server-state { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.server-state .icon { width: 15px; height: 15px; stroke-width: 2.6; opacity: 0; color: #00202b; }
.server-choice[aria-pressed=true] .server-state { border-color: transparent; background: var(--cyan); }
.server-choice[aria-pressed=true] .server-state .icon { opacity: 1; }
.skeleton { height: 58px; border-radius: 15px; background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.guide { margin-top: 16px; padding: 0 16px; }
.guide summary { display: flex; align-items: center; justify-content: space-between; min-height: 54px; cursor: pointer; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.chev { width: 9px; height: 9px; margin-inline-end: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.guide[open] .chev { transform: rotate(225deg); }
.guide ol { counter-reset: step; list-style: none; margin: 0; padding: 14px 0 4px; border-top: 1px solid var(--line); }
.guide li { counter-increment: step; position: relative; min-height: 28px; padding-inline-start: 40px; font-size: 13.5px; line-height: 1.95; }
.guide li + li { margin-top: 12px; }
.guide li::before { content: counter(step, persian); position: absolute; inset-inline-start: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: rgba(46, 230, 242, .1); color: var(--cyan); font-weight: 800; font-size: 14px; }
.guide .note { margin: 14px 0 0; padding: 12px 0 14px; border-top: 1px solid var(--line); }
bdi { color: #e3f1ff; }

.install-app { display: flex; justify-content: center; align-items: center; gap: 9px; width: 100%; min-height: 50px; margin-top: 22px;
  border: 1px dashed var(--line-strong); border-radius: 16px; background: transparent; color: var(--muted); font-size: 14px; }
.install-app .icon { color: var(--cyan); }
@media (display-mode: standalone) { .install-app { display: none; } }

#install-dialog {
  width: min(calc(100vw - 28px), 380px); max-height: calc(100svh - 40px); margin: auto; padding: 20px;
  overflow: auto; border: 1px solid var(--line); border-radius: 24px; background: var(--card-solid); color: var(--ink);
  font-family: Vazirmatn, Tahoma, sans-serif; line-height: 1.8; box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}
#install-dialog::backdrop { background: rgba(1, 8, 18, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.install-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.install-heading img { flex: none; border-radius: 12px; border: 1px solid var(--line); }
#install-dialog h2 { font-size: 18px; line-height: 1.5; }
#install-dialog p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.85; }
.install-heading form { margin-inline-start: auto; align-self: flex-start; }
.install-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: #1a2c42; color: var(--muted); font-size: 22px; line-height: 1; }
.install-steps { padding-bottom: 14px; }
.install-step { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; }
.install-step + .install-step { border-top: 1px solid var(--line); }
.install-step strong { font-size: 14px; font-weight: 700; }
.install-symbol { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; background: rgba(46, 230, 242, .1); color: var(--cyan); }
.install-done { min-height: 48px; font-size: 15px; }
@media (max-width: 500px) {
  #install-dialog { margin: auto auto 12px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (max-width: 350px) {
  .top { min-height: 160px; }
  .brand { width: 150px; height: 74px; }
  .perks { flex-wrap: wrap; }
  #remaining { font-size: 40px; }
}
.balance-row dd.live { color: var(--ok); }
.balance-row dd.live::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(62, 227, 154, .16); vertical-align: middle; }
.hint.failover { border-color: rgba(255, 200, 97, .3); background: rgba(255, 200, 97, .07); color: #ffd99a; }
.server-name small.up { color: var(--ok); }
.server-name small.down { color: var(--danger); }
.auto-choice .server-code { font-size: 10px; letter-spacing: 0; background: rgba(46, 230, 242, .14); color: var(--cyan); }
