/* Piezas comunes de las Herramientas de Bachillerato: barra superior, copia de seguridad,
   consejo para instalar y el huevo de pascua. Cada app conserva su propio diseño; esto solo
   usa la letra del sistema y sus propios colores para no pisar los de la app. */
:root {
  --hb-fondo: rgba(255, 255, 255, .86);
  --hb-tinta: #15203a;
  --hb-suave: #5a6579;
  --hb-linea: rgba(21, 32, 58, .12);
  --hb-acento: #2747d6;
  --hb-acento-fondo: #e9edff;
  --hb-sistema: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hb-fondo: rgba(13, 18, 33, .86);
    --hb-tinta: #e6ebf5;
    --hb-suave: #9da9c2;
    --hb-linea: rgba(230, 235, 245, .12);
    --hb-acento: #93a6ff;
    --hb-acento-fondo: #1f2a55;
  }
}
:root[data-theme="dark"] {
  --hb-fondo: rgba(13, 18, 33, .86);
  --hb-tinta: #e6ebf5;
  --hb-suave: #9da9c2;
  --hb-linea: rgba(230, 235, 245, .12);
  --hb-acento: #93a6ff;
  --hb-acento-fondo: #1f2a55;
}

/* ---------- Barra superior ---------- */
html { scroll-padding-top: 76px; } /* lo que se muestra al saltar a una parte no queda debajo de la barra */
.hb-barra {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) max(14px, env(safe-area-inset-right, 0px)) 6px max(14px, env(safe-area-inset-left, 0px));
  background: var(--hb-fondo);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hb-linea);
  font: 600 15px/1.2 var(--hb-sistema);
  color: var(--hb-tinta);
}
.hb-marca {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 6px 4px 2px; margin-right: auto;
  border: 0; border-radius: 10px; background: none; color: inherit; font: inherit;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.hb-logo { width: 28px; height: 28px; flex: none; display: block; }
.hb-marca span { letter-spacing: -.01em; white-space: nowrap; }
.hb-marca .hb-corto { display: none; }
.hb-nav { display: flex; gap: 4px; }
.hb-nav a {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 0 12px; border-radius: 999px;
  color: var(--hb-suave); text-decoration: none; white-space: nowrap;
}
.hb-nav a:hover { color: var(--hb-tinta); background: var(--hb-linea); }
.hb-nav a[aria-current="page"] { color: var(--hb-acento); background: var(--hb-acento-fondo); }
.hb-nav a:focus-visible, .hb-marca:focus-visible { outline: 2px solid var(--hb-acento); outline-offset: 2px; }
@media (max-width: 720px) {
  .hb-marca .hb-largo { display: none; }
}
@media (max-width: 480px) {
  .hb-barra { gap: 4px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .hb-nav { gap: 2px; }
  .hb-nav a { padding: 0 9px; font-size: 14px; }
}
@media (max-width: 360px) {
  .hb-nav a { padding: 0 7px; font-size: 13px; }
}
@media print { .hb-barra, .hb-consejo, .hb-huevo { display: none !important; } }

/* ---------- Copia de seguridad y consejo para instalar ---------- */
.hb-copia { display: grid; gap: 8px; font-family: var(--hb-sistema); font-size: 14px; color: var(--hb-suave); }
.hb-copia p { margin: 0; }
.hb-copia-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.hb-boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--hb-linea); background: transparent; color: var(--hb-tinta);
  font: 600 14px/1.2 var(--hb-sistema); cursor: pointer;
}
.hb-boton:hover { border-color: var(--hb-acento); color: var(--hb-acento); }
.hb-boton:focus-visible { outline: 2px solid var(--hb-acento); outline-offset: 2px; }

.hb-consejo {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 12px 12px 14px; border-radius: 14px;
  background: var(--hb-acento-fondo); color: var(--hb-tinta);
  font: 400 14px/1.45 var(--hb-sistema);
}
.hb-consejo b { font-weight: 700; }
.hb-consejo .hb-logo { width: 34px; height: 34px; }
.hb-consejo p { margin: 0; }
.hb-cerrar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent;
  color: var(--hb-suave); font-size: 18px; line-height: 1; cursor: pointer;
}
.hb-cerrar:hover { background: var(--hb-linea); color: var(--hb-tinta); }

/* ---------- El huevo de pascua (no busques aquí cómo se abre) ---------- */
.hb-huevo {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 700px at 15% 10%, rgba(69, 227, 255, .10), transparent 60%),
              radial-gradient(1000px 800px at 90% 95%, rgba(255, 181, 63, .09), transparent 60%), #04060b;
  color: #f3f5fa; font-family: var(--hb-sistema);
  opacity: 0; transition: opacity .45s ease;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hb-huevo.on { opacity: 1; }
.hb-huevo-caja { width: min(760px, 100%); display: grid; gap: 26px; }
.hb-frase { font-size: clamp(26px, 6.4vw, 54px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.hb-hueco { color: #45e3ff; }
.hb-cursor { display: inline-block; width: .08em; height: .9em; margin-left: .06em; vertical-align: -.08em; background: #45e3ff; animation: hb-parpadeo 1s steps(1) infinite; }
@keyframes hb-parpadeo { 50% { opacity: 0; } }
.hb-barras { display: grid; gap: 10px; }
.hb-fila { display: grid; grid-template-columns: minmax(84px, 9em) minmax(0, 1fr) 3.4em; gap: 12px; align-items: center; font-size: clamp(15px, 3.6vw, 20px); font-weight: 650; transition: color .15s, transform .15s; }
.hb-fila .hb-pal { text-align: right; color: #dfe5f0; }
.hb-fila .hb-pista { display: block; height: 14px; border-radius: 7px; background: #121a2a; overflow: hidden; }
.hb-fila .hb-relleno { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, #1aa7d6, #45e3ff); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.hb-fila .hb-pc { color: #8a93a8; font-variant-numeric: tabular-nums; }
.hb-fila.hb-luz .hb-pal, .hb-fila.hb-luz .hb-pc { color: #45e3ff; }
.hb-fila.hb-elegida .hb-pal { color: #ffb53f; }
.hb-fila.hb-elegida .hb-relleno { background: linear-gradient(90deg, #ff8a1f, #ffb53f); }
.hb-dado { min-height: 1.4em; color: #8a93a8; font-size: clamp(14px, 3.4vw, 18px); }
.hb-final { opacity: 0; transform: translateY(14px); transition: opacity .9s ease, transform .9s ease; display: grid; gap: 10px; }
.hb-final.on { opacity: 1; transform: none; }
.hb-final strong { font-size: clamp(24px, 6vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; color: #ffb53f; text-shadow: 0 0 40px rgba(255, 181, 63, .45); }
.hb-final small { color: #8a93a8; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; }
.hb-salir { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); color: #596273; font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .hb-huevo, .hb-final, .hb-fila .hb-relleno { transition: none; }
  .hb-cursor { animation: none; }
}
