/* ==========================================================================
   bee-world.css — pantalla de juego del panal hexagonal.

   Réplica de src/screens/game/game.css adaptada a vivir DENTRO de una página
   de contenido en vez de ocupar la ventana entera: .game-screen es un panel
   con borde, no una pantalla completa.

   Las variables (--gold, --blue, --surface…) las aporta site.css, así que
   aquí no se redefinen y el panal sigue al tema claro u oscuro del sitio.
   ========================================================================== */

/* ---- game.css ---- */

.game-screen {
  display: flex; flex-direction: column;
  background: var(--gold-soft);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
[data-theme='dark'] .game-screen { background: #1c1c26; }

.game-topbar {
  position: sticky; top: 62px; z-index: 6;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.game-back {
  background: none; border: none; color: var(--blue);
  font-size: 1.3rem; font-weight: 700; padding: 4px 10px; cursor: pointer;
}
.game-title {
  margin: 0; font-size: .98rem; font-weight: 800; color: var(--text);
  white-space: nowrap;
}
.game-timer { font-variant-numeric: tabular-nums; color: var(--text-soft); font-size: .92rem; }
.game-stamps {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--gold-soft); border-radius: 999px;
  padding: 4px 12px; font-size: .92rem;
}
.game-stamps img { width: 17px; height: 17px; }
.game-stamps b { color: var(--gold-dark); }

/* los dos desplegables: lo único que no está en la pantalla real */
.game-picker { display: flex; align-items: center; gap: 8px; flex: 1; }
.game-picker select {
  font: inherit; font-size: .86rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 8px; cursor: pointer;
}
.game-picker select:hover { border-color: var(--gold); }

.game-zoom {
  display: flex; justify-content: center; gap: 22px;
  padding: 8px 16px 0; flex-wrap: wrap;
}
.game-zoom-control {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; color: var(--text-soft);
}
.game-zoom-control input[type='range'] { width: 110px; accent-color: var(--gold); cursor: pointer; }

.game-layout {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 14px 12px 26px; margin: 0 auto; width: 100%;
  /* Igual que game.css: la columna crece con la escala del tablero, y el
     viewport sigue siendo el límite duro. Es lo que hace que al agrandar el
     tablero éste EMPUJE a las pistas en vez de quedarse en su caja. */
  max-width: max(640px, calc(500px * var(--grid-scale, 1)));
}
.game-clues { display: flex; flex-direction: column; gap: 10px; order: 2; }
.game-main { order: 1; display: flex; flex-direction: column; gap: 16px; }

.game-clues-v { display: flex; flex-wrap: nowrap; justify-content: center; gap: 3px; overflow-x: auto; max-width: 100%; }
.game-clues-h { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.game-clues-v, .game-clues-h { flex-shrink: 0; }
.game-clues-h:empty, .game-clues-v:empty { display: none; }

.game-grid { display: flex; justify-content: center; }
/* el SVG llena el ancho que le toque a .game-main; su viewBox conserva
   la proporción, así que un panal pequeño sale con celdas más grandes */
.game-grid svg { display: block; width: 100%; height: auto; touch-action: manipulation; }

.game-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.game-btn { color: #fff; display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; font-size: .95rem; }
.game-btn-undo  { background: var(--blue); }
.game-btn-undo:hover:not(:disabled)  { background: var(--blue-deep); }
.game-btn-hint  { background: var(--gold); }
.game-btn-hint:hover  { background: var(--gold-dark); }
.game-btn-check { background: var(--success); }
.game-btn-check:hover { background: #3d8b40; }

@media (min-width: 1000px) {
  .game-layout { flex-direction: row; align-items: flex-start; justify-content: center;
                 max-width: none; gap: 28px; padding: 24px; }
  .game-clues { flex: 0 1 620px; min-width: 300px; padding: 4px; }
  .game-clues-v { flex-wrap: wrap; justify-content: flex-start; }
  .game-clues-h { justify-content: flex-start; }
  /* base flexible = ancho real del tablero escalado: el deslizador manda,
     el monitor limita. Copiado de game.css. */
  .game-main { flex: 0 1 calc(500px * var(--grid-scale, 1)); min-width: 340px; }
}

/* ---- tablero, con los colores del tema ---- */
.cellbg  { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.candbg  { fill: var(--blue-soft); stroke: var(--border); stroke-width: 1; cursor: pointer; }
.candbg:hover { stroke: var(--gold); }
.candtxt { text-anchor: middle; dominant-baseline: central; fill: var(--text); pointer-events: none; }
.cand-out .candbg { fill: transparent; stroke: transparent; }
.cand-out .candtxt, .cand-out image { opacity: .18; }
.cand-fixed .candbg { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 2; }

.edge-hit { stroke: rgba(201,168,76,0); stroke-width: 16; cursor: pointer; pointer-events: stroke; }
.edge-hit:hover { stroke: rgba(201,168,76,.18); }
.edge-unknown { stroke: var(--border); stroke-width: 2; }
/* la pared interna se dibuja igual que el contorno: lado entero y mismo
   grosor, para que el lenguaje sea uno solo */
.edge-wall { stroke: var(--blue); stroke-width: 5; stroke-linecap: round; }
.edge-path { stroke: var(--gold); stroke-width: 7; stroke-linecap: round; }
/* El contorno del panal es pared desde el arranque. A diferencia de una
   pared interna, que es una marca corta sobre el lado, este ocupa el lado
   ENTERO para que los tramos se toquen en los vértices y el contorno se
   lea como una sola línea cerrada. */
.edge-border-wall { stroke: var(--blue); stroke-width: 5; stroke-linecap: round; }
/* cabezal de entrada/salida: una celda de panal en miniatura, no una flecha */
.portal-cap { fill: var(--gold); }

/* animación de victoria: el camino se dibuja de la entrada a la salida */
.victory-path {
  fill: none; stroke: var(--gold); stroke-width: 9;
  stroke-linecap: round; stroke-linejoin: round;
}
.victory-glow { animation: cell-pop .5s ease both; transform-box: fill-box; transform-origin: center; }
@keyframes cell-pop {
  0%   { transform: scale(1);    filter: none; }
  45%  { transform: scale(1.14); filter: drop-shadow(0 0 7px var(--gold)); }
  100% { transform: scale(1);    filter: none; }
}

/* ---- tarjetas de pista ---- */
/* calcado de components/board.css .clue-card */
.clue {
  background: none; border: none; padding: 0; cursor: pointer; line-height: 0;
  user-select: none; touch-action: none; flex: none;
  transition: transform .15s ease, opacity .15s ease;
}
.clue.resolved { opacity: .35; transform: scale(.92); }
.clue.dragging {
  position: fixed; z-index: 50; opacity: .85;
  transform: scale(1.08); pointer-events: none;
}
.slotbg  { fill: var(--blue-soft); stroke: var(--gold); stroke-width: 1.5; }
.slottxt { text-anchor: middle; dominant-baseline: central; fill: var(--text); }
.mk-path { stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.mk-wall { stroke: var(--blue); stroke-width: 5; stroke-linecap: round; }
.mk-circle-unknown { fill: var(--text-soft); stroke: var(--surface); stroke-width: 1.5; }
.mk-circle-order   { fill: #8e6bc9; stroke: var(--surface); stroke-width: 1.5; }
/* sin dominant-baseline: el desplazamiento dy es el que centra. Con los
   dos a la vez el glifo bajaba el doble de lo debido. */
.mk-lbl  { fill: #fff; text-anchor: middle; font-weight: 700; }
.glyph   { stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; fill: none; }

/* ---- overlay, copia de theme.css ---- */
.overlay-backdrop {
  position: fixed; inset: 0; background: rgba(43,43,51,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 100; animation: overlay-fade .18s ease;
}
.overlay-card {
  background: var(--surface); border-radius: var(--radius);
  border-top: 6px solid var(--gold); box-shadow: var(--shadow);
  padding: 28px 24px; max-width: 420px; width: 100%; text-align: center;
  animation: overlay-pop .2s ease;
}
@keyframes overlay-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes overlay-pop { from { transform: scale(.94); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.overlay-title { margin: 0 0 10px; font-size: 1.35rem; color: var(--text); }
.overlay-body  { color: var(--text-soft); font-size: .97rem; line-height: 1.45; margin-bottom: 20px; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-primary   { background: var(--gold); color: #fff; box-shadow: var(--shadow-soft); }
.btn-secondary { background: var(--surface); color: var(--blue); border: 2px solid var(--blue); }
.btn-secondary:hover { background: var(--blue-soft); }
.victory-time { font-variant-numeric: tabular-nums; color: var(--gold-dark); font-weight: 700; }

/* ---- toast, copia de theme.css ---- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff; padding: 10px 22px;
  border-radius: 999px; font-size: .95rem; box-shadow: var(--shadow);
  z-index: 200; animation: overlay-fade .2s ease;
  max-width: min(92vw, 520px); text-align: center; line-height: 1.35;
}

/* ---- aviso de verificación ---- */
#verdict { margin: 0 auto; max-width: 620px; padding: 11px 16px;
           border-radius: var(--radius-sm); font-size: .92rem; display: none; }
#verdict.ok  { display: block; background: var(--blue-soft); border: 1px solid var(--success); }
#verdict.err { display: block; background: var(--gold-soft); border: 1px solid var(--error); }

@media (max-width: 460px) {
  .game-topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .game-title { display: none; }
  .game-picker select { font-size: .8rem; padding: 4px 6px; }
}
