/* ══════════════════════════════════════════════
   ALOHA CAM · estilos mobile-first fullscreen
   ══════════════════════════════════════════════ */

@font-face {
  font-family: "DSEG7";
  src: url("https://cdn.jsdelivr.net/gh/keshikan/DSEG@master/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2")
    format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --coral: #ff5a3c;
  --coral-glow: #ff8a2a;
  --bg: #050308;
  --bg-2: #0f0812;
  --cream: #fef7e0;
  --dim: rgba(254, 247, 224, 0.55);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family:
    "SF Pro Display",
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ══════════ Sistema de pantallas ══════════ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen.is-active {
  display: flex;
}

/* ══════════ PANTALLA HOME ══════════ */
.screen--home {
  background:
    radial-gradient(
      ellipse at 20% 15%,
      rgba(255, 90, 60, 0.18),
      transparent 55%
    ),
    radial-gradient(
      ellipse at 80% 90%,
      rgba(255, 138, 42, 0.14),
      transparent 60%
    ),
    var(--bg);
}
.home__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 40px 24px;
  text-align: center;
}
.home__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.home__title {
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.85;
  color: var(--cream);
  text-transform: uppercase;
}
.home__title span {
  color: var(--coral);
  font-style: italic;
  letter-spacing: -0.02em;
}
.home__tag {
  font-size: 1rem;
  color: var(--dim);
  letter-spacing: 0.02em;
  max-width: 260px;
}
.home__foot {
  font-size: 0.72rem;
  color: rgba(254, 247, 224, 0.35);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.btn-shutter--start {
  background: var(--coral);
  color: var(--bg);
  border: none;
  padding: 22px 44px;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow:
    0 20px 60px rgba(255, 90, 60, 0.45),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}
.btn-shutter--start:active {
  transform: scale(0.97);
}
.btn-shutter__icon {
  font-size: 1.5rem;
}

/* ══════════ PANTALLA CÁMARA ══════════ */
.screen--camera {
  padding: 0;
  background: #000;
}
.cam__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam__stage.is-front #video {
  transform: scaleX(-1);
}
.cam__viewfinder {
  position: absolute;
  pointer-events: none;
  /* Posición y tamaño se ajustan por JS al área de crop 9:16 */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.cam__format-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--coral-glow);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  border-radius: 6px;
  border: 1px solid rgba(255, 138, 42, 0.4);
  backdrop-filter: blur(6px);
}

/* Máscaras oscuras que muestran las zonas que NO se van a capturar */
.cam__mask {
  position: absolute;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.2s ease;
}
.cam__mask--top {
  top: 0;
  left: 0;
  right: 0;
  height: 0;
}
.cam__mask--bottom {
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
}
.cam__mask--left {
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
}
.cam__mask--right {
  top: 0;
  bottom: 0;
  right: 0;
  width: 0;
}
.corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.85);
}
.corner--tl {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}
.corner--tr {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}
.corner--bl {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}
.corner--br {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}
.cam__flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.cam__flash.is-firing {
  animation: flash 200ms ease-out;
}
@keyframes flash {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.cam__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px 32px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.65) 100%);
}
.btn-icon {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.btn-icon:active {
  background: rgba(255, 255, 255, 0.15);
}
.btn-capture {
  position: relative;
  width: 84px;
  height: 84px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.btn-capture__ring {
  position: absolute;
  inset: 0;
  border: 4px solid #fff;
  border-radius: 50%;
}
.btn-capture__dot {
  position: absolute;
  inset: 8px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.1s ease;
}
.btn-capture:active .btn-capture__dot {
  transform: scale(0.9);
  background: var(--coral);
}
.btn-capture.is-busy .btn-capture__dot {
  background: var(--coral);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.85);
    opacity: 0.6;
  }
}

/* ══════════ PANTALLA RESULTADO ══════════ */
.screen--result {
  padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom));
  justify-content: space-between;
  background: #000;
}
.result__stage {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  min-height: 0;
}
#result-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.result__dev {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(5, 3, 8, 0.95);
  color: var(--cream);
}
.result__dev.is-hidden {
  display: none;
}
.dev__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 90, 60, 0.25);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.dev__text {
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-glow);
  font-weight: 700;
}
.result__actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 4px;
  width: 100%;
  justify-content: center;
}
.btn-primary,
.btn-secondary {
  flex: 1;
  max-width: 200px;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--coral);
  color: var(--bg);
  box-shadow: 0 10px 30px rgba(255, 90, 60, 0.4);
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn-secondary:active {
  background: rgba(255, 255, 255, 0.16);
}
.result__cta {
  padding: 8px 24px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.4;
}
.result__cta strong {
  color: var(--coral-glow);
}

/* ══════════ PANTALLA PERMISO DENEGADO ══════════ */
.denied__inner {
  max-width: 380px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.denied__icon {
  font-size: 3.5rem;
}
.screen--denied h2 {
  font-size: 1.5rem;
  font-weight: 800;
}
.screen--denied p {
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1.5;
}
.screen--denied details {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
}
.screen--denied summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
}
.denied__how p {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--dim);
}
