/* Mobile first: los estilos base son los del móvil, que es donde se usa esto
   de verdad. Las pantallas grandes solo amplían, en una única media query. */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e3e5ea;
  --ok: #0f7b43;
  --warn: #b45309;
  --bad: #b42318;
  --info: #1d4ed8;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --card: #191d23;
    --ink: #eef1f5;
    --muted: #9aa3af;
    --line: #2a2f37;
    --ok: #35c07a;
    --warn: #e0a034;
    --bad: #f2685c;
    --info: #7aa2ff;
  }
}

* { box-sizing: border-box; }

/* `hidden` es solo `display: none` de la hoja del navegador, así que cualquier
   `display` propio de una clase lo pisa. Con .link y .btn pasaba: el enlace de
   detalles técnicos se veía en la pantalla inicial. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
}

/* Cabecera */
.head { margin-bottom: 16px; }
.head-row { display: flex; align-items: center; gap: 12px; }
h1 { font-size: 20px; line-height: 1.25; margin: 0; flex: 1; }
.card-title { font-size: 16px; margin: 0 0 10px; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.lang {
  flex: none; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 15px;
}

/* Tarjetas */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

/* Formulario */
label { display: block; font-weight: 600; margin-bottom: 8px; }
input[type="text"] {
  width: 100%; padding: 13px 12px;
  font-size: 16px; /* 16px evita que iOS haga zoom al enfocar */
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}

/* Botones: alto mínimo de 44px, el objetivo táctil cómodo en iOS */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px; padding: 12px 16px; margin-top: 12px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  text-align: center; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--ink); color: var(--card); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.link {
  display: block; width: 100%; margin: 4px 0 12px; padding: 10px 0;
  background: none; border: 0; color: var(--info);
  font-size: 15px; font-family: inherit; text-decoration: underline; cursor: pointer;
}

/* Semáforo de comprobaciones */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.checks li:last-child { border-bottom: 0; }
.checks li:first-child { padding-top: 0; }

.dot {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 18%, transparent);
}
.dot-ok      { background: var(--ok);   box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot-bad     { background: var(--bad);  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 20%, transparent); }
.dot-warn    { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.dot-unknown { background: var(--muted); box-shadow: none; opacity: .5; }
.dot-pending { animation: latido 1.1s ease-in-out infinite; }

@keyframes latido { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dot-pending { animation: none; } }

.checks .name { flex: 1; font-size: 15px; }
.checks .state { flex: none; font-size: 13px; color: var(--muted); }

/* Lista de portales: una fila plegable por URL */
.targets { list-style: none; padding: 0; margin: 0 0 12px; }

.target {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}

.target-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 14px 16px;
  border: 0; background: none; color: var(--ink);
  font-family: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.target-head .dot { margin-top: 2px; }
.target-text { flex: 1; min-width: 0; }
.target-name {
  display: block; font-weight: 600; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
}
.target-verdict { display: block; margin-top: 3px; font-size: 14px; color: var(--muted); }
.chevron { flex: none; color: var(--muted); transition: transform .18s ease; }
.target-head[aria-expanded="true"] .chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }

.target-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.target-body > :first-child { margin-top: 14px; }

/* Agrupación por dominio */
.group {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.group-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 14px 16px;
  border: 0; background: none; color: var(--ink);
  font-family: inherit; text-align: left; cursor: pointer;
}
.group-text { flex: 1; min-width: 0; }
.group-name { display: block; font-weight: 700; font-size: 16px; word-break: break-all; }
.group-summary { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }
.group-body { list-style: none; margin: 0; padding: 0 10px 10px; border-top: 1px solid var(--line); }
.group-body .target { margin-top: 10px; margin-bottom: 0; background: var(--bg); }
.group-body .target-head { min-height: 54px; padding: 12px 14px; }
.group-body .target-body { background: var(--card); }

/* Veredicto */
.verdict {
  border-left: 5px solid var(--muted);
  background: var(--bg); border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 10px; padding: 14px; margin: 14px 0 0;
}
.verdict.level-ok { border-left-color: var(--ok); }
.verdict.level-warning, .verdict.level-domain, .verdict.level-dns { border-left-color: var(--warn); }
.verdict.level-blocked, .verdict.level-server { border-left-color: var(--bad); }
.verdict h2 { font-size: 19px; line-height: 1.3; margin: 0 0 8px; }
.verdict p { margin: 0 0 10px; }
.verdict p:last-child { margin-bottom: 0; }
.badge {
  display: inline-block; margin: 0 0 10px; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.warn { color: var(--warn); font-weight: 600; }
.error { color: var(--bad); margin: 12px 0 0; }
.missing { margin-top: 12px; color: var(--muted); font-size: 14px; }
.missing ul { margin: 6px 0 0; padding-left: 20px; }

/* Paso guiado */
.guided {
  background: var(--bg); border: 1px solid var(--line);
  border-left: 5px solid var(--info);
  border-radius: 10px; padding: 14px; margin: 12px 0 0;
}
.guided-question { margin: 16px 0 0; font-weight: 600; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.options button {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink);
  font-size: 15px; font-family: inherit; text-align: left; cursor: pointer;
}

/* Acciones del informe */
.actions { margin-bottom: 12px; }
.actions .btn:first-child { margin-top: 0; }

.hint {
  margin: 0 0 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--warn);
  border-radius: 10px; background: var(--card);
  font-size: 14px; color: var(--ink);
}

pre {
  white-space: pre-wrap; word-break: break-word;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 0; overflow-x: auto;
}

/* A partir de tablet: más aire y los botones dejan de ocupar todo el ancho */
@media (min-width: 600px) {
  .wrap { padding-top: 28px; }
  h1 { font-size: 24px; }
  .card { padding: 20px; }
  .actions { display: flex; gap: 10px; }
  .actions .btn { width: auto; flex: 1; margin-top: 0; }
}
