/* Temario TAI · app del móvil. Móvil primero; en ordenador, columna centrada de 760 px como máximo. */
@font-face { font-family: "Source Code Pro"; src: url("fuentes/SourceCodePro-Regular.ttf") format("truetype");
             font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url("fuentes/SourceCodePro-Bold.ttf") format("truetype");
             font-weight: 700; font-style: normal; font-display: swap; }

:root { --tam: 17px; --acc: #6a2c91; --accl: #dccbea; --accxl: #f5effa; --fondo: #eef0f3; --texto: #1d2329;
        --sup: env(safe-area-inset-top, 0px); --inf: env(safe-area-inset-bottom, 0px); }
/* colores de cada bloque (los mismos que en los PDF) */
.b1 { --acc: #1f4e8c; --accl: #c9d8ee; --accxl: #eef3fa; }
.b2 { --acc: #1b7a4b; --accl: #c4e5d3; --accxl: #edf7f1; }
.b3 { --acc: #6a2c91; --accl: #dccbea; --accxl: #f5effa; }
.b4 { --acc: #b8520f; --accl: #f2d3bd; --accxl: #fdf3ec; }
.ix { --acc: #37474f; --accl: #cfd8dc; --accxl: #f1f4f5; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, system-ui, Roboto, "Noto Sans", sans-serif; font-size: 16px;
       line-height: 1.45; color: var(--texto); background: var(--fondo); }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,.08); }
button:focus-visible, input:focus-visible { outline: 3px solid #ffb300; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.25; }

#app { max-width: 760px; margin: 0 auto; min-height: 100vh; background: var(--fondo);
       padding-bottom: calc(76px + var(--inf)); }
#app.sin-nav { padding-bottom: calc(24px + var(--inf)); }
.vista { padding: 16px 14px; }
.vista > h1 { font-size: 24px; margin: 6px 2px 14px; }
.cargando { padding: 40px 20px; text-align: center; font-size: 18px; color: #546e7a; }

/* ---------------------------------------------------------------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px;
       padding: 10px 16px; border-radius: 12px; border: 2px solid var(--acc); background: #fff; color: var(--acc);
       font-size: 16px; font-weight: 700; text-align: center; line-height: 1.2; }
.btn.lleno { background: var(--acc); color: #fff; }
.btn.grande { width: 100%; min-height: 56px; font-size: 18px; }
.btn.peligro { border-color: #c62828; color: #c62828; }
.btn.si { border-color: #2e7d32; color: #fff; background: #2e7d32; }
.btn.no { border-color: #c62828; color: #fff; background: #c62828; }
.btn.discreto { border-color: #cfd8dc; color: #455a64; }
.btn:disabled { opacity: .55; cursor: default; }
.fila-bots { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fila-bots .btn { flex: 1 1 140px; }

/* ---------------------------------------------------------------- navegación inferior */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
       background: #fff; border-top: 1px solid #d9dee3; padding-bottom: var(--inf); }
.nav button { flex: 1; max-width: 253px; min-height: 60px; border: 0; background: none; color: #455a64;
              font-size: 16px; font-weight: 700; }
.nav button.activo { color: #6a2c91; box-shadow: inset 0 4px 0 #6a2c91; }

/* aviso de versión nueva */
.aviso { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(72px + var(--inf));
         width: min(92vw, 520px); min-height: 56px; padding: 14px 18px; border: 0; border-radius: 14px;
         background: #1d2329; color: #fff; font-size: 17px; font-weight: 700; box-shadow: 0 6px 22px rgba(0,0,0,.35); }

/* ---------------------------------------------------------------- pantalla de la clave */
.clave { max-width: 440px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column;
         justify-content: center; padding: 24px 20px calc(24px + var(--inf)); }
.clave img { width: 88px; height: 88px; margin: 0 auto 14px; display: block; }
.clave h1 { text-align: center; font-size: 26px; margin: 0 0 4px; }
.clave .sub { text-align: center; color: #546e7a; margin: 0 0 26px; }
.clave label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 17px; }
.clave input { width: 100%; font-size: 19px; padding: 14px; border: 2px solid #b0bec5; border-radius: 12px;
               background: #fff; color: var(--texto); }
.clave input:focus { border-color: #6a2c91; outline: none; }
.clave .mostrar { display: flex; align-items: center; gap: 8px; margin: 10px 0 18px; font-weight: 400; font-size: 16px; }
.clave .mostrar input { width: 22px; height: 22px; }
.clave .estado { min-height: 28px; margin-top: 14px; text-align: center; font-size: 17px; font-weight: 700; }
.clave .estado.error { color: #c62828; }
.clave .estado.info { color: #455a64; }
.clave .ayuda { margin-top: 26px; font-size: 14px; color: #607d8b; text-align: center; }

/* ---------------------------------------------------------------- inicio */
.tarjeta { background: #fff; border-radius: 16px; padding: 16px; margin: 0 0 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tarjeta h2 { font-size: 19px; margin: 0 0 8px; }
.repasar { border-top: 5px solid #f2a900; }
.repasar ul { list-style: none; margin: 0; padding: 0; }
.repasar li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #eef0f2; }
.repasar li:first-child { border-top: 0; }
.repasar li .txt { flex: 1; min-width: 0; }
.repasar li .txt b { display: block; color: var(--acc); }
.repasar li .txt span { font-size: 14px; color: #546e7a; }
.repasar .vacio { color: #546e7a; margin: 0; }
.bloque { margin: 22px 0 8px; }
.bloque-cab { background: var(--acc); color: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.bloque-cab h2 { margin: 0; font-size: 20px; }
.bloque-cab p { margin: 2px 0 0; opacity: .92; }
.tema-card { border-left: 7px solid var(--acc); }
.tc-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-num { color: var(--acc); font-weight: 800; font-size: 15px; letter-spacing: .3px; text-transform: uppercase; }
.tc-tit { font-size: 18px; font-weight: 700; margin: 4px 0 8px; line-height: 1.3; }
.estado { display: inline-block; font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
          background: #eceff1; color: #455a64; }
.estado.e-estudiado { background: #e3f2fd; color: #1565c0; }
.estado.e-toca { background: #fff3cd; color: #8a5a00; }
.estado.e-completo { background: #e8f5e9; color: #2e7d32; }
.tc-nota { font-size: 14px; color: #546e7a; margin-top: 6px; }
.estrellas { white-space: nowrap; }
.pie { text-align: center; color: #78909c; font-size: 13px; margin: 24px 0 8px; }

/* ---------------------------------------------------------------- barra superior (tema y autotest) */
.barra { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: var(--acc); color: #fff;
         box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.barra-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 4px;
            padding: calc(6px + var(--sup)) 6px 6px; }
.barra button { min-height: 44px; min-width: 44px; padding: 6px 8px; border: 0; border-radius: 10px;
                background: rgba(255,255,255,.17); color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; }
.barra .tit { flex: 1; min-width: 0; overflow: hidden; font-weight: 700; font-size: 15px; line-height: 1.15;
              padding: 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* flechas con la fuente de código, que las tiene seguro */
.fl { font-family: "Source Code Pro", ui-monospace, monospace; font-weight: 700; }
.con-barra { padding-top: calc(58px + var(--sup)); }

/* ---------------------------------------------------------------- contenido de los temas (mismas clases que los PDF) */
.contenido { font-size: var(--tam); line-height: 1.5; background: #fff; padding: 14px 14px 10px;
             overflow-wrap: break-word; }
.contenido [id^="s-"] { scroll-margin-top: calc(66px + var(--sup)); }
.contenido h1 { font-size: 1.28em; color: #fff; background: var(--acc); margin: 0 0 12px; padding: 12px 14px;
                border-radius: 10px; font-weight: 800; }
.contenido h2 { font-size: 1.22em; color: var(--acc); margin: 1.5em 0 .5em; font-weight: 800; }
.contenido h3 { font-size: 1.07em; color: var(--acc); margin: 1.3em 0 .45em; padding-bottom: 3px;
                border-bottom: 2px solid var(--accl); font-weight: 700; }
.contenido h4 { font-size: 1em; color: #2b333b; margin: 1.1em 0 .35em; font-weight: 700; }
.contenido h5 { font-size: .95em; margin: 1em 0 .3em; }
.contenido p { margin: .45em 0; }
.contenido ul, .contenido ol { margin: .3em 0 .55em; padding-left: 1.35em; }
.contenido li { margin: .25em 0; }
.contenido hr { border: 0; border-top: 1px dashed #c5ccd3; margin: 1.3em 0; }
.contenido a { color: #1565c0; }
.contenido a.url { word-break: break-all; font-size: .9em; }
.contenido strong { font-weight: 700; color: #000; }
.contenido p strong, .contenido li strong, .contenido .note strong, .contenido blockquote strong {
  text-decoration: underline; text-decoration-color: #ffe97a; text-decoration-thickness: .42em;
  text-underline-offset: -.28em; text-decoration-skip-ink: none; }
.contenido code { font-family: "Source Code Pro", ui-monospace, monospace; font-size: .86em; background: #eef1f4;
                  border-radius: 3px; padding: 0 3px; overflow-wrap: anywhere; }
/* dibujos y código: sin cortar líneas y con desplazamiento horizontal para no descuadrar las cajas */
.contenido pre { font-family: "Source Code Pro", ui-monospace, monospace; font-size: .74em; line-height: 1.2;
                 background: #f8fafc; border: 1px solid #dfe5ec; border-left: 4px solid var(--acc); border-radius: 6px;
                 padding: 8px 10px; margin: .7em 0; white-space: pre; overflow-wrap: normal; word-break: normal;
                 overflow-x: auto; -webkit-overflow-scrolling: touch; color: #1d2329; tab-size: 4;
                 font-variant-ligatures: none; font-kerning: none; }
.contenido pre.src { background: #f4f6f8; }
.contenido .w1 { display: inline-block; width: 1ch; overflow: hidden; text-align: center; vertical-align: bottom; }
.contenido blockquote { margin: .5em 0 1em; padding: 8px 12px; background: var(--accxl); border-left: 5px solid var(--acc);
                        border-radius: 6px; }
.contenido blockquote p { margin: .2em 0; }
/* tablas dentro de un contenedor con desplazamiento horizontal */
.contenido .tabla { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .6em 0 1em; }
.contenido table { border-collapse: collapse; min-width: 100%; font-size: .88em; line-height: 1.38; }
.contenido th { background: var(--acc); color: #fff; text-align: left; padding: 6px 8px; font-weight: 700;
                border: 1px solid var(--acc); vertical-align: bottom; }
.contenido td { border: 1px solid #d3dae1; padding: 5px 8px; vertical-align: top; }
.contenido th, .contenido td { min-width: 6.5em; }
.contenido th:first-child, .contenido td:first-child { min-width: 4.5em; }
.contenido tbody tr:nth-child(even) td { background: #f5f7f9; }
.contenido th strong { color: #fff; }
.contenido .note { margin: .45em 0; padding: 6px 10px; border-left: 4px solid #999; border-radius: 4px; background: #f6f6f6; }
.contenido .n-tru { border-color: #7b1fa2; background: #f6effa; }
.contenido .n-fac { border-color: #1976d2; background: #edf4fc; }
.contenido .n-ojo { border-color: #e65100; background: #fff3e8; }
.contenido .n-cor { border-color: #c62828; background: #fdeeee; }
.contenido .n-ext { border-color: #00897b; background: #eaf6f4; }
.contenido .n-src { border-color: #90a4ae; background: #f4f6f7; font-size: .9em; }
.tag { display: inline-block; font-size: .68em; font-weight: 800; letter-spacing: .4px; color: #fff;
       padding: 2px 6px 1px; border-radius: 4px; margin-right: 4px; vertical-align: .12em; line-height: 1.4; }
.tru { background: #7b1fa2; } .fac { background: #1976d2; } .ojo { background: #e65100; }
.ext { background: #00897b; } .cor { background: #c62828; } .lnk { background: #607d8b; } .sol { background: #2e7d32; }
.dot { display: inline-block; width: .78em; height: .78em; border-radius: 50%; vertical-align: -.06em; margin: 0 1px; }
.dot.sq { border-radius: 2px; }
.dot.dotw { border: 1px solid #888; }
.star { display: inline-block; width: .95em; height: .95em; background: #f2a900; vertical-align: -.12em;
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.contenido h1 .star { background: #ffd54f; }
span.ok { color: #2e7d32; font-weight: 800; } span.no { color: #c62828; font-weight: 800; }
.destacar { animation: destello 2.2s ease-out; }
@keyframes destello { 0%, 30% { background: #fff3b0; } 100% { background: transparent; } }

/* final del tema */
.fin { background: #fff; margin: 12px 0 0; padding: 18px 16px; border-top: 5px solid var(--acc); }
.fin h2 { margin: 0 0 6px; font-size: 19px; color: var(--acc); }
.fin p { margin: 6px 0 12px; }
.fin .btn + .btn { margin-top: 10px; }

/* panel del índice */
.panel { position: fixed; inset: 0; z-index: 45; display: flex; justify-content: flex-end; background: rgba(0,0,0,.45); }
.panel-caja { width: min(90vw, 440px); height: 100%; background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch;
              box-shadow: -4px 0 16px rgba(0,0,0,.25); }
.panel-cab { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
             gap: 10px; background: var(--acc); color: #fff; padding: calc(8px + var(--sup)) 10px 8px 16px; }
.panel-cab b { font-size: 18px; }
.panel-cab button { min-height: 44px; padding: 6px 14px; border: 0; border-radius: 10px; background: rgba(255,255,255,.2);
                    color: #fff; font-weight: 700; }
.panel ol { list-style: none; margin: 0; padding: 4px 0 calc(28px + var(--inf)); }
.panel li button { display: block; width: 100%; min-height: 48px; padding: 11px 16px; border: 0; border-bottom: 1px solid #eef0f2;
                   background: none; text-align: left; color: var(--texto); font-size: 16px; font-weight: 700; line-height: 1.3; }
.panel li.n3 button { padding-left: 34px; font-size: 15px; font-weight: 400; color: #37474f; }
.panel li.actual button { background: var(--accxl); box-shadow: inset 4px 0 0 var(--acc); }

/* ---------------------------------------------------------------- autotest */
.test { padding: 14px; }
.t-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 4px 2px 8px;
         font-weight: 700; color: #455a64; }
.progreso { height: 10px; background: #dfe4e8; border-radius: 5px; overflow: hidden; margin-bottom: 14px; }
.progreso i { display: block; height: 100%; background: var(--acc); border-radius: 5px; }
.t-preg { font-size: 20px; font-weight: 700; line-height: 1.4; margin: 0 0 14px; }
.t-resp { background: #edf7f1; border-left: 6px solid #2e7d32; border-radius: 10px; padding: 12px 14px; font-size: 17px;
          margin: 0 0 16px; line-height: 1.5; }
.t-resp .lbl { display: block; font-size: 13px; font-weight: 800; color: #2e7d32; letter-spacing: .5px; margin-bottom: 4px; }
.t-resp strong { color: #000; }
.t-bots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.t-bots .btn { min-height: 60px; font-size: 18px; }
.nota-grande { font-size: 52px; font-weight: 900; color: var(--acc); line-height: 1; margin: 6px 0; }
.falladas { margin: 10px 0 0; padding-left: 1.3em; }
.falladas li { margin: 10px 0; }
.falladas .r { color: #2e5b33; }
.res-test .btn { margin-top: 10px; }

/* ---------------------------------------------------------------- buscador */
.buscador { width: 100%; font-size: 18px; padding: 14px; border: 2px solid #b0bec5; border-radius: 12px;
            background: #fff; color: var(--texto); -webkit-appearance: none; appearance: none; }
.buscador:focus { border-color: #6a2c91; outline: none; }
.b-msg { color: #546e7a; margin: 14px 4px; }
.res-grupo { margin: 18px 0 6px; }
.res-grupo h2 { font-size: 16px; margin: 0 2px 6px; color: var(--acc); }
.res-grupo h2 span { color: #78909c; font-weight: 400; }
.res-item { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid #dfe4e8;
            border-left: 5px solid var(--acc); border-radius: 12px; padding: 11px 12px; margin: 8px 0; color: var(--texto); }
.res-sec { display: block; font-weight: 700; margin-bottom: 3px; }
.res-frag { display: block; color: #455a64; font-size: 15px; line-height: 1.45; }
mark { background: #ffe97a; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------------------------------------------------------------- cómo usar */
.instalar ol { padding-left: 1.3em; margin: 6px 0; }
.instalar li { margin: 6px 0; }
.instalar .tres svg { fill: currentColor; vertical-align: -3px; margin: 0 3px; }
.leeme-txt { border-radius: 16px; overflow: hidden; margin: 0 0 14px; }

@media (min-width: 761px) {
  .vista { padding: 22px 20px; }
  .contenido { padding: 18px 22px 12px; }
}
