/* ============================================================
   CRONO ROYALE · HOJA MÓVIL
   Se carga automáticamente cuando el shell detecta pantalla
   pequeña: (max-width: 860px) o pointer coarse apaisado bajo.
   Todas las reglas van bajo html.is-mobile para no interferir
   con el diseño de escritorio.
   ============================================================ */

/* ---------- base ---------- */
html.is-mobile .screen{
  padding:10px 14px calc(10px + env(safe-area-inset-bottom));
  max-width:100%;
}
html.is-mobile body{ -webkit-tap-highlight-color:transparent; }

/* ---------- HOME: columnas → apilado vertical ---------- */
html.is-mobile .home-grid{
  grid-template-columns:1fr;
  gap:10px;
  overflow-y:auto;
  margin-top:0;
  align-items:start;
}
html.is-mobile .home-hero video,
html.is-mobile .home-hero img{ max-width:34vw; }
html.is-mobile .home-hero h1{ font-size:clamp(26px,8vw,38px)!important; }
html.is-mobile .home-hero p{ font-size:12px!important; }
html.is-mobile .home-panels{ gap:8px; }
html.is-mobile .home-panels .panel{ padding:12px 14px!important; }

/* ---------- JUEGO: 3 columnas → tarjetas compactas arriba ---------- */
html.is-mobile .game-grid{
  grid-template-columns:1fr 1fr;
  grid-template-rows:auto 1fr;
  gap:8px;
  align-items:start;
}
/* tarjetas de jugador: fila horizontal compacta arriba */
html.is-mobile .player-card{
  flex-direction:row;
  justify-content:flex-start;
  gap:8px;
  padding:8px 10px;
  text-align:left;
}
html.is-mobile .player-card .avatar-ring{
  width:44px!important;height:44px!important;flex:0 0 auto;
}
html.is-mobile .player-card p,
html.is-mobile .player-card span{ font-size:11px!important; }
/* centro del juego ocupa la fila completa inferior */
html.is-mobile .game-grid > div:nth-child(2){
  grid-column:1 / -1;
  grid-row:2;
}

/* ---------- cronómetro y controles ---------- */
html.is-mobile .chrono-wrap{
  width:clamp(170px,52vw,240px);
  height:clamp(170px,52vw,240px);
  margin-top:4px;
}
html.is-mobile .target-display{ font-size:clamp(30px,9vw,44px)!important; }
html.is-mobile .stop-btn{
  width:clamp(104px,30vw,140px);
  height:clamp(104px,30vw,140px);
  font-size:clamp(15px,4.4vw,19px);
}
html.is-mobile #turn-controls{ min-height:84px!important; }
html.is-mobile #turn-controls button{ padding:12px 18px!important; font-size:14px!important; }
html.is-mobile #tries-chips{ margin-top:4px!important; min-height:30px!important; }

/* cabecera del juego más compacta */
html.is-mobile #game-screen header{ gap:8px!important; flex-wrap:wrap; }
html.is-mobile #game-screen header img{ width:26px!important; }
html.is-mobile #game-screen header .shimmer-text{ font-size:14px!important; }
html.is-mobile #game-screen header .panel{ padding:4px 10px!important; font-size:9px!important; }

/* ---------- overlay de cuenta atrás ---------- */
html.is-mobile #count-overlay span{ font-size:clamp(64px,22vw,110px)!important; }

/* ---------- CHAT: panel lateral → hoja inferior ---------- */
html.is-mobile .chat-panel{
  top:auto;left:0;right:0;bottom:0;
  width:100%;max-width:100%;
  height:62dvh;
  border-radius:22px 22px 0 0;
  border-left:none;
  border-top:1px solid rgba(57,255,136,.25);
  transform:translateY(105%);
}
html.is-mobile .chat-panel.open{ transform:translateY(0); }
html.is-mobile .bubble{ font-size:13px; }
html.is-mobile .chat-fab{ width:46px;height:46px;font-size:20px; }

/* chat rápido más pequeño para no tapar el botón DETENER */
html.is-mobile .quick-chat{ padding:3px 6px; gap:2px; }
html.is-mobile .quick-chat .qc-emoji{ font-size:20px;padding:3px 6px; }
html.is-mobile .quick-chat .qc-open{ width:33px;height:33px;font-size:16px; }
html.is-mobile .last-msg{ bottom:calc(58px + env(safe-area-inset-bottom)); font-size:12px; }

/* ---------- pantallas de emparejamiento / apuesta ---------- */
html.is-mobile .bet-grid{ grid-template-columns:repeat(5,1fr)!important; gap:6px!important; }
html.is-mobile .anim-vs-left img, html.is-mobile .anim-vs-right img{ width:64px!important;height:64px!important; }

/* ---------- pantalla final ---------- */
html.is-mobile .screen.center h2{ font-size:clamp(34px,11vw,48px)!important; }
html.is-mobile .screen.center > div:last-child{ flex-direction:column; gap:10px!important; }

/* ---------- teclado en pantalla no rompe el layout ---------- */
html.is-mobile input, html.is-mobile button{ font-size:16px; } /* evita zoom iOS */

/* ---------- landscape móvil (altura muy baja) ---------- */
@media (max-height: 500px) and (orientation: landscape){
  html.is-mobile .game-grid{
    grid-template-columns:150px 1fr 150px;
    grid-template-rows:1fr;
  }
  html.is-mobile .player-card{ flex-direction:column; text-align:center; }
  html.is-mobile .game-grid > div:nth-child(2){ grid-column:auto; grid-row:auto; }
  html.is-mobile .chrono-wrap{ width:clamp(120px,36vh,170px);height:clamp(120px,36vh,170px); }
  html.is-mobile .stop-btn{ width:clamp(76px,22vh,104px);height:clamp(76px,22vh,104px);font-size:13px; }
  html.is-mobile .target-display{ font-size:clamp(22px,7vh,32px)!important; }
  html.is-mobile #count-overlay span{ font-size:clamp(48px,18vh,84px)!important; }
}
