/* TEKNÉ · Encuestas — una pregunta por pantalla */
:root {
    --bg: #07090c;
    --panel: rgba(13, 17, 22, 0.86);
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.16);
    --teal: #126f86;
    --teal-hi: #45a6c2;
    --teal-a: rgba(18,111,134, 0.12);
    --ink: #eef3f3;
    --ink-2: #a3afb8;
    --ink-3: #5f6b76;
    --err: #ff8a8a;
    --ff: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ff-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
    min-height: 100vh; min-height: 100dvh;
    font-family: var(--ff); background: var(--bg); color: var(--ink);
    -webkit-font-smoothing: antialiased; line-height: 1.55;
    display: flex; flex-direction: column; overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--teal); color: #031012; }
:focus-visible { outline: 2px solid var(--teal-hi); outline-offset: 3px; }
.mono { font-family: var(--ff-mono); letter-spacing: 0.06em; }

.bgfx { position: fixed; inset: 0; z-index: -2; opacity: 0.75; pointer-events: none; }
.bgfx canvas { width: 100%; height: 100%; }
.bgfx::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(7,9,12,0.3), rgba(7,9,12,0.85)); }
.frame { position: fixed; left: 50%; top: 50%; width: min(820px, calc(100% - 32px)); height: min(70vh, 640px); transform: translate(-50%, -50%); pointer-events: none; visibility: hidden; }

.progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,0.05); z-index: 20; }
.progress i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, #0d5468, var(--teal-hi)); transition: transform .8s var(--ease); }
.progress i::after { content: ''; position: absolute; right: 0; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--teal-hi); box-shadow: 0 0 14px 3px rgba(69,166,194,0.7); transform: translateX(50%); }

.top {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px var(--gutter) 0; position: relative; z-index: 5;
}
.brand img { height: 28px; width: auto; filter: brightness(0) invert(1); }
.step-count { font-size: 11px; color: var(--ink-3); letter-spacing: 0.2em; }
.step-count b { color: var(--teal-hi); font-weight: 500; }

.stage {
    flex: 1; width: 100%; max-width: 820px; margin: 0 auto;
    display: flex; flex-direction: column; justify-content: center;
    padding: clamp(28px, 6vh, 60px) var(--gutter);
}
.screen { width: 100%; }
.card {
    position: relative; background: var(--panel); border: 1px solid var(--line);
    border-radius: 18px; padding: clamp(26px, 5vw, 52px);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 40px 120px -40px rgba(0,0,0,0.9), 0 0 0 1px rgba(0,0,0,0.4);
}
.card::before { /* esquinas HUD */
    content: ''; position: absolute; inset: 10px; pointer-events: none;
    background:
        linear-gradient(var(--teal-hi), var(--teal-hi)) top left / 14px 1.5px no-repeat,
        linear-gradient(var(--teal-hi), var(--teal-hi)) top left / 1.5px 14px no-repeat,
        linear-gradient(var(--teal-hi), var(--teal-hi)) bottom right / 14px 1.5px no-repeat,
        linear-gradient(var(--teal-hi), var(--teal-hi)) bottom right / 1.5px 14px no-repeat;
    opacity: 0.7;
}

.boot { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; color: var(--ink-3); letter-spacing: 0.24em; }
.boot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-hi); box-shadow: 0 0 12px var(--teal-hi); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.kicker { display: inline-flex; align-items: center; gap: 10px; font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.24em; color: var(--teal-hi); text-transform: uppercase; margin-bottom: 18px; }
.kicker::before { content: ''; width: 22px; height: 1px; background: currentColor; }
.title {
    font-size: clamp(1.5rem, 4.2vw, 2.6rem); font-weight: 800; font-stretch: 106%;
    line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance;
}
.title .req { color: var(--teal-hi); margin-left: 4px; }
.intro .title { font-size: clamp(2rem, 6vw, 3.6rem); font-stretch: 110%; line-height: 1.02; }
.desc { margin-top: 14px; color: var(--ink-2); font-size: clamp(1rem, 1.6vw, 1.1rem); white-space: pre-line; max-width: 60ch; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.meta span { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.12em; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.wi { display: inline-block; }

.answer { margin-top: clamp(22px, 4vh, 34px); }

/* inputs de texto */
.tin {
    width: 100%; background: transparent; border: 0; border-bottom: 2px solid var(--line-2);
    padding: 12px 2px; font-size: clamp(1.15rem, 2.6vw, 1.5rem); color: var(--ink); outline: none; border-radius: 0;
    transition: border-color .3s;
}
.tin:focus { border-color: var(--teal-hi); }
.tin::placeholder { color: var(--ink-3); }
textarea.tin { resize: none; min-height: 52px; max-height: 40vh; line-height: 1.45; overflow-y: auto; }
select.tin { appearance: none; cursor: pointer; padding-right: 32px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2345a6c2' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 4px center; }
select.tin option { background: #0f1319; color: var(--ink); font-size: 1rem; }
input[type="date"].tin { color-scheme: dark; }

/* opciones */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.025);
    font-size: clamp(0.98rem, 1.8vw, 1.08rem); transition: border-color .25s, background .25s, transform .25s var(--ease);
}
.opt:hover { border-color: rgba(69,166,194,0.5); background: rgba(18,111,134,0.06); }
.opt:active { transform: scale(0.99); }
.opt .key {
    flex: none; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center;
    font-family: var(--ff-mono); font-size: 11px; border: 1px solid var(--line-2); color: var(--ink-2);
    transition: background .25s, color .25s, border-color .25s;
}
.opt .lbl { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt .tick { width: 18px; height: 18px; opacity: 0; color: var(--teal-hi); transition: opacity .2s; flex: none; }
.opt.on { border-color: var(--teal-hi); background: rgba(18,111,134,0.12); }
.opt.on .key { background: var(--teal-hi); color: #031314; border-color: var(--teal-hi); }
.opt.on .tick { opacity: 1; }
.opt.flash { animation: flash .35s 2; }
@keyframes flash { 50% { background: rgba(69,166,194,0.25); } }
.other-in { margin-top: 4px; }
.multi-note { font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.1em; margin-bottom: 12px; }

/* escala */
.scale { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; }
.scale button {
    aspect-ratio: 1 / 1.05; max-height: 64px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.025);
    font-family: var(--ff-mono); font-size: clamp(0.85rem, 2vw, 1.1rem); font-weight: 500;
    transition: background .2s, border-color .2s, transform .2s var(--ease), color .2s;
}
.scale button:hover { border-color: var(--teal-hi); transform: translateY(-2px); }
.scale button.on { background: var(--teal-hi); color: #031314; border-color: var(--teal-hi); }
.scale-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 520px) {
    .scale.wide { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* estrellas */
.stars { display: flex; gap: clamp(4px, 1.5vw, 10px); flex-wrap: wrap; }
.stars button { width: clamp(40px, 9vw, 56px); height: clamp(40px, 9vw, 56px); padding: 4px; color: rgba(255,255,255,0.14); transition: color .15s, transform .25s var(--ease); }
.stars button svg { width: 100%; height: 100%; }
.stars button.lit { color: var(--teal-hi); filter: drop-shadow(0 0 8px rgba(69,166,194,0.5)); }
.stars button:hover { transform: scale(1.12); }

/* sí / no */
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yesno .opt { justify-content: center; padding: 22px 16px; font-size: 1.2rem; font-weight: 700; }

/* contacto */
.cfields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.cfields label { display: flex; flex-direction: column; gap: 4px; }
.cfields label span { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--teal-hi); text-transform: uppercase; }
.cfields .tin { font-size: 1.08rem; padding: 10px 2px; }
@media (max-width: 560px) { .cfields { grid-template-columns: 1fr; } }

.err { min-height: 22px; margin-top: 14px; color: var(--err); font-family: var(--ff-mono); font-size: 12px; }

/* acciones */
.actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 24px; border-radius: 999px;
    font-weight: 700; font-size: 0.95rem; white-space: nowrap; text-decoration: none;
    transition: transform .3s var(--ease), background .3s, border-color .3s, box-shadow .3s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--teal); color: #031314; box-shadow: 0 12px 34px -12px rgba(18,111,134,0.8); }
.btn-primary:hover { background: var(--teal-hi); transform: translateY(-1px); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--teal); color: var(--ink); }
.btn-text { color: var(--ink-3); font-size: 0.88rem; padding: 0 8px; height: 44px; }
.btn-text:hover { color: var(--ink); }
.btn[disabled] { opacity: 0.6; pointer-events: none; }
.enter-hint { font-family: var(--ff-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.08em; }
.enter-hint b { color: var(--ink-2); font-weight: 500; }
.spacer { flex: 1; }

/* gracias */
.done { text-align: center; }
.done .title { margin-top: 22px; }
.done .desc { margin-left: auto; margin-right: auto; }
.ok-check { width: 86px; height: 86px; margin: 0 auto; }
.ok-check circle { fill: none; stroke: var(--teal-hi); stroke-width: 2; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 1s var(--ease) forwards; }
.ok-check path { fill: none; stroke: var(--teal-hi); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .7s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done .actions { justify-content: center; margin-top: 30px; }
@media (max-width: 560px) { .done .actions { flex-direction: column; align-items: stretch; } .done .actions .btn { justify-content: center; } }
.note { margin-top: 18px; font-family: var(--ff-mono); font-size: 11px; color: var(--ink-3); }

.bottom {
    display: flex; justify-content: space-between; gap: 12px; padding: 0 var(--gutter) 18px;
    font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.12em; min-height: 32px;
}
.save { display: inline-flex; align-items: center; gap: 8px; }
.save::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0; }
.save.ok { color: var(--teal-hi); } .save.ok::before { opacity: 1; }
.save.busy::before { opacity: 1; animation: pulse .8s infinite; }
.save.off { color: #ffb347; } .save.off::before { opacity: 1; }
@media (hover: none) { .hint, .enter-hint { display: none; } }

@media (max-width: 560px) {
    .card { border-radius: 14px; }
    .actions .btn-primary { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    .bgfx { display: none; }
}

html.lite .bgfx { opacity: .55; }
html.lite .card { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0d1319; }
