:root {
  --bg: var(--tg-theme-bg-color, #0a0d16);
  --text: var(--tg-theme-text-color, #eaf0ff);
  --muted: var(--tg-theme-hint-color, #8a93a8);
  --accent: var(--tg-theme-button-color, #4d7cff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --card: rgba(255, 255, 255, 0.055);
  --stroke: rgba(255, 255, 255, 0.10);
  --ok: #35d39a;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, "IRANSansX", "IRANSans", system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

body {
  position: relative;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* ambient light, kept behind the content */
.glow {
  position: fixed;
  width: 60vw;
  height: 60vw;
  max-width: 420px;
  max-height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.6s ease;
}
.glow-a { top: -14vw; right: -12vw; background: #4d7cff; }
.glow-b { bottom: -18vw; left: -14vw; background: #7b3fe4; }
body.light .glow { opacity: 0.28; }

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 4px;
  font-size: 13px;
  color: var(--muted);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(53, 211, 154, 0.55);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(53, 211, 154, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(53, 211, 154, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 211, 154, 0); }
}

.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.glass {
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.card { padding: 22px 18px; }

.avatar {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 700;
  color: var(--accent-text);
  background: linear-gradient(145deg, var(--accent), #7b3fe4);
  box-shadow: 0 12px 30px rgba(77, 124, 255, 0.35);
}
.avatar img { width: 100%; height: 100%; border-radius: 20px; object-fit: cover; }

h1 { margin: 0; text-align: center; font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
.sub { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: 13px; direction: ltr; }

.status {
  margin: 16px auto 0;
  width: fit-content;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  color: var(--muted);
  transition: color 0.25s, border-color 0.25s;
}
.status.ok { color: var(--ok); border-color: rgba(53, 211, 154, 0.35); }
.status.bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.35); }

.spinner {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.status.ok .spinner, .status.bad .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}
.meta div { text-align: center; }
.meta dt { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.meta dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.actions { display: grid; gap: 10px; padding: 16px; }

.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 15px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: scale(0.975); background: rgba(255, 255, 255, 0.09); }
.btn.primary {
  background: linear-gradient(145deg, var(--accent), #6a5cff);
  border-color: transparent;
  color: var(--accent-text);
  box-shadow: 0 14px 30px rgba(77, 124, 255, 0.3);
}

.foot { text-align: center; color: var(--muted); font-size: 11.5px; margin: 4px 0 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; }

/* light Telegram theme */
body.light { --card: rgba(255, 255, 255, 0.62); --stroke: rgba(15, 23, 42, 0.10); }
body.light .glass { box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
body.light .btn { background: rgba(255, 255, 255, 0.7); }
body.light .status { background: rgba(15, 23, 42, 0.04); }
