/* Shared Top-Header Intelligent Searchbar & Play-Stage Prediction Dropdown
 * Preserves corner-anchored brand (left) and Legacy Content (right) while centering search at the top.
 */

.hdr-moorkyz-sig {
  z-index: 42;
}

.hdr-moorkyz-sig__inner {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(195px, 460px) minmax(max-content, 1fr);
  align-items: center;
  gap: 8px 14px;
}

.hdr-moorkyz-sig__brand {
  justify-self: start;
  white-space: nowrap;
}

.hdr-moorkyz-sig__legacy {
  justify-self: end;
  margin-left: 0;
}

.hdr-search {
  position: relative;
  width: 100%;
  max-width: 460px;
  justify-self: center;
}

.hdr-search__box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 11px;
  border-radius: 999px;
  background: rgba(13, 17, 34, 0.86);
  border: 1px solid rgba(190, 168, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 160ms ease, box-shadow 180ms ease, background 160ms ease;
}

.hdr-search__box:hover {
  border-color: rgba(201, 158, 255, 0.34);
}

.hdr-search__box:focus-within,
.hdr-search.is-open .hdr-search__box {
  background: rgba(15, 20, 40, 0.96);
  border-color: rgba(201, 158, 255, 0.56);
  box-shadow:
    0 0 0 3px rgba(140, 110, 255, 0.14),
    0 10px 26px rgba(4, 6, 16, 0.42);
}

.hdr-search__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #9aa6c2;
  pointer-events: none;
  transition: color 150ms ease;
}

.hdr-search__box:focus-within .hdr-search__icon {
  color: #c99eff;
}

.hdr-search__icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.hdr-search__input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f3f5fc;
  font: 450 0.82rem/1 var(--font-sans, "DM Sans", system-ui, sans-serif);
  outline: none;
}

.hdr-search__input:focus-visible {
  outline: none;
}

.hdr-search__input::placeholder {
  color: #8490ad;
}

.hdr-search__input::-webkit-search-cancel-button,
.hdr-search__input::-webkit-search-decoration,
.hdr-search__input::-webkit-search-results-button,
.hdr-search__input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.hdr-search__kbd {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: #8b97b3;
  font: 500 0.66rem/1.2 var(--font-mono, "DM Mono", ui-monospace, monospace);
  user-select: none;
}

.hdr-search__top-hit {
  --pill-accent: #c99eff;
  flex-shrink: 0;
  max-width: 185px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pill-accent) 14%, rgba(12, 16, 30, 0.9));
  border: 1px solid color-mix(in srgb, var(--pill-accent) 42%, transparent);
  color: #f4f6fc;
  text-decoration: none;
  font: 500 0.68rem/1 var(--font-mono, "DM Mono", ui-monospace, monospace);
  transition: background 140ms ease, border-color 140ms ease;
}

.hdr-search__top-hit:hover {
  background: color-mix(in srgb, var(--pill-accent) 24%, rgba(12, 16, 30, 0.95));
  border-color: var(--pill-accent);
}

.hdr-search__top-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--pill-accent);
  box-shadow: 0 0 8px var(--pill-accent);
}

.hdr-search__top-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-search__top-enter {
  color: var(--pill-accent);
  font-weight: 700;
  flex-shrink: 0;
}

.hdr-search__clear {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #b8c3dc;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  font: 600 0.85rem/1 var(--font-sans, system-ui, sans-serif);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.hdr-search__clear:hover {
  background: rgba(201, 158, 255, 0.18);
  border-color: rgba(201, 158, 255, 0.42);
  color: #ffffff;
}

/* Dropdown List Below Searchbar (Play & Detail Pages) */
.hdr-search__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  border-radius: 14px;
  background: rgba(10, 13, 27, 0.97);
  border: 1px solid rgba(201, 158, 255, 0.26);
  box-shadow:
    0 20px 48px rgba(2, 4, 12, 0.76),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.hdr-search__list-head {
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font: 600 0.65rem/1.2 var(--font-mono, "DM Mono", ui-monospace, monospace);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8f9bb6;
}

.hdr-search__list-scroll {
  max-height: min(370px, calc(100dvh - 136px));
  overflow-y: auto;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
}

.hdr-search__item {
  --item-accent: #c99eff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #edf1fa;
  text-decoration: none;
  transition: background 130ms ease, border-color 130ms ease;
}

.hdr-search__item.is-top-prediction {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--item-accent) 13%, rgba(16, 21, 40, 0.85)),
    rgba(14, 18, 35, 0.55)
  );
  border-color: color-mix(in srgb, var(--item-accent) 34%, transparent);
}

.hdr-search__item:hover,
.hdr-search__item.is-active {
  background: color-mix(in srgb, var(--item-accent) 18%, rgba(20, 26, 48, 0.92));
  border-color: color-mix(in srgb, var(--item-accent) 52%, transparent);
}

.hdr-search__item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--item-accent);
  background: radial-gradient(
    circle at 35% 28%,
    color-mix(in srgb, var(--item-accent) 26%, transparent),
    rgba(12, 16, 30, 0.9)
  );
  border: 1px solid color-mix(in srgb, var(--item-accent) 38%, transparent);
}

.hdr-search__item-icon .game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 110ms ease;
}

.hdr-search__item-icon .game-icon-img.is-decoded {
  opacity: 1;
}

.hdr-search__item-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.hdr-search__item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hdr-search__item-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hdr-search__item-title {
  font: 600 0.82rem/1.22 var(--font-sans, "DM Sans", system-ui, sans-serif);
  color: #f6f7fc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-search__current-pill {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 999px;
  font: 600 0.6rem/1 var(--font-mono, "DM Mono", ui-monospace, monospace);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64acff;
  background: rgba(100, 172, 255, 0.14);
  border: 1px solid rgba(100, 172, 255, 0.34);
}

.hdr-search__pred-tag {
  font: 500 0.66rem/1.15 var(--font-mono, "DM Mono", ui-monospace, monospace);
  color: #9ba7c2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hdr-search__pred-tag--top {
  color: var(--item-accent);
}

.hdr-search__item-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hdr-search__cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font: 500 0.65rem/1 var(--font-mono, "DM Mono", ui-monospace, monospace);
  color: var(--item-accent);
  background: color-mix(in srgb, var(--item-accent) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--item-accent) 30%, transparent);
}

.hdr-search__cat-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--item-accent);
  box-shadow: 0 0 6px var(--item-accent);
}

.hdr-search__item-ver {
  font: 500 0.68rem/1 var(--font-mono, "DM Mono", ui-monospace, monospace);
  color: #8894b0;
}

.hdr-search__empty {
  padding: 16px 14px;
  text-align: center;
  font: 450 0.8rem/1.4 var(--font-sans, "DM Sans", system-ui, sans-serif);
  color: #94a0bc;
}

@media (hover: none) and (pointer: coarse) {
  .hdr-search__kbd {
    display: none;
  }
}

@media (max-width: 620px) {
  .hdr-moorkyz-sig__inner {
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
  }

  .hdr-search {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
  }

  .hdr-search__top-hit {
    max-width: 132px;
  }
}

@media (max-width: 480px) {
  .hdr-search__item-ver {
    display: none;
  }
}

@media (max-width: 360px) {
  .hdr-moorkyz-sig__wordmark {
    font-size: 1.04rem;
  }
  .hdr-moorkyz-sig__legacy {
    font-size: 0.63rem;
    letter-spacing: 0.04em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hdr-search__box,
  .hdr-search__icon,
  .hdr-search__item,
  .hdr-search__clear,
  .hdr-search__top-hit {
    transition: none !important;
  }
}
