/* Consola Patrics — estilos. Tokens de color en :root; tema oscuro por dispositivo o por botón. */
:root {
  --brand: #E61A25; --red: #C9151B; --redhover: #B3121A; --gold: #F4B73F; --ongold: #3B2600;
  --bg: #FBF6F0; --surface: #FFFFFF; --surface2: #F4EBE2; --text: #2B1A15; --muted: #6A564D; --line: #E6D8CC;
  --redink: #B3121A; --redtint: #FDE8E6; --goldtint: #FFEFC7; --goldink: #6B4700; --okbg: #DFF2E6; --okink: #14532D;
  --shadow: 0 1px 2px rgba(70,30,10,.06), 0 8px 20px rgba(70,30,10,.07);
  --shadowhi: 0 2px 4px rgba(70,30,10,.08), 0 14px 28px rgba(70,30,10,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #150E0C; --surface: #231815; --surface2: #2E211C; --text: #F7EEE8; --muted: #C4B2A8; --line: #3D2D26;
    --redink: #FF9087; --redtint: #41201D; --goldtint: #3B2D0E; --goldink: #F7CF7C; --okbg: #133A27; --okink: #9DE5BA;
    --shadow: 0 1px 2px rgba(0,0,0,.5); --shadowhi: 0 8px 24px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #150E0C; --surface: #231815; --surface2: #2E211C; --text: #F7EEE8; --muted: #C4B2A8; --line: #3D2D26;
  --redink: #FF9087; --redtint: #41201D; --goldtint: #3B2D0E; --goldink: #F7CF7C; --okbg: #133A27; --okink: #9DE5BA;
  --shadow: 0 1px 2px rgba(0,0,0,.5); --shadowhi: 0 8px 24px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input { font-family: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.hd { font-family: 'Baloo 2', system-ui, sans-serif; }
svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Botones sobre rojo */
.iconbtn, .salir {
  height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.7); color: #fff; cursor: pointer;
}
.iconbtn { width: 44px; flex: none; }
.salir { padding: 0 16px; gap: 8px; font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 600; font-size: 16px; }
.salir svg { stroke-width: 2; }
.iconbtn:hover, .salir:hover { background: rgba(255,255,255,.28); }
.iconbtn:focus-visible, .salir:focus-visible { outline-color: var(--gold); }

/* ───────── Ingreso ───────── */
.franja {
  background: var(--brand); padding: calc(28px + env(safe-area-inset-top)) 20px 64px;
  display: flex; justify-content: center; position: relative;
}
.tema-btn { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.logo-ingreso { width: min(300px, 70%); height: auto; display: block; }
.hoja-wrap { max-width: 440px; margin: -36px auto 0; padding: 0 16px 40px; position: relative; }
.hoja {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px;
  padding: 24px 20px 20px; box-shadow: var(--shadowhi);
}
.titulo { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 800; }
.sub { margin: 6px 0 18px; font-size: 15.5px; color: var(--muted); line-height: 1.4; }
.sub b { color: var(--text); }

.slots { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.slot {
  height: 58px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface2);
  display: flex; align-items: center; justify-content: center; transition: border-color .15s, box-shadow .15s;
}
.slot .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--text); opacity: 0; transform: scale(.4); transition: opacity .12s, transform .12s; }
.slot.filled .dot { opacity: 1; transform: scale(1); }
.slot.active { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(244,183,63,.28); }
.slots.bad .slot { border-color: var(--red); background: var(--redtint); }
.slots.bad .dot { background: var(--redink); }
.slots.cargando .slot { opacity: .6; }
.shake { animation: shake .45s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.codein {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px;
  border: 0; background: transparent; cursor: pointer; caret-color: transparent; color: transparent;
}
.slots:focus-within .slot.active { box-shadow: 0 0 0 4px rgba(244,183,63,.5); }

.zona-msg { min-height: 70px; margin: 14px 0 6px; }
.msg { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 15px; font-weight: 700; line-height: 1.35; }
.msg svg { flex: none; margin-top: 1px; stroke-width: 2; }
.msg.err { background: var(--redtint); color: var(--redink); }
.msg.lock { background: var(--goldtint); color: var(--goldink); }
.msg.info { background: var(--surface2); color: var(--text); }

.teclado { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 340px; margin: 0 auto; }
.key {
  height: 60px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 600; font-size: 26px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 0 var(--line); transition: transform .08s, background .15s; touch-action: manipulation;
}
.key:hover { background: var(--surface2); }
.key:active { transform: scale(.95); }
.key:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.key.small { font-size: 14px; font-weight: 700; font-family: 'Nunito Sans', system-ui, sans-serif; color: var(--muted); }

.paso2-acciones { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.enlace-btn {
  min-height: 44px; padding: 6px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 700; cursor: pointer;
}
.enlace-btn:hover { background: var(--surface2); }
.enlace-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ───────── Consola ───────── */
.cabecera { position: sticky; top: 0; z-index: 10; background: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.18); padding-top: env(safe-area-inset-top); }
.cab-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.logo-cab { width: 124px; height: auto; display: block; }
.relleno { flex: 1; }
.contenido { max-width: 1240px; margin: 0 auto; padding: 24px 16px 56px; }
.saludo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.etiqueta-perfil {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 14px; border-radius: 999px;
  background: var(--gold); color: var(--ongold); font-size: 13.5px; font-weight: 800;
}
.hola { margin: 0; font-size: 36px; line-height: 1.05; font-weight: 800; overflow-wrap: anywhere; }

.filtros { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; margin: 18px -16px 0; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 600; font-size: 16px; cursor: pointer;
}
.fchip:hover { background: var(--surface2); }
.fchip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ongold); }

.aviso-consola:empty { display: none; }
.aviso-consola { margin-top: 18px; }

.gwrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px 24px; margin-top: 30px; }
.sec { min-width: 0; scroll-margin-top: 90px; }
@media (min-width: 860px) {
  .gwrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sec.ancho { grid-column: 1 / -1; }
}
.gh {
  margin: 0 0 12px; display: flex; align-items: center; gap: 10px; font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700; font-size: 15px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.gh .mark { width: 10px; height: 10px; border-radius: 3px; background: var(--gold); flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }

.card {
  display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 20px;
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); transition: transform .12s, box-shadow .15s;
}
a.card { cursor: pointer; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadowhi); }
a.card:active { transform: scale(.985); }
a.card[aria-busy="true"] { opacity: .7; pointer-events: none; }
.card.feat { border-color: var(--gold); }
.card .r1 { display: flex; gap: 14px; align-items: flex-start; }
.card .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--redtint); color: var(--redink); display: flex; align-items: center; justify-content: center; flex: none; }
.card .ico svg { stroke-width: 1.8; }
.card .nm { font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 700; font-size: 20px; line-height: 1.15; }
.card .ds { margin-top: 3px; font-size: 14.5px; line-height: 1.35; color: var(--muted); }
.card .r2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip.ok { background: var(--okbg); color: var(--okink); }
.chip.ok i { background: currentColor; }
.chip.soon { background: var(--goldtint); color: var(--goldink); }
.chip.soon i { border: 2px solid currentColor; }
.btn {
  height: 44px; min-width: 116px; padding: 0 18px; border-radius: 12px; background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Baloo 2', system-ui, sans-serif; font-weight: 700; font-size: 17px; border: 0;
}
.btn svg { stroke-width: 2.2; }
a.card:hover .btn { background: var(--redhover); }
.btn.off { background: transparent; color: var(--muted); border: 1.5px solid var(--line); cursor: not-allowed; }
.card.soon { background: transparent; border: 1.5px dashed var(--line); box-shadow: none; }
.card.soon .ico { background: var(--surface2); color: var(--muted); }
.vacio { color: var(--muted); font-size: 15.5px; }

@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
  .card, .key, .slot, .slot .dot { transition: none !important; }
  a.card:hover { transform: none; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
