/* RPL · Role Playing Life — estilo RPG de 16 bits */
:root {
  --fondo: #0a0f2e;
  --win-a: #4059cd;
  --win-b: #24329e;
  --win-c: #121c66;
  --borde: #f2f3ff;
  --borde-in: #7d88dc;
  --tinta: #070a22;
  --hondo: #0a1038;
  --texto: #ffffff;
  --texto2: #cdd4ff;
  --apagado: #8d96cc;
  --oro: #ffd447;
  --hp: #4ce06a;
  --hp-medio: #ffd447;
  --hp-bajo: #ff4d5e;
  --xp: #5ccfff;
  --jefe: #ff4d5e;
  --fue: #ff6a6a;
  --men: #b98aff;
  --dis: #ffb340;
  --car: #ff8ad0;
  --riq: #4fe08a;
  --rod: #46d2ff;
  --f-pixel: 'Pixelify Sans', system-ui, sans-serif;
  --f-texto: 'Pixelify Sans', system-ui, sans-serif;
  --nav-h: 66px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { background: var(--fondo); }
body {
  background-color: var(--fondo);
  background-image:
    radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1.6px),
    linear-gradient(180deg, #0a0f2e 0%, #151d58 100%);
  background-size: 18px 18px, 100% 100%;
  background-attachment: fixed;
  color: var(--texto);
  font-family: var(--f-texto);
  font-size: 17px;
  line-height: 1.35;
  min-height: 100vh;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
#app {
  max-width: 540px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) 14px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
}
img.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

/* ── Ventana clásica ── */
.win {
  position: relative;
  background: linear-gradient(180deg, var(--win-a) 0%, var(--win-b) 55%, var(--win-c) 100%);
  border: 3px solid var(--borde);
  border-radius: 9px;
  box-shadow: 0 0 0 3px var(--tinta), inset 0 0 0 2px var(--borde-in), 0 8px 0 2px rgba(0, 0, 0, .35);
  padding: 12px 14px;
  text-shadow: 2px 2px 0 var(--tinta);
}
.pixel { font-family: var(--f-pixel); font-weight: 700; letter-spacing: .03em; }

/* ── Estado del héroe (arriba, siempre visible) ── */
#estado {
  position: sticky;
  top: calc(env(safe-area-inset-top) + 8px);
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 12px 10px 10px;
  margin-bottom: 20px;
}
.retrato {
  width: 70px; height: 70px;
  padding: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #2e3a9a, #0b1146 75%);
  border: 2px solid var(--borde-in);
  border-radius: 7px;
  overflow: hidden;
}
.fila1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nombre { font-family: var(--f-pixel); font-weight: 700; font-size: 17px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oro { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-pixel); font-weight: 700; font-size: 16px; color: var(--oro); white-space: nowrap; }
.subtitulo { color: var(--texto2); font-size: 15px; margin-top: 2px; }
.barras { display: grid; gap: 5px; margin-top: 6px; }
.barra { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 7px; font-family: var(--f-pixel); font-weight: 700; font-size: 13px; }
.barra .riel {
  height: 11px;
  background: #070b30;
  border: 2px solid var(--tinta);
  box-shadow: 0 0 0 1px var(--borde-in);
  border-radius: 2px;
  overflow: hidden;
}
.barra .relleno { display: block; height: 100%; box-shadow: inset 0 3px 0 rgba(255, 255, 255, .35); transition: width .45s steps(6); }
.barra .num { color: var(--texto2); min-width: 54px; text-align: right; }

/* ── Navegación de abajo ── */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: linear-gradient(180deg, #1c2774, #0b1144);
  border-top: 3px solid var(--borde);
  box-shadow: 0 -3px 0 var(--tinta);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
}
#nav .dentro { max-width: 540px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
#nav button {
  background: none; border: 0; border-radius: 8px;
  color: var(--texto2);
  display: grid; justify-items: center; align-content: center; gap: 6px;
  min-height: 54px; padding: 4px 0;
  font-family: var(--f-pixel); font-weight: 700; font-size: 12px; letter-spacing: .02em;
  text-shadow: 1px 1px 0 var(--tinta);
  position: relative;
}
#nav button img { height: 24px; width: auto; }
#nav button.activo { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px var(--borde-in); }
#nav button.activo::after {
  content: ''; position: absolute; top: -9px; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--oro); border-bottom: 0;
  animation: cursor 1s steps(2) infinite;
}
@keyframes cursor { 50% { transform: translateY(-3px); } }

/* ── Títulos de sección ── */
.seccion {
  margin: 26px 2px 12px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-pixel); font-weight: 700; font-size: 15px; color: var(--oro);
  text-shadow: 2px 2px 0 var(--tinta);
}
.seccion::after { content: ''; flex: 1; height: 3px; background: repeating-linear-gradient(90deg, var(--borde-in) 0 6px, transparent 6px 10px); }
.seccion .cuenta { color: var(--texto2); }
.nota { color: var(--texto2); font-size: 15px; margin: 0 2px 12px; }

/* ── Escena de portada (Hoy) ── */
.escena {
  position: relative;
  border: 3px solid var(--borde);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--tinta), 0 8px 0 2px rgba(0, 0, 0, .35);
  text-shadow: 2px 2px 0 var(--tinta);
}
.escena img { width: 100%; height: auto; }
.escena .rotulo { position: absolute; left: 12px; top: 11px; font-family: var(--f-pixel); font-weight: 700; font-size: 14px; color: #fff; }
.escena .saludo { position: absolute; left: 12px; bottom: 30px; font-size: 21px; font-weight: 700; }
.escena .avance { position: absolute; left: 12px; right: 12px; bottom: 11px; display: flex; align-items: center; gap: 8px; font-family: var(--f-pixel); font-weight: 700; font-size: 13px; }
.escena .avance .riel { flex: 1; height: 9px; background: rgba(5, 8, 32, .75); border: 2px solid var(--tinta); box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); }
.escena .avance .relleno { display: block; height: 100%; background: var(--oro); }

/* ── Tarjeta de misión (Hoy) ── */
.mision {
  display: grid;
  grid-template-columns: 38px 1fr 52px;
  gap: 11px;
  align-items: center;
  padding: 10px 10px 10px 10px;
  margin-bottom: 14px;
}
.ico {
  width: 38px; height: 38px; padding: 0;
  display: grid; place-items: center;
  background: #0b1240;
  border: 2px solid var(--area, var(--borde-in));
  border-radius: 7px;
  box-shadow: 0 0 0 2px var(--tinta);
}
.ico img { max-width: 26px; height: auto; }
.cuerpo { min-width: 0; cursor: pointer; }
.t { font-weight: 600; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; margin-top: 6px; font-size: 13px; color: var(--texto2); }
.estrellas { display: inline-flex; gap: 2px; }
.estrellas img { width: 11px; height: 11px; }
.c-xp { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--xp); }
.c-oro { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--oro); display: inline-flex; gap: 4px; align-items: center; }
.c-oro img { width: 10px; height: 10px; }
.racha { color: #ffb050; display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-pixel); font-weight: 700; font-size: 13px; }
.racha img { width: 10px; height: 12px; }
.vs { display: inline-flex; align-items: center; gap: 4px; color: #ffb0b8; font-size: 13px; }
.vs img { width: 11px; height: 11px; }
.marcar {
  width: 52px; height: 52px; padding: 0;
  border-radius: 9px;
  border: 3px solid var(--borde);
  background: var(--hondo);
  box-shadow: 0 0 0 2px var(--tinta), inset 0 0 0 2px #2a3590, 0 4px 0 2px rgba(0, 0, 0, .4);
  display: grid; place-items: center;
  font-family: var(--f-pixel); font-weight: 700; font-size: 14px; color: #fff;
  text-shadow: 1px 1px 0 var(--tinta);
}
.marcar:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--tinta), inset 0 0 0 2px #2a3590, 0 1px 0 2px rgba(0, 0, 0, .4); }
.marcar.hecha { background: #145a2c; border-color: #9effb4; }

.mision.hecha { filter: saturate(.55) brightness(.82); }
.mision.hecha .t { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--texto2); }
.pips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.pip { width: 11px; height: 11px; border: 2px solid var(--tinta); background: var(--hondo); box-shadow: 0 0 0 1px var(--borde-in); }
.pip.on { background: var(--xp); }
.paso { margin-top: 4px; font-size: 15px; color: #fff; }
.paso b { font-family: var(--f-pixel); font-weight: 700; font-size: 12px; color: var(--oro); margin-right: 4px; }
.descansa { font-size: 14px; color: var(--apagado); margin: -4px 4px 10px; }

/* ── Botones ── */
.btn {
  appearance: none;
  font-family: var(--f-pixel); font-weight: 700; font-size: 15px; line-height: 1.25;
  color: #241800;
  background: linear-gradient(180deg, #ffe680 0%, #ffc531 60%, #e8a417 100%);
  border: 3px solid var(--tinta);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(0, 0, 0, .18), 0 4px 0 var(--tinta);
  text-shadow: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55), inset 0 -3px 0 rgba(0, 0, 0, .18), 0 1px 0 var(--tinta); }
.btn.azul { color: #fff; background: linear-gradient(180deg, #7a90ff, #3d55da 60%, #2b3db2); text-shadow: 1px 1px 0 var(--tinta); }
.btn.rojo { color: #fff; background: linear-gradient(180deg, #ff7a80, #e3121b 60%, #b00c14); text-shadow: 1px 1px 0 var(--tinta); }
.btn.verde { background: linear-gradient(180deg, #b0ffc0, #4ce06a 60%, #2fb050); }
.btn.gris { color: #fff; background: linear-gradient(180deg, #8a93c8, #5a6398); text-shadow: 1px 1px 0 var(--tinta); }
.btn[disabled] { filter: grayscale(.85) brightness(.65); pointer-events: none; }
.btn.ancho { width: 100%; }
.btn.chico { font-size: 8px; padding: 9px 11px; border-width: 2px; }
.btn img { height: 14px; width: auto; }
.botones { display: grid; gap: 14px; margin-top: 16px; }
.botones.dos { grid-template-columns: 1fr 1fr; }

/* ── Tablero ── */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px; padding: 4px 14px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  font-family: var(--f-pixel); font-weight: 700; font-size: 13px;
  color: var(--texto2);
  background: #0d1548;
  border: 2px solid var(--borde-in);
  border-radius: 999px;
  padding: 9px 12px;
  display: inline-flex; gap: 7px; align-items: center;
  text-shadow: 1px 1px 0 var(--tinta);
}
.chip.on { color: #fff; background: var(--win-b); border-color: var(--borde); box-shadow: 0 0 0 2px var(--tinta); }
.chip img { height: 13px; width: auto; }
.oferta { padding: 12px 12px 13px; margin-bottom: 14px; }
.oferta .cab { display: grid; grid-template-columns: 38px 1fr; gap: 11px; align-items: start; }
.d { font-size: 15px; color: var(--texto2); margin-top: 4px; line-height: 1.3; }
.oferta .pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.oferta .pie .meta { margin-top: 0; }
.etq {
  font-family: var(--f-pixel); font-weight: 700; font-size: 12px;
  padding: 5px 6px; border-radius: 4px;
  background: #0b1240; border: 1px solid var(--borde-in); color: var(--texto2);
  text-shadow: none;
}
.etq.rec { color: var(--oro); border-color: var(--oro); }
.pasos { margin: 10px 0 0; padding: 0 0 0 49px; font-size: 14px; color: var(--texto2); display: grid; gap: 3px; }
.pasos li::marker { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--oro); }
.vacio { text-align: center; padding: 22px 16px; }
.vacio p { color: var(--texto2); margin: 10px 0 16px; }

/* ── Jefes ── */
.jefe { display: grid; grid-template-columns: 98px 1fr; gap: 13px; align-items: center; margin-bottom: 16px; cursor: pointer; }
.jefe .spr, .spr-grande {
  position: relative;
  width: 98px; height: 98px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 72%, #3a2470, #0b0f30 72%);
  border: 2px solid var(--borde-in);
  border-radius: 8px;
  overflow: hidden;
}
.jefe .spr img { animation: flotar 2.4s steps(4) infinite; }
.spr-grande { width: 150px; height: 150px; margin: 4px auto 12px; }
.spr-grande img { animation: flotar 2.4s steps(4) infinite; }
@keyframes flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.nomjefe { font-family: var(--f-pixel); font-weight: 700; font-size: 15px; line-height: 1.5; }
.nvj { color: var(--oro); }
.hab { font-size: 14px; color: var(--texto2); margin: 3px 0 7px; }
.jefe .barra { grid-template-columns: 26px 1fr auto; }
.derrotado .spr img, .derrotado .spr-grande img { filter: grayscale(1) brightness(.55); animation: none; transform: rotate(-12deg) translateY(8px); }
.sello {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: #fff;
  background: var(--rojo, #e3121b);
  border: 2px solid #fff; box-shadow: 0 0 0 2px var(--tinta);
  padding: 5px 6px; white-space: nowrap;
}
.jefe.dormido { filter: saturate(.4); }
.jefe.dormido .spr img { animation: none; opacity: .75; }

/* ── Tienda ── */
.bolsa { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bolsa .monto { display: flex; align-items: center; gap: 10px; font-family: var(--f-pixel); font-weight: 700; font-size: 26px; color: var(--oro); }
.premio { display: grid; grid-template-columns: 38px 1fr auto; gap: 11px; align-items: center; margin-bottom: 14px; padding: 11px 11px; }
.premio .costo { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-pixel); font-weight: 700; font-size: 14px; color: var(--oro); margin-top: 6px; }
.premio .costo img { width: 11px; height: 11px; }
.historial { display: grid; gap: 8px; font-size: 15px; }
.historial .fila { display: flex; justify-content: space-between; gap: 10px; color: var(--texto2); }
.historial .fila b { font-weight: 500; color: #fff; }

/* ── Héroe ── */
.ficha { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.ficha .retrato { width: 128px; height: 168px; }
.ficha .nombre { font-size: 13px; white-space: normal; }
.attr { display: grid; grid-template-columns: 38px 1fr; gap: 11px; align-items: center; margin-bottom: 13px; }
.attr:last-child { margin-bottom: 0; }
.attr .cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.attr .nm { font-family: var(--f-pixel); font-weight: 700; font-size: 14px; }
.attr .nv { font-family: var(--f-pixel); font-weight: 700; font-size: 14px; color: var(--oro); }
.attr .sub { font-size: 13px; color: var(--texto2); margin: 2px 0 5px; }
.attr .barra { grid-template-columns: 1fr auto; }
.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.numero { background: rgba(5, 8, 40, .45); border: 2px solid var(--borde-in); border-radius: 7px; padding: 10px; }
.numero b { display: block; font-family: var(--f-pixel); font-weight: 700; font-size: 20px; color: var(--oro); margin-bottom: 6px; }
.numero span { font-size: 14px; color: var(--texto2); }
.calendario { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.calendario i { aspect-ratio: 1; background: #0a1038; border: 1px solid #2a3486; border-radius: 2px; }
.calendario i.n1 { background: #1f6a3a; }
.calendario i.n2 { background: #2fa055; }
.calendario i.n3 { background: #4ce06a; }
.calendario i.n4 { background: #b4ffc6; }
.calendario i.hoy { box-shadow: 0 0 0 2px var(--oro); }
.leyenda { display: flex; justify-content: space-between; font-size: 13px; color: var(--texto2); margin-top: 8px; }
.titulos { display: flex; flex-wrap: wrap; gap: 8px; }
.titulo-chip { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--oro); border: 2px solid var(--oro); border-radius: 6px; padding: 7px 8px; background: rgba(0, 0, 0, .25); }
.renglones { display: grid; gap: 9px; font-size: 15px; }
.renglon { display: grid; grid-template-columns: 20px 1fr auto; gap: 9px; align-items: center; }
.renglon img { max-width: 18px; height: auto; }
.renglon .r { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--xp); white-space: nowrap; }
.renglon .f { font-size: 13px; color: var(--apagado); }
.ajuste { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 2px dashed rgba(125, 136, 220, .45); }
.ajuste:last-child { border-bottom: 0; }
.ajuste .tx { font-size: 16px; }
.ajuste .tx small { display: block; color: var(--texto2); font-size: 13px; }
.pie-app { text-align: center; color: var(--apagado); font-size: 13px; margin-top: 22px; }

/* ── Formularios ── */
.campo { display: grid; gap: 7px; margin-bottom: 16px; }
.campo > span { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--oro); }
input[type=text], input[type=number], textarea, select {
  font: inherit; font-size: 17px; color: #fff;
  background: var(--hondo);
  border: 2px solid var(--borde-in); border-radius: 7px;
  padding: 11px 12px; width: 100%;
  text-shadow: none;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.35; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--oro); box-shadow: 0 0 0 2px var(--tinta); }
.opciones { display: flex; flex-wrap: wrap; gap: 7px; }
.opcion {
  font-family: var(--f-pixel); font-weight: 700; font-size: 13px; line-height: 1.3;
  color: var(--texto2);
  background: var(--hondo);
  border: 2px solid var(--borde-in); border-radius: 7px;
  padding: 10px 10px;
  display: inline-flex; align-items: center; gap: 7px;
  text-shadow: 1px 1px 0 var(--tinta);
}
.opcion img { height: 14px; width: auto; }
.opcion.on { color: #fff; border-color: var(--oro); background: #2a3192; box-shadow: 0 0 0 2px var(--tinta); }
.opciones.dias .opcion { width: 38px; justify-content: center; padding: 10px 0; }

/* ── Capas (hojas y diálogos) ── */
#capa { position: fixed; inset: 0; z-index: 50; display: none; }
#capa.abierta { display: block; }
.velo { position: absolute; inset: 0; background: rgba(4, 6, 24, .74); }
.hoja {
  position: absolute; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(540px, 100%);
  max-height: 90vh; overflow-y: auto; overscroll-behavior: contain;
  border-bottom: 0; border-radius: 12px 12px 0 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 22px);
  animation: subir .2s steps(4);
}
@keyframes subir { from { transform: translate(-50%, 25%); } to { transform: translate(-50%, 0); } }
.dialogo {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100% - 32px));
  max-height: 88vh; overflow-y: auto;
  text-align: center;
  padding: 20px 18px 20px;
  animation: aparecer .2s steps(4);
}
@keyframes aparecer { from { transform: translate(-50%, -50%) scale(.85); } to { transform: translate(-50%, -50%) scale(1); } }
.cerrar {
  position: absolute; right: 10px; top: 10px;
  width: 38px; height: 38px; padding: 0;
  border-radius: 8px; border: 2px solid var(--borde-in);
  background: var(--hondo);
  font-family: var(--f-pixel); font-weight: 700; font-size: 16px;
}
.hoja h2, .dialogo h2 { font-family: var(--f-pixel); font-weight: 700; font-size: 19px; line-height: 1.5; margin: 2px 46px 10px 0; color: #fff; }
.dialogo h2 { margin: 6px 0 12px; }
.hoja .t-grande { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 6px 44px 8px 0; }
.lista-pasos { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.lista-pasos li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; font-size: 16px; }
.lista-pasos li.ok { color: var(--apagado); text-decoration: line-through; }
.lista-pasos li.ya { color: #fff; font-weight: 600; }
.lista-pasos .n { font-family: var(--f-pixel); font-weight: 700; font-size: 13px; color: var(--oro); }
.caja { background: rgba(5, 8, 40, .45); border: 2px solid var(--borde-in); border-radius: 8px; padding: 11px 12px; margin-top: 12px; }
.grande { font-family: var(--f-pixel); font-weight: 700; font-size: 24px; color: var(--oro); line-height: 1.5; }
.logo { font-family: var(--f-pixel); font-weight: 700; font-size: 60px; color: var(--oro); text-shadow: 3px 3px 0 #b05a00, 6px 6px 0 var(--tinta); letter-spacing: .06em; margin: 6px 0 4px; }
.logo-sub { font-family: var(--f-pixel); font-weight: 700; font-size: 14px; color: #fff; letter-spacing: .12em; }
.retrato-centro { margin: 16px auto 12px; width: 120px; height: 146px; }
.rayos { position: relative; overflow: hidden; }
.rayos::before {
  content: ''; position: absolute; left: 50%; top: 42%; width: 760px; height: 760px; margin: -380px 0 0 -380px;
  background: repeating-conic-gradient(rgba(255, 212, 71, .16) 0 9deg, transparent 9deg 18deg);
  animation: girar 14s linear infinite; pointer-events: none;
}
.rayos > * { position: relative; }
@keyframes girar { to { transform: rotate(360deg); } }
.parpadeo { animation: parpadeo 1s steps(2) infinite; }
@keyframes parpadeo { 50% { opacity: .55; } }

/* ── Efectos ── */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.flot {
  position: absolute;
  font-family: var(--f-pixel); font-weight: 700; font-size: 16px; white-space: nowrap;
  text-shadow: 2px 2px 0 var(--tinta), -1px -1px 0 var(--tinta);
  transform: translate(-50%, 0);
  animation: subir-fx 1.2s steps(12) forwards;
}
@keyframes subir-fx {
  0% { transform: translate(-50%, 6px); opacity: 0; }
  12% { transform: translate(-50%, 0); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -64px); opacity: 0; }
}
.chispa { position: absolute; width: 6px; height: 6px; background: #fff; box-shadow: 0 0 0 2px var(--oro); animation: chispa .65s steps(6) forwards; }
@keyframes chispa { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.temblor { animation: temblor .32s steps(4); }
@keyframes temblor { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.aviso {
  position: fixed; left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  z-index: 90;
  width: max-content; max-width: calc(100% - 32px);
  padding: 11px 14px;
  font-size: 15px; text-align: center;
  animation: aparecer-aviso .18s steps(3);
}
@keyframes aparecer-aviso { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* tapa lo que se asoma arriba de la barra de estado al hacer scroll (celular) */
#estado::before {
  content: '';
  position: absolute;
  left: -20px; right: -20px;
  bottom: 100%;
  height: calc(env(safe-area-inset-top) + 14px);
  margin-bottom: 6px;
  background: var(--fondo);
  pointer-events: none;
}

/* ── Columnas (en celular el lado se acomoda solo; en PC es una barra fija) ── */
#lado { display: contents; }
.rejilla { display: block; }

/* ── PC y tablet en horizontal ── */
@media (min-width: 900px) {
  body { font-size: 17px; }
  #app {
    max-width: 1240px;
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    column-gap: 34px;
    align-items: start;
    padding: 28px 32px 56px;
  }
  #lado { display: block; position: sticky; top: 24px; }
  #estado { position: static; margin: 0 0 22px; }
  #estado::before { display: none; }
  #nav {
    position: static;
    padding: 10px;
    border: 3px solid var(--borde);
    border-radius: 9px;
    background: linear-gradient(180deg, var(--win-a) 0%, var(--win-b) 55%, var(--win-c) 100%);
    box-shadow: 0 0 0 3px var(--tinta), inset 0 0 0 2px var(--borde-in), 0 8px 0 2px rgba(0, 0, 0, .35);
  }
  #nav .dentro { grid-template-columns: 1fr; gap: 6px; }
  #nav button {
    grid-auto-flow: column; grid-template-columns: 34px 1fr;
    justify-items: start; align-items: center;
    min-height: 50px; padding: 8px 16px;
    font-size: 16px; text-align: left;
  }
  #nav button img { justify-self: center; }
  #nav button.activo::after {
    top: 50%; left: -3px; margin: -6px 0 0;
    border: 6px solid transparent; border-left-color: var(--oro); border-right: 0;
    animation: cursor-lado 1s steps(2) infinite;
  }
  @keyframes cursor-lado { 50% { transform: translateX(3px); } }
  #vista { min-width: 0; }
  .rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; align-items: start; }
  .escena img { max-height: 300px; object-fit: cover; object-position: 50% 70%; }
  .chips { margin: 0; padding: 4px 2px 12px; flex-wrap: wrap; }
  .hoja {
    top: 50%; bottom: auto;
    width: min(640px, calc(100% - 48px));
    max-height: 86vh;
    border-bottom: 3px solid var(--borde); border-radius: 12px;
    transform: translate(-50%, -50%);
    animation: aparecer .2s steps(4);
  }
  .aviso { bottom: 32px; }
}
