/* ==========================================================================
   BULLDER · pwa (prefijo pw-): avisos flotantes, pantalla /install, guía ilustrada, modo instalado
   ========================================================================== */

/* ------------------------------------------------------------------ modo instalado: sin gestos "de página web" */
html.pwa-standalone #tabbar, html.pwa-standalone #sidebar, html.pwa-standalone #topbar,
html.pwa-standalone .btn, html.pwa-standalone .icon-btn, html.pwa-standalone .chip, html.pwa-standalone .fab {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
html.pwa-standalone a, html.pwa-standalone #view img { -webkit-touch-callout: none; }

/* ------------------------------------------------------------------ avisos flotantes (instalar / versión nueva) */
.pw-float {
  position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 12px;
  border-radius: 18px; border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  animation: pw-float-in .34s var(--ease);
}
.pw-float.is-out { opacity: 0; transform: translateY(14px); transition: opacity .2s, transform .2s var(--ease); }
.app[data-chrome="stack"] ~ .pw-float { bottom: calc(var(--safe-b) + 14px); }
.app[data-chrome="none"] ~ .pw-float { bottom: calc(var(--safe-b) + 14px); }
.pw-float .btn { flex: none; }
.pw-float-x { width: 44px; height: 44px; color: var(--text-3); }
.pw-float-x:hover { color: var(--text); }
.pw-float-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
@keyframes pw-float-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.pw-update { max-width: 380px; padding-left: 10px; gap: 10px; }
.pw-update .pw-float-x { width: 40px; }
.pw-update-text { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-update-text b { font-weight: 650; }
@media (max-width: 400px) { .pw-update .pw-float-ic { display: none; } .pw-update { padding-left: 16px; } }

.pw-appicon { width: 44px; height: 44px; border-radius: 11px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.pw-install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pw-install-text b { font: 700 15px/1.2 var(--font-display); }
.pw-install-text span { font-size: 12.5px; line-height: 1.35; color: var(--text-2); }

@media (min-width: 960px) {
  .pw-float { left: calc(var(--sidebar-w) + 24px); right: auto; width: 420px; bottom: 24px; margin: 0; }
  .app[data-chrome="stack"] ~ .pw-float { bottom: 24px; }
  .app[data-chrome="none"] ~ .pw-float { left: 24px; bottom: 24px; }
  .pw-update { width: auto; }
}

/* ------------------------------------------------------------------ pantalla /install */
.pw-page { display: flex; flex-direction: column; gap: var(--sp-5); }
.pw-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-5);
  padding: var(--sp-8) var(--sp-5) var(--sp-6); border-radius: var(--r-lg); border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 62%), var(--surface);
}
.pw-hero-art { position: relative; width: 112px; height: 112px; flex: none; }
.pw-hero-art img { position: relative; width: 112px; height: 112px; border-radius: 26px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35), 0 0 0 1px var(--line-strong); }
.pw-hero-glow { position: absolute; inset: -18px; border-radius: 40px; background: var(--accent); opacity: .16; filter: blur(26px); }
.pw-hero-copy { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; }
.pw-hero-copy h1 { font-size: 27px; text-wrap: balance; }
.pw-hero-copy > p { font-size: 15px; text-wrap: pretty; }
.pw-hero-action { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.pw-status { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ok-soft); }
.pw-status > .ic { color: var(--ok); }
.pw-status.is-warn { background: var(--warn-soft); } .pw-status.is-warn > .ic { color: var(--warn); }
.pw-status b { display: block; font-weight: 650; }
.pw-status span { display: block; font-size: 13px; color: var(--text-2); }

.pw-benefits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.pw-benefit { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.pw-benefit b { display: block; font-weight: 650; font-size: 14.5px; }
.pw-benefit span:not(.li-icon) { display: block; margin-top: 3px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
#pw-how { scroll-margin-top: calc(var(--topbar-h) + var(--safe-t) + 12px); margin-bottom: 0; }
.pw-platforms { max-width: 420px; }

@media (min-width: 720px) {
  .pw-hero { flex-direction: row; text-align: left; align-items: center; gap: var(--sp-8); padding: var(--sp-8) var(--sp-10);
    background: radial-gradient(80% 140% at 0% 50%, var(--accent-soft), transparent 60%), var(--surface); }
  .pw-hero-art, .pw-hero-art img { width: 148px; height: 148px; }
  .pw-hero-art img { border-radius: 34px; }
  .pw-hero-copy { align-items: flex-start; max-width: 560px; }
  .pw-hero-copy h1 { font-size: 32px; }
  .pw-hero-action { max-width: 340px; }
  .pw-hero-action .center { text-align: left; }
  .pw-benefits { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ pasos */
.pw-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
.pw-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.pw-step .pw-ill { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); }
.pw-step-body { display: flex; gap: 12px; padding: 14px 16px 16px; }
.pw-step-num { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font: 700 14px/1 var(--font-display); }
.pw-step h3 { font-size: 16px; margin: 3px 0 4px; }
.pw-step p { font-size: 14px; color: var(--text-2); text-wrap: pretty; }
.pw-step p b { color: var(--text); font-weight: 650; }
.ic.pw-inline { display: inline-block; vertical-align: -3px; color: var(--text); }
@media (min-width: 720px) { .pw-steps:not(.is-compact) { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); } }

/* en la hoja de iPhone: carrusel horizontal con imán */
.pw-sheet-lead { font-size: 14.5px; margin-bottom: var(--sp-4); }
.pw-steps.is-compact {
  grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 calc(var(--sp-4) * -1); padding: 2px var(--sp-4) 6px; scroll-padding: 0 var(--sp-4); scrollbar-width: none; overscroll-behavior-x: contain;
}
.pw-steps.is-compact::-webkit-scrollbar { display: none; }
.pw-steps.is-compact .pw-step { scroll-snap-align: start; }
.pw-steps.is-compact .pw-step-body { padding: 12px 14px 14px; }
.pw-steps.is-compact .pw-step h3 { font-size: 15px; }
.pw-steps.is-compact .pw-step p { font-size: 13.5px; }

/* ------------------------------------------------------------------ ilustraciones (maquetas) */
.pw-ill {
  position: relative; height: 136px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 14px 18px;
  background: radial-gradient(120% 100% at 50% 0%, var(--surface-2), var(--bg-elev)); color: var(--text-3); font-size: 12px; border-radius: var(--r-sm);
}
.pw-ill .ic { color: var(--text-2); }
.pw-ill b { color: var(--text); font-weight: 650; }
.pw-ill small { display: block; color: var(--text-3); font-size: 10.5px; }
.pw-ill .pw-appicon { width: 40px; height: 40px; border-radius: 10px; }
.pw-ill .pw-appicon.sm { width: 30px; height: 30px; border-radius: 8px; }
.pw-ill .pw-appicon.xs { width: 16px; height: 16px; border-radius: 4px; box-shadow: none; }

.pw-mock-page { display: flex; flex-direction: column; gap: 7px; flex: 1; justify-content: center; }
.pw-mock-line { display: block; height: 8px; border-radius: 4px; background: var(--surface-3); opacity: .8; }
.pw-mock-line.w70 { width: 70%; } .pw-mock-line.w60 { width: 60%; } .pw-mock-line.w45 { width: 45%; }
.pw-mock-url { display: flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-weight: 600; min-width: 0; }
.pw-mock-url .ic { width: 12px; height: 12px; color: var(--text-3); }
.pw-mock-url.grow { justify-content: flex-start; }
.pw-mock-url.grow > span:not(.pw-hot) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-mock-bar { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px; }
.pw-mock-top { display: flex; align-items: center; gap: 10px; padding-right: 6px; }
.pw-mock-top .pw-mock-url { flex: 1; justify-content: flex-start; }

.pw-ill-ios { padding-bottom: 10px; }

.pw-mock-sheet, .pw-mock-menu, .pw-mock-dialog { border-radius: 14px; background: var(--bg-elev); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); overflow: hidden; }
.pw-ill-sheet { justify-content: flex-end; padding-bottom: 0; }
.pw-mock-sheet { border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.pw-mock-sheet .pw-mock-sheet-head { padding: 8px 12px; }
.pw-mock-sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pw-mock-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text-2); font-weight: 600; }
.pw-mock-row + .pw-mock-row { border-top: 1px solid var(--line); }
.pw-mock-row-hot { color: var(--text); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.pw-mock-row-hot .ic { color: var(--accent); }
.pw-mock-menu { align-self: flex-end; width: 76%; }
.pw-mock-menu-sm { width: 70%; }

.pw-mock-nav { padding: 0 8px 0 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--info); font-weight: 600; }
.pw-mock-nav b { font-size: 12px; }
.pw-mock-link { color: var(--info); font-weight: 700; padding: 2px 4px; }
.pw-mock-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--line); }

.pw-mock-grid { display: grid; grid-template-columns: repeat(4, 40px); justify-content: center; gap: 10px 18px; align-items: start; }
.pw-mock-grid i { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); opacity: .7; }
.pw-mock-grid i:nth-child(2) { opacity: .45; } .pw-mock-grid i:nth-child(6) { opacity: .5; }
.pw-mock-app { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pw-mock-app small { color: var(--text); font-weight: 600; font-size: 9.5px; }

.pw-mock-dialog { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.pw-mock-dialog-head { display: flex; align-items: center; gap: 10px; }
.pw-mock-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; color: var(--text-2); font-weight: 600; }
.pw-mock-btn { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; }

.pw-ill-desk { padding: 14px 16px 0; justify-content: flex-end; }
.pw-mock-window { border-radius: 12px 12px 0 0; background: var(--bg-elev); border: 1px solid var(--line-strong); border-bottom: 0; padding: 8px 10px 0; height: 104px; display: flex; flex-direction: column; gap: 8px; }
.pw-mock-chrome { display: flex; align-items: center; gap: 6px; height: 14px; }
.pw-mock-chrome i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.pw-mock-chrome b { font-size: 11px; }
.pw-mock-window .pw-mock-url { height: 26px; }
.pw-mock-split { flex: 1; display: flex; gap: 10px; }
.pw-mock-side { width: 26%; border-radius: 6px 6px 0 0; background: var(--surface-2); }
.pw-mock-split .pw-mock-page { justify-content: flex-start; padding-top: 6px; }
.pw-mock-x { width: 24px; display: grid; place-items: center; }

/* el punto que hay que tocar */
.pw-hot { position: relative; display: inline-grid; place-items: center; border-radius: 999px; }
.pw-hot::before { content: ""; position: absolute; inset: -7px; border-radius: inherit; border: 2px solid var(--accent); }
.pw-hot::after { content: ""; position: absolute; inset: -7px; border-radius: inherit; background: var(--accent); opacity: .18; animation: pw-pulse 1.8s var(--ease) infinite; }
.pw-hot > .ic, .pw-hot .ic { color: var(--accent); }
.pw-hot-icon { border-radius: 14px; }
.pw-hot-icon::before, .pw-hot-icon::after { inset: -5px; }
@keyframes pw-pulse { 0% { transform: scale(.85); opacity: .32; } 70% { transform: scale(1.35); opacity: 0; } 100% { opacity: 0; } }
