:root{
    --paper:#F2F3F5;
    --paper-dark:#E7E9EC;
    --ink:#2B2E3A;
    --ink-soft:#6B7280;
    --navy:#2FA89D;
    --navy-soft:#24857D;
    --stamp:#4A5164;
    --sage:#8FAE9E;
    --line: #E4E6EA;
    --white: #FFFFFF;
    --radius: 14px;
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0; height:100%;}
  body{
    background-color:var(--paper);
    color:var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    height:100vh;
    height:100dvh;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    line-height:1.5;
  }
  body::before{
    content:"";
    position:fixed; inset:0;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity:0.15;
    pointer-events:none;
    z-index:0;
  }
  .display{ font-family: 'Inter', sans-serif; font-weight:800; letter-spacing:-0.01em; }
  .mono{ font-family: "SF Mono", "Courier New", monospace; letter-spacing:0.02em; }

  /* HEADER — barra blanca a todo lo ancho, como la topbar de la plataforma Leolia */
  header.top{
    position:relative; z-index:2;
    flex: 0 0 auto;
    background: var(--white);
    border-bottom: 3px solid var(--navy);
    box-shadow: 0 1px 0 rgba(43,46,58,0.03);
  }
  .top-inner{
    max-width:1120px; margin:0 auto;
    padding: 12px 32px;
    display:flex; align-items:center; justify-content:space-between;
  }
  header.top .brand{
    display:flex; align-items:center; gap:10px;
  }
  header.top .ref{ font-size:11px; color:var(--ink-soft); }

  .imgleolia{
    height: 36px;
    width: 36px;
    object-fit: contain;
    display:block;
  }

  .wrap{
    position:relative; z-index:1;
    flex: 1 1 auto;
    min-height:0;
    max-width:1120px;
    width:100%;
    margin:0 auto;
    padding: clamp(10px,2vh,24px) 32px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    overflow:hidden;
  }

  .dossier{
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(27,42,74,0.05), 0 18px 40px -30px rgba(27,42,74,0.5);
    position:relative;
    display:flex;
    flex-direction:column;
    min-height:0;
    max-height:100%;
  }
  .dossier::before{
    content:"";
    position:absolute; top:0; left:0; right:0; height:6px;
    background: var(--navy);
    opacity:0.95;
  }

  .hero{ flex:0 0 auto; padding: clamp(16px,3vh,32px) 48px clamp(12px,2vh,20px); border-bottom:1px solid var(--line); }
  .hero .eyebrow{
    font-size:11px; text-transform:uppercase; letter-spacing:0.14em;
    color:var(--stamp); font-weight:700; margin-bottom:10px;
  }
  .hero h1{ font-size: clamp(22px, 2.6vw + 1vh, 34px); line-height:1.15; margin:0 0 10px; color:var(--ink); font-weight:800; letter-spacing:-0.01em; max-width:32ch; }
  .hero p{ color:var(--ink-soft); font-size: clamp(13px,1.5vh,16px); max-width:68ch; margin: 0; }

  .quiz-area{ flex:1 1 auto; min-height:0; overflow-y:auto; padding: clamp(16px,3vh,32px) 48px clamp(16px,2vh,28px); }

  .progress{ display:flex; gap:6px; margin-bottom: clamp(14px,2.5vh,26px); }
  .progress .tab{ flex:1; height:4px; background:var(--paper-dark); position:relative; overflow:hidden; }
  .progress .tab.done{ background:var(--navy); }
  .progress .tab.current::after{
    content:""; position:absolute; inset:0; background:var(--stamp);
    animation: fillbar 0.4s ease forwards; transform-origin:left;
  }
  @keyframes fillbar{ from{transform:scaleX(0);} to{transform:scaleX(1);} }

  .step{ display:none; }
  .step.active{ display:block; animation: rise 0.35s ease; }
  @keyframes rise{ from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:translateY(0);} }

  .q-label{ font-size:11px; text-transform:uppercase; letter-spacing:0.12em; color:var(--stamp); font-weight:700; margin-bottom:8px; }
  .q-text{ font-family:'Inter', sans-serif; font-weight:700; font-size: clamp(18px,1.8vw + 1vh,24px); color:var(--ink); margin:0 0 4px; line-height:1.3; letter-spacing:-0.01em; }
  .q-help{ font-size:13px; color:var(--ink-soft); margin:0 0 16px; }

  .options{ display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap:12px; }
  .option{
    text-align:left; background:var(--white); border:1.5px solid var(--line); border-radius:var(--radius);
    padding: clamp(14px,2vh,20px) 20px; cursor:pointer; font-size:15px; color:var(--ink);
    display:flex; align-items:flex-start; gap:14px;
    box-shadow: 0 1px 2px rgba(43,46,58,0.04);
    transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
  }
  .option:hover{
    border-color:var(--navy);
    transform: translateY(-3px);
    box-shadow: 0 14px 28px -18px rgba(43,46,58,0.35);
  }
  .option:active{ transform: translateY(-1px); }
  .option.selected{
    border-color:var(--navy);
    background: rgba(47,168,157,0.06);
    box-shadow: inset 0 0 0 1.5px var(--navy), 0 14px 28px -18px rgba(43,46,58,0.3);
  }
  .option .tag{
    flex:0 0 auto; width:30px; height:30px; border-radius:50%;
    border:1.5px solid var(--line); background:var(--paper);
    color:var(--ink-soft); position:relative;
    display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700;
    font-family: "SF Mono", monospace;
    transition: all .15s ease;
  }
  .option:hover .tag{ border-color:var(--navy); color:var(--navy); }
  .option.selected .tag{ background:var(--navy); border-color:var(--navy); color:transparent; }
  .option.selected .tag::after{
    content:"✓"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    color:#fff; font-family:'Inter',sans-serif; font-size:14px;
  }
  .option .body{ padding-top:2px; }
  .option .body b{ display:block; color:var(--ink); font-size:15.5px; font-weight:700; margin-bottom:4px; }
  .option .body span{ color:var(--ink-soft); font-size:13.5px; line-height:1.45; display:block; }

  .backline{ margin-top:16px; display:flex; justify-content:space-between; align-items:center; }
  .backline button.link{ background:none; border:none; color:var(--ink-soft); font-size:13px; cursor:pointer; padding:4px 0; }
  .backline button.link:hover{ color:var(--navy); text-decoration:underline; }

  .cta-row{ margin-top:18px; display:none; }
  .cta-row.visible{ display:block; animation: rise .3s ease; }
  button.submit{
    background:var(--navy); color:#fff; border:none; padding:14px 22px; font-size:15px;
    font-weight:600; cursor:pointer; border-radius:var(--radius); transition: background .15s ease;
  }
  button.submit:hover{ background:var(--navy-soft); }
  button.submit:disabled{ opacity:0.6; cursor:default; }

  /* Result (revealed after modal) */
  .result{ display:none; }
  .result.active{ display:flex; flex-direction:column; justify-content:center; min-height:100%; animation: rise 0.4s ease; }
  .result-label{
    font-size:11px; text-transform:uppercase; letter-spacing:0.14em; font-weight:700;
    color:var(--navy-soft); margin-bottom:10px;
  }
  .summary-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; }
  .summary-chips .chip{
    font-size:12.5px; color:var(--ink-soft); background:var(--paper);
    border:1px solid var(--line); border-radius:999px; padding:5px 12px;
  }
  .verdict{ border:1px solid var(--line); background:#fff; padding: clamp(22px,4vh,34px) clamp(20px,4vw,32px); position:relative; margin-bottom:18px; border-radius:var(--radius); }
  .stamp{
    position:absolute; top:18px; right:22px; width:84px; height:84px;
    border:2px solid var(--stamp); border-radius:50%;
    display:flex; align-items:center; justify-content:center; text-align:center;
    color:var(--stamp); font-family:"SF Mono", monospace; font-size:10px; font-weight:700;
    letter-spacing:0.06em; text-transform:uppercase;
    transform: rotate(-9deg) scale(0.5); opacity:0;
    animation: stampin .5s cubic-bezier(.2,1.4,.4,1) 0.15s forwards;
  }
  @keyframes stampin{ to{ opacity:1; transform: rotate(-9deg) scale(1);} }
  .verdict h2{ font-family:'Inter', sans-serif; font-weight:800; color:var(--ink); font-size: clamp(22px,3vw,28px); margin:0 0 14px; max-width:75%; letter-spacing:-0.01em; }
  .verdict p{ color:var(--ink); font-size: clamp(15px,1.6vw,17px); margin:0 0 10px; max-width:80%; line-height:1.55; }
  .verdict .art{
    display:inline-block; margin-top:6px; font-size:11px; color:var(--navy-soft);
    background:rgba(63,107,105,0.09); padding:4px 8px; font-family:"SF Mono", monospace;
  }
  .sent-note{ font-size:13px; color:var(--ink-soft); }
  .sent-note b{ color:var(--navy); }

  /* Modal */
  .modal-backdrop{
    position:fixed; inset:0; background:rgba(27,32,42,0.55);
    display:none; align-items:center; justify-content:center; padding:20px; z-index:50;
  }
  .modal-backdrop.open{ display:flex; animation: fadein .2s ease; }
  @keyframes fadein{ from{opacity:0;} to{opacity:1;} }
  .modal{
    background:var(--white); border:1px solid var(--line); max-width:440px; width:100%;
    padding:30px 28px; position:relative;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4);
    animation: modalin .25s cubic-bezier(.2,1,.3,1);
  }
  @keyframes modalin{ from{opacity:0; transform: translateY(10px) scale(.98);} to{opacity:1; transform:none;} }
  .modal-close{
    position:absolute; top:14px; right:16px; background:none; border:none; cursor:pointer;
    font-size:18px; color:var(--ink-soft); line-height:1;
  }
  .modal-close:hover{ color:var(--navy); }
  .modal .eyebrow{ font-size:11px; text-transform:uppercase; letter-spacing:0.1em; color:var(--stamp); font-weight:700; margin-bottom:8px; }
  .modal h3{ color:var(--navy); font-size:19px; margin:0 0 8px; }
  .modal p.sub{ color:var(--ink-soft); font-size:13.5px; margin:0 0 20px; }

  form.lead{ display:flex; flex-direction:column; gap:12px; }
  form.lead label{ font-size:12px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:0.08em; }
  form.lead input[type=text], form.lead input[type=email]{
    width:100%; padding:12px 14px; border:1px solid var(--line); background:#fff;
    font-size:15px; color:var(--ink); border-radius:var(--radius); font-family:inherit;
  }
  form.lead input:focus{ outline:2px solid var(--navy); outline-offset:1px; }
  .row2{ display:flex; gap:12px; }
  .row2 > div{ flex:1; }
  .consent{ display:flex; gap:10px; align-items:flex-start; font-size:12.5px; color:var(--ink-soft); margin-top:4px; }
  .consent input{ margin-top:3px; }
  .consent a{ color:var(--navy); }
  .error-msg{ color:var(--stamp); font-size:13px; margin-top:6px; display:none; }

  footer.note{ flex:0 0 auto; margin-top:0; padding: 6px 32px 10px; text-align:center; font-size:11px; color:var(--ink-soft); }
  footer.note a{ color:var(--navy); }

  /* ===== Responsive: móvil / pantallas estrechas o bajas ===== */
  @media (max-width: 640px){
    .top-inner{ padding: 10px 16px; }
    header.top .ref{ display:none; }
    .imgleolia{ height:30px; width:30px; }

    .wrap{ padding: 8px 12px; }
    .dossier{ border-radius: var(--radius); }

    .hero{ padding: 16px 18px 12px; }
    .hero .eyebrow{ font-size:10px; letter-spacing:0.1em; margin-bottom:6px; }
    .hero h1{ font-size: clamp(19px, 5.5vw, 24px); margin:0 0 6px; max-width:none; }
    .hero p{ font-size:12.5px; max-width:none; }

    .quiz-area{ padding: 14px 18px 16px; }
    .progress{ margin-bottom:14px; }
    .q-label{ font-size:10px; margin-bottom:6px; }
    .q-text{ font-size:17px; margin-bottom:4px; }
    .q-help{ font-size:12px; margin-bottom:12px; }

    .options{ grid-template-columns: 1fr; gap:10px; }
    .option{ padding:12px 14px; gap:10px; border-radius: calc(var(--radius) - 4px); }
    .option:hover{ transform:none; } /* evita el "salto" con touch */
    .option .tag{ width:24px; height:24px; font-size:11px; }
    .option .body b{ font-size:14px; margin-bottom:2px; }
    .option .body span{ font-size:12.5px; }

    .backline{ margin-top:12px; }
    .cta-row{ margin-top:14px; }
    button.submit{ width:100%; padding:13px 18px; font-size:14.5px; }

    .verdict{ padding:16px 16px; }
    .stamp{ width:56px; height:56px; font-size:8px; top:12px; right:12px; }
    .verdict h2{ font-size:18px; max-width:62%; margin-bottom:8px; }
    .verdict p{ font-size:13.5px; max-width:100%; }
    .sent-note{ font-size:12px; }

    .modal-backdrop{ padding:12px; }
    .modal{ padding:22px 18px; max-width:100%; }
    .modal h3{ font-size:17px; }
    .modal p.sub{ font-size:12.5px; margin-bottom:16px; }
    .row2{ flex-direction:column; gap:12px; }
    form.lead input[type=text], form.lead input[type=email]{ font-size:16px; } /* evita el zoom automático de iOS al enfocar */

    footer.note{ font-size:10px; padding:4px 16px 8px; }
  }

  /* Pantallas muy bajas (móvil en horizontal, ventanas pequeñas): comprime aún más */
  @media (max-height: 620px){
    .hero{ padding: 10px 18px 8px; }
    .hero p{ display:none; }
    .quiz-area{ padding: 10px 18px 12px; }
    .progress{ margin-bottom:10px; }
    .q-help{ display:none; }
    .options{ gap:8px; }
    .option{ padding:10px 12px; }
  }