/* Celaje web (iPhone), 04/12/2026: lo que en la web no existe se oculta (ver IPHONE.md) y la ayuda para instalarla.
   Lo añade a la página procesos/web_iphone.js; no va en el APK. */
html.web #btnStatus, html.web #btnPin, html.web #statusSheet,
html.web #alertBattery,
/* Widgets (05/12/2026): en iPhone, la guía de Scriptable, solo con el interruptor «widgets-web» (o en la versión de
   prueba): app.js pone web-widgets */
html.web:not(.web-widgets) #btnWidgets,
/* Alertas (05/12/2026, con notificaciones push): en iPhone no se elige tono ni vibración (suena como el iPhone); «Probar» sí */
html.web .al-tone .tone-btn, html.web .al-tone select,
/* …y el botón de las alertas solo con el interruptor «alertas-web» (o en la versión de prueba): app.js pone web-alertas */
html.web:not(.web-alertas) #btnAlerts { display: none !important; }

/* Ayuda para instalar (iPhone) o ir a Google Play (Android) */
.web-inst { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 9000;
  background: rgba(14, 26, 46, .96); color: #fff; border-radius: 18px; padding: 14px 44px 14px 14px; font-size: 15px;
  line-height: 1.4; box-shadow: 0 8px 30px rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .12); }
.web-inst b { font-weight: 700; }
/* No tapa el recorrido guiado ni la pantalla de inicio (pueden empezar después de que salga) */
body.touring .web-inst, body.intro .web-inst { display: none; }
.web-inst .wi-x { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border: 0; background: none;
  color: #fff; font-size: 22px; line-height: 34px; opacity: .7; }
.web-inst .wi-pasos { margin: 8px 0 0; padding-left: 20px; }
.web-inst .wi-pasos li { margin: 4px 0; }
.web-inst svg { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; margin: 0 2px; fill: none; stroke: #6CB4FF; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.web-inst a.wi-play { display: inline-block; margin-top: 10px; padding: 9px 16px; border-radius: 12px; background: #FFB547;
  color: #14213A; font-weight: 700; text-decoration: none; }

/* ---------- iPhone: ficha de instalación (inicio_web.js, ficha) ---------- */
.web-ficha { position: fixed; inset: 0; z-index: 10000; overflow-y: auto; -webkit-overflow-scrolling: touch; color: #fff;
  background: linear-gradient(180deg, rgba(14, 18, 44, .97), rgba(27, 20, 52, .98)), #141A3A;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(26px + env(safe-area-inset-bottom));
  font-family: -apple-system, system-ui, sans-serif; transition: opacity .3s, transform .3s; -webkit-user-select: none; user-select: none; }
.web-ficha.fuera { opacity: 0; transform: translateY(30px); }
.wf-in { max-width: 480px; margin: 0 auto; }
.wf-cab { display: flex; align-items: center; gap: 16px; text-align: left; }
.wf-ico { width: 104px; height: 104px; border-radius: 23px; box-shadow: 0 8px 26px rgba(0, 0, 0, .45); flex: 0 0 auto; }
.wf-cab h2 { margin: 0; font-size: 28px; font-weight: 700; }
.wf-lema { margin: 2px 0 0; font-size: 16px; color: rgba(255, 255, 255, .8); }
.wf-mini { margin: 6px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .6); }
.wf-instalar { display: block; width: 100%; margin: 20px 0 0; padding: 15px; border: 0; border-radius: 16px;
  background: #0A84FF; color: #fff; font: 700 19px -apple-system, system-ui, sans-serif; box-shadow: 0 8px 24px rgba(10, 132, 255, .35); }
.wf-instalar:active { transform: scale(.98); }
.wf-capt { display: flex; gap: 10px; overflow-x: auto; margin: 22px -18px 0; padding: 0 18px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.wf-capt::-webkit-scrollbar { display: none; }
.wf-capt img { flex: 0 0 auto; width: 150px; height: 266px; object-fit: cover; border-radius: 16px; scroll-snap-align: start;
  border: 1px solid rgba(255, 255, 255, .12); background: #22284A; }
.wf-que { list-style: none; margin: 20px 0 0; padding: 0; font-size: 15px; line-height: 1.45; }
.wf-que li { padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .09); }
.wf-nota { margin: 14px 0 0; font-size: 13.5px; color: rgba(255, 255, 255, .7); line-height: 1.45; }
.wf-seguir { display: block; margin: 18px auto 0; padding: 10px 16px; border: 0; background: none; color: rgba(255, 255, 255, .75);
  font-size: 15px; text-decoration: underline; }
/* La guía con los pasos (arriba) y una flecha que señala el botón de Safari (abajo a la derecha en iOS 26) */
.web-guia { position: fixed; inset: 0; z-index: 10001; background: rgba(5, 8, 20, .72);
  padding: calc(18px + env(safe-area-inset-top)) 14px 0; font-family: -apple-system, system-ui, sans-serif; color: #1E1635; }
.wg-caja { max-width: 440px; margin: 0 auto; background: #fff; border-radius: 22px; padding: 18px 18px 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.wg-caja h3 { margin: 0 0 8px; font-size: 20px; }
.wg-caja ol { list-style: none; counter-reset: p; margin: 0; padding: 0; }
.wg-caja li { counter-increment: p; display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 15.5px; line-height: 1.35;
  border-bottom: 1px solid #EEEAF3; }
.wg-caja li::before { content: counter(p); flex: 0 0 24px; height: 24px; border-radius: 50%; background: #0A84FF; color: #fff;
  font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.wg-caja li i { flex: 0 0 34px; height: 34px; border-radius: 9px; background: #F1EFF6; display: grid; place-items: center; }
.wg-caja li i svg { width: 22px; height: 22px; fill: #0A84FF; }
.wg-caja li i svg.st { fill: none; stroke: #0A84FF; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wg-caja li i img { width: 30px; height: 30px; border-radius: 7px; }
.wg-caja li i .wg-txt { color: #0A84FF; font: 700 22px/1 -apple-system, system-ui, sans-serif; }
.wg-ayuda { margin: 10px 2px 0; font-size: 13.5px; line-height: 1.35; color: #5E5872; }
.wg-cerrar, .wg-copiar { display: block; width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 14px;
  background: #F1EFF6; color: #1E1635; font: 600 16px -apple-system, system-ui, sans-serif; }
.wg-copiar { background: #0A84FF; color: #fff; }
.wg-flecha { position: fixed; width: 44px; height: 66px; animation: wgSalto 1s ease-in-out infinite; }
.wg-flecha svg { width: 100%; height: 100%; fill: none; stroke: #FFDE96; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }
.wg-flecha.abajo-dcha { right: 14px; bottom: calc(52px + env(safe-area-inset-bottom)); }
.wg-flecha.abajo { left: calc(50% - 22px); bottom: calc(46px + env(safe-area-inset-bottom)); }
.wg-flecha.arriba { right: 70px; top: calc(8px + env(safe-area-inset-top)); transform: rotate(180deg); animation-name: wgSaltoArriba; }
@keyframes wgSalto { 50% { transform: translateY(10px); } }
@keyframes wgSaltoArriba { 0%, 100% { transform: rotate(180deg); } 50% { transform: rotate(180deg) translateY(10px); } }

/* ---------- Aviso antes de que el navegador pregunte por la ubicación (puente_web.js, antesDePreguntar) ---------- */
.web-ubi { position: fixed; inset: 0; z-index: 10002; display: grid; place-items: center; padding: 20px; background: rgba(5, 8, 20, .7);
  font-family: -apple-system, system-ui, sans-serif; }
.wu-caja { max-width: 380px; background: #fff; color: #1E1635; border-radius: 24px; padding: 22px 20px 16px; text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.wu-ic { font-size: 40px; }
.wu-caja h3 { margin: 6px 0 8px; font-size: 19px; line-height: 1.25; }
.wu-caja p { margin: 0 0 10px; font-size: 15px; line-height: 1.45; color: #4A4060; }
.wu-caja .wu-ojo { color: #1E1635; background: #FFF4D6; border-radius: 12px; padding: 9px 10px; }
.wu-ok { display: block; width: 100%; margin-top: 6px; padding: 14px; border: 0; border-radius: 14px; background: #0A84FF; color: #fff;
  font: 700 17px -apple-system, system-ui, sans-serif; }
.wu-no { display: block; width: 100%; margin-top: 6px; padding: 10px; border: 0; background: none; color: #6B6080; font-size: 14.5px; }

/* ---------- Márgenes de la muesca/isla y de la barra de abajo (05/12/2026) ----------
   app.js mide los márgenes una vez al arrancar (GetInsets) y los pone en --top/--bottom; en el iPhone instalado, al
   arrancar pueden salir a 0 y la barra de arriba quedaba debajo de la hora (los botones no respondían). Aquí se toman
   siempre del iPhone, en vivo (env), y ganan a los del arranque. Sin muesca (Safari con su barra, Android): 10 px. */
html.web { --top: max(10px, env(safe-area-inset-top)) !important; --bottom: env(safe-area-inset-bottom, 0px) !important; }

/* App instalada en iPhone (iOS 26, medido en un iPhone 14 con el botón «Bordes» del panel 🐞, 05/12/2026): el alto que
   da el iPhone (797) acaba 47 puntos antes del borde de abajo (844), y en esa franja el iPhone NO pinta nada de la
   página (ni lo que se baje ahí con bottom negativo: se cortaban las letras de las pestañas), solo el color de fondo de
   <html>. Así que: las pestañas, dentro del alto que se pinta y sin margen extra (la rayita del iPhone cae en la franja),
   y el fondo de <html> del color de la barra: barra y franja se ven como una sola barra hasta el borde. La barra no se
   esconde sola (dejaría la franja oscura suelta). */
/* (05/12/2026, a petición del usuario tras probarlo) La franja, del color de la parte de abajo de la foto del tiempo
   (inicio_web.js, franja → --franja); la pinta el fondo de <body> (#1B2457 en app.css), no el de <html>: los dos. En el
   resto de la pantalla el body queda tapado por la foto (#bg). La barra de pestañas, más estrecha, y se esconde sola. */
/* (05/12/2026 noche) La causa: fallo de WebKit 301108 en iOS 26. Instalada con viewport-fit=cover y black-translucent,
   el iPhone da una pantalla corta (le resta la barra de arriba) MIENTRAS la página sea más baja que la pantalla; si la
   página es al menos tan alta como la pantalla, le da la pantalla entera. Arreglo de frappe-ui#1284 (probado allí en un
   iPhone 17 Pro con iOS 26.2): <html> tan alto como la pantalla, con tope 100lvh para que no haga scroll donde la barra
   de arriba no cuenta. Con esto innerHeight debería llegar a 844 y «gap» (abajo) ya no se activa; si en algún iPhone
   no funcionara, sigue el apaño de la franja. */
@media (display-mode: standalone) {
  html.web { min-height: min(100lvh, calc(100% + env(safe-area-inset-top))) !important; }
}
html.web.gap { background: var(--franja, #141B3A) !important; --bottom: 0px !important; }
html.web.gap body { background: var(--franja, #141B3A) !important; transition: background-color 1.2s; }
html.web.gap #tabs { padding: 3px 6px 2px; }
html.web.gap #tabs button { height: 42px; gap: 1px; font-size: 10.5px; min-width: 56px; }
html.web.gap #tabs svg { width: 19px; height: 19px; }
html.web.gap .tabs-more { height: 42px; bottom: 2px; }
html.web.gap #scroller { padding-bottom: 72px !important; }

/* ---------- Que no se note que es una web ---------- */
/* Sin zoom con dos toques; sin el menú de Safari (copiar, abrir imagen…) al mantener pulsado; el texto de los cuadros
   de escribir se sigue pudiendo seleccionar */
html.web { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
html.web body { -webkit-touch-callout: none; }
html.web input, html.web textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* Botón de compartir cuando iPhone no deja abrir el menú solo (puente_web.js, shareFile) */
.web-share-btn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 9001; padding: 14px 22px; border-radius: 16px; border: 0; background: #FFB547; color: #14213A; font-size: 16px;
  font-weight: 700; box-shadow: 0 8px 30px rgba(0, 0, 0, .45); }

/* Versión de prueba: botón y panel de errores (no hay Mac para ver la consola de Safari) */
.web-bug { position: fixed; left: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 8999; width: 38px; height: 38px;
  border-radius: 50%; border: 0; background: rgba(14, 26, 46, .85); font-size: 20px; line-height: 38px; padding: 0; }
.web-bug i { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: #E5484D;
  color: #fff; font: 700 11px/18px system-ui; font-style: normal; }
.web-errs { position: fixed; inset: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom)); z-index: 9002;
  background: #0E1A2E; color: #fff; border-radius: 16px; padding: 12px; overflow: auto; font: 12px/1.4 ui-monospace, Menlo, monospace;
  border: 1px solid rgba(255, 255, 255, .15); }
.web-errs h3 { margin: 0 0 8px; font: 700 15px system-ui; }
.web-errs pre { white-space: pre-wrap; word-break: break-word; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.web-errs button { margin: 0 8px 10px 0; padding: 8px 14px; border-radius: 10px; border: 0; background: #2A3B5C; color: #fff; font-size: 14px; }
