/* ==========================================================================
   Escala Glasgow — estilo médico moderno (azul · blanco · verde)
   Secciones: 1 tokens · 2 base · 3 cabecera · 4 herramienta · 5 anuncios
              6 contenido · 7 tabla · 8 pie · 9 responsive · 10 movimiento
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --blue-900: #073a7a;
  --blue-700: #0b4ea2;
  --blue-600: #1565c0;
  --blue-500: #1e78d8;
  --blue-100: #e3effb;
  --blue-50:  #f2f7fd;

  --green-700: #0b7a57;
  --green-600: #0f9d6e;
  --green-100: #e2f6ee;

  --amber-700: #a35c00;
  --amber-600: #c77700;
  --amber-100: #fdf1dd;

  --red-700: #a81f1f;
  --red-600: #c62828;
  --red-100: #fdeaea;

  --ink:      #10243a;
  --ink-soft: #46617c;
  --ink-mute: #6b829a;
  --line:     #dbe5f0;
  --line-soft:#eaf0f7;
  --white:    #ffffff;
  --bg:       #f6f9fc;

  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(16, 36, 58, .05), 0 8px 24px rgba(16, 36, 58, .06);
  --shadow-lg:0 2px 4px rgba(16, 36, 58, .06), 0 18px 48px rgba(16, 36, 58, .12);
  --wrap:     1060px;
  color-scheme: light;
  --ease:     cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; color: var(--blue-900); }
h1 { font-size: clamp(1.6rem, 1.15rem + 2vw, 2.5rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 600; color: var(--blue-700); }
h4 { font-size: 1rem; font-weight: 600; }
p  { margin: 0 0 1em; }
a  { color: var(--blue-600); text-underline-offset: 2px; }
a:hover { color: var(--blue-700); }
strong { font-weight: 600; }
em { font-style: normal; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }

main > section { padding-block: clamp(28px, 4vw, 48px); }
main > section.ad-wrap { padding-block: 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--blue-700); color: #fff; padding: 12px 18px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:where(a, button, input, summary):focus-visible {
  outline: 3px solid var(--blue-500); outline-offset: 2px; border-radius: 6px;
}

.sec-intro { color: var(--ink-soft); max-width: 70ch; }
.note { font-size: .92rem; color: var(--ink-soft); background: var(--blue-50);
        border-left: 3px solid var(--blue-500); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- 3. Cabecera ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--blue-700);
         font-size: 1.02rem; text-decoration: none; letter-spacing: -.01em; }
.brand strong { font-weight: 700; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.site-nav { display: flex; gap: clamp(10px, 2vw, 22px); flex-wrap: wrap; }
.site-nav a { color: var(--ink-soft); font-size: .92rem; font-weight: 500; text-decoration: none; }
.site-nav a:hover { color: var(--blue-700); }

/* ---------- 4. La herramienta ---------- */
.hero { padding-block: clamp(20px, 3vw, 36px) 12px; }
.hero h1 { max-width: 24ch; }
.hero-sub { color: var(--ink-soft); max-width: 62ch; margin: 0; font-size: clamp(.95rem, .9rem + .2vw, 1.06rem); }

.tool-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: clip;
}

.result-bar {
  position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 10;
  display: flex; align-items: center; gap: clamp(12px, 3vw, 22px);
  padding: 14px clamp(16px, 3vw, 24px);
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .25);
  transition: background .25s var(--ease);
}
.tool-card[data-band="leve"]     .result-bar { background: linear-gradient(135deg, var(--green-700), var(--green-600)); }
.tool-card[data-band="moderado"] .result-bar { background: linear-gradient(135deg, var(--amber-700), var(--amber-600)); }
.tool-card[data-band="grave"]    .result-bar { background: linear-gradient(135deg, var(--red-700), var(--red-600)); }
.tool-card[data-band="nt"]       .result-bar { background: linear-gradient(135deg, #3f5d7d, #5b7898); }

.result-score { display: flex; align-items: baseline; gap: 4px; flex: none; }
.result-total {
  font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3rem); font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}
.result-total.is-pop { animation: pop .28s var(--ease); }
@keyframes pop { 0% { transform: scale(.82); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
.result-max { font-size: 1rem; opacity: .75; font-weight: 500; }
.result-meta { min-width: 0; }
.result-breakdown { margin: 0; font-weight: 600; font-size: clamp(.95rem, .9rem + .3vw, 1.12rem);
                    font-variant-numeric: tabular-nums; }
.result-band { margin: 2px 0 0; font-size: .86rem; opacity: .9; text-transform: uppercase; letter-spacing: .08em; }

.gcs-form { padding: clamp(14px, 2.5vw, 22px) clamp(16px, 3vw, 24px) 4px; display: grid; gap: 18px; border: 0; }

.comp { border: 0; margin: 0; padding: 0; }
.comp legend { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; width: 100%; }
.comp-key {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  background: var(--blue-100); color: var(--blue-700);
  border-radius: 8px; font-weight: 700; font-size: .95rem;
}
.comp-name { font-weight: 600; color: var(--blue-900); font-size: 1.02rem; }
.comp-range { margin-left: auto; font-size: .8rem; color: var(--ink-mute); background: var(--line-soft);
              padding: 2px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }

.opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }

.opt {
  position: relative; display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; cursor: pointer;
  background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .16s var(--ease), background .16s var(--ease), transform .16s var(--ease);
}
.opt:hover { border-color: var(--blue-500); background: var(--blue-50); }
.opt:active { transform: scale(.995); }
.opt input {
  position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none;
}
.opt:has(input:focus-visible) { outline: 3px solid var(--blue-500); outline-offset: 2px; }

.opt-pts {
  display: grid; place-items: center; flex: none; min-width: 32px; height: 32px; padding: 0 6px;
  background: var(--line-soft); color: var(--ink-soft);
  border-radius: 9px; font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.opt-text { display: grid; gap: 1px; min-width: 0; }
.opt-text strong { font-size: .97rem; font-weight: 600; color: var(--ink); }
.opt-text em { font-size: .84rem; color: var(--ink-mute); line-height: 1.45; }

.opt:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--blue-600); }
.opt:has(input:checked) .opt-pts { background: var(--blue-600); color: #fff; }
.opt:has(input:checked) .opt-text strong { color: var(--blue-900); }

.opt-nt { border-style: dashed; }
.opt-nt .opt-pts { font-size: .8rem; letter-spacing: .04em; }
.opt-nt:has(input:checked) { border-color: #5b7898; box-shadow: inset 0 0 0 1px #5b7898; background: #f3f6fa; }
.opt-nt:has(input:checked) .opt-pts { background: #5b7898; }

/* Fallback sin :has() */
@supports not selector(:has(*)) {
  .opt input:checked ~ .opt-pts { background: var(--blue-600); color: #fff; }
}

.interp { margin: 4px clamp(16px, 3vw, 24px) 0; padding: 14px 16px; border-radius: var(--radius-sm);
          background: var(--blue-50); border: 1px solid var(--line); }
.interp-text { margin: 0 0 .6em; font-weight: 600; color: var(--blue-900); }
.interp-context { margin: 0; font-size: .88rem; color: var(--ink-soft); }
.tool-card[data-band="leve"]     .interp { background: var(--green-100); border-color: #bfe8d8; }
.tool-card[data-band="moderado"] .interp { background: var(--amber-100); border-color: #f2dcb6; }
.tool-card[data-band="grave"]    .interp { background: var(--red-100); border-color: #f4c9c9; }

.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px clamp(16px, 3vw, 24px) 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 12px 18px; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  transition: transform .14s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease), opacity .16s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--green-600); color: #fff; box-shadow: 0 2px 10px rgba(15, 157, 110, .3); }
.btn-primary:hover { background: var(--green-700); }
.btn-ghost { background: var(--white); color: var(--blue-700); border-color: var(--blue-600); }
.btn-ghost:hover { background: var(--blue-50); }
.btn-ghost.is-ok { background: var(--green-100); border-color: var(--green-600); color: var(--green-700); }
.btn-reset { background: transparent; color: var(--ink-mute); padding-inline: 12px; }
.btn-reset:hover { color: var(--red-600); }
.btn-block { width: 100%; }

.privacy-badge { margin: 12px clamp(16px, 3vw, 24px); font-size: .88rem; color: var(--green-700);
                 background: var(--green-100); border-radius: var(--radius-sm); padding: 10px 14px; }
.notice { font-size: .88rem; border-radius: var(--radius-sm); padding: 11px 14px; }
.notice-med { margin: 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 20px); color: var(--ink-soft);
              background: var(--blue-50); border: 1px dashed var(--line); }
.notice-warn { margin: 0 clamp(16px, 3vw, 24px) 0; color: var(--amber-700); background: var(--amber-100);
               border: 1px solid #f2dcb6; }

/* ---------- 5. Anuncios (placeholders) ---------- */
.ad-wrap { padding-block: clamp(14px, 2.5vw, 22px) 0; }
.ad-slot {
  display: grid; place-items: center;
  border: 1.5px dashed #c6d4e4; border-radius: var(--radius-sm);
  background: repeating-linear-gradient(135deg, #fbfdff 0 10px, #f4f8fc 10px 20px);
  color: #9fb3c8;
}
.ad-label { font-size: .72rem; font-weight: 700; letter-spacing: .22em; }
.ad-leaderboard { min-height: 96px; }
.ad-incontent   { min-height: 260px; }
.ad-mini        { min-height: 86px; width: 100%; }
.ad-popup       { min-height: 230px; width: 100%; margin-block: 12px; }

.ad-toast {
  position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 30; width: min(290px, calc(100vw - 28px));
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px;
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ad-toast[hidden] { display: none; }
.ad-toast-close {
  position: absolute; top: -9px; right: -9px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); color: var(--ink-soft);
  font-size: 17px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.ad-toast-close:hover { color: var(--red-600); }

.ad-dialog {
  width: min(340px, calc(100vw - 32px));
  border: 0; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-lg); color: var(--ink);
}
.ad-dialog::backdrop { background: rgba(7, 34, 58, .5); backdrop-filter: blur(2px); }
.ad-dialog-x { position: absolute; top: 8px; right: 8px; margin: 0; }
.ad-dialog-x button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--white); color: var(--ink-soft); font-size: 19px; line-height: 1; cursor: pointer;
}
.ad-dialog-x button:hover { color: var(--red-600); }
.ad-dialog-ok { margin: 0 24px .4em 0; font-weight: 600; color: var(--green-700); }

/* ---------- 6. Contenido ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px;
         grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps li { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
            padding: 18px; box-shadow: var(--shadow); }
.steps svg { width: 26px; height: 26px; color: var(--green-600); margin-bottom: 6px; }
.steps p { margin: 0; font-size: .92rem; color: var(--ink-soft); }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin-bottom: 28px; }
.card { background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--blue-500);
        border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p { margin: 0; font-size: .92rem; color: var(--ink-soft); }

.bands { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 18px; }
.band { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--line); }
.band-range { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .1em; color: var(--ink-mute);
              font-variant-numeric: tabular-nums; }
.band strong { display: block; font-size: 1.15rem; margin-bottom: .3em; }
.band p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.band-leve     { border-top-color: var(--green-600); } .band-leve strong     { color: var(--green-700); }
.band-moderado { border-top-color: var(--amber-600); } .band-moderado strong { color: var(--amber-700); }
.band-grave    { border-top-color: var(--red-600); }   .band-grave strong    { color: var(--red-700); }

.list-check, .list-x { list-style: none; margin: 0 0 1.4em; padding: 0; display: grid; gap: 9px; max-width: 86ch; }
.list-check li, .list-x li {
  position: relative; padding: 11px 14px 11px 40px; font-size: .93rem; color: var(--ink-soft);
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.list-check li::before, .list-x li::before {
  position: absolute; left: 13px; top: 10px; font-weight: 700; font-size: 1rem;
}
.list-check li::before { content: "✓"; color: var(--green-600); }
.list-x li::before     { content: "✕"; color: var(--red-600); }
.list-check li strong, .list-x li strong { color: var(--ink); }

.cases { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(265px, 1fr)); }
.case { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 18px; box-shadow: var(--shadow); }
.case h4 { color: var(--blue-700); margin-bottom: .5em; }
.case p { font-size: .92rem; color: var(--ink-soft); margin-bottom: .7em; }
.case-res { margin: 0 !important; font-weight: 600; font-size: .98rem; padding: 9px 12px;
            border-radius: var(--radius-sm); font-variant-numeric: tabular-nums; }
.case-res.band-leve     { background: var(--green-100); color: var(--green-700); }
.case-res.band-moderado { background: var(--amber-100); color: var(--amber-700); }
.case-res.band-grave    { background: var(--red-100);   color: var(--red-700); }
.case-res.band-nt       { background: #eef2f7; color: #3f5d7d; }

details {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 16px; margin-bottom: 9px; box-shadow: var(--shadow);
}
details summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--blue-900); font-size: .98rem;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+"; flex: none; color: var(--blue-600); font-size: 1.3rem; font-weight: 400; line-height: 1;
  transition: transform .2s var(--ease);
}
details[open] summary::after { content: "−"; }
details p { margin: 0 0 14px; font-size: .93rem; color: var(--ink-soft); max-width: 78ch; }

.closing p { color: var(--ink-soft); max-width: 78ch; font-size: .95rem; }

/* ---------- 7. Tabla ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 26px;
                border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
                box-shadow: var(--shadow); }
.gcs-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: .92rem; }
.gcs-table caption { text-align: left; padding: 14px 16px 0; font-size: .85rem; color: var(--ink-mute); }
.gcs-table th, .gcs-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.gcs-table thead th { background: var(--blue-700); color: #fff; font-weight: 600; font-size: .88rem;
                      border-bottom: 0; position: sticky; top: 0; }
.gcs-table thead th:first-child { width: 58px; }
.gcs-table tbody th { background: var(--blue-50); color: var(--blue-700); font-weight: 700;
                      font-variant-numeric: tabular-nums; text-align: center; }
.gcs-table tbody tr:hover td { background: var(--blue-50); }
.gcs-table .na { color: #b9c7d6; }
.gcs-table .row-nt th { background: #eef2f7; color: #3f5d7d; }
.gcs-table .row-nt td { color: var(--ink-mute); font-style: italic; }
.gcs-table tbody tr:last-child th, .gcs-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- 8. Pie ---------- */
.site-footer { margin-top: clamp(28px, 5vw, 56px); background: var(--blue-900); color: #c9dcf0; padding-block: 30px; }
.footer-disclaimer { font-size: .88rem; max-width: 86ch; color: #bfd4ea; }
.footer-disclaimer strong { color: #fff; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a { color: #9fc4ea; font-size: .9rem; }
.footer-copy { margin: 0; font-size: .82rem; color: #8bacce; }

/* ---------- 9. Responsive ---------- */
@media (max-width: 760px) {
  .site-nav { gap: 12px; }
  .site-nav a { font-size: .85rem; }
  .hero { padding-block: 16px 10px; }
  .hero-sub { font-size: .92rem; }
  .result-bar { top: calc(56px + env(safe-area-inset-top, 0px)); padding: 12px 14px; }
  .tool-actions { padding-inline: 14px; }
  .tool-actions .btn { flex: 1 1 100%; }
  .tool-actions .btn-reset { flex-basis: auto; }
  .opts { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .brand span { font-size: .95rem; }
  .site-nav a:nth-child(3) { display: none; }
  .opt-text em { font-size: .8rem; }
}

/* ---------- 10. Movimiento ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
html:not(.is-ready) .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
  .site-header, .site-nav, .ad-slot, .ad-wrap, .ad-toast, .ad-dialog, .tool-actions, .skip-link { display: none !important; }
  body { background: #fff; }
  .tool-card { box-shadow: none; border-color: #999; }
  .result-bar { position: static; background: #eee !important; color: #000; }
}

/* ---------- 11. Páginas legales ---------- */
.legal { padding-block: clamp(24px, 4vw, 44px); max-width: 820px; }
.legal h2 { font-size: 1.12rem; margin-top: 1.6em; }
.legal p { color: var(--ink-soft); font-size: .95rem; }
.legal .note { margin-bottom: 1.6em; }
