/* Hipernet Hız Testi — Ookla Speedtest görünümünde sıfırdan arayüz */
:root {
  --hn-page: #eef3fa;
  --hn-navy: #06295d;
  --hn-orange: #ec741a;
  --hn-card: #141827;
  --hn-card-2: #1b2033;
  --hn-line: rgba(255, 255, 255, 0.08);
  --hn-text: #ffffff;
  --hn-muted: #8d93ab;
  --hn-dim: #5c6280;
  --hn-cyan: #2ad3ff;
  --hn-teal: #6cf2e4;
  --hn-purple: #c25cff;
  --hn-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--hn-font);
  color: var(--hn-navy);
  background:
    radial-gradient(1100px 520px at 50% -160px, rgba(12, 168, 216, 0.16), transparent 70%),
    linear-gradient(180deg, #f6f9fd 0%, var(--hn-page) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 12px calc(16px + env(safe-area-inset-bottom));
}

button { font-family: inherit; }

/* ---------- Sayfa başlığı ---------- */
.hn-page-head {
  width: 100%;
  max-width: 980px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 14px;
}
.hn-logo { display: inline-flex; }
.hn-logo img { height: 46px; width: auto; display: block; }
.hn-nav { display: flex; align-items: center; gap: 6px; }
.hn-nav a,
.hn-nav-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--hn-navy);
  -webkit-text-fill-color: var(--hn-navy);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.hn-nav a:hover,
.hn-nav-btn:hover,
.hn-nav a:focus-visible,
.hn-nav-btn:focus-visible {
  background: #fff;
  border-color: rgba(6, 41, 93, 0.12);
  color: var(--hn-orange);
  -webkit-text-fill-color: var(--hn-orange);
  outline: none;
}

/* ---------- Kart ---------- */
.hn-card {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, var(--hn-card-2) 0%, var(--hn-card) 38%);
  color: var(--hn-text);
  border-radius: 20px;
  box-shadow: 0 30px 70px -28px rgba(6, 41, 93, 0.55), 0 0 0 1px rgba(6, 41, 93, 0.06);
  padding: 18px 26px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.hn-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 28px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.hn-brand svg { color: var(--hn-teal); }

/* ---------- Üst sonuçlar ---------- */
/* BAŞLAT'ta kart büyümesin: sonuçlar idle'da da yer kaplar, sadece soluk görünür. */
.hn-results {
  margin-top: 18px;
  height: 118px;
  transition: opacity .3s ease;
}
body[data-state="idle"] .hn-results { opacity: 0.35; }
body[data-state="idle"] .hn-graph { visibility: hidden; }

.hn-res-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hn-res { text-align: center; min-width: 0; }
.hn-res-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--hn-muted);
  transition: color .25s;
}
.hn-res-label b { font-weight: 700; letter-spacing: 0.06em; color: #fff; }
.hn-res-label span { color: var(--hn-muted); font-weight: 400; }
.hn-res-dl .hn-res-label svg { color: var(--hn-cyan); }
.hn-res-ul .hn-res-label svg { color: var(--hn-purple); }

.hn-res-value {
  margin-top: 4px;
  height: 52px;
  line-height: 52px;
  font-size: 44px;
  font-weight: 300;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}
.hn-res-value.is-empty { color: var(--hn-dim); font-weight: 200; }

.hn-res.is-pending { opacity: 0.38; }
.hn-res.is-active { opacity: 1; }

.hn-lat-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 13px;
  color: var(--hn-muted);
  white-space: nowrap;
}
.hn-lat { display: inline-flex; align-items: center; gap: 6px; }
.hn-lat svg { color: #f6c64e; }
.hn-lat[data-metric="jitter"] svg { color: #f6c64e; }
.hn-lat strong {
  color: #fff;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 1ch;
  text-align: center;
}
.hn-sep { width: 1px; height: 14px; background: var(--hn-line); display: inline-block; }

/* ---------- Hız grafiği ---------- */
.hn-graph {
  margin-top: 8px;
  height: 44px;
  transition: opacity .25s, visibility 0s;
}
.hn-graph svg { width: 100%; height: 100%; display: block; overflow: visible; }
body[data-state="connecting"] .hn-graph { opacity: 0; }
.hn-graph-base { stroke: var(--hn-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.hn-graph-line-dl,
.hn-graph-line-ul {
  fill: none;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.hn-graph-line-dl { stroke: var(--hn-cyan); }
.hn-graph-line-ul { stroke: var(--hn-purple); }
.hn-graph-area-dl { fill: url(#hnGraphDl); stroke: none; }
.hn-graph-area-ul { fill: url(#hnGraphUl); stroke: none; }

/* ---------- Gösterge sahnesi ---------- */
.hn-stage {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: 6px auto 0;
  aspect-ratio: 300 / 302;
}
.hn-gauge,
.hn-spinner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transition: opacity .3s;
  pointer-events: none;
}

.hn-arc-track,
.hn-arc-fill {
  fill: none;
  stroke-width: 24;
  stroke-linecap: butt;
}
.hn-arc-track { stroke: #262b40; }
.hn-arc-fill {
  stroke: url(#hnArcDl);
  stroke-dasharray: 0 100;
  filter: drop-shadow(0 0 7px rgba(42, 211, 255, 0.45));
}
body.is-upload .hn-arc-fill {
  stroke: url(#hnArcUl);
  filter: drop-shadow(0 0 7px rgba(194, 92, 255, 0.5));
}

.hn-ticks text {
  fill: #9aa0b8;
  font-size: 14px;
  font-weight: 400;
  font-family: var(--hn-font);
  dominant-baseline: central;
  transition: fill .2s;
}
.hn-ticks text.is-lit { fill: #fff; }

.hn-needle { transition: opacity .25s; }

.hn-speed {
  fill: #fff;
  font-family: var(--hn-font);
  font-size: 48px;
  font-weight: 200;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.hn-unit text {
  fill: var(--hn-muted);
  font-family: var(--hn-font);
  font-size: 15px;
  font-weight: 400;
}
.hn-unit-ico { color: var(--hn-cyan); }
body.is-upload .hn-unit-ico { color: var(--hn-purple); }
body.is-ping .hn-unit-ico { color: #f6c64e; }

body.is-ping .hn-ticks,
body.is-ping .hn-needle,
body.is-ping .hn-arc-fill { opacity: 0; }
body.is-ping .hn-arc-track { stroke: #22273a; }

.hn-gauge { opacity: 0; }
body[data-state="ping"] .hn-gauge,
body[data-state="download"] .hn-gauge,
body[data-state="upload"] .hn-gauge { opacity: 1; }

.hn-spinner { opacity: 0; }
body[data-state="connecting"] .hn-spinner { opacity: 1; }
.hn-spin-rot { transform-origin: 150px 150px; animation: hn-spin 1.1s linear infinite; }
body:not([data-state="connecting"]) .hn-spin-rot { animation-play-state: paused; }
.hn-spin-text { fill: #fff; font-family: var(--hn-font); font-size: 22px; font-weight: 300; }
@keyframes hn-spin { to { transform: rotate(360deg); } }

/* ---------- BAŞLAT düğmesi ---------- */
.hn-go {
  position: absolute;
  left: 50%;
  top: 49.67%;
  width: 62%;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--hn-teal);
  background: radial-gradient(circle at 50% 50%, rgba(108, 242, 228, 0.07) 0%, rgba(108, 242, 228, 0) 70%);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: clamp(22px, 6.4vw, 30px);
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(108, 242, 228, 0.0), inset 0 0 26px rgba(108, 242, 228, 0.12);
  transition: box-shadow .25s, background-color .25s, opacity .25s, border-color .25s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hn-go:hover,
.hn-go:focus-visible {
  outline: none;
  background-color: rgba(108, 242, 228, 0.1);
  box-shadow: 0 0 34px rgba(108, 242, 228, 0.32), inset 0 0 30px rgba(108, 242, 228, 0.2);
}
.hn-go:active { background-color: rgba(108, 242, 228, 0.18); }
.hn-go:disabled { cursor: progress; opacity: 0.55; }

body:not([data-state="idle"]):not([data-state="done"]) .hn-go {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body[data-state="done"] .hn-go { font-size: clamp(20px, 5.6vw, 26px); }

/* ---------- Sunucu / sağlayıcı ---------- */
.hn-meta {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--hn-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.hn-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.hn-meta-ico {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.hn-meta-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.hn-meta-text strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  overflow-wrap: anywhere;
}
.hn-meta-text span {
  font-size: 13px;
  line-height: 1.3;
  color: var(--hn-muted);
  overflow-wrap: anywhere;
}
.hn-meta-link { display: flex; justify-content: center; gap: 4px; }
.hn-meta-link i { width: 4px; height: 4px; border-radius: 50%; background: var(--hn-dim); }

/* ---------- Alt bilgi ---------- */
.hn-privacy-note {
  margin: 14px 0 0;
  max-width: 560px;
  text-align: center;
  font-size: 12.5px;
  color: #4c5f80;
}
.hn-privacy-note button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--hn-navy);
  -webkit-text-fill-color: var(--hn-navy);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.hn-privacy-note button:hover { color: var(--hn-orange); -webkit-text-fill-color: var(--hn-orange); }

.hn-footer {
  margin-top: auto;
  padding-top: 18px;
  font-size: 12.5px;
  color: #6a7a96;
}
.hn-footer a { color: var(--hn-navy); -webkit-text-fill-color: var(--hn-navy); font-weight: 600; text-decoration: none; }
.hn-footer a:hover { color: var(--hn-orange); -webkit-text-fill-color: var(--hn-orange); }

.hn-dialog {
  width: min(92vw, 460px);
  border: 0;
  border-radius: 16px;
  padding: 22px 22px 18px;
  color: var(--hn-navy);
  box-shadow: 0 30px 80px -20px rgba(6, 41, 93, 0.5);
}
.hn-dialog::backdrop { background: rgba(6, 20, 45, 0.55); }
.hn-dialog h2 { margin: 0 0 10px; font-size: 18px; }
.hn-dialog p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: #33476b; }
.hn-dialog a { color: #0a4ea8; }
.hn-dialog form { display: flex; justify-content: flex-end; margin-top: 6px; }
.hn-dialog-btn {
  border: 0;
  border-radius: 999px;
  background: var(--hn-orange);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 20px;
  cursor: pointer;
}
.hn-dialog-btn:hover { background: #d4650f; }

/* ---------- Mobil (telefon) ---------- */
@media (max-width: 560px) {
  .hn-page-head { padding: 12px 2px 10px; }
  .hn-logo img { height: 38px; }
  .hn-nav a,
  .hn-nav-btn { padding: 7px 9px; font-size: 13px; }
  .hn-card { padding: 16px 16px 18px; border-radius: 18px; }
  .hn-results { height: 108px; margin-top: 14px; }
  .hn-res-label { font-size: 11.5px; gap: 5px; }
  .hn-res-label svg { width: 16px; height: 16px; }
  .hn-res-value { font-size: 36px; height: 46px; line-height: 46px; }
  .hn-lat-row { font-size: 12.5px; gap: 10px; }
  .hn-meta { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hn-meta-link { display: none; }
}

/* ---------- Çok küçük ekran ---------- */
@media (max-width: 360px) {
  .hn-nav a:first-child { display: none; }
  .hn-res-value { font-size: 31px; }
  .hn-card { padding: 12px 12px 14px; }
}

/* ---------- Tablet (yatay) ---------- */
@media (min-width: 561px) and (max-width: 1024px) {
  .hn-card { max-width: 520px; }
}

/* ---------- Büyük desktop ---------- */
@media (min-width: 1200px) {
  .hn-card { max-width: 600px; padding: 22px 32px 26px; }
  .hn-res-value { font-size: 48px; height: 56px; line-height: 56px; }
}

/* ---------- Kısa ekran (yatay telefon vb.) ---------- */
@media (max-height: 580px) {
  .hn-results { height: 92px; margin-top: 10px; }
  .hn-res-value { font-size: 30px; height: 38px; line-height: 38px; }
  .hn-lat-row { margin-top: 6px; font-size: 12px; }
  .hn-graph { height: 28px; margin-top: 4px; }
  .hn-stage { max-width: 260px; }
  .hn-meta { margin-top: 8px; padding-top: 10px; gap: 8px; }
}

/* ---------- Hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
  .hn-go,
  .hn-arc-fill,
  .hn-needle,
  .hn-results,
  .hn-graph { transition: none !important; }
  .hn-spin-rot { animation: none !important; }
}

/* ========== OİM / iframe gömülü ========== */
html.hn-embed,
html.hn-embed body,
body.hn-embed {
  background: #141827 !important;
  color: #fff;
  width: 100%; height: 100%;
  margin: 0; padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
html.hn-embed .hn-page-head,
html.hn-embed .hn-footer,
html.hn-embed .hn-privacy-note,
html.hn-embed .hn-brand,
body.hn-embed .hn-page-head,
body.hn-embed .hn-footer,
body.hn-embed .hn-privacy-note,
body.hn-embed .hn-brand {
  display: none !important; height: 0 !important; margin: 0 !important; padding: 0 !important;
}

/* Kart: tam viewport, flexbox dikey */
html.hn-embed .hn-card,
body.hn-embed .hn-card {
  width: 100%; max-width: none; flex: 1 1 0; min-height: 0;
  border-radius: 0; box-shadow: none;
  padding: 6px 14px 8px; box-sizing: border-box;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* Embed: sonuçlar + grafik idle'da gizli — kart zaten sabit boyut */
body.hn-embed[data-state="idle"] .hn-results,
body.hn-embed[data-state="idle"] .hn-graph {
  display: none !important;
}

/* Embed idle: BAŞLAT ortada, kalan alanı doldurur */
body.hn-embed[data-state="idle"] .hn-stage {
  flex: 1 1 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; max-width: 300px; width: 100%;
}
body.hn-embed[data-state="idle"] .hn-gauge,
body.hn-embed[data-state="idle"] .hn-spinner {
  width: 100%; height: auto; max-height: 100%;
}

/* Embed: sonuçlar kompakt */
body.hn-embed .hn-results {
  height: auto; max-height: 82px; margin-top: 2px; overflow: hidden;
  flex-shrink: 0;
}
body.hn-embed .hn-res-value {
  font-size: 24px; height: 30px; line-height: 30px;
}
body.hn-embed .hn-res-label {
  font-size: 10.5px; gap: 4px;
}
body.hn-embed .hn-res-label svg { width: 14px; height: 14px; }
body.hn-embed .hn-lat-row {
  margin-top: 3px; font-size: 11.5px; gap: 8px;
}
body.hn-embed .hn-graph {
  height: 24px; flex-shrink: 0; margin-top: 4px;
}

/* Embed: gösterge — test çalışırken kalan alanı doldur */
body.hn-embed:not([data-state="idle"]) .hn-stage {
  flex: 1 1 0; min-height: 0;
  max-width: 280px; width: 100%;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
body.hn-embed:not([data-state="idle"]) .hn-gauge,
body.hn-embed:not([data-state="idle"]) .hn-spinner {
  width: 100%; height: auto; max-height: 100%;
}
body.hn-embed .hn-go {
  width: 56%;
}

/* Embed: meta — tek sütun, kompakt, IP kesilmesin */
body.hn-embed .hn-meta {
  margin-top: auto; padding-top: 6px; gap: 4px;
  border-top: 1px solid var(--hn-line);
  flex-shrink: 0;
  grid-template-columns: minmax(0, 1fr);
}
body.hn-embed .hn-meta-link { display: none; }
body.hn-embed .hn-meta-row { gap: 8px; }
body.hn-embed .hn-meta-text { gap: 1px; }
body.hn-embed .hn-meta-text strong {
  font-size: 12px; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
body.hn-embed .hn-meta-text span {
  font-size: 11px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.hn-embed .hn-meta-ico {
  width: 26px; height: 26px; flex: 0 0 26px;
}
body.hn-embed .hn-meta-ico svg {
  width: 15px; height: 15px;
}

/* Embed: çok kısa ekran */
@media (max-height: 580px) {
  body.hn-embed .hn-card { padding: 4px 10px 6px; }
  body.hn-embed .hn-results { max-height: 68px; }
  body.hn-embed .hn-res-value { font-size: 22px; height: 26px; line-height: 26px; }
  body.hn-embed .hn-graph { height: 18px; }
  body.hn-embed .hn-meta { gap: 3px; padding-top: 4px; }
  body.hn-embed .hn-meta-ico { width: 22px; height: 22px; flex: 0 0 22px; }
  body.hn-embed .hn-meta-ico svg { width: 13px; height: 13px; }
}
