/* ============ Variables (paleta de colores.png) ============ */
:root {
  --c-turquesa: #17acb7;
  --c-turquesa-osc: #0a808b;   /* turquesa más oscuro para texto blanco con buen contraste */
  --c-azul: #026da2;
  --c-blanco: #ffffff;
  --c-fondo: #05121c;
  --c-tinta: #0a2a3d;
  --c-tinta-suave: #4a6575;
  --c-error: #b3261e;
  --c-borde: #c9d7de;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dur: 300ms;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  height: 100vh; height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--c-fondo);
  color: var(--c-blanco);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }

:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px rgba(23, 172, 183, .85); }

/* ============ Contenedor de la app ============ */
#app {
  position: relative;
  width: 100%; max-width: 430px;
  height: 100vh; height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--c-fondo);
  isolation: isolate;
}
@media (min-width: 431px) {
  #app { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 80px rgba(0, 0, 0, .6); }
}

/* ============ Escenario del avatar (video) ============ */
#avatar-stage { position: absolute; inset: 0; z-index: 0; background: #0b1b28; }
#avatar-stage video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; background: #0b1b28; }

.shade { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; }
.shade-top { top: 0; height: min(30%, 230px); background: linear-gradient(to bottom, rgba(4, 18, 32, .68), rgba(4, 18, 32, 0)); }
.shade-bottom { bottom: 0; height: min(54%, 440px); background: linear-gradient(to top, rgba(4, 18, 32, .85), rgba(4, 18, 32, .48) 55%, rgba(4, 18, 32, 0)); }

/* ============ Efecto glass ============ */
.glass {
  background: rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .3);
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}

/* ============ Capa principal ============ */
#main {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: space-between;
  pointer-events: none;
}
#main > * { pointer-events: auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 0;
}
.logo { --lw: 158px; display: block; position: relative; width: var(--lw); height: calc(var(--lw) * 100 / 490); overflow: hidden; flex: none; }
.logo img {
  position: absolute; max-width: none;
  width: calc(var(--lw) * 520 / 490);
  left: calc(var(--lw) * -15 / 490);
  top: calc(var(--lw) * -210 / 490);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .35));
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  text-decoration: none;
}
.icon-btn img { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); }

/* ============ Botones inferiores ============ */
.actions {
  display: flex; flex-direction: column; gap: 12px;
  padding: 0 16px calc(var(--safe-bottom) + 18px);
}
.btn {
  position: relative; isolation: isolate;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px;
  padding: 10px 20px 10px 16px;
  border-radius: 999px;
  font-size: clamp(14px, 3.9vw, 16px); font-weight: 600; line-height: 1.25;
  text-align: left; text-decoration: none;
  transition: transform .15s ease;
}
.btn:active { transform: scale(.98); }
.btn img { width: 30px; height: 30px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); }

/* Botón principal: luz giratoria + halo pulsante */
.btn-primary { min-height: 62px; background: rgba(255, 255, 255, .2); }
.btn-primary::before { /* luz que gira por el borde */
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 2px;
  background: conic-gradient(from var(--angle), rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0) 235deg, rgba(23, 172, 183, .95) 295deg, #fff 338deg, rgba(255, 255, 255, 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  animation: giro 3.5s linear infinite;
}
.btn-primary::after { /* halo turquesa */
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 26px 2px rgba(23, 172, 183, .6), 0 0 60px 6px rgba(23, 172, 183, .25);
  animation: halo 2.8s ease-in-out infinite;
}
.no-angle .btn-primary::before { display: none; } /* sin @property: queda solo el halo */
@keyframes giro { to { --angle: 360deg; } }
@keyframes halo { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: .9; transform: scale(1.025); } }

/* ============ Sonido y play ============ */
.sound {
  position: absolute; right: 16px; top: calc(var(--safe-top) + 12px + 46px + 12px);
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; min-width: 42px; padding: 0 14px; justify-content: center;
  border-radius: 999px; font-size: 13px; font-weight: 500;
}
.sound .ico-on { display: none; }
.sound[aria-pressed="true"] .ico-on { display: block; }
.sound[aria-pressed="true"] .ico-off { display: none; }
.sound:not(.is-prompt) { padding: 0; width: 42px; }
.sound:not(.is-prompt) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sound.is-prompt { position: absolute; animation: flota 2.6s ease-in-out infinite; }
.sound.is-prompt::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
  animation: onda 2.6s ease-out infinite;
}
@keyframes flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes onda { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.18, 1.5); } }

.play {
  position: absolute; left: 50%; top: 50%; margin: -44px 0 0 -44px;
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; padding: 0 0 0 4px;
}
[hidden] { display: none !important; }

/* ============ Menú hamburguesa ============ */
.menu { position: absolute; inset: 0; z-index: 20; visibility: hidden; transition: visibility 0s var(--dur); }
.menu.is-open { visibility: visible; transition: none; }
.menu-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .28); opacity: 0; transition: opacity var(--dur) var(--ease); }
.menu.is-open .menu-scrim { opacity: 1; }
.menu-panel {
  position: absolute; top: calc(var(--safe-top) + 10px); right: 10px;
  width: min(310px, calc(100% - 20px));
  padding: 12px; border-radius: 26px;
  background: rgba(8, 28, 44, .58);
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  transform: translateX(calc(100% + 24px));
  transition: transform var(--dur) var(--ease);
}
.menu.is-open .menu-panel { transform: none; }
.menu-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 8px 12px; font-weight: 600; font-size: 15px; }
.x-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; }
.x-btn-light { background: #eaf1f5; color: var(--c-tinta); width: 38px; height: 38px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px;
  padding: 8px 12px; border: 0; border-radius: 16px; background: transparent;
  font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; color: #fff;
}
.menu-item:hover, .menu-item:active { background: rgba(255, 255, 255, .14); }
.menu-item img { width: 26px; height: 26px; object-fit: contain; flex: none; }

/* ============ Paneles inferiores (bottom sheets) ============ */
.backdrop {
  position: absolute; inset: 0; z-index: 30; background: rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.backdrop.is-on { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  max-height: 80vh; max-height: 80dvh;
  display: flex; flex-direction: column;
  background: #fbfdfe; color: var(--c-tinta);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .3);
  transform: translateY(105%); visibility: hidden;
  transition: transform var(--dur) var(--ease), visibility 0s var(--dur);
  outline: none;
}
.sheet.is-open { transform: none; visibility: visible; transition: transform var(--dur) var(--ease), visibility 0s; }
.sheet-head { flex: none; padding: 10px 18px 6px; touch-action: none; cursor: grab; }
.grip { width: 42px; height: 5px; border-radius: 3px; background: #c6d5dd; margin: 0 auto 8px; }
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { font-size: 20px; font-weight: 600; line-height: 1.25; }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 6px 20px calc(var(--safe-bottom) + 22px);
}
.lead { font-size: 14px; color: var(--c-tinta-suave); margin: 0 0 16px; line-height: 1.5; }

/* Formulario */
.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; padding: 0; }
.opt { font-weight: 400; color: var(--c-tinta-suave); }
input[type="text"], input[type="tel"], input[type="email"], input[type="date"], select {
  display: block; width: 100%; min-height: 50px; padding: 0 14px;
  font-size: 16px; color: var(--c-tinta);
  background: #fff; border: 1.5px solid var(--c-borde); border-radius: 14px;
  -webkit-appearance: none; appearance: none; text-align: left;
}
select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%230a2a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:focus-visible, select:focus-visible { outline: none; border-color: var(--c-azul); box-shadow: 0 0 0 4px rgba(23, 172, 183, .3); }
[aria-invalid="true"] { border-color: var(--c-error) !important; }
.err { font-size: 12.5px; color: var(--c-error); margin: 5px 2px 0; display: none; line-height: 1.35; }
.err.is-on { display: block; }

.chips { display: flex; gap: 10px; }
.chip { position: relative; flex: 1; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: flex; align-items: center; justify-content: center; height: 50px;
  border: 1.5px solid var(--c-borde); border-radius: 14px; background: #fff;
  font-weight: 500; font-size: 15px; transition: background .15s, color .15s, border-color .15s;
}
.chip input:checked + span { background: var(--c-azul); border-color: var(--c-azul); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--c-azul); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--c-azul); }
.check a { color: var(--c-azul); }

.cta {
  display: block; width: 100%; min-height: 54px; margin-top: 6px; padding: 0 20px;
  border: 0; border-radius: 999px; color: #fff; font-size: 16px; font-weight: 600;
  background: linear-gradient(135deg, var(--c-turquesa-osc), var(--c-azul));
  box-shadow: 0 8px 20px rgba(2, 109, 162, .3);
}
.cta:disabled { opacity: .75; cursor: progress; }
.cta:focus-visible { outline-color: var(--c-azul); box-shadow: 0 0 0 5px rgba(23, 172, 183, .45); }

/* Éxito */
.success { text-align: center; padding: 18px 4px 4px; }
.success-icon { width: 68px; height: 68px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--c-turquesa-osc), var(--c-azul)); }
.success h3 { font-size: 21px; font-weight: 600; margin-bottom: 8px; outline: none; }
.success p { color: var(--c-tinta-suave); font-size: 15px; line-height: 1.55; margin: 0 auto 20px; max-width: 30ch; }

/* Tarjetas de tratamientos */
.cards { list-style: none; padding: 0; display: grid; gap: 10px; margin: 4px 0 12px; }
.card { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 14px 16px; background: #fff; border: 1px solid #e0eaef; border-radius: 18px; box-shadow: 0 2px 8px rgba(10, 42, 61, .05); }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 3px; line-height: 1.3; }
.card p { font-size: 13px; color: var(--c-tinta-suave); line-height: 1.45; }
.price { flex: none; text-align: right; font-weight: 700; font-size: 16px; color: var(--c-azul); white-space: nowrap; }
.price small { display: block; font-size: 11px; font-weight: 500; color: var(--c-tinta-suave); }
.notice { font-size: 12.5px; color: var(--c-tinta-suave); text-align: center; margin: 4px 0 14px; }

/* Pantallas bajas */
@media (max-height: 640px) {
  .actions { gap: 9px; padding-bottom: calc(var(--safe-bottom) + 12px); }
  .btn { min-height: 52px; }
  .btn-primary { min-height: 56px; }
}

/* Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .btn-primary::before, .sound.is-prompt, .sound.is-prompt::after { animation: none; }
  .btn-primary::after { animation: none; opacity: .6; }
  :root { --dur: 1ms; }
  .btn { transition: none; }
}
