:root {
  --bg: #0a0a0f;
  --glass: rgba(255, 255, 255, 0.06);
  --glass2: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-light: rgba(255, 255, 255, 0.18);
  --text: #f2f2f2;
  --muted: #a0a0b0;
  --red: #e74c3c;
  --green: #2ecc71;
  --yellow: #f39c12;
  --font: "Peyda", Tahoma, system-ui, sans-serif;
  --mono: Consolas, "Courier New", monospace;
  --blur: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

a, button, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
a:visited { color: inherit; }

button {
  color: inherit;
  background: none;
  border: none;
  font: inherit;
}

button:focus, a:focus, input:focus, textarea:focus {
  outline: none;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.22);
  outline-offset: 2px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(80, 60, 180, 0.18), transparent),
    radial-gradient(ellipse 60% 45% at 85% 75%, rgba(40, 120, 200, 0.14), transparent),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(60, 180, 140, 0.06), transparent),
    var(--bg);
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.5rem 0.85rem 2.5rem;
}

.page-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}

/* شیشه‌ای مشترک */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* کارت اطلاعات */
.info-card {
  border-radius: 16px;
  padding: 0;
  margin-bottom: 0.85rem;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-head {
  display: flex;
  justify-content: center;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.badge {
  display: inline-block;
  padding: 0.22rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.badge.ok {
  background: rgba(46, 204, 113, 0.25);
  border: 1px solid rgba(46, 204, 113, 0.45);
  color: #6ee7a0;
}
.badge.bad {
  background: rgba(231, 76, 60, 0.25);
  border: 1px solid rgba(231, 76, 60, 0.45);
  color: #ff8a7a;
}
.badge.warn {
  background: rgba(243, 156, 18, 0.25);
  border: 1px solid rgba(243, 156, 18, 0.45);
  color: #ffc96b;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--glass-border);
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem 0.4rem;
  border-left: 1px solid var(--glass-border);
}

.stat-box:first-child {
  border-left: none;
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.stat-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.stat-sub {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.1rem;
  font-weight: 500;
}

.usage-bar-wrap {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.usage-bar {
  height: 100%;
  background: linear-gradient(90deg, rgba(46, 204, 113, 0.7), rgba(39, 174, 96, 0.9));
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
  border-radius: 0 2px 2px 0;
  transition: width 0.4s ease;
}

.sub-link-block {
  padding: 0.85rem 1rem 0;
}

.sub-link-block-last {
  padding-bottom: 1rem;
}

.sub-link-block-all {
  text-align: center;
  padding: 1rem 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lbl-center {
  text-align: center;
  width: 100%;
  margin-bottom: 0.65rem;
  font-size: 0.8rem;
}

/* دکمه کپی همه — stroke رعد و برق */
.lightning-wrap {
  position: relative;
  width: 100%;
  max-width: 300px;
  border-radius: 16px;
  background: transparent;
  padding: 0;
}

.lightning-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 5px;
  background: linear-gradient(
    120deg,
    #3d5af1,
    #00e5ff,
    #fff59d,
    #00e5ff,
    #7c4dff,
    #3d5af1
  );
  background-size: 350% 100%;
  animation: lightning-flow 2.8s linear infinite;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.45));
}

.lightning-wrap::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  padding: 7px;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  background-size: 250% 100%;
  animation: lightning-sweep 3.5s ease-in-out infinite;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
}

.lightning-wrap:hover::before {
  animation-duration: 1.8s;
}

@keyframes lightning-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 350% 50%; }
}

@keyframes lightning-sweep {
  0%, 82% { background-position: 200% 0; opacity: 0; }
  86% { opacity: 0.85; }
  90% { opacity: 0; }
  92% { opacity: 0.6; }
  94% { opacity: 0; }
  100% { background-position: -100% 0; opacity: 0; }
}

.btn-copy-lightning {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 0.92rem;
  padding: 0.82rem 1.2rem;
  letter-spacing: 0.02em;
}

.btn-copy-lightning:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-copy-lightning.copied {
  background: rgba(46, 204, 113, 0.3);
  color: #7dffb0;
  box-shadow: 0 0 16px rgba(46, 204, 113, 0.3);
}

.sub-link-block + .sub-link-block {
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.15rem;
}

.lbl {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.sub-copy {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.sub-copy input,
.sub-copy textarea {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: #ccc;
  font-size: 0.7rem;
  padding: 0.55rem 0.65rem;
  font-family: var(--mono);
  resize: none;
}

.all-links-input {
  height: 2.5rem;
  overflow: hidden;
  line-height: 1.4;
}

.btn-copy {
  flex-shrink: 0;
  min-width: 5.5rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border-light);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-copy.copied {
  background: rgba(46, 204, 113, 0.3);
  border-color: rgba(46, 204, 113, 0.55);
  color: #7dffb0;
}

.btn-copy-wide {
  width: 100%;
  display: block;
  padding: 0.78rem 1rem;
  font-size: 0.88rem;
  border-radius: 12px;
}

.btn-copy:active,
.btn-copy-node:active,
.btn-copy-wide:active {
  transform: scale(0.98);
  opacity: 0.9;
}
.ltr-en {
  direction: ltr;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.74rem;
  unicode-bidi: isolate;
}

.muted { color: var(--muted); }

/* برنامه‌ها */
.apps-block {
  margin-bottom: 1rem;
}

.section-lbl {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.45rem;
  text-align: center;
}

.apps-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem 0.35rem 0.4rem;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.app-chip:hover {
  border-color: var(--glass-border-light);
  background: var(--glass2);
  color: var(--text);
}

.app-chip:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.app-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* جدول سرورها */
.table-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.table-title .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* لیست سرورها */
.server-list {
  border-radius: 16px;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.server-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}

.server-row:last-child {
  border-bottom: none;
}

.server-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.loc-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  font-weight: 600;
  min-width: 0;
}

.loc-name {
  line-height: 1.4;
  font-size: 0.9rem;
  color: var(--text);
}

.loc-name strong {
  font-weight: 700;
}

.loc-sep {
  font-weight: 500;
  color: var(--muted);
  margin: 0 0.05rem;
}

.flag-img {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.btn-copy-node {
  flex-shrink: 0;
  min-width: 5.5rem;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border-light);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-copy-node:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-copy-node.copied {
  background: rgba(46, 204, 113, 0.3);
  border-color: rgba(46, 204, 113, 0.55);
  color: #7dffb0;
}

/* جدول — نگه‌داری برای سازگاری */
.table-wrap {
  border-radius: 16px;
  overflow-x: auto;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.srv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 400px;
}

.srv-table thead {
  background: var(--glass2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.srv-table th {
  text-align: right;
  padding: 0.5rem 0.65rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.srv-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
  font-weight: 500;
}

.srv-table tbody tr:last-child td {
  border-bottom: none;
}

.srv-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.srv-table code {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

.loc-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.loc-cell img {
  border-radius: 3px;
  flex-shrink: 0;
}

#toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border-light);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 99;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

#toast.show { opacity: 1; }

@media (max-width: 400px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  .stat-box {
    border-left: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    text-align: right;
  }
  .stat-box:last-child {
    border-bottom: none;
  }
  .stat-lbl { margin-bottom: 0; }
  .stat-sub { margin-top: 0; margin-right: 0.5rem; }
  .page { padding: 1.1rem 0.6rem 2rem; }
  .srv-table { font-size: 0.7rem; min-width: 360px; }
}
