:root {
    --paper: #ffffff;
    --ink: #1d2433;
    --muted: #555f70;
    --celeste: #0b5ed7;
    --celeste-soft: #f1f5fb;
    --accent: #0b5ed7;
    --line: #dee2e6;
    --wrap: 1120px;
    --gutter: clamp(16px, 4vw, 40px);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 .5em;
}

h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.35rem; line-height: 1.2; }
p { margin: 0 0 1em; }

a { color: var(--celeste); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: 68ch; }
.muted { color: var(--muted); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip {
    position: absolute; left: 8px; top: -60px; z-index: 100;
    background: var(--accent); color: #fff; padding: 8px 14px; font-weight: 700;
}
.skip:focus { top: 8px; }

/* Barra superior */
.top {
    position: sticky; top: 0; z-index: 50;
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--ink); text-decoration: none;
    font-weight: 700; font-size: 1.2rem; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand img { flex: none; }
.menu {
    display: flex; gap: 4px; margin-left: auto;
    overflow-x: auto; scrollbar-width: none;
}
.menu::-webkit-scrollbar { display: none; }
.menu a {
    color: var(--ink); text-decoration: none; white-space: nowrap;
    padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: .95rem;
}
.menu a:hover { color: var(--celeste); background: var(--celeste-soft); }

/* Hero */
.hero {
    background: #0b5ed7; color: #fff;
    padding: clamp(40px, 7vw, 88px) 0 clamp(120px, 14vw, 170px);
}
        .hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    max-width: 22ch; margin-bottom: .35em;
}
.hero p { max-width: 56ch; font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: #fff; margin: 0; }

/* Test */
.meter { margin-top: clamp(-130px, -12vw, -100px); position: relative; z-index: 3; }
.meter-frame {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 24px 48px -24px rgba(14, 27, 51, .35);
    overflow: hidden;
}
.speedtest-frame { min-height: 650px; }
.speedtest-frame iframe { display: block; width: 100%; height: 650px; border: 0; }
.speedtest-placeholder {
    height: 650px; display: flex; flex-direction: column; gap: 14px;
    align-items: center; justify-content: center; color: var(--muted);
}
.spinner {
    width: 44px; height: 44px; border-radius: 50%;
    border: 4px solid var(--celeste-soft); border-top-color: var(--celeste);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.meter-note { margin: 14px 4px 0; font-size: .95rem; }

/* IP */
.readout {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0; margin: 56px 0 0;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.readout div { padding: 22px 24px 22px 0; }
.readout dt { color: var(--muted); font-size: .95rem; margin-bottom: 4px; }
.readout dd {
    margin: 0; font-weight: 700;
    font-size: 1.3rem; line-height: 1.3; overflow-wrap: anywhere;
}

/* Secciones */
.band { padding: clamp(56px, 8vw, 96px) 0; }
.band-soft { background: var(--celeste-soft); }
.answer { font-size: 1.2rem; max-width: 60ch; }

.metrics {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px; margin: 36px 0 44px;
}
.metrics div { border-left: 4px solid var(--celeste); padding-left: 18px; }
.metrics dt { font-weight: 700; font-size: 1.3rem; }
.metrics dd { margin: 6px 0 0; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
caption { text-align: left; font-weight: 700; font-size: 1.15rem; padding-bottom: 12px; }
th, td { text-align: left; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: .95rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--ink); }
tbody th { font-weight: 700; }
.band-soft th, .band-soft td { border-bottom-color: #c3d2e6; }
.level { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.level::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.level-1 { color: #1c7a43; }
.level-2 { color: #2f6f2a; }
.level-3 { color: #8a5a00; }
.level-4 { color: #b42318; }
.table-note { margin-top: 14px; font-size: .95rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 32px 0 0; max-width: 72ch; }
.steps li {
    counter-increment: step; position: relative;
    padding: 0 0 26px 64px; min-height: 48px;
}
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: -4px;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--ink); color: #fff; font-weight: 700; font-size: 1.3rem;
}

.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.split img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }

/* Boceto de planes (esqueleto de carga, sin contenido real) */
.plans-sketch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.sketch-card {
    display: flex; flex-direction: column; gap: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px;
}
.sketch-card.is-featured { padding-top: 30px; padding-bottom: 26px; border: 2px solid #9dbcec; box-shadow: 0 12px 28px -18px rgba(11, 94, 215, .5); }
.sk {
    display: block; border-radius: 6px; height: 10px;
    background: linear-gradient(90deg, #e6ebf2 0%, #f4f6fa 50%, #e6ebf2 100%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.6s ease-in-out infinite;
}
.sk-tag { width: 45%; height: 12px; }
.sk-speed { width: 70%; height: 34px; margin-top: 6px; }
.sk-unit { width: 35%; height: 10px; margin-bottom: 8px; }
.sk-line { width: 100%; }
.sk-short { width: 65%; }
.sk-btn { width: 100%; height: 34px; margin-top: 10px; border-radius: 8px; }
.is-featured .sk-tag { background: linear-gradient(90deg, #cfe0fa 0%, #e3edfc 50%, #cfe0fa 100%); background-size: 200% 100%; }
.is-featured .sk-btn { background: linear-gradient(90deg, #a9c7f2 0%, #c9dcf7 50%, #a9c7f2 100%); background-size: 200% 100%; }
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
    cursor: pointer; list-style: none; position: relative;
    padding: 20px 44px 20px 0; font-weight: 700; font-size: 1.15rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: ""; position: absolute; right: 8px; top: 50%;
    width: 12px; height: 12px; margin-top: -9px;
    border-right: 3px solid var(--celeste); border-bottom: 3px solid var(--celeste);
    transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -3px; }
.faq details p { padding: 0 0 22px; margin: 0; max-width: 68ch; color: var(--muted); }

.btn {
    display: inline-block; text-decoration: none; font-weight: 700;
    padding: 14px 22px; border-radius: 8px;
    background: var(--celeste); color: #fff;
}
.btn:hover { background: var(--ink); color: #fff; }

.nibiru { background: var(--ink); color: #fff; }
.nibiru .wrap { display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: center; justify-content: space-between; }
.nibiru h2 { margin-bottom: .25em; font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.nibiru p { color: #dde3ec; margin: 0; max-width: 52ch; }
.nibiru .btn { background: #fff; color: var(--ink); }
.nibiru .btn:hover { background: var(--celeste-soft); }

.site-footer { padding: 32px 0 40px; font-size: .95rem; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer p { margin: 0 0 .4em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 14px; }
.footer-links a { font-weight: 600; }

.menu a[aria-current="page"] { color: var(--celeste); background: var(--celeste-soft); }

/* Tarjetas de posts (home y blog) */
.post-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px; margin: 28px 0;
}
.post-teaser a { color: var(--ink); text-decoration: none; }
.post-teaser a:hover h3, .post-teaser a:focus-visible h3 { color: var(--celeste); text-decoration: underline; }
.post-teaser img {
    display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--line); background: var(--celeste-soft);
}
.post-teaser h2, .post-teaser h3 { font-size: 1.2rem; line-height: 1.3; margin: 14px 0 6px; }
.post-teaser .post-meta { font-size: .9rem; color: var(--muted); margin: 0 0 6px; }
.post-teaser p { margin: 0; font-size: .97rem; }

/* Cabecera de páginas internas */
.page-head { background: var(--celeste-soft); padding: clamp(32px, 5vw, 56px) 0; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .3em; }
.page-head p { max-width: 62ch; margin: 0; color: var(--muted); font-size: 1.1rem; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; font-size: .93rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }

/* Blog */
.blog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(32px, 5vw, 56px); padding-top: clamp(36px, 5vw, 56px); padding-bottom: clamp(36px, 5vw, 56px); }
.blog-layout .post-grid { margin-top: 0; }
.sidebar h2 { font-size: 1.15rem; margin: 0 0 12px; }
.sidebar section + section { margin-top: 32px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sidebar li a { color: var(--ink); text-decoration: none; }
.sidebar li a:hover { color: var(--celeste); text-decoration: underline; }
.search { display: flex; gap: 8px; }
.search input {
    flex: 1; min-width: 0; font: inherit; padding: 10px 12px;
    border: 1px solid #b8c2d0; border-radius: 8px; background: #fff; color: var(--ink);
}
.search button { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 10px 14px; background: var(--celeste); color: #fff; cursor: pointer; }
.search button:hover { background: var(--ink); }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 24px 0 0; }
.pagination a, .pagination span {
    display: block; min-width: 44px; padding: 10px 12px; text-align: center;
    border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 600;
}
.pagination [aria-current="page"] { background: var(--celeste); border-color: var(--celeste); color: #fff; }
.pagination span[aria-disabled] { color: #9aa3b2; }

.article { max-width: 72ch; }
.article-cover { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); margin: 0 0 24px; }
.article-meta { color: var(--muted); font-size: .95rem; margin-bottom: 24px; }
.article-body { font-size: 1.07rem; line-height: 1.75; }
.article-body img { max-width: 100%; height: auto; }
.article-body h2 { font-size: 1.55rem; margin-top: 1.6em; }
.article-body h3 { margin-top: 1.4em; }
.article-body table { min-width: 0; margin: 1em 0; }
.article-body table td, .article-body table th { padding: 8px 12px 8px 0; }

.empty { padding: 24px 0; }
.empty img { max-width: 320px; width: 100%; height: auto; }

/* Mi IP */
.ip-hero { background: #0b5ed7; color: #fff; padding: clamp(36px, 6vw, 64px) 0; }
.ip-hero .crumbs a, .ip-hero .crumbs ol { color: #dce8fb; }
.ip-hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .2em; }
.ip-big {
    display: block; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 700; line-height: 1.15;
    overflow-wrap: anywhere; margin: 8px 0 12px;
}
.ip-hero dl { display: flex; flex-wrap: wrap; gap: 8px 36px; margin: 0; }
.ip-hero dt { color: #dce8fb; font-size: .95rem; }
.ip-hero dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.copy-btn {
    font: inherit; font-weight: 700; cursor: pointer;
    background: #fff; color: var(--ink); border: 0; border-radius: 8px; padding: 10px 16px; margin-bottom: 20px;
}
.copy-btn:hover { background: var(--celeste-soft); }
.compare th[scope="row"] { white-space: nowrap; }

@media (max-width: 760px) {
    .menu a.optional { display: none; }
    .blog-layout { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; }
    .speedtest-frame, .speedtest-placeholder, .speedtest-frame iframe { height: 720px; min-height: 720px; }
    .top .wrap { gap: 12px; }
    .brand { font-size: 1.05rem; }
    .brand-long { display: none; }
    .menu a { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .spinner { animation: none; }
    .sk { animation: none; }
    .faq summary::after { transition: none; }
}

/* Panel del blog */
.admin { background: #f3f5f8; }
.admin-bar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.admin-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; min-height: 60px; }
.admin-bar .brand { font-size: 1.1rem; }
.admin-nav { display: flex; gap: 4px; }
.admin-nav a {
    color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
    padding: 18px 10px; border-bottom: 3px solid transparent;
}
.admin-nav a:hover { color: var(--celeste); }
.admin-nav a[aria-current="page"] { color: var(--celeste); border-bottom-color: var(--celeste); }
.admin-user { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: .95rem; }
.admin-user-name { color: var(--muted); }
.btn-ghost {
    font: inherit; font-weight: 600; cursor: pointer; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
}
.btn-ghost:hover { border-color: var(--celeste); color: var(--celeste); }

.admin-main { padding-top: 28px; padding-bottom: 64px; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 1.75rem; }
.admin-head p { margin: 2px 0 0; }
.admin-subtitle { font-size: 1.3rem; margin: 40px 0 14px; }

.panel-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.panel-card + .panel-card { margin-top: 16px; }
.panel-card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state p { max-width: 52ch; margin: 0 auto 20px; color: var(--muted); }

.notice { border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-weight: 600; border: 1px solid; }
.notice-ok { background: #e9f7ef; border-color: #a7d9b9; color: #1c6b3a; }
.notice-ok::before { content: "✓ "; }
.notice-error { background: #fdecec; border-color: #f2b8b5; color: #a1251b; }
.notice-error::before { content: "⚠ "; }

.btn { border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .7; cursor: progress; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-danger { background: #b42318; }
.btn-danger:hover { background: #7a1710; }
.btn-small {
    display: inline-block; font-weight: 600; font-size: .9rem; text-decoration: none;
    padding: 7px 12px; border-radius: 6px; border: 1px solid var(--celeste); color: var(--celeste); background: #fff;
}
.btn-small:hover { background: var(--celeste); color: #fff; }
.btn-quiet { border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { background: var(--celeste-soft); color: var(--ink); border-color: var(--line); }
.btn-small.danger { color: #b42318; }
.btn-small.danger:hover { background: #fdecec; color: #a1251b; border-color: #f2b8b5; }

/* Lista de posts */
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.list-tools input, .list-tools select {
    font: inherit; padding: 9px 12px; border: 1px solid #b8c2d0; border-radius: 8px; background: #fff; color: var(--ink);
}
.list-tools input { flex: 1; min-width: 220px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.post-list li:last-child { border-bottom: 0; }
.post-list li[hidden] { display: none; }
.post-list img { flex: none; width: 112px; height: 63px; object-fit: cover; border-radius: 6px; background: var(--celeste-soft); }
.post-list-body { flex: 1; min-width: 0; }
.post-list-title { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.post-list-title:hover { color: var(--celeste); text-decoration: underline; }
.post-list-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.post-list-actions { display: flex; gap: 6px; flex: none; }

/* Editor de posts */
.post-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.post-editor-side { position: sticky; top: 80px; }
.post-editor-side .field { margin-bottom: 0; }
.side-actions { display: grid; gap: 10px; justify-items: center; }
.input-title { font-size: 1.35rem !important; font-weight: 700; }
.url-preview { overflow-wrap: anywhere; }
.url-preview strong { color: var(--ink); }
.cover-drop {
    display: grid; place-items: center; gap: 8px; cursor: pointer; text-align: center;
    min-height: 150px; border: 2px dashed #b8c2d0; border-radius: 8px; padding: 10px; background: #fafbfd;
}
.cover-drop:hover, input[type="file"]:focus-visible + .hint, .cover-drop:focus-within { border-color: var(--celeste); }
#postFile:focus-visible ~ .hint { outline: none; }
.cover-drop img { width: 100%; height: auto; border-radius: 6px; }
.cover-text { font-weight: 700; color: var(--celeste); }
.cover-drop.has-image .cover-text { font-size: .9rem; }
.label { display: block; font-weight: 700; margin-bottom: 6px; }

.admin-form { max-width: 760px; }
.field { margin-bottom: 20px; flex: 1; min-width: 220px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field select, .field textarea {
    width: 100%; font: inherit; padding: 10px 12px; color: var(--ink); background: #fff;
    border: 1px solid #b8c2d0; border-radius: 8px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--celeste); }
.field-row { display: flex; flex-wrap: wrap; gap: 0 20px; }
.hint { font-size: .88rem; color: var(--muted); margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 8px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 16px; margin-bottom: 20px; }
.inline-form .btn { margin-bottom: 20px; }

.admin-table { min-width: 560px; }
.admin-table th[scope="row"] { font-weight: 600; }
.admin-thumb-lg { display: block; max-width: 320px; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0 16px; }
.nowrap { white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions form { display: inline-block; margin-left: 12px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--celeste); text-decoration: underline; cursor: pointer; }
.danger, .link-btn.danger { color: #b42318; }

.login-box { max-width: 420px; margin: 40px auto; }
.confirm-box { max-width: 620px; margin: 24px auto; }
.login-box h1, .confirm-box h1 { font-size: 1.5rem; }

@media (max-width: 900px) {
    .post-editor { grid-template-columns: 1fr; }
    .post-editor-side { position: static; }
    .admin-nav a { padding: 10px 8px; }
    .admin-user { margin-left: 0; }
    .admin-bar { position: static; }
    .admin-user-name { display: none; }
}
@media (max-width: 640px) {
    .post-list li { flex-wrap: wrap; }
    .post-list-actions { width: 100%; }
}
