:root {
  --papel: #f6f1ea;
  --tinta: #2c2723;
  --tinta-suave: #6f665e;
  --salvia: #7f907b;
  --oro: #a9844f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

/* ---------- Pantallas a pantalla completa ---------- */
.pantalla {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  text-align: center;
  background: radial-gradient(120% 80% at 50% 0%, #fffdf9 0%, var(--papel) 60%, #efe7dc 100%);
  z-index: 10;
  overflow-y: auto;
}

.marca {
  font-family: var(--serif);
  font-size: 20px; letter-spacing: .04em;
  color: var(--tinta);
}
.marca span { font-style: italic; color: var(--oro); }
.marca--clara { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.marca--clara span { color: #f1d9ad; }

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 8vw, 40px);
  letter-spacing: .02em;
}
.texto { color: var(--tinta-suave); font-size: 16px; line-height: 1.5; max-width: 34ch; }
.aviso { font-size: 13px; color: var(--tinta-suave); max-width: 32ch; }

.lamina-mini {
  width: min(52vw, 220px);
  aspect-ratio: 0.7;
  padding: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 18px 40px -18px rgba(60,40,20,.45);
  transform: rotate(-1.5deg);
}
.lamina-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }

.boton {
  appearance: none; border: 0; cursor: pointer;
  background: var(--tinta); color: var(--papel);
  font: 500 17px/1 var(--sans);
  padding: 17px 34px; border-radius: 999px;
  min-width: 230px;
  box-shadow: 0 10px 24px -10px rgba(44,39,35,.6);
}
.boton:active { transform: scale(.98); }
.enlace {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--tinta-suave); font: 15px var(--sans);
  text-decoration: underline; text-underline-offset: 3px;
  padding: 8px;
}

.girando {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(44,39,35,.15); border-top-color: var(--oro);
  animation: girar 0.9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Escena AR ---------- */
#escena {
  position: fixed; inset: 0;
  overflow: hidden;
  background: #000;
}
#escena video { object-fit: cover; }

#capa-camara {
  position: fixed; inset: 0; z-index: 5;
  pointer-events: none;
}
#capa-camara .marca {
  position: absolute; left: 0; right: 0;
  top: max(16px, env(safe-area-inset-top));
  text-align: center;
}

.guia {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .4s ease;
}
.guia.oculta { opacity: 0; }
.guia p {
  color: #fff; font-size: 16px;
  background: rgba(0,0,0,.45); padding: 10px 18px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.esquinas {
  position: relative;
  width: min(64vw, 300px); aspect-ratio: 0.7;
  animation: respirar 2.4s ease-in-out infinite;
}
.esquinas i {
  position: absolute; width: 34px; height: 34px;
  border: 3px solid rgba(255,255,255,.9);
}
.esquinas i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.esquinas i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.esquinas i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.esquinas i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
@keyframes respirar { 50% { transform: scale(.96); opacity: .75; } }

.controles {
  position: absolute; right: 16px; left: 16px;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 14px;
  pointer-events: auto;
}
.redondo {
  appearance: none; border: 0; cursor: pointer;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff; font-size: 20px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* ---------- Vídeo normal ---------- */
#video-plano {
  width: min(100%, 420px);
  max-height: 68vh;
  background: #000;
  border-radius: 6px;
  box-shadow: 0 18px 40px -18px rgba(60,40,20,.5);
}
