/* TinyNetwork — server status page */
@font-face {
  font-family: 'Cinema';
  src: url('../fonts/Cinema.woff2') format('woff2'),
       url('../fonts/Cinema.woff') format('woff'),
       url('../fonts/Cinema.ttf') format('truetype');
  font-weight: 400 900; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #05080f;
  --card: rgba(255, 255, 255, .04);
  --line: rgba(255, 255, 255, .09);
  --txt: #eaf1fb;
  --muted: #8fa1b8;
  --ok: #34d399;
  --bad: #fb7185;
  --acc: #38bdf8;
  --warn: #fbbf24;
  --r-lg: 24px;
  --r-sm: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 76px 24px 24px;
  overflow-x: hidden;
}

h1, h2, .label {
  font-family: 'Cinema', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
}

/* ---------- Site nav ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(5, 8, 15, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-nav .nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--txt);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}
/* balances the brand so the links sit dead-center above the status card */
.site-nav::after { content: ''; flex: 1; }
.site-nav .nav-items {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.site-nav .nav-items a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  transition: color .2s;
}
.site-nav .nav-items a:hover { color: var(--txt); }
@media (max-width: 600px) {
  .site-nav { padding: 8px 14px; gap: 10px; }
  .site-nav .nav-brand { flex: 0 0 auto; }
  .site-nav .nav-brand span { display: none; }
  .site-nav::after { display: none; }
  /* one swipeable line instead of three wrapped rows; the fade hints there is more */
  .site-nav .nav-items {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0 16px;
    padding-inline-end: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to left, #000 82%, transparent);
            mask-image: linear-gradient(to left, #000 82%, transparent);
  }
  .site-nav .nav-items::-webkit-scrollbar { display: none; }
  .site-nav .nav-items a { font-size: 12.5px; white-space: nowrap; }
}

.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- Aurora orbs ---------- */
.orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .55;
  will-change: transform;
}
.orb.o1 {
  width: 440px; height: 440px;
  background: rgba(37, 99, 235, .30);
  top: -12%; right: -8%;
  animation: drift1 22s ease-in-out infinite alternate;
}
.orb.o2 {
  width: 480px; height: 480px;
  background: rgba(56, 189, 248, .20);
  bottom: -18%; left: -12%;
  animation: drift2 28s ease-in-out infinite alternate;
}
.orb.o3 {
  width: 320px; height: 320px;
  background: rgba(124, 58, 237, .18);
  top: 38%; left: 52%;
  animation: drift3 34s ease-in-out infinite alternate;
}
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-90px, 70px) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1.1); }
  to   { transform: translate(110px, -60px) scale(.92); }
}
@keyframes drift3 {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(-70px, -90px) rotate(25deg); }
}

/* ---------- Card ---------- */
.status-screen { position: relative; z-index: 1; width: 100%; display: flex; justify-content: center; }
.status-card {
  width: 100%;
  max-width: 720px;
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 26px 18px;
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px -24px rgba(2, 12, 27, .95);
  animation: cardIn .6s cubic-bezier(.22, .8, .26, .99) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}
.brand img { border-radius: 8px; }
.host-chip .flag {
  width: 18px; height: 12px;
  flex-shrink: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15);
}
.host-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--acc);
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: 999px;
  padding: 4px 14px;
  background: rgba(56, 189, 248, .07);
  animation: chipGlow 3s ease-in-out infinite;
}
@keyframes chipGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(56, 189, 248, 0); }
  50% { box-shadow: 0 0 18px rgba(56, 189, 248, .25); }
}

/* ---------- Hero status ---------- */
.status-live {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0 22px;
}
.dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--muted);
  position: relative;
}
.dot::before, .dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
}
.status-live[data-state="loading"] .dot { animation: blink 1.1s ease-in-out infinite; }
.status-live[data-state="loading"] .label { color: var(--muted); background: none; -webkit-text-fill-color: currentColor; }

.status-live[data-state="up"] { color: var(--ok); }
.status-live[data-state="up"] .dot {
  background: var(--ok);
  box-shadow: 0 0 22px rgba(52, 211, 153, .8), 0 0 70px rgba(52, 211, 153, .35);
}
.status-live[data-state="up"] .dot::before { animation: ripple 2s ease-out infinite; }
.status-live[data-state="up"] .dot::after { animation: ripple 2s ease-out 1s infinite; }

.status-live[data-state="down"] { color: var(--bad); }
.status-live[data-state="down"] .dot {
  background: var(--bad);
  box-shadow: 0 0 22px rgba(251, 113, 133, .75), 0 0 70px rgba(251, 113, 133, .32);
}
.status-live[data-state="down"] .dot::before { animation: ripple 1.4s ease-out infinite; }
.status-live[data-state="down"] .dot::after { animation: ripple 1.4s ease-out .7s infinite; }

.status-live[data-state="slow"] { color: var(--warn); }
.status-live[data-state="slow"] .dot {
  background: var(--warn);
  box-shadow: 0 0 22px rgba(251, 191, 36, .75), 0 0 70px rgba(251, 191, 36, .3);
}
.status-live[data-state="slow"] .dot::before { animation: ripple 1.8s ease-out infinite; }
.status-live[data-state="slow"] .dot::after { animation: ripple 1.8s ease-out .9s infinite; }

@keyframes ripple {
  0%   { transform: scale(1); opacity: .6; }
  100% { transform: scale(3.2); opacity: 0; }
}
@keyframes blink {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}

.label {
  font-size: clamp(40px, 8vw, 58px);
  font-weight: 700;
  line-height: 1.15;
  transition: color .3s;
}
.status-live[data-state="up"] .label {
  background: linear-gradient(110deg, #34d399 20%, #a7f3d0 40%, #38bdf8 60%, #34d399 80%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 4s linear infinite;
}
.status-live[data-state="down"] .label {
  background: linear-gradient(110deg, #fb7185 20%, #fecdd3 45%, #f97316 70%, #fb7185 90%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 3s linear infinite;
}
.status-live[data-state="slow"] .label {
  background: linear-gradient(110deg, #fbbf24 20%, #fef3c7 45%, #f59e0b 70%, #fbbf24 90%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 3.5s linear infinite;
}
@keyframes sheen {
  0%   { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}

.sub {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  animation: fadeSwap .5s ease both;
}
@keyframes fadeSwap {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .025);
  animation: tileIn .55s cubic-bezier(.22, .8, .26, .99) both;
  animation-delay: calc(.25s + var(--i) * .1s);
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.m-label { color: var(--muted); font-size: 11.5px; }
.m-val { font-size: 18px; font-weight: 700; line-height: 1.45; }
#mQuality[data-q="great"], #mQuality[data-q="good"] { color: var(--ok); }
#mQuality[data-q="poor"] { color: var(--warn); }
#mQuality[data-q="down"] { color: var(--bad); }

/* ---------- 24h uptime ---------- */
.uptime {
  margin-top: 12px;
  padding: 13px 14px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .025);
  animation: tileIn .55s cubic-bezier(.22, .8, .26, .99) .55s both;
}
.uptime-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.uptime-head h2 {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
}
#uptimePct { font-size: 15px; color: var(--muted); }
#uptimePct[data-s="up"] { color: var(--ok); }
#uptimePct[data-s="warn"] { color: var(--warn); }
#uptimePct[data-s="down"] { color: var(--bad); }

/* RTL: the oldest half-hour sits on the right, "now" on the left, matching the axis labels */
.uptime-bar { display: flex; gap: 2px; height: 30px; }
.uptime-bar i, .uptime-legend i {
  display: block;
  border-radius: 2px;
  background: rgba(148, 163, 184, .16);
}
.uptime-bar i {
  flex: 1 1 0;
  min-width: 2px;
  cursor: pointer;
  outline: none;
  transition: transform .15s, filter .15s;
}
.uptime-bar i:hover, .uptime-bar i:focus-visible { transform: scaleY(1.18); filter: brightness(1.3); }
.uptime-bar i:focus-visible { box-shadow: 0 0 0 1.5px var(--acc); }
.uptime-bar i[data-s="up"], .uptime-legend i[data-s="up"] { background: var(--ok); }
.uptime-bar i[data-s="warn"], .uptime-legend i[data-s="warn"] { background: var(--warn); }
.uptime-bar i[data-s="down"], .uptime-legend i[data-s="down"] { background: var(--bad); }
.uptime-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--muted);
}
.uptime-readout {
  min-height: 20px;
  margin-top: 4px;
  font-size: 12px;
  text-align: center;
}
.uptime-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.uptime-legend span { display: inline-flex; align-items: center; gap: 5px; }
.uptime-legend i { width: 9px; height: 9px; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  color: var(--muted);
  font-size: 12px;
}
.auto-refresh { display: inline-flex; align-items: center; gap: 6px; }
.auto-refresh i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, .7);
  animation: blink 2.4s ease-in-out infinite;
}


@media (max-width: 430px) {
  .metrics { gap: 8px; }
  .metric { padding: 10px 6px; }
  .m-val { font-size: 16px; }
  .uptime-bar { gap: 1.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Buy button ---------- */
.buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  background: linear-gradient(120deg, #38bdf8, #2563eb);
  background-size: 180% auto;
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  transition: background-position .4s, transform .2s, box-shadow .3s;
  box-shadow: 0 10px 26px -12px rgba(37, 99, 235, .8);
  animation: tileIn .55s cubic-bezier(.22, .8, .26, .99) both;
  animation-delay: .5s;
}
.buy-btn:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -12px rgba(37, 99, 235, .9);
}
.buy-btn:active { transform: translateY(0) scale(.98); }

/* ---------- 3 Dedicated Servers Grid ---------- */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  box-shadow: 0 0 6px var(--ok);
  animation: blink 1.4s infinite ease-in-out;
}

.servers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 6px;
}
@media (max-width: 680px) {
  .servers-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.server-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .03);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  animation: tileIn .55s cubic-bezier(.22, .8, .26, .99) both;
}
.server-card:hover {
  border-color: rgba(56, 189, 248, .35);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5);
}
.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.sc-country {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sc-flag {
  display: flex;
  align-items: center;
  width: 24px;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 6px rgba(0,0,0,.4);
  flex-shrink: 0;
}
.flag-icon {
  width: 100%;
  height: 100%;
  display: block;
}
.sc-title-wrap {
  display: flex;
  flex-direction: column;
}
.sc-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--txt);
  line-height: 1.2;
}
.sc-sub {
  font-size: 10px;
  color: var(--muted);
}
.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(52, 211, 153, .12);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, .25);
}
.sc-badge.live .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: blink 1.4s infinite ease-in-out;
}
.sc-badge.warn {
  background: rgba(251, 191, 36, .12);
  color: var(--warn);
  border-color: rgba(251, 191, 36, .25);
}
.sc-badge.warn .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
}
.sc-badge.down {
  background: rgba(251, 113, 133, .12);
  color: var(--bad);
  border-color: rgba(251, 113, 133, .25);
}
.sc-badge.down .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bad);
}
.sc-ping-box {
  background: rgba(0, 0, 0, .25);
  border: 1px solid rgba(255, 255, 255, .04);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  margin-bottom: 12px;
}
.sc-ping-val {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}
.sc-val {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.sc-unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.sc-ping-label {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
}
.sc-details {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11.5px;
}
.sc-detail-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.sc-detail-k {
  color: var(--muted);
}
.sc-detail-v {
  font-weight: 700;
  color: var(--txt);
}
.sc-detail-v.great, .sc-detail-v.good { color: var(--ok); }
.sc-detail-v.poor { color: var(--warn); }
.sc-detail-v.down { color: var(--bad); }
