/* ============================================================
   PELAZÓN ETERNAL — Estilos Globales
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;   /* v31: altura real del viewport móvil (barra URL) */
  overflow: hidden;
  background: #0a0a14;
  font-family: Nunito, system-ui, sans-serif;
  color: #ffffff;
}

/* ---- Canvas principal ---- */
#gameCanvas {
  display: block;
  position: fixed;
  inset: 0;           /* top/right/bottom/left = 0 — ocupa TODO el viewport */
  width: 100vw;
  height: 100vh;
  width: 100dvw;    /* v31: móvil — sin franjas blancas por la barra URL */
  height: 100dvh;
  cursor: crosshair;
  z-index: 10;
  touch-action: none; /* evita scroll/zoom del browser durante el juego */
}

/* ---- Pantalla de Título ---- */
#titleScreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Portada oficial del juego (arte con título y controles) */
  /* v13: 'contain' muestra la imagen COMPLETA (un poco más pequeña),
     con marco oscuro elegante alrededor */
  background: url('portada_es.jpg') center center / contain no-repeat, #140f1e;
  z-index: 200;
  transition: opacity 0.35s ease;
}

/* (sin viñeta: la imagen de portada ya trae su propia iluminación) */

#titleContent {
  position: relative;
  z-index: 1;
}

#titleScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

#titleContent {
  text-align: center;
  max-width: 480px;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

#titleContent h1 {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
  color: #FF4444;
  text-shadow:
    0 0 20px rgba(255, 68, 68, 0.8),
    0 0 60px rgba(255, 68, 68, 0.4),
    4px 4px 0 #880000;
  margin-bottom: 8px;
}

#titleContent h1 span {
  color: #FFD700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.8),
    0 0 60px rgba(255, 215, 0, 0.3),
    4px 4px 0 #886600;
}

.subtitle {
  font-size: 15px;
  color: #aaaaaa;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.controls-hint {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 28px;
  text-align: left;
}

.controls-hint p {
  font-size: 14px;
  color: #cccccc;
  margin-bottom: 8px;
  line-height: 1.5;
}

.controls-hint p:last-child {
  margin-bottom: 0;
}

.controls-hint strong {
  color: #FFD700;
}

#startBtn {
  display: inline-block;
  padding: 14px 36px;
  font-size: 18px;
  font-weight: 700;
  color: #000;
  background: linear-gradient(135deg, #FFD700, #FF9900);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 0 30px rgba(255, 200, 0, 0.5);
  transition: transform 0.1s, box-shadow 0.2s;
}

#startBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(255, 200, 0, 0.8);
}

#startBtn:active {
  transform: scale(0.97);
}

/* ---- Animación de pulso en el título ---- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

#startBtn {
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================================
   OVERLAY "GIRA TU DISPOSITIVO"
   ============================================================ */
#rotateOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0a0a14;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
}

#rotateOverlay.visible {
  display: flex;
}

#rotateContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#rotateIcon {
  font-size: 64px;
  animation: rotateHint 1.6s ease-in-out infinite;
}

@keyframes rotateHint {
  0%,100% { transform: rotate(0deg); }
  45%, 55% { transform: rotate(90deg); }
}

#rotateContent p {
  font-size: 22px;
  font-weight: 700;
  color: #FFD700;
  margin: 0;
}

.rotateSub {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #888 !important;
}

/* ============================================================
   AJUSTES TÍTULO EN MÓVIL / LANDSCAPE PEQUEÑO
   ============================================================ */
@media (max-width: 600px), (max-height: 480px) {
  #titleContent h1    { font-size: 40px; }
  #titleContent       { padding: 16px 14px; max-width: 96vw; }
  .subtitle           { font-size: 12px; margin-bottom: 14px; }
  .controls-hint      { padding: 10px 12px; margin-bottom: 14px; }
  .controls-hint p    { font-size: 12px; margin-bottom: 5px; }
  #startBtn           { padding: 11px 24px; font-size: 15px; }
}

/* ============================================================
   PORTADA v3 — mascota, plumas flotantes y video
   ============================================================ */
#mascotCanvas {
  display: block;
  margin: 0 auto 4px auto;
  filter: drop-shadow(0 6px 18px rgba(255, 180, 60, 0.35));
}

/* Plumas y migas flotando de fondo en la portada */
.floaters {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.floaters span {
  position: absolute;
  top: -40px;
  font-size: 26px;
  opacity: 0.75;
  animation-name: floatDown;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes floatDown {
  0%   { transform: translateY(-40px)   rotate(0deg);   }
  100% { transform: translateY(110vh)   rotate(360deg); }
}

/* Pantalla del video intro */
#videoScreen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
#introVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#skipBtn {
  position: absolute;
  bottom: 28px;
  right: 28px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 1px;
}
#skipBtn:hover { background: rgba(255,255,255,0.15); }

/* Mascota más pequeña en pantallas bajas para que quepa todo */
@media (max-height: 700px) { #mascotCanvas { width: 150px; height: 150px; } }
@media (max-height: 540px) { #mascotCanvas { display: none; } }


/* ── Portada v13: imagen completa (contain) + botón centrado ── */
#titleContent {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 6vh 0;
  background: none;
  /* FIX: el #titleContent original traía max-width y empujaba el
     botón a la izquierda — aquí se anula para centrarlo de verdad */
  max-width: none;
  width: 100%;
  margin: 0;
}
#startBtn {
  animation: btnPulse 1.6s ease-in-out infinite;
  box-shadow: 0 6px 24px rgba(255, 150, 30, 0.55), 0 2px 0 rgba(0,0,0,0.35);
}
@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}


/* ══════════════════════════════════════════════════════════════
   CONFIGURACIÓN v13 — engranaje + panel de volúmenes
   ══════════════════════════════════════════════════════════════ */
#cfgBtn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 400;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(20, 15, 30, 0.65);
  color: #FFD966;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.2s;
}
#cfgBtn:hover { transform: rotate(45deg); background: rgba(40, 30, 60, 0.85); }

#cfgPanel {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 400;
  width: 240px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid rgba(255, 200, 80, 0.35);
  background: rgba(20, 14, 28, 0.92);
  color: #FFF3D8;
  font-family: Nunito, system-ui, sans-serif;
  display: none;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#cfgPanel.open { display: block; }
#cfgPanel h3 {
  margin: 0 0 12px 0;
  font-size: 15px;
  letter-spacing: 1px;
  color: #FFD966;
}
#cfgPanel label {
  display: block;
  font-size: 13px;
  margin: 10px 0 4px;
}
#cfgPanel input[type=range] {
  width: 100%;
  accent-color: #FFB020;
  cursor: pointer;
}


/* ══ v33 · TIENDA DE PLUMAS (overlay) — pergamino y madera ══ */
#shopBtn {
  display: block;
  margin: 14px auto 0;
  padding: 12px 26px;
  font-size: 17px;
  font-weight: 900;
  color: #4a2f00;
  background: linear-gradient(180deg, #FFD873, #FFC03A);
  border: 3px solid #8a5c00;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 0 #6b4700, 0 8px 18px rgba(0,0,0,0.45);
}
#shopBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #6b4700; }

#shopScreen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12,7,20,0.85);
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
           max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
#shopScreen.open { display: flex; }

#shopPanel {
  width: min(700px, 96vw);
  max-height: 94dvh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.35), transparent 55%),
    #F2E3C2;
  border: 4px solid #3E2716;
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px #FFC03A, inset 0 0 50px rgba(120,80,30,0.25),
              0 12px 34px rgba(0,0,0,0.65);
  padding: 14px;
  color: #2B1B10;
}
#shopHeader { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#shopHeader h2 {
  font-size: clamp(17px, 3.5vw, 24px);
  color: #3E2716;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}
#shopBalance {
  font-size: clamp(15px, 3vw, 20px);
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #6FD65B, #4CAF3E);
  border: 3px solid #2E7325;
  padding: 6px 16px;
  border-radius: 999px;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #2E7325;
}
#shopSub { font-size: 12px; font-weight: 700; color: #5C4630; margin: 6px 0 10px; }
#shopScroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.shopSection {
  font-size: 15px;
  font-weight: 900;
  color: #3E2716;
  margin: 10px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px dashed #8A5B33;
}
.skinPrev {
  width: 52px; height: 52px; flex-shrink: 0;
  display: block; background: none;
}
#shopList, #shopSkins {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#shopList {
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.shopItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FBF1D9;
  border: 2.5px solid #8A5B33;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 3px 0 rgba(107,68,38,0.35);
}
.shopItem.maxed { filter: saturate(0.55); opacity: 0.8; }
.shopName { font-size: 15px; font-weight: 900; color: #3E2716; }
.shopDesc { font-size: 12px; font-weight: 700; color: #5C4630; margin-top: 2px; }
.shopLvl  { font-size: 12px; font-weight: 900; color: #9a6a00; margin-top: 2px; }
.shopBuy {
  flex-shrink: 0;
  min-width: 84px;
  min-height: 52px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 900;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #FF7A6B, #D8372A 60%);
  border: 3px dashed rgba(255,255,255,0.75);
  outline: 3px solid #8E1E14;
  border-radius: 50%;
  cursor: pointer;
  text-shadow: 1px 1px 0 #8E1E14;
  box-shadow: 0 4px 0 #8E1E14, 0 6px 12px rgba(0,0,0,0.3);
}
.shopBuy:active { transform: translateY(3px) rotate(-4deg); box-shadow: 0 1px 0 #8E1E14; }
.shopBuy.off {
  background: radial-gradient(circle at 35% 30%, #b9ad98, #8d8271 60%);
  outline-color: #5c5546;
  box-shadow: 0 4px 0 #5c5546;
  color: #eee;
  text-shadow: none;
  cursor: not-allowed;
}
#shopPlayBtn {
  margin-top: 12px;
  min-height: 52px;
  font-size: 19px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #6FD65B, #4CAF3E);
  border: 3px solid #2E7325;
  border-radius: 12px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #2E7325;
  box-shadow: 0 4px 0 #2E7325;
}
#shopPlayBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2E7325; }
#shopCloseBtn {
  margin-top: 8px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 900;
  color: #F2E3C2;
  background: #6B4426;
  border: 3px solid #3E2716;
  border-radius: 12px;
  cursor: pointer;
}

/* v31 · En móvil apretado, la portada no debe recortar los botones */
@media (max-height: 480px) {
  #titleContent { padding: 10px; }
  #startBtn { padding: 12px 22px; font-size: 16px; }
  #shopBtn  { margin-top: 8px; padding: 9px 18px; font-size: 14px; }
}


/* v32 · Enlace al Modo Tienda (segunda ventana) */
#storeModeBtn {
  display: block;
  margin: 10px auto 0;
  width: fit-content;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #FFCC44;
  background: rgba(255,204,68,0.1);
  border: 1.5px solid rgba(255,204,68,0.55);
  border-radius: 10px;
  text-decoration: none;
}
#storeModeBtn:active { transform: scale(0.96); }


/* v33 · Pantallas cortas (móvil horizontal): tienda compacta */
@media (max-height: 520px) {
  #shopPanel { padding: 10px; max-height: 96dvh; max-height: 96vh; }
  #shopHeader h2 { font-size: 16px; }
  #shopSub { display: none; }
  .shopItem { padding: 7px 10px; gap: 8px; }
  .shopDesc { display: none; }
  .shopBuy { min-height: 44px; min-width: 70px; font-size: 13px; }
  .skinPrev { width: 40px; height: 40px; }
  #shopPlayBtn { min-height: 46px; margin-top: 8px; }
  #shopCloseBtn { min-height: 38px; margin-top: 6px; }
  #titleContent { padding: 6px; }
}


/* ══ v35 · MENÚ PRINCIPAL a pantalla completa (pergamino/madera) ══ */
#menuScreen {
  position: fixed; inset: 0; z-index: 400;
  display: none; flex-direction: column;
  background:
    linear-gradient(180deg, rgba(20,10,30,0.78), rgba(10,6,16,0.9)),
    url('portada.jpg') center / cover no-repeat;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
           max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
#menuScreen.open { display: flex; }

/* Cabecera: tostada + nivel flexible + usuario + créditos */
#menuTop {
  display: flex; align-items: center; gap: 12px;
  background: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.3), transparent 55%), #F2E3C2;
  border: 3px solid #3E2716; border-radius: 14px;
  box-shadow: inset 0 0 0 2px #FFC03A;
  padding: 8px 14px;
  color: #2B1B10;
}
#menuToast { font-size: 30px; }
#menuLevelBox { flex: 1; min-width: 120px; }
#menuLevelLbl { font-size: 13px; font-weight: 900; color: #3E2716; letter-spacing: 0.5px; }
#menuXpBar {
  height: 12px; margin: 3px 0 2px;
  background: #d9c294; border: 2px solid #8A5B33; border-radius: 999px;
  overflow: hidden;
}
#menuXpFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #FFD873, #FFB300);
  transition: width 0.3s;
}
#menuXpTxt { font-size: 10.5px; font-weight: 800; color: #5C4630; }
#menuUser {
  font-size: 12px; font-weight: 900; color: #5C4630;
  max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Pestañas */
#menuTabs { display: flex; gap: 6px; margin: 8px 0; }
.mTab {
  flex: 1; min-height: 42px;
  font-size: 14px; font-weight: 900;
  color: #F2E3C2;
  background: #6B4426; border: 3px solid #3E2716; border-radius: 12px 12px 0 0;
  cursor: pointer; opacity: 0.75;
}
.mTab.active {
  background: #F2E3C2; color: #3E2716; opacity: 1;
  border-bottom-color: #F2E3C2;
  box-shadow: inset 0 2px 0 #FFC03A;
}

/* Cuerpo */
#menuBody {
  flex: 1; overflow: hidden;
  background: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.3), transparent 55%), #F2E3C2;
  border: 3px solid #3E2716; border-radius: 0 14px 14px 14px;
  box-shadow: inset 0 0 0 2px #FFC03A, inset 0 0 50px rgba(120,80,30,0.22);
  padding: 10px;
}
.mPane { display: none; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.mPane.active { display: block; }

/* Rejilla de cartas (2 columnas en pantallas anchas) */
.mGrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 700px) { .mGrid { grid-template-columns: 1fr 1fr; } }

/* Cuenta */
.mHint { font-size: 12.5px; font-weight: 700; color: #5C4630; margin-bottom: 8px; }
#pane-cuenta input {
  width: 100%; margin-bottom: 8px; padding: 12px 13px;
  font-size: 15px; font-weight: 800; color: #2B1B10;
  background: #FFF8E8; border: 2px solid #8A5B33; border-radius: 10px;
}
#pane-cuenta input:focus { outline: 3px solid #FFC03A; outline-offset: 1px; }
.mBtnRow { display: flex; gap: 8px; flex-wrap: wrap; }
.mBtn {
  flex: 1; min-height: 46px; padding: 8px 14px;
  font-size: 15px; font-weight: 900;
  border-radius: 10px; cursor: pointer;
  border: 3px solid; box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
.mBtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.3); }
.mBtn.verde  { background: linear-gradient(180deg,#6FD65B,#4CAF3E); border-color:#2E7325; color:#fff; text-shadow:1px 1px 0 #2E7325; }
.mBtn.dorado { background: linear-gradient(180deg,#FFD873,#FFC03A); border-color:#8a5c00; color:#4a2f00; }
.mBtn.gris   { background: #6B4426; border-color:#3E2716; color:#F2E3C2; }
.mLink {
  display: block; margin-top: 8px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 800; color: #8a5c00; text-decoration: underline;
}
#authMsg, #resetMsg { font-size: 13px; font-weight: 800; margin-top: 8px; min-height: 18px; }
#authMsg.err, #resetMsg.err { color: #D8372A; }
#authMsg.ok,  #resetMsg.ok  { color: #2E7325; }

/* Progreso (medallas) */
.medallas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.medalla {
  background: #FBF1D9; border: 2.5px solid #8A5B33; border-radius: 12px;
  padding: 10px; text-align: center;
}
.medalla .num { font-size: 20px; font-weight: 900; color: #3E2716; }
.medalla .lbl { font-size: 10.5px; font-weight: 900; color: #5C4630; text-transform: uppercase; }

/* Pie: JUGAR */
#menuFoot { padding-top: 8px; }
#shopPlayBtn {
  width: 100%; min-height: 54px;
  font-size: 20px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg,#6FD65B,#4CAF3E);
  border: 3px solid #2E7325; border-radius: 14px;
  cursor: pointer; text-shadow: 1px 1px 0 #2E7325;
  box-shadow: 0 5px 0 #2E7325;
}
#shopPlayBtn:active { transform: translateY(3px); box-shadow: 0 2px 0 #2E7325; }

/* Móvil horizontal: todo más compacto */
@media (max-height: 520px) {
  #menuTop { padding: 4px 10px; gap: 8px; }
  #menuToast { font-size: 22px; }
  #menuUser { display: none; }
  .mTab { min-height: 34px; font-size: 12px; }
  #menuBody { padding: 6px; }
  .shopDesc { display: none; }
  #shopPlayBtn { min-height: 44px; font-size: 16px; }
  #menuFoot { padding-top: 5px; }
}


/* ══ v36 · Menú menos invasivo en desktop: contenido centrado y acotado ══ */
#menuScreen { align-items: center; }
#menuTop, #menuTabs, #menuBody, #menuFoot {
  width: 100%;
  max-width: 880px;
}
@media (min-width: 1100px) {
  #menuTop  { padding: 10px 18px; }
  #menuBody { padding: 14px; }
}

/* Selector de arma inicial */
#weaponPicker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #FBF1D9; border: 2.5px solid #8A5B33; border-radius: 12px;
  padding: 8px 12px; margin-bottom: 10px;
}
#wpLbl { font-size: 13px; font-weight: 900; color: #3E2716; }
#wpChips { display: flex; gap: 6px; flex-wrap: wrap; }
.wpChip {
  min-height: 38px; padding: 6px 14px;
  font-size: 13px; font-weight: 900;
  color: #5C4630; background: #EFE0BE;
  border: 2.5px solid #8A5B33; border-radius: 999px;
  cursor: pointer;
}
.wpChip.active {
  color: #fff; background: linear-gradient(180deg,#6FD65B,#4CAF3E);
  border-color: #2E7325; text-shadow: 1px 1px 0 #2E7325;
}


/* ══ v37 · MENÚ MÓVIL PROFESIONAL — compacto, denso, sin gigantismos ══ */
@media (max-width: 900px), (max-height: 560px) {
  #menuScreen { padding: 6px; }
  #menuTop { padding: 5px 10px; gap: 8px; border-width: 2px; border-radius: 10px; }
  #menuToast { font-size: 20px; }
  #menuLevelLbl { font-size: 10.5px; }
  #menuXpBar { height: 8px; margin: 2px 0 1px; }
  #menuXpTxt { font-size: 9px; }
  #menuUser { font-size: 10px; max-width: 22vw; }
  
  #menuTabs { gap: 4px; margin: 5px 0; }
  .mTab { min-height: 32px; font-size: 11px; border-width: 2px; padding: 4px 2px; }

  #menuBody { padding: 6px; border-width: 2px; border-radius: 0 10px 10px 10px; }
  .mGrid { gap: 6px; }

  .shopItem { padding: 6px 8px; gap: 8px; border-width: 2px; border-radius: 10px; box-shadow: 0 2px 0 rgba(107,68,38,0.3); }
  .shopName { font-size: 12.5px; }
  .shopDesc { font-size: 10.5px; line-height: 1.25; }
  .shopLvl  { font-size: 10px; }

  /* Chapa de precio → píldora compacta (la circular era enorme).
     v79 · 44px de alto mínimo: a 36 era difícil de acertar con el
     pulgar y se fallaba la compra. 44 es el mínimo táctil sensato. */
  .shopBuy {
    border-radius: 999px;
    min-width: 70px;
    min-height: 44px;
    padding: 4px 12px;
    font-size: 12.5px;
    border-width: 2px;
    outline-width: 2px;
    box-shadow: 0 2px 0 #8E1E14;
  }
  .shopBuy.off { box-shadow: 0 2px 0 #5c5546; }
  .skinPrev { width: 34px; height: 34px; }

  #weaponPicker { padding: 6px 8px; gap: 6px; border-width: 2px; margin-bottom: 6px; }
  #wpLbl { font-size: 11px; }
  .wpChip { min-height: 30px; padding: 4px 10px; font-size: 11px; border-width: 2px; }

  .medallas { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .medalla { padding: 7px; border-width: 2px; }
  .medalla .num { font-size: 15px; }
  .medalla .lbl { font-size: 9px; }

  #pane-cuenta input { padding: 9px 11px; font-size: 14px; margin-bottom: 6px; }
  .mBtn { min-height: 40px; font-size: 13px; }
  .mHint { font-size: 11px; }

  #menuFoot { padding-top: 5px; }
  #shopPlayBtn { min-height: 44px; font-size: 16px; border-radius: 10px; }
}

/* ══ v58 · Retoques TIENDA MÓVIL (vertical angosto) ══ */
@media (max-width: 480px) {
  /* Pestañas deslizables en vez de apretujadas */
  #menuTabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #menuTabs::-webkit-scrollbar { display: none; }
  .mTab { flex: 0 0 auto; min-width: 82px; font-size: 11px; }
  /* Aire al final de cada lista para que el botón JUGAR no tape la última carta */
  .mPane { padding-bottom: 16px; }
    /* iOS hace zoom automático si el input tiene <16px */
  #pane-cuenta input { font-size: 16px; }
  .wpChip { min-height: 42px; }
}


/* v38 · Badge de créditos en la cabecera del menú */
#menuCreditos {
  font-size: 17px; font-weight: 900; color: #4a2f00;
  background: linear-gradient(180deg,#FFD873,#FFC03A);
  border: 3px solid #8a5c00; border-radius: 999px;
  padding: 4px 14px; white-space: nowrap;
}
@media (max-width: 900px), (max-height: 560px) {
  #menuCreditos { font-size: 13px; padding: 3px 10px; border-width: 2px; }
}


/* ═══ v81 · Botón de pantalla completa (panel de configuración) ═══ */
#fsBtn {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 900;
  color: #F2E3C2;
  background: linear-gradient(180deg, #5B4A7A, #3E3157);
  border: 3px solid #241C36;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #241C36;
}
#fsBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #241C36; }
#fsNota {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
  color: #D8CFC0;
}
#fsNota:empty { display: none; }


/* ═══ v91 · Cuenta obligatoria: Google + separador + aviso ═══ */
#googleBox { margin-bottom: 12px; }
#googleBtn { display: flex; justify-content: center; }
.oSep {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 4px;
  font-size: 11.5px; font-weight: 800; color: #8A7C5C;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.oSep::before, .oSep::after {
  content: ''; flex: 1; height: 2px; background: #d9c294; border-radius: 2px;
}
#authMsg.aviso {
  color: #8a5c00; font-weight: 900;
  background: #FFF3D0; border: 2px solid #E0B84A;
  border-radius: 8px; padding: 8px 10px; margin-top: 8px;
}
/* El botón JUGAR se ve bloqueado mientras no haya sesión */
#shopPlayBtn.bloqueado {
  filter: grayscale(0.75) brightness(0.9);
  box-shadow: 0 5px 0 #555;
  border-color: #555;
}

/* ═══ v92 · Volver al menú desde el panel de configuración ═══ */
#menuBtn {
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 900;
  color: #2B1B10;
  background: linear-gradient(180deg, #FFD873, #FFC03A);
  border: 3px solid #8a5c00;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #8a5c00;
}
#menuBtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a5c00; }

/* v171 · Controles nativos, accesibles con teclado y tacto. */
#playControls { position:fixed;right:12px;top:58px;z-index:30;display:flex;gap:6px; }
#playControls[hidden] { display:none; }
#playControls button, #pauseDialog button, #playInfo button { min-height:44px;padding:8px 12px;border:2px solid #d4a556;border-radius:10px;background:#252032;color:#fff3d9;font:700 14px Nunito, system-ui;cursor:pointer; }
#playControls button:focus-visible, #pauseDialog button:focus-visible, #playInfo button:focus-visible { outline:3px solid #66d8ff;outline-offset:3px; }
#pauseDialog,#playInfo { box-sizing:border-box;width:min(90vw,460px);max-height:80vh;overflow:auto;padding:24px;border:2px solid #d4a556;border-radius:16px;background:#252032;color:#fff3d9;font:16px/1.5 Nunito, system-ui;z-index:100; }
#pauseDialog::backdrop,#playInfo::backdrop { background:rgba(8,8,16,.72); }
#playInfo li { margin-bottom:18px; } #playInfo li p { margin-top:4px; }
@media(max-width:560px){ #playControls { top:92px;right:6px;gap:4px; } #playControls button { padding:6px 8px;font-size:12px; } }
#pauseDialog,#playInfo { position:fixed;inset:0;margin:auto;height:fit-content; }

.pauseActions { display:flex;flex-wrap:wrap;gap:8px;margin-top:12px; }

/* Camera comfort settings share the existing configuration panel. */
#cfgPanel { max-height: calc(100dvh - 90px); overflow-y: auto; box-sizing: border-box; }
#cfgPanel select { width: 100%; min-height: 36px; color: #FFF3D8; background: #241b30; border: 1px solid #b28c46; border-radius: 5px; font: inherit; }
#cameraShakeHelp { font-size: 12px; line-height: 1.4; margin: 6px 0; }

@media (max-width: 480px) { #statsBox.medallas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* v183 · Fichas completas, legibles con teclado, ratón y pantalla táctil. */
#playInfo { width:min(94vw,680px); }
#playInfo .cardExplanation { margin:18px 0;padding:16px;border:1px solid #776080;border-radius:12px;background:#191725; }
#playInfo h4 { margin:0;font-size:20px;line-height:1.3;color:#fff; }
#playInfo .cardMeta { color:#d9c6ec;font-size:14px;margin:6px 0; }
#playInfo .cardEffect { color:#ffe299;font-weight:700; }
#playInfo .cardExplanation li { margin-bottom:8px; }
#playInfo .cardExplanation p { margin:8px 0; }
#playInfo .cardExplanation ul, #playInfo .cardExplanation ol { padding-left:22px; }
#playInfo summary { cursor:pointer;min-height:44px;display:list-item;padding:8px 0;box-sizing:border-box;color:#9ce7ff; }
#playInfo summary:focus-visible { outline:3px solid #66d8ff; }
#playInfo .cardStatus { color:#9dffb3; }
@media(max-width:560px){ #playInfo { padding:16px;font-size:16px; } #playControls { flex-wrap:wrap;max-width:290px;justify-content:flex-end; } }

#closePlayInfo { position:sticky;top:0;z-index:1;display:block;margin-left:auto;box-shadow:0 3px 8px #100c19; }

#playInfo .playInfoHeader { position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;background:#252032;border-bottom:1px solid #776080; }
#playInfo .playInfoHeader h2 { margin:0;font-size:22px; }
#playInfo .playInfoHeader #closePlayInfo { position:static;margin:0;flex-shrink:0; }
#playControls[data-choosing="true"] { top:auto;bottom:12px;left:12px;right:auto; }
#playControls[data-choosing="true"] button:not(#cardInfoBtn) { display:none; }

/* v197 · El contador acompaña los controles, fuera de la escala de resolución del Canvas. */
#runTokens { position:absolute;right:0;top:calc(100% + 8px);box-sizing:border-box;width:196px;padding:9px 12px;border:2px solid #d4a556;border-radius:10px;background:#2d2416f2;color:#ffe4a4;text-align:center;pointer-events:none;box-shadow:0 2px 5px #0006;font:700 12px/1.45 Nunito, system-ui; }
#runTokens[hidden] { display:none; }
#runTokens strong, #runTokens span { display:block; }
#runTokens span { color:#f0dfbc;font-size:12px;font-weight:500; }

/* v199 · Elección de continuación, teclado y táctil. */
.act-choice{margin:auto;box-sizing:border-box;width:min(540px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;background:#30231c;color:#fff0d1;border:3px solid #bd8750;border-radius:20px;padding:24px;font:16px/1.5 Nunito, system-ui;box-shadow:0 12px 70px #000a}
.act-choice::backdrop{background:#100b08c9}.act-choice h2{font-size:24px;line-height:1.2;margin:0 0 16px}.act-choice div{display:flex;gap:12px;flex-wrap:wrap}.act-choice button{flex:1;min-height:48px;min-width:160px;border:2px solid #ecbf78;border-radius:12px;background:#5b3b26;color:#fff3cf;padding:12px;font:700 16px Nunito, system-ui;cursor:pointer}.act-choice button:focus-visible{outline:3px solid #fff;outline-offset:3px}

/* v207 · Action stays clear of the floating movement stick and HUD. */
#dodgeBtn { position:fixed;right:max(18px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));z-index:30;min-width:112px;min-height:62px;white-space:pre-line;padding:12px 16px;border:3px solid #edc171;border-radius:22px;background:#332336ed;color:#fff1cb;font:800 16px Nunito, system-ui;touch-action:none;user-select:none;cursor:pointer;box-shadow:0 3px 0 #160e1d; }
#dodgeBtn[hidden] { display:none; }
#dodgeBtn[aria-disabled="true"] { border-color:#86735f;color:#d0c2b0;background:#28232bea; }
#dodgeBtn:focus-visible { outline:3px solid #66d8ff;outline-offset:3px; }
@media(max-width:560px){ #dodgeBtn { right:max(12px,env(safe-area-inset-right));bottom:max(18px,env(safe-area-inset-bottom));min-width:100px;min-height:64px;font-size:15px; } }

/* v209 · Friendly headings and actions, clear body copy and counters. */
#playControls button,#pauseDialog button,#playInfo button,#dodgeBtn,.act-choice button { font-family:var(--tostu-display); }
#pauseDialog h2,#playInfo h2,.act-choice h2 { font-family:var(--tostu-display);font-weight:800; }
#playInfoBody,#playInfoBody p,#pauseDialog p { font-family:var(--tostu-text); }
#runTokens { font-variant-numeric:tabular-nums; }
