/* ── Variables ── */
:root {
  --bg:    #080808;
  --card:  rgba(255,255,255,.04);
  --brd:   rgba(255,255,255,.08);
  --brd-a: rgba(108,99,255,.4);
  --acc:   #6C63FF;
  --dim:   rgba(108,99,255,.13);
  --glow:  rgba(108,99,255,.35);
  --txt:   #fff;
  --muted: rgba(255,255,255,.42);
  /* Apple-style radius scale */
  --r-xl:  36px;
  --r-lg:  24px;
  --r-md:  16px;
  --r-sm:  10px;
  --r-xs:  8px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box }
html { scroll-behavior: smooth }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Particles canvas ── */
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none }

/* ── Shell ── */
.shell { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 28px }

/* ── Utility ── */
.dim   { color: var(--muted) }
.small { font-size: 12px }

/* Twemoji images */
img.emoji {
  height: 1em; width: 1em;
  margin: 0 .05em 0 .1em;
  vertical-align: -0.1em;
  display: inline-block;
}
.ls-flag img.emoji { height: 22px; width: 22px; margin: 0; vertical-align: middle }
.sflag img.emoji   { height: 24px; width: 24px; margin: 0; vertical-align: middle }
.ls-item-flag img.emoji { height: 22px; width: 22px; margin: 0; vertical-align: middle }

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 22px 0;
  border-bottom: 1px solid var(--brd);
}
.brand {
  font-size: 17px; font-weight: 700; letter-spacing: -.4px;
  text-decoration: none; color: var(--txt);
}
.brand span { color: var(--acc) }

nav { display: flex; gap: 24px; flex: 1; justify-content: center }
nav a { text-decoration: none; color: var(--muted); font-size: 14px; transition: color .18s }
nav a:hover { color: var(--txt) }

/* ── Lang switcher ── */
.ls { position: relative; margin-left: auto }

.ls-btn {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(145deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.03) 100%);
  border: 1px solid var(--brd);
  border-radius: 40px;
  padding: 7px 11px 7px 9px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px; font-weight: 500;
  transition: background .18s, border-color .18s;
  line-height: 1;
}
.ls-btn:hover {
  background: linear-gradient(145deg, rgba(255,255,255,.13) 0%, rgba(255,255,255,.06) 100%);
  border-color: rgba(255,255,255,.14);
}
.ls-flag { font-size: 20px; line-height: 1; display: flex; align-items: center }
.ls-code { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--txt) }

.ls-menu {
  position: absolute; top: 100%; right: 0;
  padding-top: 8px;
  z-index: 200; pointer-events: none;
  min-width: 160px;
}
.ls-menu.open { pointer-events: auto }

.ls-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(14,10,32,.95);
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(108,99,255,.22);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  cursor: pointer; width: 100%; color: var(--txt);
  opacity: 0; transform: translateY(-8px) scale(.95);
  transition: opacity .2s, transform .2s, background .15s;
}
.ls-item:last-child { margin-bottom: 0 }
.ls-item-flag { font-size: 20px; display: flex; align-items: center }
.ls-item-name { font-size: 13px; font-weight: 500; color: var(--txt) }
.ls-item:hover { background: rgba(108,99,255,.22) }

.ls-menu.open .ls-item:nth-child(1) { opacity:1; transform:none; transition-delay:.04s }
.ls-menu.open .ls-item:nth-child(2) { opacity:1; transform:none; transition-delay:.09s }
.ls-menu.open .ls-item:nth-child(3) { opacity:1; transform:none; transition-delay:.14s }

/* ── Hero ── */
.hero {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 24px;
  padding: 56px 0 42px;
}
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  color: var(--muted); margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ''; display: block;
  width: 20px; height: 1px; background: var(--muted); flex-shrink: 0;
}
.hero h1 {
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 700; letter-spacing: -1.8px; line-height: 1.08;
}
.hero h1.accent { color: var(--acc) }
.lead { margin-top: 16px; font-size: 15px }

.hero-aside {
  flex-shrink: 0; display: flex; align-items: flex-start; gap: 12px;
  margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.6;
  text-align: right;
}
.hero-aside svg { color: var(--acc); flex-shrink: 0; margin-top: 2px }
.hero-aside strong { color: var(--txt) }

/* ── Workspace (two-col) ── */
.workspace { display: grid; grid-template-columns: 1fr 304px; gap: 18px; margin-bottom: 60px }

/* ── Card ── */
.card {
  background: linear-gradient(145deg, rgba(255,255,255,.055) 0%, rgba(255,255,255,.018) 100%);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--brd);
  border-radius: var(--r-xl);
  padding: 26px 28px 20px;
}

/* ── Card top ── */
.card-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
  font-size: 13px;
}
.card-top .dim:last-child { margin-left: auto; font-size: 12px }

/* ── Status dot ── */
.dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--acc); flex-shrink: 0;
}
.dot.pulse { animation: pulse 2s ease-in-out infinite }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow) }
  50%       { box-shadow: 0 0 0 5px transparent }
}

/* ── Gauge ── */
.gauge-wrap { position: relative }
.gauge-num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 32px; pointer-events: none; text-align: center;
}
.gcap  { font-size: 11px; font-weight: 600; letter-spacing: .1em }
.gval  { font-size: clamp(2.8rem, 5vw, 4rem); font-weight: 700; letter-spacing: -2px; line-height: 1; margin: 3px 0 2px }
.gunit { font-size: 13px }

/* ── Go button ── */
.btn-row {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: -4px 0 22px;
}
.go-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 44px; border-radius: 50px;
  background: linear-gradient(145deg, #837BFF 0%, #5952D4 100%);
  border: none; color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .2s, box-shadow .2s, filter .2s, opacity .2s;
  box-shadow: 0 0 36px var(--glow), 0 4px 18px rgba(0,0,0,.35);
}
.go-btn:disabled { opacity: .4; cursor: default; box-shadow: none }
.go-btn:not(:disabled):hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow: 0 0 56px var(--glow), 0 6px 28px rgba(0,0,0,.4);
}
.go-btn:not(:disabled):active { transform: none; filter: brightness(.96) }

/* ── Metrics ── */
.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--brd);
  border-radius: var(--r-md); overflow: hidden; margin-bottom: 20px;
}
.metric { background: var(--bg); padding: 13px 16px }
.mlbl {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; margin-bottom: 5px;
}
.mval { display: flex; align-items: baseline; gap: 3px }
.mval strong { font-size: 20px; font-weight: 600 }
.mval span   { font-size: 12px }

/* ── Chart ── */
.chart-wrap { margin-bottom: 18px }
.chart-top  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px }
.eyebrow2   { font-size: 11px; font-weight: 600; letter-spacing: .08em }
.legend     { display: flex; align-items: center; gap: 10px }
.legline    { display: inline-block; width: 18px; height: 2px; border-radius: 2px; vertical-align: middle; margin-right: 3px }
.legline.dl { background: var(--acc) }
.legline.ul { background: rgba(108,99,255,.5) }
.chart-box  {
  position: relative; height: 86px;
  background: rgba(0,0,0,.18); border: 1px solid var(--brd);
  border-radius: var(--r-sm); overflow: hidden;
}
.chart-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ── Card footer ── */
.card-foot {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; padding-top: 16px; border-top: 1px solid var(--brd);
}
.card-foot strong { color: var(--txt) }
.copy-btn {
  margin-left: auto; background: none;
  border: 1px solid var(--brd); color: var(--muted);
  font-size: 12px; padding: 4px 12px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .18s, color .18s;
}
.copy-btn:hover { border-color: var(--acc); color: var(--acc) }

/* ── Locations card ── */
.loc-card { display: flex; flex-direction: column }
.loc-top  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px }
.loc-top h2 { font-size: 16px; font-weight: 600; margin-top: 6px }
.count-pill {
  background: var(--dim); color: var(--acc);
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(108,99,255,.2); flex-shrink: 0;
}
.auto-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: linear-gradient(145deg, rgba(108,99,255,.22) 0%, rgba(108,99,255,.07) 100%);
  border: 1px solid rgba(108,99,255,.22);
  color: var(--txt); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: filter .18s, border-color .18s;
}
.auto-btn:hover { filter: brightness(1.15); border-color: rgba(108,99,255,.4) }
.loc-hint { font-size: 12px; color: var(--muted); margin: 8px 0 14px }
.srv-list { display: flex; flex-direction: column; gap: 7px; flex: 1 }

/* ── Server card ── */
.srv-card {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--r-md);
  background: rgba(255,255,255,.025); border: 1px solid var(--brd);
  cursor: pointer; width: 100%;
  color: var(--txt);
  transition: background .16s, border-color .16s;
  text-align: left;
}
.srv-card:hover  { background: rgba(255,255,255,.05); border-color: rgba(108,99,255,.22) }
.srv-card.active {
  background: linear-gradient(145deg, rgba(108,99,255,.22) 0%, rgba(108,99,255,.07) 100%);
  border-color: var(--brd-a);
  box-shadow: 0 0 20px rgba(108,99,255,.12);
}
.sflag  { font-size: 22px; line-height: 1; flex-shrink: 0; display: flex; align-items: center }
.sinfo  { flex: 1; min-width: 0 }
.sname  { font-size: 13px; font-weight: 500; color: var(--txt) }
.ssub   { font-size: 11px; color: var(--muted); margin-top: 1px }
.sright { text-align: right; flex-shrink: 0 }
.sping  { font-size: 12px; font-weight: 600; color: var(--acc) }
.sstatus{ font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin-top: 2px; display: block }

/* ping quality */
.sping.ping-good { color: #4ade80 }
.sping.ping-ok   { color: #facc15 }
.sping.ping-bad  { color: #f87171 }
.sping.ping-meas { color: var(--muted); animation: blink 1.2s ease-in-out infinite }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* best server highlight */
.srv-card.srv-best { border-color: rgba(108,99,255,.35) }
.srv-card.srv-best .sstatus { color: var(--acc) }

.loc-foot {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--brd);
}
.loc-foot p { font-size: 12px; color: var(--muted); line-height: 1.5 }

/* ── About ── */
.about { margin-bottom: 72px }
.about h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  font-weight: 700; letter-spacing: -1px; line-height: 1.2;
  margin: 10px 0 36px;
}
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px }
.about-card {
  background: linear-gradient(145deg, rgba(255,255,255,.055) 0%, rgba(255,255,255,.018) 100%);
  border: 1px solid var(--brd);
  border-radius: var(--r-xl); padding: 28px 24px;
  transition: border-color .18s;
}
.about-card:hover { border-color: rgba(108,99,255,.22) }
.ab-num { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--acc); margin-bottom: 12px }
.about-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 9px }
.about-card p  { font-size: 13px; color: var(--muted); line-height: 1.6 }

/* ── Footer ── */
footer {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 0 28px; border-top: 1px solid var(--brd);
  font-size: 13px;
}
footer a { color: var(--muted); text-decoration: none; margin-left: auto; transition: color .18s }
footer a:hover { color: var(--acc) }

/* ── Responsive ── */
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr }
  .loc-card  { order: -1 }
  .about-grid { grid-template-columns: 1fr; gap: 10px }
  .metrics   { grid-template-columns: repeat(2, 1fr) }
  .hero      { flex-direction: column; gap: 28px }
  .hero-aside{ text-align: left }
  nav        { display: none }
}
@media (max-width: 480px) {
  .shell { padding: 0 16px }
  .card  { padding: 20px 18px 16px }
  .hero  { padding: 36px 0 28px }
}
