/* ===========================================================================
   CeeFAST — faithful "finex" speed-test dashboard (dark, Geist, cyan→blue)
   =========================================================================== */

:root {
  --bg: #050506;
  --bg-2: #0c0d10;
  --fg: #f4f4f5;
  --muted: #8b90a0;
  --faint: #5b6070;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --card: rgba(255, 255, 255, 0.03);
  --card-2: rgba(255, 255, 255, 0.05);
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --purple: #a855f7;
  --green: #22c55e;
  --tex: rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-2: #ffffff;
  --fg: #0b0d12;
  --muted: #5b616e;
  --faint: #8b90a0;
  --line: rgba(10, 12, 20, 0.10);
  --line-2: rgba(10, 12, 20, 0.16);
  --card: rgba(255, 255, 255, 0.75);
  --card-2: rgba(10, 12, 20, 0.03);
  --cyan: #0891b2;
  --blue: #2563eb;
  --tex: rgba(10, 12, 20, 0.025);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; line-height: 1.55;
  min-height: 100vh; position: relative; overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}
body::before {  /* faint diagonal texture */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: repeating-linear-gradient(135deg, var(--tex) 0 1px, transparent 1px 46px);
}
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--cyan); }

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }

/* ---------------- nav ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0; position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--fg); letter-spacing: -.2px; }
.brand span { text-shadow: 0 0 16px rgba(255,255,255,.22); }
.mark { flex: 0 0 auto; width: 25px; height: 25px; color: var(--cyan); filter: drop-shadow(0 0 5px rgba(34,211,238,.7)); }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--fg); }
.nav-right { display: inline-flex; align-items: center; gap: 10px; }
.theme-btn {
  border: 1px solid var(--line-2); background: var(--card); color: var(--fg);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); transition: border-color .15s, transform .2s;
}
.theme-btn:hover { border-color: var(--cyan); transform: rotate(-15deg); }
@media (max-width: 640px) { .nav { display: none; } }

/* ---------------- hero ---------------- */
.hero { text-align: center; max-width: 680px; margin: 0 auto; padding: 3.5vh 0 2vh; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 13px; background: var(--card);
  backdrop-filter: blur(8px);
}
.hero-title {
  font-size: clamp(22px, 3.4vw, 34px); font-weight: 800; line-height: 1.12;
  letter-spacing: -1px; margin: 14px 0 0;
}
.hero-sub { color: var(--muted); font-size: clamp(13px, 1.5vw, 15px); max-width: 480px; margin: 10px auto 0; line-height: 1.55; }

/* ---------------- dashboard card ---------------- */
.dash {
  position: relative; margin-top: 18px; border: 1px solid var(--line); border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.018) 32%, rgba(255,255,255,.006));
  overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.dash::before {  /* inner ambient glow — multi-stop falloff to avoid banding */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(58% 60% at 66% 26%, rgba(34,211,238,.17), rgba(34,211,238,.08) 34%, rgba(34,211,238,.025) 55%, transparent 72%),
    radial-gradient(46% 58% at 22% 92%, rgba(99,102,241,.13), rgba(99,102,241,.045) 44%, transparent 74%);
}
.dash::after {  /* fine grain dithers the glow, killing colour banding */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
}
.dash-head {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: flex-end;
  padding: 15px 22px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.dash-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.dash-brand .mark { font-size: 16px; }
.dash-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dash-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.dash-grid {
  position: relative; z-index: 1; display: grid; grid-template-columns: 210px 1fr 240px;
  gap: 26px; padding: 28px 26px 34px; align-items: start;
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; gap: 30px; }
  .dash-center { order: -1; }   /* gauge above the client/connection data on mobile */
}

.micro { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); margin-bottom: 14px; }

/* connection column */
.conn-row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.conn-row:last-child { border-bottom: 0; }
.conn-row i { width: 36px; height: 36px; border-radius: 11px; background: var(--card-2); border: 1px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 15px; flex: 0 0 auto; }
.conn-row b { display: block; font-size: 14px; line-height: 1.25; word-break: break-all; }
.conn-row small { color: var(--faint); font-size: 11px; }
.mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* center gauge */
.dash-center { text-align: center; }
.gaugewrap { position: relative; width: min(300px, 74vw); aspect-ratio: 1 / 1; margin: 8px auto 0; display: grid; place-items: center; }
.gauge { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-linecap: round; }
.gauge .track { stroke: var(--line-2); stroke-width: 5; stroke-dasharray: 245 327; }
.gauge .fill {
  stroke: url(#cf-grad); stroke-width: 6.5; stroke-dasharray: 245 327; stroke-dashoffset: 245;
  transition: stroke-dashoffset .4s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 0 4px rgba(34,211,238,.55)) drop-shadow(0 0 14px rgba(59,130,246,.35));
}
.bignum {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
  font-family: 'Geist Mono', ui-monospace, monospace; font-weight: 600; line-height: .9; letter-spacing: -2px;
}
.bignum #speed { font-size: clamp(48px, 12vw, 78px); font-variant-numeric: tabular-nums; color: var(--fg); }
.bignum .unit { font-family: 'Geist', sans-serif; font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: 1px; margin-top: 6px; text-transform: uppercase; }

.status { color: var(--muted); font-size: 12px; min-height: 16px; margin-top: 14px; letter-spacing: .3px; }
.progress { height: 3px; width: min(240px, 60%); margin: 12px auto 0; background: var(--line); border-radius: 3px; overflow: hidden; opacity: 0; transition: opacity .3s; }
body.running .progress { opacity: 1; }
.progress .bar { height: 100%; width: 38%; border-radius: 3px; background: linear-gradient(90deg, #2dd4bf, #22d3ee 45%, #3b82f6 80%, #6366f1); box-shadow: 0 0 12px rgba(34,211,238,.55); animation: cf-slide 1.15s ease-in-out infinite; }
.meter[data-phase="ul"] .progress .bar { background: linear-gradient(90deg, #22d3ee, #6366f1 50%, #a855f7); box-shadow: 0 0 12px rgba(168,85,247,.5); }
@keyframes cf-slide { 0% { transform: translateX(-160%); } 100% { transform: translateX(380%); } }

.controls { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 18px; min-height: 42px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--fg);
  font-size: 13px; font-weight: 600; cursor: pointer; backdrop-filter: blur(8px);
  transition: border-color .15s, box-shadow .2s, transform .15s;
}
.pill:hover { border-color: var(--cyan); transform: translateY(-1px); }
.pill.accent {
  border-color: transparent; color: #eafeff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0) 45%),
    linear-gradient(100deg, rgba(45,212,191,.28), rgba(34,211,238,.24) 42%, rgba(99,102,241,.26) 82%, rgba(168,85,247,.24));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 0 0 1px rgba(34,211,238,.45), 0 6px 24px rgba(34,211,238,.30);
}

/* stats column */
.dash-stats { display: flex; flex-direction: column; gap: 12px; }
.stat { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px; background: var(--card); }
.stat-top { display: flex; align-items: center; gap: 9px; }
.stat-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.stat.dl .stat-ic { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 16%, transparent); }
.stat.ul .stat-ic { color: var(--purple); background: color-mix(in srgb, var(--purple) 16%, transparent); }
.stat.pg .stat-ic { color: var(--green); background: color-mix(in srgb, var(--green) 16%, transparent); }
.stat-name { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.stat-val { margin-top: 8px; font-family: 'Geist Mono', monospace; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-val small { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat-sub { font-family: 'Geist', sans-serif; font-size: 11px; color: var(--faint); font-style: normal; }
.spark { position: absolute; right: 12px; top: 14px; width: 66px; height: 22px; opacity: .8; }
.stat.dl .spark { color: var(--cyan); } .stat.ul .spark { color: var(--purple); }

/* ---------------- prose ---------------- */
.prose { max-width: 1020px; margin: 24px auto 60px; padding: 0 20px; }
.prose h1 { font-size: clamp(26px, 4.4vw, 38px); line-height: 1.15; letter-spacing: -.6px; }
.prose h2 { font-size: 20px; margin-top: 36px; padding-bottom: 8px; border-bottom: 1px solid var(--line); letter-spacing: -.2px; }
.prose p { color: color-mix(in srgb, var(--fg) 84%, transparent); }
.faq { margin: 18px 0; }
.faq dt { font-weight: 600; margin-top: 16px; }
.faq dd { margin: 5px 0 0; color: var(--muted); }
.prose ol, .prose ul { padding-left: 20px; }
.prose li { margin: 5px 0; color: color-mix(in srgb, var(--fg) 84%, transparent); }
.prose table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.prose strong { color: var(--fg); }
.citylist, .langlist { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.citylist.big { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.citylist li, .langlist li { font-size: 14px; }
.citylist a, .langlist a { color: color-mix(in srgb, var(--fg) 78%, transparent); }
.citylist a:hover, .langlist a:hover { color: var(--cyan); }
.foot { margin-top: 20px; color: var(--muted); }

/* ---------------- network tools ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0,0,0,.4); padding: 22px 22px 18px; }
.tools { margin: 34px 0; }
.tools.card h2, .offers-head h2 { margin-top: 0; border: 0; padding: 0; font-size: 18px; }
.toolnote { color: var(--muted); font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.hostin { flex: 1 1 220px; min-width: 0; padding: 11px 14px; font-size: 15px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); color: var(--fg); }
.hostin::placeholder { color: var(--faint); }
.dnstype { padding: 11px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); color: var(--fg); font-size: 14px; }
.toolbtn { padding: 11px 18px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card-2); color: var(--fg); transition: border-color .15s, box-shadow .2s; }
.toolbtn:hover { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 12%, transparent); }
.toolbtn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.tool-out { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; overflow-x: auto; }
.tool-out .mono, .mono.blk { font-family: 'Geist Mono', ui-monospace, monospace; font-size: 13px; white-space: pre; margin: 0; color: var(--fg); }
.tool-head, .dns-head { font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.tool-head .tag, .dns-head b { color: var(--cyan); }
.tag { font-size: 11px; border: 1px solid var(--cyan); border-radius: 6px; padding: 0 5px; }
.dns-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.dns-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dns-tbl .ans { word-break: break-all; font-family: 'Geist Mono', monospace; }
.dns-tbl .st { text-align: end; width: 28px; }
.dns-tbl .muted, .muted { color: var(--muted); }
.ok { color: var(--green); } .bad { color: #f87171; }
.port-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.port { display: flex; flex-direction: column; gap: 1px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); font-size: 12px; }
.port b { font-family: 'Geist Mono', monospace; font-size: 15px; }
.port span { color: var(--muted); }
.port em { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.port.p-open { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.port.p-open em { color: var(--green); }
.port.p-closed em { color: var(--faint); }
.port.p-filt em { color: #f59e0b; }
.tool-explain { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.tool-explain .tx { display: flex; gap: 10px; align-items: flex-start; }
.tool-explain .ic { font-size: 20px; line-height: 1.2; flex: 0 0 auto; }
.tool-explain b { display: block; font-size: 14px; }
.tool-explain p { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.embed-preview { margin: 14px 0; }
body.embed { background: transparent; }
body.embed::before { display: none; }
body.embed .topbar, body.embed .hero { display: none; }
body.embed .dash { margin-top: 0; }

/* ---------------- footer ---------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 46px; padding: 30px 20px; background: color-mix(in srgb, var(--bg) 60%, transparent); }
.foot-wrap { max-width: 1020px; margin: 0 auto; text-align: center; }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.foot-tag { color: var(--muted); font-size: 14px; margin: 8px 0; }
.foot-nav { font-size: 14px; margin: 10px 0; line-height: 2; }
.foot-nav a { color: color-mix(in srgb, var(--fg) 78%, transparent); }
.foot-nav a:hover { color: var(--cyan); }
.foot-copy { color: var(--faint); font-size: 12px; margin-top: 10px; }

/* ---------------- a11y / motion ---------------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.hostin:focus { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: transparent; }
@media (prefers-reduced-motion: reduce) { .progress .bar { animation: none; width: 100%; } .theme-btn:hover, .pill:hover { transform: none; } html { scroll-behavior: auto; } }
