:root {
  --fondo: #14211a;
  --panel: #1d3024;
  --panel2: #29432f;
  --borde: #41614a;
  --texto: #f4f0e3;
  --suave: #bccbb0;
  --acento: #e0556b;
  --acento2: #f2b53a;
  --radio: 10px;
  --titulo: "Fredoka", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto);
  background: var(--fondo);
}

/* Fondo: la foto del jardín fija, con un velo encima para que se lea el texto */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background: url("../assets/fondo.jpg") center / cover no-repeat;
}
/* Inicio: el velo oscurece la izquierda (donde va el texto) y deja ver a Makka Pakka */
body::after {
  background: linear-gradient(90deg, rgba(12, 26, 14, .88) 0%, rgba(12, 26, 14, .66) 30%, rgba(12, 26, 14, .08) 56%, rgba(12, 26, 14, 0) 100%);
}
/* Dentro de un juego: velo uniforme y fondo desenfocado */
body.en-juego::before { filter: blur(5px); transform: scale(1.04); }
body.en-juego::after { background: rgba(12, 26, 14, .74); }

h1, h2, .logo, .volver, .jugar, .bm-dato, .bm .bm-btn, .bm-niveles button, .pk .pk-btn { font-family: var(--titulo); }

a { color: inherit; text-decoration: none; }

/* ---------- Cabecera y pie ---------- */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--borde);
  background: rgba(20, 33, 26, .92);
  position: sticky;
  top: 0;
  z-index: 5;
}
.logo { font-weight: 600; font-size: 1.35rem; }
.volver {
  color: var(--suave);
  font-size: .95rem;
  padding: 6px 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
}
.volver:hover { color: var(--texto); border-color: var(--suave); }

.app { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 16px 40px; }

.pie { text-align: center; color: var(--texto); font-size: .85rem; padding: 18px; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }

/* ---------- Inicio / selector ---------- */
.inicio { max-width: 460px; margin-left: 0; }
.inicio h1 { margin: 12px 0 6px; font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 600; line-height: 1.05; }
.inicio .sub { margin: 0 0 24px; color: var(--texto); }

.rejilla { display: flex; flex-direction: column; gap: 12px; }

.tarjeta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(29, 48, 36, .93);
  border: 1px solid var(--borde);
  border-radius: 18px 18px 18px 6px;
  transition: background .15s ease, border-color .15s ease;
}
.tarjeta:hover, .tarjeta:focus-visible {
  background: var(--panel2);
  border-color: var(--acento2);
  outline: none;
}
.tarjeta h2 { margin: 0 0 2px; font-size: 1.25rem; font-weight: 600; }
.tarjeta p { margin: 0 0 6px; color: var(--suave); font-size: .92rem; line-height: 1.35; }
.tarjeta .jugar { color: var(--acento2); font-weight: 500; font-size: .95rem; }
.tarjeta:hover .jugar { text-decoration: underline; text-underline-offset: 3px; }

/* Pompón de colores, como las bolas del jardín */
.bola {
  --c: #e0556b;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .4) 0 10%, transparent 11%),
    radial-gradient(circle, rgba(255, 255, 255, .5) 1.6px, transparent 2px) 0 0 / 10px 10px,
    var(--c);
}
.tarjeta:nth-child(2) .bola { --c: #f2b53a; }
.tarjeta:nth-child(3) .bola { --c: #5aa0a8; }
.tarjeta:nth-child(4) .bola { --c: #9a6ec0; }

/* En el inicio el contenido va pegado a la izquierda para dejar libre a Makka Pakka */
body:not(.en-juego) .app { max-width: none; margin: 0; padding-left: clamp(16px, 5vw, 80px); }

@media (max-width: 900px) {
  body::after { background: rgba(12, 26, 14, .72); }
  .inicio { max-width: none; }
}
@media (max-width: 900px) {
  body:not(.en-juego) .app { padding-right: 16px; }
}

/* ---------- Vista de juego ---------- */
.vista-juego h1 { margin: 0 0 16px; font-size: 1.9rem; font-weight: 600; }

/* ---------- Buscaminas ---------- */
.bm { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.bm-niveles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.bm button, .bm input {
  font: inherit;
  color: var(--texto);
}
.bm-niveles button, .bm-btn {
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  cursor: pointer;
}
.bm-niveles button:hover, .bm-btn:hover { border-color: var(--suave); }
.bm-niveles button.activo { background: var(--acento); border-color: var(--acento); color: #fff; font-weight: 700; }

.bm-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 14px;
  background: rgba(29, 48, 36, .93);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
}
.bm-custom[hidden] { display: none; }
.bm-custom label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--suave); }
.bm-custom input {
  width: 84px;
  padding: 7px 8px;
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 8px;
}
.bm-custom .bm-btn { background: var(--acento2); border-color: var(--acento2); color: #1a1a1a; font-weight: 700; }

.bm-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  background: rgba(29, 48, 36, .93);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
}
.bm-dato {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 82px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.3rem;
}
.bm-dato img, .bm-dato .fb { width: 26px; height: 26px; object-fit: contain; }

/* Iconos dibujados con CSS mientras no haya pokeball.png / voltorb.png */
.fb { display: block; border-radius: 50%; }
.fb-bandera {
  background:
    radial-gradient(circle, #f4f0e3 0 14%, #222 15% 24%, transparent 25%),
    linear-gradient(#e0556b 0 44%, #222 44% 56%, #f4f0e3 56%);
}
.fb-mina {
  background:
    radial-gradient(circle, #f2b53a 0 22%, transparent 23%),
    #2a2a2a;
  box-shadow: inset 0 0 0 3px #e0556b;
}
.bm-cara { font-size: 1rem; padding: 6px 14px; }
.bm-etiqueta { font-weight: 500; font-size: .95rem; color: var(--suave); }
.bm-modo.activo { background: var(--acento2); border-color: var(--acento2); color: #1a1a1a; font-weight: 700; }

.bm-tablero-wrap {
  max-width: 100%;
  overflow: auto;
  padding: 10px;
  background: rgba(29, 48, 36, .93);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
}

.bm-tablero {
  --tam: 32px;
  display: grid;
  gap: 2px;
  width: max-content;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.bm-tablero.sacudir { animation: sacudir .45s ease; }

.celda {
  width: var(--tam);
  height: var(--tam);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: calc(var(--tam) * .55);
  border-radius: 5px;
  cursor: pointer;
}
.celda img, .celda .fb { width: 82%; height: 82%; object-fit: contain; pointer-events: none; display: block; }

.celda.cerrada { background: var(--panel2); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08); }
.celda.cerrada:hover { background: #34533b; }
.celda.abierta { background: #0d1710; cursor: default; }
.celda.explotada { background: var(--acento); }
.celda.error { background: #5e2a35; }

.celda.n1 { color: #4da3ff; }
.celda.n2 { color: #4ecb71; }
.celda.n3 { color: #ff6b6b; }
.celda.n4 { color: #b388ff; }
.celda.n5 { color: #ff9f43; }
.celda.n6 { color: #1dd3c4; }
.celda.n7 { color: #e8ebf5; }
.celda.n8 { color: #9aa3c0; }

.bm-mensaje { min-height: 1.4em; margin: 0; color: var(--suave); text-align: center; }
.bm-mensaje.gana { color: #4ecb71; font-weight: 700; }
.bm-mensaje.pierde { color: var(--acento); font-weight: 700; }

@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@media (max-width: 600px) {
  .bm-tablero { --tam: 28px; }
  .app { padding-top: 18px; }
}

/* ---------- Pokédle ---------- */
.pk { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pk-estado { color: var(--suave); text-align: center; padding: 30px 0; }
.pk-juego { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pk-juego[hidden], .pk-fin[hidden], .pk-silueta[hidden], .pk-sug[hidden] { display: none; }
.pk button, .pk input, .pk select { font: inherit; color: var(--texto); }

.pk-barra {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between;
  width: 100%; max-width: 640px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
}
.pk-barra label { color: var(--suave); font-size: .9rem; }
.pk-barra select { margin-left: 6px; padding: 5px 8px; background: var(--fondo); border: 1px solid var(--borde); border-radius: 8px; }
.pk-stats { font-size: .9rem; font-weight: 700; }

.pk-entrada { position: relative; width: 100%; max-width: 640px; }
.pk-input {
  width: 100%; padding: 12px 16px; font-size: 1.05rem;
  background: var(--panel); border: 2px solid var(--borde); border-radius: var(--radio);
}
.pk-input:focus { outline: none; border-color: var(--acento2); }
.pk-input:disabled { opacity: .5; }

.pk-sug {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 4; margin: 0; padding: 4px; list-style: none;
  background: var(--panel2); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.pk-sug li { display: flex; align-items: center; gap: 10px; padding: 4px 10px; border-radius: 10px; cursor: pointer; }
.pk-sug li.sel, .pk-sug li:hover { background: var(--borde); }
.pk-sug img { width: 44px; height: 44px; image-rendering: pixelated; object-fit: contain; }
.pk-sug span { flex: 1; font-weight: 700; }
.pk-sug small { color: var(--suave); }

.pk-acciones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pk-btn {
  padding: 8px 14px; background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); cursor: pointer;
}
.pk-btn:hover:not(:disabled) { border-color: var(--suave); }
.pk-btn:disabled { opacity: .45; cursor: default; }
.pk-primario { background: var(--acento2); border-color: var(--acento2); color: #1a1a1a; font-weight: 800; }
.pk-primario:hover { border-color: #fff; }

.pk-silueta, .pk-fin {
  display: flex; align-items: center; gap: 16px; width: 100%; max-width: 640px; padding: 14px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
}
.pk-silueta { flex-direction: column; text-align: center; }
.pk-silueta img { width: 150px; height: 150px; object-fit: contain; filter: brightness(0); }
.pk-silueta p { margin: 0; color: var(--suave); }
.pk-fin img { width: 150px; height: 150px; object-fit: contain; flex: none; animation: aparece .5s ease; }
.pk-fin h2 { margin: 0 0 4px; }
.pk-fin h2 small { color: var(--suave); font-weight: 400; }
.pk-fin p { margin: 0 0 12px; color: var(--suave); }
.pk-fin.gana { border-color: #4ecb71; }
.pk-fin.pierde { border-color: var(--acento); }

.pk-tabla-wrap { width: 100%; overflow-x: auto; padding-bottom: 6px; }
.pk-tabla { display: flex; flex-direction: column; gap: 6px; width: max-content; min-width: 100%; margin: 0 auto; }
.pk-fila { display: grid; grid-template-columns: 150px repeat(7, 92px); gap: 6px; }
.pk-cab .pk-c { min-height: 0; background: none; color: var(--suave); font-size: .8rem; }

.pk-c {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 78px; padding: 4px; border-radius: 10px; background: var(--panel2);
  font-weight: 700; font-size: .85rem; line-height: 1.15;
}
.pk-fila:not(.pk-cab) .pk-c:not(.pk-nom) { opacity: 0; animation: voltea .45s ease forwards; }
.pk-c.ok { background: #2e8b4f; color: #fff; }
.pk-c.parcial { background: #c98a1b; color: #fff; }
.pk-c.mal { background: #a83246; color: #fff; }
.pk-c .fl { display: block; font-size: 1.1rem; margin-top: 2px; }
.pk-nom { flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--borde); }
.pk-nom img { width: 56px; height: 56px; image-rendering: pixelated; object-fit: contain; }
.pk-tipo { display: inline-block; padding: 3px 8px; border-radius: 999px; font-style: normal; font-size: .78rem; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }

@keyframes voltea { from { opacity: 0; transform: rotateX(90deg); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 600px) {
  .pk-fin { flex-direction: column; text-align: center; }
  .pk-fila { grid-template-columns: 110px repeat(7, 80px); }
}

/* ---------- Pokédoku ---------- */
.pd-info { font-weight: 700; font-size: .95rem; }
.pd-grid {
  --tam: 112px;
  display: grid; grid-template-columns: 96px repeat(3, var(--tam)); gap: 6px;
  max-width: 100%; padding: 10px; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
}
.pd-cab {
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 56px; padding: 4px; font-weight: 800; font-size: .85rem; line-height: 1.15;
  background: var(--panel2); border-radius: 10px;
}
.pd-punto { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); flex: none; }
.pd-celda {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: var(--tam); height: var(--tam); padding: 4px; font: inherit; font-size: .75rem; font-weight: 700; color: #fff;
  background: var(--fondo); border: 2px dashed var(--borde); border-radius: 12px; cursor: pointer;
}
.pd-celda:hover:not(:disabled) { border-color: var(--suave); }
.pd-celda.activa { border-style: solid; border-color: var(--acento2); box-shadow: 0 0 0 3px rgba(255, 203, 61, .25); }
.pd-celda.ok { background: #2e8b4f; border: 2px solid #4ecb71; cursor: default; animation: aparece .35s ease; }
.pd-celda.revelada { background: var(--panel2); border-color: var(--borde); opacity: .6; }
.pd-celda.revelada img { filter: grayscale(1); }
.pd-celda img { width: 68px; height: 68px; image-rendering: pixelated; object-fit: contain; }
.pd-celda.mal { animation: sacudir .45s ease; border-color: var(--acento); }
.pd-msg { min-height: 1.4em; margin: 0; text-align: center; color: var(--suave); }
.pd-msg.gana { color: #4ecb71; font-weight: 700; }
.pd-msg.pierde { color: var(--acento); font-weight: 700; }

@media (max-width: 600px) {
  .pd-grid { --tam: 84px; grid-template-columns: 70px repeat(3, var(--tam)); gap: 4px; }
  .pd-cab { font-size: .72rem; }
  .pd-celda img { width: 50px; height: 50px; }
  .pd-celda { font-size: .65rem; }
}

/* ---------- Serpiente ---------- */
.sp { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sp button, .sp select, .sp .sp-subir {
  font: inherit; color: var(--texto); background: var(--panel);
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 7px 14px; cursor: pointer;
}
.sp button:hover, .sp .sp-subir:hover { border-color: var(--suave); }
.sp-modos { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sp-modos button { font-family: var(--titulo); }
.sp-modos button.on { background: var(--acento2); border-color: var(--acento2); color: #2a2208; }
.sp-hud { display: flex; gap: 22px; font-family: var(--titulo); }
.sp-hud b { color: var(--acento2); font-weight: 600; margin-left: 4px; }
.sp-lienzo { position: relative; width: min(100%, 540px); touch-action: none; }
.sp-lienzo canvas { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--borde); }
.sp-vel {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 20px; text-align: center; border-radius: 14px; cursor: pointer;
  background: rgba(12, 26, 14, .62); font-family: var(--titulo); font-size: 1.3rem;
}
.sp-vel[hidden] { display: none; }
.sp-vel small { font-family: "Nunito", system-ui, sans-serif; font-size: .95rem; color: var(--suave); }
.sp-ayuda, .sp-aviso { margin: 0; color: var(--suave); font-size: .9rem; text-align: center; }
.sp-aviso:empty { display: none; }
.sp-panel {
  width: min(100%, 540px); display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: rgba(29, 48, 36, .93); border: 1px solid var(--borde); border-radius: 18px 18px 18px 6px;
}
.sp-panel h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.sp-skins { display: flex; flex-wrap: wrap; gap: 12px; }
.sp .sp-skin { position: relative; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 3px solid var(--borde); }
.sp-skin img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.sp .sp-skin.on { border-color: var(--acento2); box-shadow: 0 0 0 3px rgba(242, 181, 58, .3); }
.sp-x {
  position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--acento); color: #fff; font-size: .85rem; line-height: 20px; text-align: center;
}
.sp .sp-subir { align-self: flex-start; font-family: var(--titulo); }
.sp-opc { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.sp-opc label { display: flex; align-items: center; gap: 8px; color: var(--suave); font-size: .92rem; }
.sp-opc input[type=color] { width: 38px; height: 30px; padding: 0; background: none; border: 1px solid var(--borde); border-radius: 8px; }
.sp-skins { gap: 14px 10px; }
.sp-it { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 66px; }
.sp .sp-skin { background-size: cover; background-position: center; flex: none; }
.sp-ini { font-family: var(--titulo); font-size: 1.3rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.sp-nom { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; color: var(--suave); }
.sp-quien { margin: 0; font-family: var(--titulo); font-size: 1rem; }
.sp-modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 18, 10, .85); }
.sp-caja { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 340px); padding: 18px; background: var(--panel); border: 1px solid var(--borde); border-radius: 18px 18px 18px 6px; }
.sp-caja p { margin: 0; font-family: var(--titulo); text-align: center; overflow-wrap: anywhere; }
.sp-caja canvas { width: 280px; max-width: 100%; height: auto; border-radius: 12px; background: #0c1a0e; cursor: grab; touch-action: none; }
.sp-caja input[type=range] { width: 100%; accent-color: var(--acento2); }
.sp-bt { display: flex; gap: 10px; }
.sp-bt button { font: inherit; font-family: var(--titulo); color: var(--texto); background: var(--panel2); border: 1px solid var(--borde); border-radius: var(--radio); padding: 7px 18px; cursor: pointer; }
.sp-bt .si { background: var(--acento2); border-color: var(--acento2); color: #2a2208; }
.sp-acc { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sp .sp-acc .sp-subir { align-self: auto; }
.sp .sp-subir.off { opacity: .45; cursor: not-allowed; pointer-events: none; }
.sp .sp-ajustar { font-family: var(--titulo); }
.sp-bt { flex-wrap: wrap; justify-content: center; }
.sp-bt { gap: 8px; }
.sp-bt button { padding: 7px 11px; }

/* ---------- Inicio de sesión ---------- */
.der { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.usuario { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--suave); }
.usuario[hidden], .volver[hidden] { display: none; }
#usuario-nombre { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sync.mal { color: var(--acento); }
.usuario button, .login-btn {
  font: inherit; font-family: var(--titulo); color: var(--texto); background: var(--panel2);
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 6px 14px; cursor: pointer;
}
.usuario button:hover, .login-btn:hover { border-color: var(--suave); }
.login { max-width: 360px; margin: 8vh auto 0; padding: 26px 22px; text-align: center; background: rgba(12, 26, 14, .82); border: 1px solid var(--borde); border-radius: 16px; }
.login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-form input {
  font: inherit; color: var(--texto); background: rgba(12, 26, 14, .7);
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 11px 12px;
}
.login-form input:focus { outline: none; border-color: var(--acento2); }
.login-btn { padding: 11px 14px; background: var(--acento2); color: #2a1f05; border-color: var(--acento2); font-weight: 600; }
.login-btn:hover { filter: brightness(1.08); }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-err { min-height: 1.2em; margin: 0; color: var(--acento); font-size: .9rem; }

.sp-skin .sp-foto { display: block; width: 100%; height: 100%; border-radius: 50%; }

/* ---------- 2048 con fotos ---------- */
.g48 .sp-hud { flex-wrap: wrap; justify-content: center; align-items: center; }
.g48-tablero { aspect-ratio: 1; padding: 0; border-radius: 14px; background: #183021; border: 1px solid var(--borde); overflow: hidden; }
.g48-celdas, .g48-fichas { position: absolute; inset: 1.6%; }
.g48-celdas { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.g48-celdas i { margin: 1.4%; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.g48-f {
  position: absolute; left: 0; top: 0; width: 25%; height: 25%; padding: 1.4%;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%)); transition: transform .12s ease-out;
}
.g48-c {
  position: relative; width: 100%; height: 100%; border-radius: 10px; overflow: hidden;
  background: hsl(var(--tono, 120) 45% 30%); box-shadow: 0 3px 8px rgba(0, 0, 0, .4);
}
.g48-c img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; user-select: none; pointer-events: none; }
.g48-c img.ok { opacity: 1; }
.g48-n {
  position: absolute; right: 5%; bottom: 5%; padding: 1px 8px; border-radius: 999px; color: #fff;
  font-family: var(--titulo); font-weight: 600; font-size: clamp(.7rem, 3.2vw, 1.15rem); line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.sin-num .g48-n { display: none; }
.g48-c.nuevo { animation: g48-pop .18s .1s ease-out backwards; }
.g48-c.fusion { animation: g48-fus .2s .08s ease-out; }
@keyframes g48-pop { from { transform: scale(0); } }
@keyframes g48-fus { 50% { transform: scale(1.14); } }
.g48-op { color: var(--suave); font-size: .92rem; display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* ---------- Glyph (palabra del día / ilimitado) ---------- */
.gl { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 460px; margin: 0 auto; }
.gl-modos { display: flex; gap: 8px; }
.gl-modos button, .gl-btn, .gl-tecla { font-family: var(--titulo); color: var(--texto); background: var(--panel2); border: 1px solid var(--borde); border-radius: var(--radio); cursor: pointer; touch-action: manipulation; }
.gl-modos button { padding: 7px 16px; }
.gl-modos button.activo { background: var(--acento2); border-color: var(--acento2); color: #2a1f05; font-weight: 600; }
.gl-info { margin: 0; color: var(--suave); font-size: .88rem; text-align: center; }
.gl-msg { min-height: 1.4em; margin: 0; text-align: center; font-weight: 700; white-space: pre-line; }

.gl-tablero { display: grid; gap: 6px; width: min(100%, 320px); }
.gl-fila { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gl-c {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-family: var(--titulo); font-weight: 600; font-size: clamp(1.5rem, 8vw, 2rem); line-height: 1;
  border: 2px solid var(--borde); border-radius: 8px; background: rgba(0, 0, 0, .18); user-select: none;
}
.gl-c.lleno { border-color: var(--suave); animation: gl-pop .1s ease-out; }
.gl-c.fija { color: #fff; border-color: transparent; }
.gl-c.fija.ok { background: #2e8b4f; }
.gl-c.fija.pres { background: #b8891f; }
.gl-c.fija.no { background: #3a4a40; }
.gl-c.gira { animation: gl-gira .5s ease-in-out backwards; }
.gl-fila.sacude { animation: sacudir .45s ease; }
@keyframes gl-pop { 50% { transform: scale(1.1); } }
@keyframes gl-gira { 0% { transform: scaleY(1); } 50% { transform: scaleY(0); } 100% { transform: scaleY(1); } }

.gl-teclado { display: grid; gap: 6px; width: 100%; }
.gl-tf { display: flex; gap: 5px; justify-content: center; }
.gl-tecla { flex: 1 1 0; max-width: 44px; height: 52px; padding: 0; font-size: 1rem; font-weight: 600; }
.gl-tecla.ancha { flex: 1.6 1 0; max-width: 70px; font-size: .8rem; }
.gl-tecla:hover { border-color: var(--suave); }
.gl-tecla.ok { background: #2e8b4f; border-color: #2e8b4f; }
.gl-tecla.pres { background: #b8891f; border-color: #b8891f; }
.gl-tecla.no { background: #26332b; border-color: #26332b; color: var(--suave); }

.gl-fin { width: 100%; padding: 16px; text-align: center; background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; }
.gl-fin.gana { border-color: #4ecb71; }
.gl-fin.pierde { border-color: var(--acento); }
.gl-fin.entra { animation: aparece .35s ease; }
.gl-fin h2 { margin: 0 0 4px; font-size: 1.3rem; }
.gl-fin h2 b { color: var(--acento2); letter-spacing: .08em; }
.gl-fin p { margin: 0 0 12px; color: var(--suave); }
.gl-stats { display: flex; justify-content: space-around; gap: 6px; margin-bottom: 12px; }
.gl-stats div { display: flex; flex-direction: column; }
.gl-stats b { font-family: var(--titulo); font-size: 1.4rem; font-weight: 600; }
.gl-stats span { font-size: .72rem; color: var(--suave); }
.gl-dist { display: grid; gap: 3px; margin-bottom: 12px; }
.gl-barra { display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.gl-barra span { width: 1em; text-align: right; color: var(--suave); }
.gl-barra i { font-style: normal; min-width: 1.6em; padding: 1px 6px; text-align: right; background: #3a4a40; border-radius: 4px; font-weight: 700; }
.gl-barra i.esta { background: #2e8b4f; }
.gl-cuenta { margin: 0 0 10px; }
.gl-cuenta b { color: var(--acento2); font-family: var(--titulo); font-variant-numeric: tabular-nums; }
.gl-btn { padding: 9px 20px; }
.gl-btn:hover { border-color: var(--suave); }
.gl-primario { background: var(--acento2); border-color: var(--acento2); color: #2a1f05; font-weight: 600; }

@media (max-width: 420px) {
  .gl-tecla { height: 48px; font-size: .9rem; }
  .gl-tf { gap: 4px; }
}
.tarjeta:nth-child(5) .bola { --c: #4ecb71; }
.tarjeta:nth-child(6) .bola { --c: #e8834a; }

/* Glyph: paneles de glifos */
.gl-glifos { display: flex; gap: 12px; width: 100%; justify-content: center; }
.gl-glifos figure { margin: 0; flex: 1 1 0; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gl-glifos figcaption { padding: 2px 12px; font-family: var(--titulo); font-size: .8rem; font-weight: 600; background: var(--panel); border: 1px solid var(--borde); border-radius: 999px; }
.gl-lienzo { width: 100%; aspect-ratio: 1; padding: 8%; background: rgba(0, 0, 0, .28); border: 1px solid var(--borde); border-radius: 14px; }
.gl-lienzo svg { display: block; width: 100%; height: 100%; }
.gl-lienzo .pt circle { fill: rgba(255, 255, 255, .2); }
.gl-lienzo line { stroke-width: 8; stroke-linecap: round; }
.gl-lienzo line.bl { stroke: #fff; }
.gl-lienzo line.ok { stroke: #4ecb71; }
.gl-lienzo line.ex { stroke: var(--acento); }
.gl-lienzo line.fal { stroke: rgba(255, 255, 255, .22); }
