/* Estilos propios de Anime Grid. Lo compartido (barra de arriba, buscador, modales) está en /assets/base.css. */

.topbar-spacer { width: 44px; }
.topbar-spacer[hidden] { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- inicio: compartido en /assets/base.css (.start-card, 25/10/2026) ---------- */

/* ---------- grilla ---------- */
.play-status { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.clock { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.clock.low { color: var(--bad); }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.board > * {
  aspect-ratio: 1; border-radius: 10px; padding: 6px; min-width: 0; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
}
.corner {
  background: var(--text); color: var(--bg); align-items: center; justify-content: center !important;
  font-family: var(--font-title); font-weight: 800; font-size: 14px; line-height: 1; gap: 0 !important;
}
.corner span:last-child { color: var(--accent); }

.head { background: var(--surface); border: 1px solid var(--border); }
.head .k { display: flex; align-items: center; gap: 3px; font-size: 9px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.head .k svg { flex-shrink: 0; }
/* ⓘ de la categoría (29/10/2026). En el celu no entraba "PREMIERED ⓘ": letras un poco más juntas y sin el ícono del tipo. */
.head .k .cat-info { margin-left: 1px; width: 12px; height: 12px; }
.head .k .kt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .head .k { letter-spacing: 0.5px; gap: 2px; }
  .head .k > svg:first-child { display: none; }
}
.head .v { font-family: var(--font-title); font-weight: 700; font-size: 14px; line-height: 1.1; overflow-wrap: break-word; }
.head .v.s { font-size: 12px; }
.head .v.xs { font-size: 10.5px; }

.cell.empty { border: 1px dashed var(--border); }
.cell.filled { background: var(--surface-2); border-bottom: 3px solid var(--ok); padding: 0; }
.cell.filled img, .cell.revealed img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.cell .name {
  position: relative; font-weight: 700; font-size: 11px; line-height: 1.15; padding: 14px 6px 5px;
  background: linear-gradient(to top, rgba(14, 17, 22, 0.95) 40%, rgba(14, 17, 22, 0));
}
.cell .name span { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cell.revealed { background: #2E1A1E; border: 1px solid var(--bad); padding: 0; }
.cell.revealed img { opacity: 0.45; }
.cell.revealed .tag { position: absolute; top: 5px; left: 6px; font-size: 8px; letter-spacing: 1px; color: #FF9E9E; }
.cell.revealed .name { color: #FFD9D9; background: linear-gradient(to top, rgba(46, 26, 30, 0.95) 40%, rgba(46, 26, 30, 0)); }
.cell.fresh { animation: pop 0.35s ease-out; }
.cell.target {
  border: 2px solid var(--accent); background: #2A1A16; color: #FFB8A6; font-size: 11px; font-weight: 600;
  align-items: center; justify-content: center; text-align: center;
}
.cell.target:hover, .cell.target:focus-visible { background: #3A2119; outline: none; }
@keyframes pop { from { transform: scale(0.9); opacity: 0.3; } to { transform: none; opacity: 1; } }

.pick-banner {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
.pick-banner[hidden] { display: none; }
.pick-name { font-size: 15px; font-weight: 600; }

.guess-box { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.message { min-height: 18px; font-size: 13px; text-align: center; color: var(--muted); }
.message.bad { color: #FF9E9E; }
.guess-row-input { display: flex; gap: 8px; }
.guess-row-input .search { flex: 1; min-width: 0; }
.flag-btn { width: 46px; height: 46px; border-color: var(--border-strong); background: transparent; flex-shrink: 0; }

/* ---------- resultado ---------- */
.result-head { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.result-title { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--close); }
.result-title.won { color: var(--ok); }
.result-points { font-family: var(--font-title); font-weight: 800; font-size: 56px; line-height: 1; }
.result-points small { font-size: 24px; color: var(--muted); }
.breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-size: 12px; text-align: center; }
.breakdown div { border-radius: 8px; background: var(--surface); padding: 8px 4px; display: flex; flex-direction: column; }
.breakdown b { font-size: 15px; }
.breakdown span { color: var(--muted); }
.see-btn { border-color: var(--bad); color: #FFD9D9; }
.see-btn:hover { background: #2E1A1E; }
.result-actions .btn[hidden] { display: none; }
.result-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ---------- modales ---------- */
.modal-text { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.answers-modal { max-height: calc(100dvh - 32px); }
.answers-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.answers-list section { display: flex; flex-direction: column; gap: 4px; }
.answers-list h3 { margin: 0; font-size: 11px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.answers-list p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.answers-list .yours { color: var(--ok); font-weight: 600; }

.stat-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stat-tiles div { border-radius: 10px; background: var(--surface-2); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; }
.stat-tiles b { font-family: var(--font-title); font-weight: 800; }
.stat-tiles span { color: var(--muted); text-align: center; } /* tamaños: base.css (#stats-modal), igual en todos los juegos */
.dist { display: flex; flex-direction: column; gap: 8px; }
.dist-bars { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; align-items: end; height: 140px; }
.dist-bars div { display: flex; flex-direction: column; align-items: center; gap: 3px; justify-content: flex-end; height: 100%; }
.dist-bars span { font-size: 12px; }
.dist-bars i { width: 100%; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.dist-bars em { font-style: normal; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); width: 100%; text-align: center; padding-top: 4px; }
.stat-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- compu (≥1040 px; Juan Cruz, 28/10/2026: "la grilla bastante más grande, que no sobre espacio") ----------
   La grilla va a la izquierda, del alto de la pantalla (descontando la barra de arriba y el zoom de fit.js), y a la
   derecha una columna con el estado y el buscador (la lista de sugerencias baja) o, en el resultado, el puntaje y los
   botones. Todo entra en una pantalla en 1366×768 y 1920×1080. En el celu no cambia nada. */
@media (min-width: 1040px) {
  .app:has(> #screen-play:not([hidden])), .app:has(> #screen-result:not([hidden])) { max-width: 1040px; }
  #screen-play:not([hidden]), #screen-result:not([hidden]) {
    --board: min(680px, calc((100dvh - var(--ad-b, 0px)) / var(--zoom, 1) - 112px));
    display: grid; grid-template-columns: var(--board) minmax(300px, 1fr); column-gap: 28px; row-gap: 14px;
    align-content: start; justify-content: center;
  }
  #screen-play .board, #screen-result .board { grid-column: 1; grid-row: 1 / span 8; width: var(--board); gap: 8px; align-self: start; }
  #screen-play > :not(.board), #screen-result > :not(.board) { grid-column: 2; }

  #screen-play .play-status { font-size: 15px; padding-top: 4px; }
  #screen-play .clock { font-size: 22px; }
  #screen-play .guess-box { margin-top: 0; }
  #screen-play .guess-box .message { order: 2; text-align: left; font-size: 14px; }
  #screen-play .suggestions { bottom: auto; top: 52px; max-height: min(440px, calc((100dvh - var(--ad-b, 0px)) / var(--zoom, 1) - 220px)); }
  #screen-play .pick-name { font-size: 16px; }

  #screen-result .result-head { align-items: flex-start; padding-top: 4px; }
  #screen-result .result-points { font-size: 64px; }
  #screen-result .result-actions { margin-top: 4px; }
  #screen-result .breakdown b { font-size: 18px; }
  #screen-result .breakdown span { font-size: 13px; }

  /* Celdas más grandes: letra más grande */
  .board > * { border-radius: 12px; padding: 9px; }
  .corner { font-size: 22px; }
  .head .k { font-size: 11px; gap: 4px; letter-spacing: 0.6px; } /* 0.6: que entre "PREMIERED ⓘ" (29/10/2026) */
  .head .k svg { width: 13px; height: 13px; }
  .head .k .cat-info { width: 14px; height: 14px; }
  .head .v { font-size: 19px; }
  .head .v.s { font-size: 16px; }
  .head .v.xs { font-size: 13.5px; }
  .cell.filled, .cell.revealed { padding: 0; }
  .cell .name { font-size: 14px; padding: 20px 9px 8px; }
  .cell.revealed .tag { font-size: 10px; top: 8px; left: 9px; }
  .cell.target { font-size: 15px; }
}

/* Día bonus (29/10/2026): "Play 2nd round" al lado de Share, misma altura; la nota va donde estaba la cuenta regresiva. */
.share-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.share-row.with-r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.share-row .btn[hidden], .round2-pill[hidden], .round2-note[hidden], .countdown[hidden] { display: none; }
#round2-note { text-align: center; }
.start-body .round2-pill { align-self: flex-start; }
/* Resultado de la ronda 2 en el celu (30/10/2026): la pastilla "2nd round" va en el renglón del título, no en uno propio
   (así entra en una pantalla de 390×750). */
@media (max-width: 1039px) {
  #screen-result .result-head { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 8px; }
  #screen-result .result-points { flex-basis: 100%; text-align: center; }
  #screen-result .result-head .round2-pill { padding: 0 8px; line-height: 16px; }
}

/* Publicidad (30/10/2026, assets/ads.js): con la barra de abajo del celu, el resultado se compacta ~50 px (grilla un
   poco más chica y menos aire) para seguir entrando en 390×750. Con ADS_MODE 'off' no cambia nada. */
@media (max-width: 1039px) {
  .ads-on #screen-result { gap: 8px; }
  .ads-on #screen-result .board { width: min(100%, 324px); margin: 0 auto; }
}

/* Inicio en el celu (1/11/2026): con la barra de publicidad, Start quedaba tapado en 390×750. Miniatura más chica, menos
   aire y el resumen de dificultades corto (el largo sigue en la compu). */
.start-modes-short { display: none; }
@media (max-width: 719px) {
  .start-modes-long { display: none; }
  .start-body p.start-modes-short { display: block; }
  #screen-start .start-preview { font-size: 3.8px; padding: 6px; }
  #screen-start .start-body { gap: 9px; }
  #screen-start .start-card { gap: 12px; }
  #screen-start .start-body h1 { font-size: 28px; }
}

/* Teclado del celu (3/11 y 4/11/2026, common.js pone .kb-open, --vvh y --kb-acc): sin barra de arriba, el tablero llena
   lo que queda entre arriba y el buscador (pegado al teclado); las sugerencias se abren hacia arriba (base.css). */
@media (max-width: 1039px) {
  .kb-open .topbar { display: none; }
  .kb-open #screen-play { gap: 8px; }
  /* 4/11/2026 (Juan Cruz: "la sigo viendo pequeña"): con el teclado, la grilla usa todo el ancho y el alto que queda;
     las casillas dejan de ser cuadradas (más anchas que altas) mientras se escribe. */
  .kb-open #screen-play .board { width: 100%; height: max(200px, calc(var(--vvh, 100dvh) - var(--kb-acc, 0px) - 100px)); grid-template-rows: repeat(4, minmax(0, 1fr)); margin: 0; gap: 4px; }
  .kb-open #screen-play .board > * { aspect-ratio: auto; }
  .kb-open #screen-play .guess-box { margin-top: 0; }
  .kb-open #screen-play .board > * { padding: 4px; }
  .kb-open #screen-play .message:empty { display: none; }
}

/* Celu sin teclado (4/11/2026, Juan Cruz: quedaba un hueco grande entre la grilla y el buscador): la grilla crece
   para llenar el alto que queda (las casillas, un poco más altas que anchas, como un póster), con tope. */
@media (max-width: 1039px) {
  html:not(.kb-open) #screen-play .board { flex: 1 1 auto; min-height: 0; max-height: calc((100vw - 24px) * 1.4); grid-template-rows: repeat(4, minmax(0, 1fr)); }
  html:not(.kb-open) #screen-play .board > * { aspect-ratio: auto; }
}
