/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #060814;
  --bg-soft: #0b0f22;
  --surface: #10152b;
  --surface-2: #161c3a;
  --border: #262c52;
  --border-soft: #1a2044;

  --text: #eef0fb;
  --text-dim: #9aa1c7;
  --text-faint: #6b7299;

  --primary: #7c5cff;
  --primary-2: #4361ff;
  --neon-cyan: #22e6ff;
  --neon-pink: #ff3ec9;
  --neon-green: #2bffa3;
  --danger: #ff5470;
  --warning: #ffb648;

  --grad-primary: linear-gradient(120deg, var(--primary), var(--primary-2) 55%, var(--neon-cyan));
  --shadow-glow: 0 0 0 1px rgba(124, 92, 255, .25), 0 12px 40px -12px rgba(76, 50, 255, .55);
  --shadow-card: 0 20px 60px -24px rgba(3, 4, 15, .8);

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
  background-image:
    radial-gradient(60vw 40vw at 85% -5%, rgba(124, 92, 255, .22), transparent 60%),
    radial-gradient(50vw 35vw at 8% 12%, rgba(34, 230, 255, .12), transparent 60%),
    radial-gradient(45vw 45vw at 50% 100%, rgba(255, 62, 201, .10), transparent 65%);
  background-attachment: fixed, fixed, fixed;
}

img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
code { font-family: var(--mono); background: var(--surface-2); padding: .1em .4em; border-radius: 6px; font-size: .92em; }
::selection { background: var(--primary); color: #fff; }

:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container {
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
.prose { max-width: 720px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--neon-cyan); color: #061018;
  z-index: 9999; border-radius: 8px; font-weight: 700;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(6, 8, 20, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: rgba(6, 8, 20, .96); }
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: .85rem;
  max-width: 1080px;
}
.logo { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.logo em { font-style: normal; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-nav { display: none; align-items: center; gap: 1.6rem; font-size: .92rem; font-weight: 600; color: var(--text-dim); }
.site-nav a { transition: color .2s var(--ease-out); }
.site-nav a:hover { color: var(--neon-cyan); }
@media (min-width: 720px) { .site-nav { display: flex; } }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 2.6rem 1.6rem; text-align: center; }
.hero h1 {
  font-size: clamp(1.9rem, 5.4vw, 2.9rem);
  max-width: 18ch;
  margin-inline: auto;
}
.hero__subtitle {
  margin: 1rem auto 0;
  max-width: 46ch;
  color: var(--text-dim);
  font-size: 1.05rem;
}
@media (min-width: 720px) { .hero { padding-block: 3.6rem 2rem; } }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-bottom: 1rem; }

.tool-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}
.tool-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(124,92,255,.5), rgba(34,230,255,.35) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.tool-tabs {
  display: flex;
  padding: .6rem .6rem 0;
  gap: .4rem;
}
.tool-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 600; font-size: .95rem;
  color: var(--text-faint);
  transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.tool-tab svg { color: currentColor; }
.tool-tab:hover { color: var(--text-dim); }
.tool-tab.is-active {
  color: var(--text);
  background: var(--surface-2);
}

.tool-panel { padding: 1.6rem 1.4rem 1.8rem; }
.tool-panel.is-hidden, .tool-panel[hidden] { display: none; }

@media (min-width: 540px) {
  .tool-tab { font-size: 1rem; padding: 1rem 1.2rem; }
  .tool-panel { padding: 2.2rem 2rem 2.4rem; }
}

/* ---- Mi IP panel ---- */
.ip-display { min-height: 220px; display: flex; flex-direction: column; justify-content: center; }

.ip-display__loading { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 2.4rem 0; color: var(--text-dim); }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--neon-cyan);
  animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ip-display__label { display: block; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 600; margin-bottom: .5rem; }
.ip-display__value-row { display: flex; align-items: center; flex-wrap: wrap; gap: .9rem; }
.ip-display__value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  word-break: break-word;
}
.btn-copy {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: .85rem; font-weight: 600;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.btn-copy:hover { color: var(--neon-cyan); border-color: var(--neon-cyan); }

.ip-details { display: grid; grid-template-columns: 1fr; gap: .8rem; margin-top: 1.6rem; }
.ip-details__item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.ip-details__key { color: var(--text-faint); font-size: .85rem; font-weight: 600; }
.ip-details__val { font-weight: 600; font-size: .92rem; text-align: right; }
@media (min-width: 540px) { .ip-details { grid-template-columns: repeat(3, 1fr); } .ip-details__item { flex-direction: column; align-items: flex-start; gap: .3rem; } .ip-details__val { text-align: left; } }

.browser-reveal { margin-top: 1.4rem; }
.browser-reveal summary {
  cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--text-dim);
  padding: .5rem 0;
}
.browser-reveal summary:hover { color: var(--neon-cyan); }
.browser-reveal__grid { display: grid; grid-template-columns: 1fr; gap: .6rem; margin-top: .6rem; }
.browser-reveal__grid > div { display: flex; justify-content: space-between; padding: .5rem .7rem; background: var(--bg-soft); border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }
@media (min-width: 540px) { .browser-reveal__grid { grid-template-columns: repeat(3, 1fr); } .browser-reveal__grid > div { flex-direction: column; gap: .2rem; } }

.ip-display__error { text-align: center; padding: 2rem 0; color: var(--text-dim); display: flex; flex-direction: column; align-items: center; gap: 1rem; }

/* ---- Test de velocidad panel ---- */
.speed-test { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1.4rem; }

.speed-gauge { position: relative; width: min(100%, 260px); }
.speed-gauge__svg { width: 100%; height: auto; }
.speed-gauge__arc { transition: stroke-dashoffset .1s linear; }
.speed-gauge__needle { transition: none; }
.speed-gauge__readout {
  position: absolute; left: 50%; bottom: 6%;
  transform: translateX(-50%);
  display: flex; align-items: baseline; gap: .3rem;
}
.speed-gauge__value { font-family: var(--mono); font-weight: 700; font-size: 1.9rem; color: var(--text); }
.speed-gauge__unit { font-size: .85rem; color: var(--text-faint); font-weight: 600; }

.speed-phase { color: var(--text-dim); font-size: .95rem; min-height: 1.4em; }

.btn-primary {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .95rem 1.8rem;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #05060f;
  font-weight: 700; font-size: 1rem;
  box-shadow: var(--shadow-glow);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(124,92,255,.4), 0 18px 46px -14px rgba(34,230,255,.6); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600; font-size: .92rem;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.btn-secondary:hover { color: var(--text); border-color: var(--neon-cyan); }

.speed-results { width: 100%; }
.speed-results__grid { display: grid; grid-template-columns: 1fr; gap: .8rem; margin-bottom: 1.2rem; }
.speed-result-card {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: 1.1rem .8rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--neon-cyan);
}
.speed-result-card__label { color: var(--text-faint); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.speed-result-card__value { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; color: var(--text); }
@media (min-width: 540px) { .speed-results__grid { grid-template-columns: repeat(3, 1fr); } }

.speed-error { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--text-dim); }

/* ---- Shared: privacy + limits ---- */
.privacy-badge {
  display: flex; align-items: center; gap: .5rem;
  margin-top: 1.1rem;
  color: var(--neon-green);
  font-size: .88rem; font-weight: 600;
}
.tool-limits { margin-top: .4rem; color: var(--text-faint); font-size: .82rem; }

/* =============================================================
   7. Ad slots
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px;
  margin-block: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--bg-soft) 10px 20px);
}
.ad-slot__label {
  font-size: .78rem; font-weight: 700; letter-spacing: .12em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.ad-slot--leaderboard { min-height: 100px; }
.ad-slot--incontent { min-height: 250px; }
.ad-slot--popup { min-height: 200px; width: 100%; margin: 0; }
/* PEGA AQUÍ TU CÓDIGO DE ADSENSE (en el HTML, dentro de cada .ad-slot) */

/* =============================================================
   8. Steps ("cómo funciona")
   ============================================================= */
.steps-section { padding-block: 1rem 2.5rem; }
.steps-section h2, .content-section h2, .faq-section h2 {
  font-size: clamp(1.5rem, 3.6vw, 2rem);
  text-align: center;
  margin-bottom: 2rem;
}
.steps-grid {
  list-style: none;
  display: grid; grid-template-columns: 1fr; gap: 1rem;
}
.step-card {
  position: relative;
  padding: 1.6rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--neon-cyan);
}
.step-card__number {
  position: absolute; top: 1rem; right: 1.2rem;
  font-family: var(--mono); font-weight: 700; font-size: 1.6rem;
  color: var(--border);
}
.step-card h3 { color: var(--text); font-size: 1.1rem; margin: .8rem 0 .4rem; }
.step-card p { color: var(--text-dim); font-size: .92rem; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }

/* =============================================================
   9. Content / SEO text
   ============================================================= */
.content-section { padding-block: 1rem; }
.prose h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); text-align: left; margin: 2rem 0 .8rem; }
.prose h3 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; color: var(--text); }
.prose p { color: var(--text-dim); margin-bottom: .3rem; }
.prose h2:first-child { margin-top: 0; }

/* =============================================================
   10. FAQ
   ============================================================= */
.faq-section { padding-block: 1rem 3rem; }
.faq-list { display: flex; flex-direction: column; gap: .7rem; max-width: 720px; margin-inline: auto; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--neon-cyan);
  flex-shrink: 0;
  transition: transform .2s var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: .8rem; color: var(--text-dim); font-size: .95rem; }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border-soft); padding-block: 2.2rem; margin-top: 1rem; }
.site-footer__inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.logo--footer { font-size: 1rem; }
.site-footer__links { display: flex; gap: 1.2rem; font-size: .88rem; color: var(--text-dim); }
.site-footer__links a:hover { color: var(--neon-cyan); }
.site-footer__note { color: var(--text-faint); font-size: .82rem; }
@media (min-width: 720px) { .site-footer__inner { flex-direction: row; justify-content: space-between; text-align: left; } }

/* =============================================================
   12. Popup de anuncio
   ============================================================= */
.ad-popup {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 1.4rem;
  max-width: min(92vw, 420px);
  box-shadow: var(--shadow-card);
}
.ad-popup::backdrop { background: rgba(3, 4, 12, .72); backdrop-filter: blur(2px); }
.ad-popup__eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); font-weight: 700; margin-bottom: .8rem; }
.ad-popup__close {
  position: absolute; top: .7rem; right: .8rem;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.2rem; line-height: 1;
  background: var(--surface-2);
  transition: color .2s var(--ease-out), background .2s var(--ease-out);
}
.ad-popup__close:hover { color: var(--text); background: var(--border); }

/* =============================================================
   13. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.4s; }
}

/* =============================================================
   14. Breakpoints reference
   ============================================================= */
@media (min-width: 1280px) {
  .container { max-width: 960px; }
}
