:root {
  --accent: #31D1FF;
  --accent-bright: #05FBFF;
  --text-dark: #0E062C;
  --text-400: #103d75;
  --bg: #f4f4f4;
  --card: #fff;
  --muted: #888;
  --ok: #15a24a;
  --warn: #f59e0b;
  --bad: #e11d48;
}

/* ========= BASE ========= */
* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  padding: 40px;
  margin: 0;
}

.step {
  display: none;
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  max-width: 560px;
  margin: 0 auto 28px auto;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.step.active { display: block; }

h2 {
  margin: 0 0 14px 0;
  line-height: 1.2;
}

/* ========= BOTONES GLOBALES ========= */
button {
  margin: 10px 8px 0 0;
  padding: 12px 20px;
  font-size: 16px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  font-weight: 700;
  transition: all 0.3s ease;
}
button:hover:not(:disabled) {
  color: var(--accent-bright);
}
button:disabled {
  background: #bcdfee !important;
  cursor: not-allowed;
  color: #4c5a67 !important;
}

/* ========= STEP 1 (Intro) ========= */
#step1 {
  text-align: center;
}
#step1 h2 {
  font-size: 24px;
  margin-bottom: 30px;
  color: var(--text-400);
  font-weight: 700;
}


#playIntro {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px auto;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
}
#playIntro:hover:not(:disabled) {
  color: var(--accent-bright);
}

#readyBtn {
  display: block;
  margin: 0 auto;
  font-size: 16px;
  padding: 12px 20px;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
}
#readyBtn:hover:not(:disabled) {
  color: var(--accent-bright);
}

/* efecto “pulse” cuando está reproduciendo */
#playIntro.playing {
  position: relative;
  z-index: 1;
}
#playIntro.playing::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--accent), var(--accent-bright));
  color: var(--text-dark);
  opacity: 0.5;
  transform: translate(-50%, -50%) scale(1);
  z-index: -1;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  70%  { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}


/* ========= STEP 2 (Formulario) ========= */
#step2 h2 {
  font-size: 24px;
  margin-bottom: 30px;
  color: var(--text-400);
  font-weight: 700;
  text-align: center;
}

/* Inputs y select */
#step2 input,
#step2 select {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid #e0e3e8;
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
  color: var(--text-dark);
  transition: all 0.3s ease;
}

/* Placeholder más suave */
#step2 input::placeholder,
#step2 select:invalid {
  color: #2e3536;
  font-size: 14px;
}

/* Hover y focus */
#step2 input:hover,
#step2 select:hover {
  border-color: var(--accent);
}
#step2 input:focus,
#step2 select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(49, 209, 255, 0.4);
}

/* Estado inválido */
#step2 input:invalid,
#step2 select:invalid {
  border-color: var(--bad);
}

/* Checkbox */
#step2 label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dark);
  margin-top: 12px;
}
#step2 label.check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* Botón de envío */
#formNext {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 25px;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transition: all 0.3s ease;
}
#formNext:hover:not(:disabled) {
  color: var(--accent-bright);
}


/* ========= STEP 3 (Tips) ========= */
#step3 h2 {
  font-size: 24px;
  margin-bottom: 30px;
  color: var(--text-400);
  font-weight: 700;
  text-align: center;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 10px 0 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  background: #fafbfd;
  border: 1px solid #eef1f4;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--text-dark);
}

.checklist li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

/* Icono dentro de la checklist */
.checklist li .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.checklist li .icon svg {
  width: 100%;
  height: 100%;
  fill: var(--text-400);
}

/* Botón centrado */
#startTest {
  display: block;
  margin: 20px auto 0 auto;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 25px;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transition: all 0.3s ease;
  text-align: center;
}
#startTest:hover:not(:disabled) {
  color: var(--accent-bright);
}


/* ========= TEST ========= */
#testSection h2 {
  font-size: 24px;
  margin-bottom: 30px;
  color: var(--text-400);
  font-weight: 700;
  text-align: center;
}

.ear-columns {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.ear-card {
  flex: 1;
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  text-align: center;
  transition: all 0.3s ease;
}
.ear-card.inactive {
  opacity: 0.5;
  pointer-events: none;
}

.ear-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 16px;
  color: var(--text-400);
}

.icon-ear {
  display: block;
  margin: 0 auto 14px auto;
}
.icon-ear svg {
  width: 70px;
  height: 70px;
  fill: var(--text-400);
}

#testSection p[id^="question-"] {
  color: var(--text-400);
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 18px;
}
.q-line strong {
  color: var(--text-dark);
}

/* Contenedor de respuestas */
.split-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  position: relative;
  opacity: 0;
}
.split-container.show {
  opacity: 1;
}

.btn-split {
  flex-direction: column;     /* icono arriba, texto abajo */
  justify-content: center;
  align-items: center;
  min-width: 70px;
  min-height: 70px;
  padding: 10px;
  border-radius: 16px;
  font-size: 11px;            /* texto más pequeño */
  line-height: 1.2;
  text-align: center;

  transform: scale(0);
  opacity: 0;
}

.btn-split .icon-btn svg {
  width: 16px;
  height: 16px;
  margin-bottom: 4px;
}

.btn-split.appear-left {
  animation: mitosisLeft 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}
.btn-split.appear-right {
  animation: mitosisRight 0.6s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes mitosisLeft {
  0%   { transform: scale(0) translateX(0); opacity: 0; }
  40%  { transform: scale(1.2) translateX(0); opacity: 1; }
  100% { transform: scale(1) translateX(-60px); opacity: 1; }
}
@keyframes mitosisRight {
  0%   { transform: scale(0) translateX(0); opacity: 0; }
  40%  { transform: scale(1.2) translateX(0); opacity: 1; }
  100% { transform: scale(1) translateX(60px); opacity: 1; }
}

#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.btn-main, .btn-split {
  font-weight: bold;
  border: none;
  cursor: pointer;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-main {
  padding: 14px 28px;
  font-size: 14px;
  border-radius: 25px;
}

.btn-split {
  font-size: 11px;
}

.btn-main:hover:not(:disabled),
.btn-split:hover:not(:disabled) {
  color: var(--accent-bright);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--card);
}


/* ========= TEST ========= */
#testSection h2{
  font-size:24px;
  margin-bottom:30px;
  color:var(--text-400);
  font-weight:700;
  text-align:center;
}

/* Cards de cada oído */
.ear-columns {
  display: flex;
  gap: 20px;
  justify-content: center;
}
.ear-card {
  flex: 1;
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  text-align: center;
  transition: .3s;
}
.ear-card.inactive {
  opacity: .5;
  pointer-events: none;
}

.icon-ear {
  display: block;
  margin: 0 auto 14px;
}
.icon-ear svg {
  width: 70px;
  height: 70px;
  fill: var(--text-400);
}

.ear-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 16px;
  color: var(--text-400);
}

/* Texto de frecuencia/volumen en 2 líneas */
#testSection p[id^="question-"] {
  color: var(--text-400);
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 18px;
}
.q-line strong {
  color: var(--text-dark);
}

/* ================= Gooey Controls ================= */
#testSection .controls {
  position: relative;
  width: 220px;
  margin: 20px auto 0;
  filter: url(#goo);
  -webkit-filter: url(#goo);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* Play en el centro */
#testSection .controls .btn-main {
  width: 80px;
  height: 80px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 2;
}

/* Mensaje de prueba completada */
.ear-done {
  display: none;
  margin-top: 15px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ok);
}
.ear-done.show {
  display: block;
}

/* Contenedor de los botones Sí/No */
#testSection .split-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  opacity: 0;
  pointer-events: none; /* inactivo hasta que aparezcan */
  transform: scale(0.5);
  transition: opacity 0.3s var(--mitosis-ease), transform 0.3s var(--mitosis-ease);
}
#testSection .split-container.show {
  opacity: 1;
  pointer-events: auto; /* ahora sí clicables */
  transform: scale(1);
}

/* Botones Sí/No */
#testSection .btn-split {
  min-width: 72px;
  min-height: 72px;
  padding: 8px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1.2;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transform: scale(0);
  opacity: 0;
}
#testSection .btn-split .icon-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--card);
}

/* Hover */
#testSection .btn-main:hover:not(:disabled),
#testSection .btn-split:hover:not(:disabled) {
  color: var(--accent-bright);
}

/* ================= Animaciones Mitosis ================= */
:root { --mitosis-ease: cubic-bezier(.7,0,.2,1); }

.btn-split.appear-left {
  animation: mitosisLeft 0.5s var(--mitosis-ease) forwards;
}
.btn-split.appear-right {
  animation: mitosisRight 0.5s var(--mitosis-ease) forwards;
}

@keyframes mitosisLeft {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1) translateX(-10px); opacity: 1; }
}
@keyframes mitosisRight {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1) translateX(10px); opacity: 1; }
}

/* Encogimiento del Play */
.cell-shrink {
  animation: cellShrink 0.4s var(--mitosis-ease) forwards;
}
@keyframes cellShrink {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

/* Reaparición del Play */
.cell-grow {
  animation: cellGrow 0.4s var(--mitosis-ease) forwards;
}
@keyframes cellGrow {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.progress-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.progress-bar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ddd;
  transition: background 0.3s ease, transform 0.2s ease;
}
.progress-bar span.active {
  background: var(--accent);
  transform: scale(1.2);
}


/* ========= PRE-RESULTADOS ========= */
#step4 {
  text-align: center;
}

#step4 h2 {
  font-size: 24px;
  margin-bottom: 20px;
  color: var(--text-400);
  font-weight: 700;
}

#step4 p {
  font-size: 15px;
  color: var(--text-dark);
  margin-bottom: 30px;
  line-height: 1.5;
}

/* ==== Mobile ajuste para oídos ==== */
@media (max-width: 767px) {
  .ear-columns {
    flex-direction: column;
    gap: 0;
  }
  .ear-card {
    display: none; /* por defecto ocultos */
  }
  .ear-card.active {
    display: block; /* solo el activo */
  }
}


/* Botón "Ver resultados" */
#seeResultsBtn {
  display: inline-block;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 25px;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transition: all 0.3s ease;
}
#seeResultsBtn:hover:not(:disabled) {
  color: var(--accent-bright);
}

/* ========= RESULTADOS ========= */
#resultSection {
  text-align: center;
}

#resultSection h2 {
  font-size: 26px;
  margin-bottom: 24px;
  color: var(--text-400);
  font-weight: 700;
}

#resultSection .score {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 6px 0 2px;
}

#resultSection .sub {
  color: var(--text-400);
  font-size: 14px;
  margin-bottom: 12px;
  font-weight: 600;
}

#resultSection .card {
  flex: 1 1 260px;
  background: #fafbfd;
  border: 1px solid #eef1f4;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

#resultSection .table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 18px;
  font-size: 14px;
  color: var(--text-dark);
}
#resultSection .table th,
#resultSection .table td {
  border: 1px solid #e6e8eb;
  padding: 10px 12px;
  text-align: center;
}

#resultSection .row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.badge.ok  { background: #e8f8ee; color: var(--ok); }
.badge.mid { background: #fff6e6; color: var(--warn); }
.badge.bad { background: #ffe8ee; color: var(--bad); }

.cta-row {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  align-items: center;
  gap: 25px;
}
#restartLink {
  color: var(--text-400);
  font-size: 14px;
  text-decoration: underline;
}
#restartLink:hover {
  color: var(--accent);
}

#contactLink.btn-main {
  text-decoration: none;
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  background: linear-gradient(45deg, var(--text-400), var(--text-dark));
  color: var(--card);
  transition: background 0.3s ease;
}
#contactLink.btn-main:hover {
  background: linear-gradient(45deg, var(--accent), var(--text-dark));
}

