:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #e2e6ec;
  --brand: #0f7a4f;
  --brand-dark: #0b5e3c;
  --accent: #fff6df;
  --radius: 14px;
  --input-bg: #ffffff;
  --th-bg: #eef2f5;
  --accent-text: #1c2430;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --card: #1a2129;
    --text: #e6eaef;
    --muted: #9aa5b3;
    --line: #2c3540;
    --brand: #34b27b;
    --brand-dark: #2a9a69;
    --accent: #2f2a1c;
    --input-bg: #11161c;
    --th-bg: #222b35;
    --accent-text: #f2e6c4;
  }
  header.site { background: linear-gradient(135deg, #0f7a4f 0%, #0b5e3c 50%, #073d27 100%); }
  button.primary { color: #0b1a12; }
  .error { color: #ff8a80; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--brand); }

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #12925f 0%, #0f7a4f 45%, #0a5537 100%);
  color: #fff;
  padding: 10px 0;
  border-bottom: 3px solid #f4c542;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header.site a { color: #fff; text-decoration: none; }

.brand { display: flex; align-items: center; gap: 10px; }
.logo { flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-name .mx { color: #f4c542; }
.tagline { font-size: .75rem; opacity: .85; font-weight: 500; }

header.site nav { display: flex; align-items: center; gap: 6px; }
header.site nav a {
  font-weight: 600;
  font-size: .9rem;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s;
}
header.site nav a:hover { background: rgba(255, 255, 255, .14); }
header.site nav a.cta { background: #f4c542; color: #1f1a08; }
header.site nav a.cta:hover { background: #ffd65c; }
@media (max-width: 560px) { header.site nav a:not(.cta) { display: none; } }
@media (max-width: 360px) { .tagline { display: none; } }

/* Que los anclas no queden tapados por el encabezado fijo */
[id] { scroll-margin-top: 80px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 28px 0 8px; }
h2 { font-size: 1.35rem; margin: 36px 0 10px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.lead { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 18px 0;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }

input, select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-top: 4px; }
.check input { width: auto; }

button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
button.primary:hover { background: var(--brand-dark); }

.result { display: none; }
.result.show { display: block; }
.big { font-size: 2.2rem; font-weight: 800; color: var(--brand); margin: 0; }
.rows { width: 100%; border-collapse: collapse; margin-top: 12px; }
.rows td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rows td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.note { color: var(--accent-text); background: var(--accent); border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin-top: 14px; }
.error { color: #b42318; font-weight: 600; margin-top: 10px; }

table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 8px; text-align: left; }
table.data th { background: var(--th-bg); }

details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }

/* Espacios de anuncios: quedan vacíos (sin altura) hasta que AdSense los llena */
.ad-slot { margin: 22px 0; text-align: center; }
.ad-slot:empty { margin: 0; }

footer.site { color: var(--muted); font-size: .88rem; padding: 30px 16px 40px; border-top: 1px solid var(--line); margin-top: 40px; }
footer.site a { margin-right: 14px; }

.countdown { background: var(--accent); color: var(--accent-text); border-radius: 10px; padding: 10px 14px; font-size: .95rem; }
.countdown:empty { display: none; }

.share { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.share p { margin: 0 0 10px; font-weight: 600; }
.btn-share {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  margin: 0 8px 8px 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn-share.wa { background: #25d366; border-color: #25d366; color: #0b2b17; }
