/* Acústica+ · guided hearing screening · direction A */
#voice-hearing-test-view {
  --vht-primary: var(--accent, #49b6a5);
  --vht-primary-dark: #164b4a;
  --vht-primary-soft: #e7f6f3;
  --vht-paper: #f7faf9;
  --vht-surface: #fff;
  --vht-text: #163331;
  --vht-body: #344745;
  --vht-muted: #667a77;
  --vht-line: #cfe0dd;
  --vht-alert: #d94b57;
  --vht-alert-soft: #fff0f1;
  --vht-warning: #9a6200;
  --vht-warning-soft: #fff7df;
  --vht-success: #28795e;
  --vht-success-soft: #e8f5ef;
  background: var(--vht-paper);
}

#voice-hearing-test-view .page-title { display: none; }
body:has(#voice-hearing-test-view.active) .platform-sticker { display: none; }

.voice-hearing-test-page {
  width: min(100%, 720px);
  max-width: none;
  min-height: calc(100vh - 78px);
  padding: 20px 18px calc(100px + env(safe-area-inset-bottom));
  margin: 0 auto;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color: var(--vht-text);
}

.voice-hearing-test-page #voice-hearing-test-content {
  display: block;
  min-height: 0;
}

.vht-load-state {
  min-height: 320px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--vht-deep);
  text-align: center;
}

.vht-load-error p { margin: 0; color: var(--vht-muted); }
.vht-load-error button {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--vht-deep);
  font: inherit;
  font-weight: 700;
}

.vht-welcome,
.vht-screen {
  width: 100%;
  animation: vht-enter .24s ease-out;
}

.vht-welcome {
  padding: 10px 0 24px;
  text-align: center;
}

.vht-brand-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--vht-line);
  text-align: left;
}

.vht-brand-line span {
  color: var(--vht-primary-dark);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.035em;
}

.vht-brand-line small {
  color: var(--vht-muted);
  font-size: .875rem;
}

.vht-kicker {
  margin: 0 0 8px;
  color: var(--vht-primary-dark);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.vht-welcome h2,
.vht-main h2 {
  max-width: 20ch;
  margin: 0 auto 14px;
  color: var(--vht-text);
  font-size: clamp(1.75rem, 7vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.08;
}

.vht-lead,
.vht-main p {
  max-width: 52ch;
  margin: 0 auto 18px;
  color: var(--vht-body);
  font-size: 1rem;
  line-height: 1.58;
}

.vht-ear-art {
  width: 180px;
  height: 180px;
  margin: 22px auto 12px;
}

.vht-ear-art svg { width: 100%; height: 100%; overflow: visible; }
.vht-ear-shape,
.vht-wave {
  fill: none;
  stroke: var(--vht-primary-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vht-ear-shape { stroke-width: 3; }
.vht-wave { stroke: var(--vht-primary); stroke-width: 2; opacity: .48; }
.vht-ear-art.is-active .vht-wave-one { animation: vht-wave 1s ease-in-out infinite; }
.vht-ear-art.is-active .vht-wave-two { animation: vht-wave 1s .16s ease-in-out infinite; }

.vht-requirements {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 28px 0;
  list-style: none;
  border-block: 1px solid var(--vht-line);
  text-align: left;
}

.vht-requirements li {
  display: grid;
  grid-template-columns: minmax(110px, .7fr) 1.3fr;
  gap: 14px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--vht-line);
}

.vht-requirements li:last-child { border-bottom: 0; }
.vht-requirements strong { color: var(--vht-text); font-size: .95rem; }
.vht-requirements span { color: var(--vht-muted); font-size: .92rem; line-height: 1.4; }

.vht-consents {
  display: grid;
  gap: 12px;
  margin: 0 0 22px;
  text-align: left;
}

.vht-consents label,
.vht-consent-line {
  display: flex !important;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 10px 0;
  color: var(--vht-body);
  font-size: .95rem;
  line-height: 1.45;
}

.vht-consents input,
.vht-consent-line input {
  width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  margin: 0;
  flex: 0 0 22px;
  accent-color: var(--vht-primary-dark);
}

.vht-primary,
.vht-secondary,
.vht-text-button,
.vht-btn-response,
.vht-din-keypad button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.vht-primary,
.vht-secondary {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 13px;
  font-size: 1.06rem;
  font-weight: 700;
}

.vht-primary {
  color: #fff;
  background: var(--vht-primary-dark);
  border: 2px solid var(--vht-primary-dark);
}

.vht-primary:hover { background: #0f3d3c; border-color: #0f3d3c; }
.vht-primary span { font-size: 1.3rem; }
.vht-secondary { color: var(--vht-primary-dark); background: var(--vht-surface); border: 2px solid var(--vht-primary-dark); }
.vht-secondary:hover { background: var(--vht-primary-soft); }
.vht-primary:disabled,
.vht-secondary:disabled { opacity: .52; cursor: wait; }

.vht-text-button {
  min-height: 48px;
  padding: 11px 14px;
  color: var(--vht-primary-dark);
  background: transparent;
  border: 0;
  font-size: .96rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.vht-disclaimer {
  margin-top: 22px !important;
  color: var(--vht-muted) !important;
  font-size: .86rem !important;
  line-height: 1.48 !important;
}

.vht-screen-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--vht-line);
}

.vht-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.vht-progress-copy span { color: var(--vht-muted); font-size: .8rem; }
.vht-progress-copy strong { color: var(--vht-primary-dark); font-size: .9rem; }
.vht-progress-track { height: 5px; overflow: hidden; background: var(--vht-line); border-radius: 99px; }
.vht-progress-track span { display: block; height: 100%; background: var(--vht-primary); border-radius: inherit; transition: width .25s ease; }

.vht-exit {
  min-width: 48px;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--vht-muted);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
}

.vht-main {
  min-height: 520px;
  padding: clamp(30px, 7vw, 54px) 0 24px;
}

.vht-centered { text-align: center; }
.vht-centered .vht-primary,
.vht-centered .vht-secondary,
.vht-question .vht-primary { margin-top: 12px; }

.vht-guide {
  position: sticky;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 11px 14px;
  background: var(--vht-primary-soft);
  border: 1px solid #bfe1da;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(22, 75, 74, .09);
}

.vht-guide-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--vht-primary-dark);
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
}

.vht-guide-icon svg { width: 23px; height: 23px; fill: currentColor; }
.vht-guide strong,
.vht-guide small { display: block; }
.vht-guide strong { color: var(--vht-text); font-size: .94rem; }
.vht-guide small { margin-top: 2px; color: var(--vht-body); font-size: .82rem; line-height: 1.35; }
.vht-guide i { width: 10px; height: 10px; background: var(--vht-primary); border-radius: 50%; animation: vht-listen 1.2s ease-in-out infinite; }
.vht-guide-solo { background: #f1f5f4; border-color: var(--vht-line); }

.vht-spinner {
  width: 42px;
  height: 42px;
  margin: 16px auto 24px;
  border: 4px solid var(--vht-line);
  border-top-color: var(--vht-primary-dark);
  border-radius: 50%;
  animation: vht-spin .7s linear infinite;
}

.vht-status-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin: 10px auto 22px;
  border-radius: 50%;
  font-size: 1.55rem;
  font-weight: 700;
}
.vht-status-ok { color: var(--vht-success); background: var(--vht-success-soft); }
.vht-status-warn { color: var(--vht-warning); background: var(--vht-warning-soft); }
.vht-status-alert { color: var(--vht-alert); background: var(--vht-alert-soft); }

.vht-noise-meter {
  width: min(100%, 440px);
  height: 18px;
  padding: 3px;
  margin: 26px auto 14px;
  overflow: hidden;
  background: var(--vht-line);
  border-radius: 99px;
}
.vht-noise-meter span { display: block; width: 0; height: 100%; background: var(--vht-primary); border-radius: inherit; transition: width .08s linear; }
.vht-live-status { color: var(--vht-muted) !important; font-size: .91rem !important; }

.vht-response-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 28px 0 16px;
}

.vht-btn-response {
  min-height: 74px;
  padding: 15px 12px;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 700;
}
.vht-btn-heard { color: #fff; background: var(--vht-primary-dark); border: 2px solid var(--vht-primary-dark); }
.vht-btn-notheard { color: var(--vht-primary-dark); background: var(--vht-surface); border: 2px solid var(--vht-primary-dark); }
.vht-btn-response:active { transform: translateY(1px); }

.vht-voice-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--vht-muted) !important;
  font-size: .9rem !important;
}
.vht-voice-hint span { color: var(--vht-primary); animation: vht-listen 1.2s ease-in-out infinite; }

.vht-question { padding-top: 24px; text-align: center; }
.vht-question h2 { max-width: 24ch; font-size: clamp(1.65rem, 6vw, 2.25rem); }

.vht-safety { text-align: left; }
.vht-safety .vht-status-mark { margin-left: 0; }
.vht-safety h2 { max-width: 18ch; margin-left: 0; }
.vht-safety p { margin-left: 0; }
.vht-safety ul { padding: 16px 18px 16px 34px; margin: 20px 0; color: var(--vht-body); background: var(--vht-alert-soft); border-left: 4px solid var(--vht-alert); }
.vht-safety li { margin: 6px 0; line-height: 1.45; }

.vht-din-display {
  min-height: 58px;
  margin: 18px 0;
  color: var(--vht-primary-dark);
  font-size: 2.15rem;
  font-weight: 700;
  letter-spacing: .24em;
  font-variant-numeric: tabular-nums;
}

.vht-din-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0 auto 14px;
}
.vht-din-keypad button { min-height: 58px; color: var(--vht-text); background: var(--vht-surface); border: 2px solid var(--vht-line); border-radius: 12px; font-size: 1.35rem; font-weight: 700; }
.vht-din-keypad button:hover { border-color: var(--vht-primary-dark); background: var(--vht-primary-soft); }
.vht-din-actions { display: flex; gap: 8px; align-items: center; justify-content: center; }
.vht-din-actions .vht-secondary { width: auto; min-height: 48px; font-size: .95rem; }

.vht-results { text-align: center; }
.vht-result-lead { font-size: 1.06rem !important; }
.vht-quality {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 0;
  margin: 24px 0 10px;
  border-block: 1px solid var(--vht-line);
  text-align: left;
}
.vht-quality span { color: var(--vht-muted); }
.vht-quality strong { color: var(--vht-success); }
.vht-result-guide { padding: 15px 16px; margin: 20px 0; color: var(--vht-primary-dark); background: var(--vht-primary-soft); border-left: 4px solid var(--vht-primary); text-align: left; font-size: .94rem; line-height: 1.45; }
.vht-limitations { padding: 16px 0; margin: 18px 0; border-block: 1px solid var(--vht-line); text-align: left; }
.vht-limitations strong { color: var(--vht-text); }
.vht-limitations p { margin: 7px 0 0; color: var(--vht-muted); font-size: .88rem; line-height: 1.5; }

.vht-audiogram-container { min-height: 0; margin: 18px auto; }
.vht-audiogram-container:empty { display: none; }
.vht-audiogram { max-width: 440px; margin: 0 auto; }
.vht-audiogram-svg { width: 100%; height: auto; background: var(--vht-surface); border: 1px solid var(--vht-line); }
.vht-ag-grid { stroke: var(--vht-line); stroke-width: 1; }
.vht-ag-axis { fill: var(--vht-muted); font: 11px "Atkinson Hyperlegible", sans-serif; }
.vht-ag-line { fill: none; stroke-width: 2.5; }
.vht-ag-line.ht-ag-right,
.vht-ag-mark.ht-ag-right { stroke: var(--vht-alert); }
.vht-ag-line.ht-ag-left,
.vht-ag-mark.ht-ag-left { stroke: var(--vht-primary-dark); }
.vht-ag-mark.ht-ag-right { fill: var(--vht-surface); }
.vht-ag-o { fill: var(--vht-surface) !important; }
.vht-ag-legend { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 9px; color: var(--vht-muted); font-size: .82rem; }
.vht-ag-legend small { width: 100%; }
.vht-ag-leg.ht-ag-right { color: var(--vht-alert); }
.vht-ag-leg.ht-ag-left { color: var(--vht-primary-dark); }

.vht-appointment { text-align: left; }
.vht-appointment h2 { max-width: 22ch; margin-left: 0; }
.vht-appointment > p { margin-left: 0; }
.vht-appointment form { display: grid; gap: 15px; margin-top: 24px; }
.vht-appointment label { display: grid; gap: 7px; color: var(--vht-text); font-size: .92rem; font-weight: 700; }
.vht-appointment label span { display: block; }
.vht-appointment em { color: var(--vht-alert); font-style: normal; }
.vht-appointment small { color: var(--vht-muted); font-weight: 400; }
.vht-appointment input,
.vht-appointment select {
  width: 100%;
  min-height: 52px;
  padding: 11px 13px;
  color: var(--vht-text);
  background: var(--vht-surface);
  border: 2px solid var(--vht-line);
  border-radius: 11px;
  font: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}
.vht-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vht-confirmation { display: grid; gap: 4px; padding: 16px; margin: 18px 0; background: var(--vht-primary-soft); border-left: 4px solid var(--vht-primary); text-align: left; }
.vht-confirmation strong { color: var(--vht-text); }
.vht-confirmation span { color: var(--vht-body); }

.vht-inline-error { color: #a92332 !important; font-size: .9rem !important; font-weight: 700; }
.vht-inline-error[hidden] { display: none; }

.voice-hearing-test-page button:focus-visible,
.voice-hearing-test-page input:focus-visible,
.voice-hearing-test-page select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--vht-primary) 55%, white);
  outline-offset: 3px;
}

@keyframes vht-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes vht-spin { to { transform: rotate(360deg); } }
@keyframes vht-wave { 50% { opacity: 1; transform: scale(1.025); transform-origin: center; } }
@keyframes vht-listen { 50% { opacity: .35; transform: scale(.78); } }

@media (min-width: 760px) {
  .voice-hearing-test-page { padding-top: 34px; }
  .vht-welcome,
  .vht-screen { padding: 28px 34px 34px; background: var(--vht-surface); border: 1px solid var(--vht-line); box-shadow: 0 18px 52px rgba(22, 75, 74, .08); }
  .vht-guide { bottom: 18px; }
}

@media (max-width: 520px) {
  .voice-hearing-test-page { min-height: calc(100vh - 62px); padding-inline: 16px; }
  .vht-main { min-height: 490px; }
  .vht-brand-line { display: grid; gap: 2px; }
  .vht-requirements li { grid-template-columns: 1fr; gap: 3px; }
  .vht-form-row { grid-template-columns: 1fr; }
  .vht-response-buttons { gap: 9px; }
  .vht-btn-response { min-height: 70px; font-size: 1.08rem; }
  .vht-guide { bottom: calc(66px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .voice-hearing-test-page *,
  .voice-hearing-test-page *::before,
  .voice-hearing-test-page *::after { animation: none !important; transition: none !important; }
}

@media (prefers-contrast: more) {
  #voice-hearing-test-view { --vht-line: #718481; --vht-muted: #3c4d4a; }
  .vht-primary,
  .vht-secondary,
  .vht-btn-response,
  .vht-appointment input,
  .vht-appointment select { border-width: 3px; }
}
