/* ==================================================
   DRAW ME 
   HOJA DE ESTILOS PRINCIPAL
   ==================================================

   ÍNDICE DE SECCIONES:
   01. Base y variables globales
   02. Pantalla de carga
   03. Pantalla de cámara
   04. Barra superior y marca DRAW ME
   05. Indicador de grabación y estado
   06. Controles de captura
   07. Footer: créditos y legal
   08. Botones
   09. Vista previa y modal
   10. Páginas legales
   11. Responsive y adaptabilidad móvil

   ================================================== */


/* ============ 01. BASE Y VARIABLES GLOBALES ============ */

:root {
  /* Acento de la marca: terracota del dossier (#A34E32).
     --accent rellena botones (con texto blanco); --amber es su versión clara, legible sobre negro (textos, iconos activos, contornos). */
  --accent: #A34E32;
  --accent-hover: #8A412A;
  --on-accent: #ffffff;   /* texto e iconos sobre --accent */
  --amber: #E3A07F;
  --link: var(--amber);   /* enlaces; por museo: colorEnlaces o colorPrincipal */

  --bg: #0c0a09;
  --card: #18181b;
  --line: #292524;
  --text: #F3EFE5;   /* hueso del dossier */
  --muted: #a8a29e;
  --tool: #fff;   /* Color de los iconos en estado normal */

  /* Tokens de diseño: todas las pantallas usan estos valores */
  --text-2: #d6d3d1;                      /* texto de lectura sobre fondo oscuro */
  --text-3: #78716c;                      /* notas y texto de apoyo */
  --field: #1c1917;                       /* fondo de botones secundarios y campos */
  --field-hover: #292524;
  --field-line: #292524;                  /* 👈 CORREGIDO: valor de línea asignado correctamente */
  --amber-soft: rgba(163, 78, 50, .16);   /* fondo suave de cuadros de resumen */
  --amber-line: rgba(227, 160, 127, .38);
  --r-sm: 6px;                            /* imágenes y logotipos */
  --r-md: 12px;                           /* botones, campos, cuadros */
  --r-lg: 16px;                           /* tarjetas */
  --r-xl: 24px;                           /* ventanas modales */
  --icon-stroke: 1.75;                    /* grosor de línea de todos los iconos */
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: only light;
  background: #000;
  overscroll-behavior: none;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #000;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

.icon--lg {
  width: 30px;
  height: 30px;
}


/* ============ 02. PANTALLA DE CARGA  ============ */

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
  overscroll-behavior: none;
  touch-action: none;
}

.splash--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash__content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.splash__logo {
  width: clamp(80px, 20vw, 120px);
  height: clamp(80px, 20vw, 120px);
  object-fit: cover;
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  animation: logoPulse 2s infinite ease-in-out;
}

.splash__title {
  font-size: clamp(24px, 5vw, 32px);
  letter-spacing: .1em;
  color: #f4f0e2;
}

.splash__credits-text {
  margin: 0 0 20px 0;
}

.consent {
  max-width: 300px;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--amber-line);
  border-radius: var(--r-lg);
  background: var(--amber-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity .3s ease;
}
.consent[hidden] { display: none; }
.consent.is-done { opacity: 0; pointer-events: none; }
.consent p { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.consent__btns { display: flex; gap: 8px; }
.consent__btn {
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  padding: 9px 16px; min-height: 40px; border-radius: 999px;
  color: var(--text); background: none; border: 1px solid var(--amber-line);
}
.consent__btn--yes { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.consent-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.consent-ctl__state { font-size: 13px; color: var(--muted); flex-basis: 100%; }
.welcome {
  position: fixed; inset: 0; z-index: 140;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0, 0, 0, .78);
}
.welcome__card {
  width: 100%; max-width: 340px; padding: 22px 20px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: #0b0b0b; border: 1px solid var(--amber-line); border-radius: var(--r-xl);
}
.welcome__card h2 { font-size: 18px; letter-spacing: .06em; color: var(--amber); text-align: center; }
.welcome__steps { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.welcome__steps li { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.welcome__ico {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .2); color: #fff;
}
.welcome__card .consent__btn { min-width: 140px; }
.consent__more { font-size: 11px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.splash--quick .consent { display: none; }

.splash__text {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-2);
  background: none;
  border: 0;
  margin-top: 15px;
  padding: 14px 22px;
  opacity: 0;
  pointer-events: none;
}

.splash.is-ready .splash__text {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  animation: arcadeBlink 1s infinite steps(1);
}
.splash.is-starting .splash__text {
  animation: none;
  opacity: 1;
  color: var(--amber);
}

@keyframes arcadeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.splash--quick .splash__title,
.splash--quick .splash__credits-text,
.splash--quick .splash__text { display: none; }
.splash--quick .splash__logo { animation: logoBlink .9s ease-in-out infinite; }
@keyframes logoBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .25; transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .splash--quick .splash__logo { animation: none; } }

/* Logo del museo en la animación de carga (modules/institutionLogo.ts): silueta en hueso, solo en
   la entrada rápida. La portada inicial ("Comenzar") sigue con el logo de DRAW ME. */
/* Regreso desde otra página (index.html marca <html class="returning"> antes de pintar): la portada
   queda en negro hasta que main.ts pone .splash--quick con el logo que toca. */
html.returning .splash:not(.splash--quick) .splash__content { visibility: hidden; }

.splash__inst-logo { display: none; }
.splash--quick.has-inst-logo .splash__logo { display: none; }
.splash--quick.has-inst-logo .splash__inst-logo {
  --h: clamp(64px, 17vw, 100px);
  display: block;
  height: var(--h);
  width: calc(var(--h) * var(--ar, 2));
  max-width: 80vw;
  margin-bottom: 10px;
  background: var(--text);
  animation: logoBlink .9s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .splash--quick.has-inst-logo .splash__inst-logo { animation: none; } }

/* Presentación del museo al entrar (institutionLogo.ts → playInstitutionIntro): 2 s. */
.splash--intro .splash__content { visibility: hidden; }
.splash__intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 28px);
  pointer-events: none;
}
.splash__intro-logo {
  --h: clamp(84px, 22vw, 160px);
  height: var(--h);
  width: calc(var(--h) * var(--ar, 2));
  max-width: 84vw;
  background: var(--text);
  animation: instIntro 2s cubic-bezier(.2, .7, .2, 1) both;
}
.splash__intro::after {
  content: "";
  width: min(60vw, 340px);
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  animation: instLine 2s ease both;
}
@keyframes instIntro {
  0% { opacity: 0; transform: scale(.86); filter: blur(10px); }
  30% { opacity: 1; transform: scale(1); filter: blur(0); }
  82% { opacity: 1; transform: scale(1.03); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.06); filter: blur(2px); }
}
@keyframes instLine {
  0%, 18% { transform: scaleX(0); opacity: 1; }
  55% { transform: scaleX(1); opacity: 1; }
  82% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .splash__intro-logo, .splash__intro::after { animation: none; transform: none; }
}

.docov {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: #000;
}
.docov__frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.docov__close {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--field-line);
  background: var(--field);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.docov__close:hover { background: var(--field-hover); }
.docov__close:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.is-embed .docbar__brand { display: none; }
.is-embed .docbar { justify-content: flex-end; }

.reveal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 150;
  pointer-events: none;
  display: none;
}


/* ============ 03. PANTALLA DE CÁMARA ============ */

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overflow: hidden;
  touch-action: none;
}

#pixelCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; 
  object-position: center center;
}

body.is-front #pixelCanvas,
.stage.is-image #pixelCanvas {
  object-fit: contain;
  background: #000;
}


/* ============ 04. BARRA SUPERIOR Y MARCA DRAW ME ============ */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  /* Márgenes proporcionales: en pantallas grandes (pantalla completa en PC) no quedan pegados a la orilla. */
  padding: calc(env(safe-area-inset-top) + clamp(12px, 1.6vw, 32px)) clamp(14px, 2vw, 40px) 28px;
  background: linear-gradient(#00000099, transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer; /* copia el enlace de la app (share.ts) */
  -webkit-tap-highlight-color: transparent;
}
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.brand__image {
  display: block;
  width: clamp(42px, 4vw, 76px);
  height: clamp(42px, 4vw, 76px);
  flex: 0 0 auto;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--r-sm);
}

.brand__text {
  min-width: 0;
}

.brand__text h1 {
  font-size: clamp(16px, 1.6vw, 28px);
  line-height: 1.2;
  letter-spacing: .08em;
  color: #f4f0e2;
}

.brand__text p {
  max-width: none;
  font-size: clamp(10px, .8vw, 14px);
  line-height: 1.50;
  letter-spacing: .05em;
  color: #f4f0e2;
}

.tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.round {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--tool);
}

.adjust {
  position: absolute;
  z-index: 2;
  right: calc(env(safe-area-inset-right) + 14px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round--lg {
  width: 46px;
  height: 46px;
  margin-bottom: 20px;
}


/* ============ 05. INDICADOR DE GRABACIÓN Y ESTADO ============ */

.rec {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top) + 85px);
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(220, 38, 38, .92);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  animation: pulse 1.2s infinite;
}

.rec__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.status {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 150px);
  padding: 0 16px;
  text-align: center;
  font-size: var(--notice-size, 12px);
  color: #e7e5e4;
  text-shadow: 0 1px 4px #000;
  pointer-events: none;
}

.status[data-title] {
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 10px 18px;
  font-size: var(--status-size, 18px);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  text-shadow: none;
  background: rgba(0, 0, 0, .68);
  border: 1px solid var(--amber-line);
  border-radius: var(--r-xl);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.status:empty { display: none; }

.status[data-title]::before {
  content: attr(data-title) / "";
  display: block;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 3px;
}
.status[data-pos]::after {
  content: attr(data-pos) / "";
  display: block;
  font-size: .66em;
  letter-spacing: .22em;
  color: var(--amber);
  margin-top: 4px;
}


/* ============ 06. CONTROLES DE CAPTURA ============ */

.controls {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  padding: 48px 16px calc(env(safe-area-inset-bottom) + 30px);
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}

.shutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 4px #000;
  transition: transform .1s;
}

/* El atributo hidden debe ganarle al display:flex de arriba (si no, el video del plan base se veía) */
.shutter[hidden] { display: none; }

.shutter:active {
  transform: scale(.94);
}

.shutter__ring {
  padding: 4px;
  border: 3px solid var(--c);
  border-radius: 50%;
}

.shutter__core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c);
  display: grid;
  place-items: center;
}

.shutter--photo {
  --c: var(--accent);
}

.shutter--photo .shutter__core {
  color: var(--on-accent);
}

.shutter--video {
  --c: rgb(253, 81, 81);
}

.shutter--video .shutter__core {
  color: #fff;
}

.hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 4px);
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .7);
  animation: bob 1.8s infinite;
}


/* ============ CINTA ANIMADA DEL MUSEO ============ */
/* Movimiento: lo hace src/modules/ribbon.ts (bucle infinito que entra por el borde derecho
   y cubre cualquier ancho). Las medidas son fluidas: se adaptan a celular, tableta, PC,
   pantallas de quiosco, en vertical u horizontal. */

:root {
  --ribbon-h-active: clamp(30px, 4.6vmin, 46px);
  --ribbon-font: clamp(11px, 1.9vmin, 18px);
  --ribbon-gap-fluid: clamp(28px, 6vmin, 72px);
}

.ribbon {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--ribbon-h, 0px) + env(safe-area-inset-bottom));
  background: var(--ribbon-bg, #000);
  border-top: 1px solid var(--amber-line);
  overflow: hidden;
  pointer-events: none;
}

.ribbon--flow {
  position: relative;
  /* iPhone/Android con barra de gestos: la cinta crece hacia abajo y el texto queda visible. */
  height: calc(var(--ribbon-h, 0px) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
  border-bottom: 1px solid var(--amber-line);
}

.ribbon__track {
  display: flex;
  align-items: center;
  width: max-content;
  height: var(--ribbon-h, 0px);
  will-change: transform;
}

.ribbon__group { display: flex; align-items: center; flex: none; }

.ribbon__text {
  flex: none;
  margin-right: var(--ribbon-gap, var(--ribbon-gap-fluid));
  font-size: var(--ribbon-logo-h, var(--ribbon-font));
  font-weight: 700;
  letter-spacing: .28em;
  white-space: nowrap;
  color: #f4f0e2;
  opacity: var(--ribbon-opacity, .9);
  user-select: none;
}

.ribbon__group img {
  display: block;
  height: var(--ribbon-logo-h, var(--ribbon-font));
  width: auto;
  margin-right: var(--ribbon-gap, var(--ribbon-gap-fluid));
  opacity: var(--ribbon-opacity, .9);
  user-select: none;
}

.stage.has-ribbon-bar {
  height: calc(100vh - var(--ribbon-h) - env(safe-area-inset-bottom));
  height: calc(100dvh - var(--ribbon-h) - env(safe-area-inset-bottom));
}

.stage.has-ribbon .controls {
  bottom: calc(var(--ribbon-h) + env(safe-area-inset-bottom));
  padding-bottom: 30px;
}
.stage.has-ribbon .hint { bottom: calc(var(--ribbon-h) + env(safe-area-inset-bottom) + 4px); }

@media (prefers-reduced-motion: reduce) {
  .ribbon__track { width: 100%; justify-content: center; transform: none !important; }
  .ribbon__group + .ribbon__group { display: none; }
  .ribbon__group img:not(:first-child), .ribbon__text:not(:first-child) { display: none; }
  .ribbon__group img, .ribbon__text { margin-right: 0; }
}


/* ============ 07. FOOTER: CRÉDITOS Y LEGAL ============ */

.footer {
  padding: 36px 20px calc(env(safe-area-inset-bottom) + 32px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.footer__legal a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer__note {
  font-size: 11px;
  color: var(--text-3);
  max-width: 320px;
}


/* Tira de patrocinadores (modules/sponsors.ts): misma ALTURA para todos, ancho según su proporción. */
.sponsors {
  --sponsor-h: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.sponsors__label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .6;
  margin: 0;
}
.sponsors__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
}
.sponsors__logo {
  display: block;
  height: var(--sponsor-h);
  width: calc(var(--sponsor-h) * var(--ar, 4));
  max-width: 140px;
  background: var(--text); /* hueso: la máscara recorta este color con la silueta del logo */
}
.sponsors__logo--color { background: none; object-fit: contain; }
@media (max-width: 480px) {
  .sponsors { --sponsor-h: 22px; }
  .sponsors__list { gap: 12px; }
}


/* ============ 08. BOTONES ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--field-line);
  background: var(--field);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  background: var(--field-hover);
}

.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .icon { display: none; }
.btn.is-loading::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btnSpin .8s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-loading::before { animation-duration: 2s; } }

.btn--at {
  padding: 6px;
  background: #fff;
  border-color: #fff;
}

.btn--at:hover {
  background: #e7e5e4;
}

.btn--at img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: var(--r-sm);
}

/* Botón pix con el logo del museo (institutionApply.ts): más grande y con aire alrededor, para
   que las esquinas redondeadas no corten el logo. */
.btn--at.has-inst-logo {
  padding: 12px 18px;
  border-radius: var(--r-md);
}
/* Logo del museo en el hueso de la app, sin recuadro (utils/logoTone.ts → .logo-bone): se integra
   al fondo oscuro y sigue siendo el enlace del museo. */
.btn--at.has-inst-logo.logo-bone {
  background: transparent;
  border-color: transparent;
}
.btn--at.has-inst-logo.logo-bone:hover {
  background: rgba(243, 239, 229, .08);
}
.btn--at.has-inst-logo img {
  height: clamp(48px, 6vw, 64px);
  max-width: min(70vw, 260px);
  object-fit: contain;
  border-radius: 0;
}

.btn--dl {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn--inst {
  background: #000;
  border-color: var(--line);
}
.btn--inst:hover { background: #111; border-color: var(--amber-line); }
.btn--inst img { height: 28px; border-radius: 0; }


/* ============ 09. VISTA PREVIA Y MODAL ============ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .9);
}

.modal__card {
  width: 100%;
  max-width: 380px;
  max-height: 96dvh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.modal__head h3 {
  font-size: 13px;
  color: var(--amber);
}

.modal__close {
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
}

.modal__media {
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.modal__media img,
.modal__media video {
  max-width: 100%;
  max-height: 55dvh;
  object-fit: contain;
}

.modal__note {
  min-height: 16px;
  font-size: 11px;
  text-align: center;
  color: var(--amber);
}

.modal__actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.modal__actions .btn {
  flex: 1;
  padding: 10px 6px;
  font-size: 12px;
  justify-content: center;
}


/* ============ 10. PÁGINAS LEGALES ============ */

.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  line-height: 1.7;
  color: var(--text-2);
}

.doc__back {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--link);
}

.doc h1 {
  font-size: 26px;
  color: #fff;
  margin-bottom: 4px;
}

.doc .doc__date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
}

.doc h2 {
  font-size: 17px;
  color: var(--amber);
  margin: 28px 0 8px;
}

.doc p,
.doc ul {
  font-size: 14px;
  margin-bottom: 10px;
}

.doc ul {
  padding-left: 20px;
}

.doc li {
  margin-bottom: 6px;
}

.doc strong {
  color: #fff;
}

.doc__summary {
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 28px;
}

.doc__gh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--field);
  border: 1px solid var(--field-line);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.doc__gh:hover {
  background: var(--field-hover);
}

.doc__footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}


/* ============ 11. RESPONSIVE Y ADAPTABILIDAD MÓVIL ============ */

@media (max-width: 480px) {
  .topbar {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .brand__image {
    width: 44px;
    height: 44px;
  }

  .brand__text {
    min-width: 0;
  }

  .brand__text h1 {
    font-size: 16px;
  }

  .brand__text p {
    max-width: 150px;
    font-size: 8px;
    letter-spacing: .03em;
  }

  .tools {
    gap: 6px;
    flex-shrink: 0;
  }

  .topbar:has(#btnFlipCamera:not(.hidden):not([hidden])) .brand__text p { display: none; }

  .round {
    width: 36px;
    height: 36px;
  }

  .controls {
    gap: 18px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .shutter__core {
    width: 56px;
    height: 56px;
  }

  .icon--lg {
    width: 26px;
    height: 26px;
  }

  .modal__actions {
    gap: 6px;
  }

  .modal__actions .btn {
    padding: 9px 4px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .topbar {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .brand {
    gap: 6px;
  }

  .brand__image {
    width: 38px;
    height: 38px;
  }

  .brand__text h1 {
    font-size: 14px;
  }

  .brand__text p {
    max-width: 125px;
    font-size: 7px;
    letter-spacing: .02em;
    overflow-wrap: break-word;
  }

  .tools {
    gap: 4px;
  }

  .round {
    width: 32px;
    height: 32px;
  }

  .controls {
    gap: 12px;
  }

  .shutter__core {
    width: 50px;
    height: 50px;
  }

  .icon--lg {
    width: 23px;
    height: 23px;
  }

  .round--lg {
    width: 38px;
    height: 38px;
  }

  .status {
    font-size: 11px;
    padding-left: 10px;
    padding-right: 10px;
  }
}


/* ============ ANIMACIONES GLOBALES (KEYFRAMES) ============ */

@keyframes pulse {
  50% {
    opacity: .65;
  }
}

@keyframes bob {
  50% {
    transform: translate(-50%, 4px);
  }
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
}


/* ============ AVISO PARA NAVEGADORES INTERNOS ============ */
.gate { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.95); overflow-y: auto; }
.gate__card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.gate__logo { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.gate__card h2 { font-size: 20px; color: var(--amber); }
.gate__card p { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.gate__card .btn { width: 100%; }
.gate__copy { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.gate__copy input { width: 100%; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--field-line); background: var(--field); color: var(--text); font: inherit; font-size: 12px; text-align: center; }
.gate__steps { width: 100%; padding-left: 20px; text-align: left; font-size: 13px; line-height: 1.6; color: var(--text-2); }
.gate__steps:empty { display: none; }
.gate__skip { background: none; border: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; padding: 6px; }


/* ============ AJUSTE: PANTALLAS BAJAS ============ */
@media (max-height: 560px) {
  .adjust {
    top: calc(env(safe-area-inset-top) + 64px);
    bottom: 12px;
    transform: none;
    gap: 6px;
    flex-wrap: wrap-reverse;
    justify-content: center;
    align-content: flex-start;
  }
  .adjust .round { width: 34px; height: 34px; }
}

.round[hidden] { display: none; }

.round { --hit: 2px; position: relative; }
.round::after { content: ""; position: absolute; inset: calc(var(--hit) * -1); border-radius: 50%; }
@media (max-width: 480px) { .round { --hit: 4px; } }
@media (max-width: 360px) { .round { --hit: 6px; } }
@media (max-height: 560px) { .adjust .round { --hit: 5px; } }
.footer__legal { align-items: center; }
.footer__legal a { display: inline-block; padding: 14px 6px; }

.heat {
  position: fixed; z-index: 60;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--ribbon-h, 0px) + env(safe-area-inset-bottom) + 150px);
  width: min(320px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(10, 10, 10, .92);
  border: 1px solid var(--amber-line, rgba(227, 160, 127, .4));
  border-radius: var(--r-md);
  font-size: 13px; line-height: 1.4; color: var(--text);
}
.heat p { margin: 0; }
.heat .btn { flex-shrink: 0; padding: 8px 12px; }
.heat.hidden { display: none; }

.stage.no-camera .status {
  bottom: 50%;
  transform: translateY(50%);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  padding: 0 28px;
}
.stage.no-camera .shutter { opacity: .35; pointer-events: none; }

@media (orientation: landscape) and (max-height: 500px) {
  .controls {
    top: 64px; bottom: 0; left: 0; right: auto;
    width: auto;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 0 calc(env(safe-area-inset-left) + 14px);
    background: none;
  }
  .stage.has-ribbon-bar .controls { bottom: 0; }
}

@media (orientation: landscape) and (max-height: 380px) {
  .controls { top: 54px; gap: 10px; }
  .shutter { gap: 0; }
  .shutter > span:not(.shutter__ring) { display: none; }
  .shutter__core { width: 42px; height: 42px; }
  .shutter__ring { padding: 3px; border-width: 2px; }
  .icon--lg { width: 22px; height: 22px; }
  .brand__image { width: 38px; height: 38px; }
  .brand__text p { display: none; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .splash.is-ready .splash__text { animation: none; }
}


/* ============ ESTADOS DE INTERACCIÓN ============ */
.round {
  transition: color .18s ease, border-color .18s ease;
}

@media (hover: hover) {
  .round:hover:not(:disabled) { color: var(--amber); }
}

.round:active:not(:disabled) { color: var(--amber); }

.round.is-active {
  color: var(--amber);
  border-color: var(--amber);
}

.round:focus-visible,
.shutter:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.shutter:focus-visible { outline-offset: 6px; border-radius: var(--r-md); }

.round:disabled,
.round[aria-disabled="true"] {
  color: rgba(255, 255, 255, .35);
  border-color: rgba(255, 255, 255, .1);
  cursor: not-allowed;
}

.shutter--video.is-recording .shutter__ring {
  box-shadow: 0 0 0 5px rgba(220, 38, 38, .35);
  animation: pulse 1.2s infinite;
}
@media (prefers-reduced-motion: reduce) {
  .shutter--video.is-recording .shutter__ring { animation: none; }
}


/* ============ HOMOLOGACIÓN: PÁGINAS DE DOCUMENTOS, MARCA Y PIE ============ */
.docbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 20px 0;
}

.docbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
}

.docbar__logo {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--r-sm);
}

/* Logo del museo junto al de DRAW ME en las páginas legales (modules/institutionLogo.ts). */
.docbar__sep {
  flex: 0 0 auto;
  width: 1px;
  height: 28px;
  background: currentColor;
  opacity: .3;
}
.docbar__inst-logo {
  --h: 28px;
  display: block;
  flex: 0 1 auto;
  height: var(--h);
  width: calc(var(--h) * var(--ar, 2));
  max-width: 120px;
  background: #f4f0e2;
}

.docbar__name {
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .08em;
  color: #f4f0e2;
}

.btn-lang {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.doc__header { margin-bottom: 4px; }

.doc__eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.doc h3 {
  font-size: 15px;
  color: #fff;
  margin: 20px 0 6px;
}

.doc__summary p { margin-bottom: 0; }

.doc a:not(.doc__gh):not(.doc__back) {
  color: var(--link);
  text-underline-offset: 3px;
}

.doc__back:hover { text-decoration: underline; text-underline-offset: 3px; }

.footer__slogan {
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: .06em;
  color: var(--text-3);
}

.splash__tagline {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

a:focus-visible,
.btn:focus-visible,
.gate__skip:focus-visible,
.modal__close:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}


/* ============ PIE DE PÁGINA ============ */
.footer {
  max-width: 560px;
  margin: 0 auto;
  gap: 14px;
}

.footer__legal a:hover { color: var(--link); }
.footer__note { font-size: 12px; line-height: 1.6; }

@media (max-width: 480px) {
  .footer__legal { flex-direction: column; gap: 8px; }
  .footer__legal span { display: none; }
}


/* ============ PIE DE LAS PÁGINAS DE DOCUMENTOS ============ */
.docfoot {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px calc(env(safe-area-inset-bottom) + 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}

.docfoot__more { width: 100%; }

.docfoot__label {
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.docfoot__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.docfoot__card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  text-decoration: none;
  color: #fff;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border-color .18s ease;
}

.docfoot__card:hover { border-color: var(--amber); }

.docfoot__title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.docfoot__title [aria-hidden] { color: var(--amber); }
.docfoot__card small { font-size: 12px; line-height: 1.5; color: var(--muted); }

@media (max-width: 480px) {
  .docfoot__cards { grid-template-columns: 1fr; }
}

.shutter--screen { --c: rgba(255, 255, 255, .85); }
.shutter--screen .shutter__ring { padding: 3px; border-width: 2px; }
.shutter--screen .shutter__core { width: 44px; height: 44px; background: rgba(0, 0, 0, .45); color: #fff; }
.shutter--screen { align-self: flex-start; margin-top: 17px; }
.shutter--screen .icon { width: 22px; height: 22px; }

/* ============ GALERÍA, MODO INSTITUCIONAL, ESTACIÓN E IMPRESIÓN ============ */

.round--source { margin-top: 10px; }
@media (orientation: landscape) and (max-height: 500px) { .round--source { margin-top: 0; } }
.stage.is-image .shutter--video { opacity: .35; pointer-events: none; }
.stage.is-image #btnFlipCamera { display: none; }
.stage.is-drop::after {
  content: ""; position: absolute; inset: 12px; z-index: 6; pointer-events: none;
  border: 2px dashed var(--amber); border-radius: var(--r-lg); background: var(--amber-soft);
}

.splash__inst { display: block; max-width: 180px; max-height: 56px; width: auto; margin: 10px auto 4px; object-fit: contain; }

.is-kiosk, .is-kiosk body { overflow: hidden; }
.is-kiosk .footer, .is-kiosk .hint { display: none !important; }

.print-sheet { display: none; }
@media print {
  @page { margin: 8mm; }
  html, body { background: #fff !important; overflow: visible !important; height: auto !important; }
  body > *:not(#printSheet) { display: none !important; }
  #printSheet { display: block !important; }
  #printSheet img { display: block; width: 100%; height: auto; max-height: 100vh; object-fit: contain; }
}
/* Pantallas grandes (PC en pantalla completa): botones de arriba proporcionales al logo y título. */
@media (min-width: 1280px) and (min-height: 700px) {
  .tools { gap: clamp(10px, .8vw, 16px); }
  .tools .round { width: clamp(40px, 2.6vw, 52px); height: clamp(40px, 2.6vw, 52px); }
  .tools .round .icon { width: 1.4em; height: 1.4em; }
}

/* Página no encontrada (404.html): el diseño de la pantalla de pausa, debajo de la barra de arriba. */
.pause--404 { min-height: calc(100dvh - 72px); padding-top: 12px; }
.pause__block { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pause__block[hidden] { display: none; }
/* "404" grande relleno de líneas de grabado (achurado diagonal), con el filo de la letra en hueso */
.pause__code {
  margin: 4px 0 -6px;
  font-size: clamp(88px, 22vw, 180px);
  font-weight: 700;
  line-height: .9;
  letter-spacing: .04em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--text);
  background: repeating-linear-gradient(-45deg, var(--text) 0 1.5px, transparent 1.5px 7px);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Pantalla de pausa (licencia vencida/inactiva/inexistente; main.ts → showLicenseBlock). */
.pause {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 32px) 24px calc(env(safe-area-inset-bottom) + 32px);
  background: #000;
  color: var(--text);
  text-align: center;
}
.pause__logos {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 24px);
  margin-bottom: 14px;
}
/* Cada logo de la pantalla de pausa lleva a su enlace (DRAW ME → autor; museo → su `enlace`) */
.pause__link {
  display: inline-flex;
  border-radius: var(--r-lg);
  transition: opacity .2s ease, transform .2s ease;
}
.pause__link:hover { opacity: .8; transform: translateY(-1px); }
.pause__link:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }

.pause__logo {
  width: clamp(72px, 16vw, 104px);
  height: clamp(72px, 16vw, 104px);
  border-radius: var(--r-lg);
  object-fit: cover;
}
.pause__inst-logo {
  --h: clamp(48px, 10vw, 68px);
  height: var(--h);
  width: calc(var(--h) * var(--ar, 2));
  max-width: 50vw;
  padding-left: clamp(14px, 3vw, 24px);
  border-left: 0;
  background: var(--text);
}
.pause__title {
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.2;
  letter-spacing: .02em;
  color: #fff;
  max-width: 22ch;
}
.pause__text {
  font-size: clamp(14px, 3.6vw, 17px);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 34ch;
}
.pause__btn {
  margin-top: 12px;
  padding: 14px 28px;
  font-size: 15px;
  letter-spacing: .06em;
}

/* Página de patrocinadores (patrocinadores.html + modules/sponsorsPage.ts) */
.doc .sponsors-page__grid { /* .doc gana sobre las listas de las páginas legales (sangría) */
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.doc .sponsors-page__item {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 14px 16px;
  border: 1px solid rgba(243, 239, 229, .14);
  border-radius: var(--r-md);
  text-align: center;
}
.sponsors-page__logo { width: 100%; max-width: 160px; height: 72px; object-fit: contain; }
.sponsors-page__name { margin: 0; font-size: 14px; color: var(--text); line-height: 1.3; }
.sponsors-page__status { margin-top: 18px; color: var(--text-2); }
.sponsors-page__status[hidden] { display: none; }
@media (max-width: 480px) {
  .doc .sponsors-page__grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .sponsors-page__logo { height: 56px; }
}
.sponsors-page__link {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; color: inherit; text-decoration: none;
}
.doc .sponsors-page__item:has(.sponsors-page__link):hover { border-color: rgba(243, 239, 229, .4); }
/* Páginas estáticas /patrocinadores/<clave>/ (Jorge, 2026-12-02) */
.sponsors-page__museum { display: inline-block; margin: 6px 0 2px; }
.sponsors-page__museum-logo { display: block; height: 56px; width: auto; max-width: 60vw; object-fit: contain; }
.sponsors-page__intro { color: var(--text-2); max-width: 60ch; }
.sponsors-page__support {
  margin-top: 28px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3, #78716c);
}
.doc .sponsors-page__grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.doc .sponsors-page__item { min-height: 120px; }
.sponsors-page__link:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: var(--r-md); }

/* Página de consulta de la licencia (licencia.html?inst=, modules/licensePage.ts) */
.license-page [data-lang][hidden] { display: none; }
.license-page__museum { margin: 8px 0 18px; }
.license-page__museum-logo { display: block; height: 56px; width: auto; max-width: 60vw; object-fit: contain; margin-bottom: 10px; }
.license-page__museum-name { margin: 0; color: var(--text); font-size: 20px; font-weight: 700; }
.license-page__state { border: 1px solid rgba(243, 239, 229, .16); border-radius: var(--r-md); padding: 16px 18px; margin: 8px 0 24px; }
.license-page__state p { margin: 4px 0; }
.license-page__state-label { font-size: 22px; font-weight: 700; color: var(--text); }
.license-page__state--ok .license-page__state-label { color: #7bd88f; }
.license-page__state--off .license-page__state-label { color: var(--amber, #E3A07F); }
.license-page__section { margin: 26px 0 0; }
.license-page__section h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--amber, #E3A07F); margin: 0 0 10px; }
.license-page__row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(243, 239, 229, .08); }
.license-page__label { color: var(--text-2); }
.license-page__value { color: var(--text); text-align: right; overflow-wrap: anywhere; }
.license-page__color { display: inline-flex; align-items: center; gap: 8px; }
.license-page__swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(243, 239, 229, .3); }
.license-page__links { display: flex; flex-wrap: wrap; gap: 10px; }
.license-page__links a { padding: 10px 14px; border: 1px solid rgba(243, 239, 229, .2); border-radius: var(--r-md); color: var(--text); text-decoration: none; }
.license-page__links a:hover { border-color: rgba(243, 239, 229, .5); }
.license-page__hint { font-size: 13px; color: var(--text-3, #78716c); overflow-wrap: anywhere; }
.license-page__alert { padding: 14px 16px; border: 1px solid var(--amber, #E3A07F); border-radius: var(--r-md); color: var(--text); }
.doc .license-page__list { margin: 6px 0 0; padding-left: 18px; }
.license-page__warnings li { color: var(--text); }
@media (max-width: 480px) {
  .license-page__row { flex-direction: column; gap: 2px; }
  .license-page__value { text-align: left; }
}
