.game-search {
  --search-blue: #95bdf1;
  width: 100%;
  min-width: 0;
}

.game-search svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-search-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  gap: 12px;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: #b7c3d4;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.game-search-trigger svg { width: 19px; height: 19px; color: var(--search-blue); }
.game-search-trigger:disabled { opacity: .6; cursor: default; }
.game-search button:focus-visible { outline: 2px solid var(--search-blue); outline-offset: 2px; }

html:has(.game-search-dialog[open]) { overflow: hidden; }
.game-search-dialog {
  --search-top: clamp(16px, 6vh, 56px);
  --card-gap: 12px;
  --visible-cards: 7;
  width: min(1120px, calc(100% - 40px));
  max-width: none;
  max-height: min(860px, calc(var(--search-viewport, 100dvh) - var(--search-top) - var(--search-top)));
  margin: var(--search-top) auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  color: var(--text);
  color-scheme: dark;
}
.game-search-dialog[open] { display: flex; flex-direction: column; }
.game-search-dialog::backdrop {
  background: rgb(4 9 20 / 72%);
  backdrop-filter: blur(4px);
}

.game-search-toolbar,
.game-search-field {
  display: flex;
  align-items: center;
}
.game-search-toolbar {
  flex: none;
  gap: 12px;
  min-height: 66px;
  padding: 10px 20px;
  background: var(--panel);
}
.game-search-field:focus-within svg { color: #d5e9ff; }
.game-search-field { flex: 1; min-width: 0; gap: 12px; }
.game-search-field svg { flex: none; width: 21px; height: 21px; color: var(--search-blue); }
.game-search-field input {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--soft);
  caret-color: var(--search-blue);
  font: 500 17px/1.4 var(--font-main);
}
.game-search-field input::placeholder { color: #b7c3d4; }
.game-search-field input::-webkit-search-cancel-button { appearance: none; }

.game-search-close,
.game-search-shelf-head button {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #becbdd;
  line-height: 0;
  cursor: pointer;
}
.game-search-close { width: 36px; height: 36px; }
.game-search-close svg { stroke-width: 2; }
.game-search-shelf-head button svg { width: 16px; height: 16px; stroke-width: 2; }
.game-search-shelf-head button:disabled { opacity: .32; cursor: default; }
@media (hover: hover) {
  .game-search-shelf-head button:enabled:hover {
    background: var(--panel-soft);
    color: var(--soft);
  }
}

.game-search-content {
  min-height: 0;
  padding: 16px 20px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.game-search-shelf { min-width: 0; }
.game-search-shelf + .game-search-shelf {
  margin-top: 20px;
  padding-top: 16px;
}
.game-search-shelf-head {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 8px;
  margin-bottom: 10px;
}
.game-search-shelf-head h2 {
  min-width: 0;
  margin: 0 auto 0 0;
  color: var(--soft);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.015em;
  text-align: left;
  overflow-wrap: anywhere;
}

.game-search-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% + var(--card-gap)) / var(--visible-cards) - var(--card-gap));
  gap: var(--card-gap);
  padding-block: 9px 18px;
  margin-block: -6px -14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}
.game-search-card {
  display: grid;
  place-items: center;
  position: relative;
  min-width: 0;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--soft);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  scroll-snap-align: start;
  transform: translate3d(0, 0, 0);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.game-search-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.game-search-card:is(:hover, :focus-visible) {
  transform: translate3d(0, -8px, 0);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
  filter: brightness(1.03);
}
.game-search-card:focus-visible { outline: 2px solid var(--search-blue); outline-offset: -3px; }

.game-search-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 12px; }
.game-search-empty strong { font-size: 15px; font-weight: 600; }
.game-search-empty button {
  min-height: 40px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--search-blue);
  font-size: 14px;
  cursor: pointer;
}
.game-search-empty button:hover { text-decoration: underline; }

@media (max-width: 899px) {
  .game-search-dialog { --visible-cards: 5; }
}
@media (max-width: 639px) {
  .game-search-dialog {
    --visible-cards: 3;
    --card-gap: 8px;
    --search-top: 8px;
    width: calc(100% - 16px);
  }
  .game-search-trigger { min-height: 46px; padding-inline: 13px; }
  .game-search-toolbar { min-height: 54px; padding: 5px 10px 5px 14px; }
  .game-search-content { padding: 8px 12px 14px; }
  .game-search-shelf + .game-search-shelf { margin-top: 14px; padding-top: 8px; }
  .game-search-shelf-head { gap: 6px; margin-bottom: 6px; }
  .game-search-shelf-head h2 { font-size: 15px; }
  .game-search-shelf-head button, .game-search-close { width: 44px; height: 44px; }
  .game-search-card { border-radius: 8px; }
}
@media (max-width: 359px) {
  .game-search-dialog { --visible-cards: 2; }
}
@media (max-height: 480px) {
  .game-search-dialog { --search-top: 8px; }
}
