/* Juegos (a063.es/games): buscador, «Ordenar» y flecha para volver (16/11/2026). Va aparte de portal.css; el tema claro
   está escrito a mano abajo (tema_claro.py no lee este archivo). */

.gm-tools { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* buscador: un botón redondo de cristal que se abre en píldora al tocarlo (y se queda abierto si hay algo escrito) */
.gm-find { position: relative; display: flex; align-items: center; width: 46px; height: 46px; flex: none; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .055); box-shadow: var(--lq);
  -webkit-backdrop-filter: blur(16px) saturate(170%) brightness(1.08); backdrop-filter: blur(16px) saturate(170%) brightness(1.08);
  transition: width .45s cubic-bezier(.25, 1.2, .4, 1), background .2s, transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.gm-find:hover { background: rgba(255, 255, 255, .1); }
.gm-find:not(.open):active { transform: scale(.95); }
.gm-find.open { width: min(280px, calc(100vw - 190px)); cursor: text; background: rgba(255, 255, 255, .08); }
.gm-find > svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gm-find input { width: 100%; min-width: 0; height: 100%; padding: 0 38px 0 42px; border: 0; outline: none; background: none; color: var(--ink);
  font: 400 15px var(--sans); opacity: 0; pointer-events: none; transition: opacity .2s; }
.gm-find.open input { opacity: 1; pointer-events: auto; }
.gm-find input::placeholder { color: var(--muted); }
.gm-find input::-webkit-search-cancel-button { display: none; }
.gm-find:focus-within { box-shadow: var(--lq), 0 0 0 3px rgba(255, 255, 255, .1); }
.gm-find-x { position: absolute; right: 7px; top: 50%; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 999px; display: grid; place-items: center;
  transform: translateY(-50%); cursor: pointer; color: var(--muted); background: rgba(255, 255, 255, .08); transition: background .2s, color .2s; }
.gm-find-x[hidden] { display: none; }
.gm-find-x:hover { background: rgba(255, 255, 255, .14); color: var(--ink); }
.gm-find-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* «Ordenar»: píldora de cristal con lo elegido; menú de cristal con un check en lo elegido */
.gm-sort { position: relative; flex: none; }
.gm-sort-btn { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 17px 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  color: var(--ink); font: 500 14px/1 var(--sans); white-space: nowrap;
  background: rgba(255, 255, 255, .055); box-shadow: var(--lq);
  -webkit-backdrop-filter: blur(16px) saturate(170%) brightness(1.08); backdrop-filter: blur(16px) saturate(170%) brightness(1.08);
  transition: background .2s, transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.gm-sort-btn:hover, .gm-sort-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .1); }
.gm-sort-btn:active { transform: scale(.95); }
.gm-sort-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gm-menu { min-width: 236px; z-index: 20; }
.gm-menu .p-menu-item { justify-content: space-between; color: var(--ink); font: 400 15px var(--sans); }
.gm-menu .p-menu-item svg { opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.gm-menu .p-menu-item[aria-checked="true"] { font-weight: 500; }
.gm-menu .p-menu-item[aria-checked="true"] svg { opacity: 1; transform: none; }
.gm-menu.out { animation: gm-menu-out .16s ease-in forwards; }
@keyframes gm-menu-out { to { opacity: 0; transform: scale(.96) translateY(-4px); } }

/* tarjetas ocultas por la búsqueda (.p-app pone display propio) */
.p-games > .p-app[hidden] { display: none; }
.gm-empty { margin: 4px 0 0; }
.gm-empty[hidden] { display: none; }

/* móvil: «Ordenar» solo con el icono, redondo */
@media (max-width: 640px) {
  .gm-sort-btn { width: 46px; padding: 0; justify-content: center; }
  .gm-sort-btn span { display: none; }
  .gm-find.open { width: calc(100vw - 40px - 46px - 10px - 46px - 12px - var(--gm-l, 0px)); }
  .gm-top:has(.p-top-back) { --gm-l: 36px; }
}
@media (prefers-reduced-motion: reduce) { .gm-find, .gm-menu .p-menu-item svg { transition: none; } }

/* la portada lleva width/height en el HTML (para que no salte al cargar): el alto lo pone aspect-ratio */
.p-game-cover { height: auto; }

/* tema claro (a mano, como lo haría tema_claro.py) */
:where([data-theme="light"]) .gm-find, :where([data-theme="light"]) .gm-sort-btn { background: rgba(0, 0, 0, .04); box-shadow: var(--lq); }
:where([data-theme="light"]) .gm-find:hover, :where([data-theme="light"]) .gm-sort-btn:hover,
:where([data-theme="light"]) .gm-sort-btn[aria-expanded="true"], :where([data-theme="light"]) .gm-find.open { background: rgba(0, 0, 0, .065); }
:where([data-theme="light"]) .gm-find:focus-within { box-shadow: var(--lq), 0 0 0 3px rgba(0, 0, 0, .05); }
:where([data-theme="light"]) .gm-find > svg, :where([data-theme="light"]) .gm-sort-btn svg, :where([data-theme="light"]) .gm-find-x svg { fill: none; stroke: currentColor; }
:where([data-theme="light"]) .gm-find-x { background: rgba(0, 0, 0, .06); }
:where([data-theme="light"]) .gm-find-x:hover { background: rgba(0, 0, 0, .1); }
:where([data-theme="light"]) .gm-menu .p-menu-item svg { fill: none; stroke: currentColor; }
