* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

:root {
  --font-sans: "Roboto", sans-serif;
  --line-soft: rgba(255, 255, 255, 0.11);
  --yellow: #f5d03a;
  --text-main: #f5f5f5;
  --text-mid: #b5b5bf;
  --text-dim: #8b8b97;
  --bg-page: #0a0a0c;
  /* Tint of page color so html::before grain shows through (matches bg, not a flat black card) */
  --search-surface: color-mix(in srgb, var(--bg-page) 64%, transparent);
  /* Neutral grey grain: desaturate noise, then squeeze toward mid-grey (feComponentTransfer) */
  --bg-grain: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'200'%20height%3D'200'%3E%3Cfilter%20id%3D'g'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'0.78'%20numOctaves%3D'4'%20stitchTiles%3D'stitch'%20result%3D't'%2F%3E%3CfeColorMatrix%20in%3D't'%20type%3D'saturate'%20values%3D'0'%20result%3D'gray'%2F%3E%3CfeComponentTransfer%20in%3D'gray'%20result%3D'out'%3E%3CfeFuncR%20type%3D'linear'%20slope%3D'0.1'%20intercept%3D'0.45'%2F%3E%3CfeFuncG%20type%3D'linear'%20slope%3D'0.1'%20intercept%3D'0.45'%2F%3E%3CfeFuncB%20type%3D'linear'%20slope%3D'0.1'%20intercept%3D'0.45'%2F%3E%3C%2FfeComponentTransfer%3E%3C%2Ffilter%3E%3Crect%20width%3D'100%25'%20height%3D'100%25'%20filter%3D'url(%23g)'%20opacity%3D'0.14'%2F%3E%3C%2Fsvg%3E");
  /* Lookup page motion — ease-out deceleration, no overshoot (avoids “bouncy” feel) */
  --lookup-shift-duration: 0.82s;
  --lookup-shift-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --lookup-card-duration: 0.58s;
  --lookup-card-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --lookup-card-stagger: 0.03s;
  --lookup-value-font-size: 1.1rem;
  /* Smaller than --lookup-value-font-size (1.1rem) */
  --lookup-link-font-size: 0.9rem;
}

body {
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 26px;
  position: relative;
  overflow-x: hidden;
  background: transparent;
  color: var(--text-main);
  z-index: 1;
}

body.page-lookup {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-left: 26px;
  padding-right: 26px;
  padding-bottom: 26px;
  /* Midway between top (0) and viewport center (50vh) → 25vh */
  padding-top: max(26px, 25vh);
  transition: padding-top var(--lookup-shift-duration) var(--lookup-shift-ease);
}

/* After a successful lookup, pull the hero block up so results fit in view. */
body.page-lookup.page-lookup--results {
  padding-top: max(20px, 48px);
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
}

/* Grain on html so it isn’t hidden behind body’s own background (body::after + z-index: -1 was invisible). */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    var(--bg-grain),
    radial-gradient(ellipse 100% 75% at 50% 100%, rgba(0, 0, 0, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.2) 100%);
  background-size: 200px 200px, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat;
  background-blend-mode: soft-light, normal, normal;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body.page-lookup {
    transition: none;
  }

  .lookup-results:not([hidden]) .lookup-account-block {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .lookup-error:not([hidden]) {
    animation: none !important;
  }

  .lookup-fetch-spinner {
    animation: lookup-fetch-pulse 1.2s ease-in-out infinite;
  }
}

@keyframes lookup-fetch-pulse {
  0%,
  100% {
    opacity: 0.45;
    border-top-color: var(--yellow);
  }
  50% {
    opacity: 1;
    border-top-color: var(--yellow);
  }
}

.container {
  width: 100%;
  max-width: 860px;
}

.page-lookup .container {
  max-width: 860px;
  flex: 1 0 auto;
  width: 100%;
}

.site-footer {
  width: 100%;
  max-width: 860px;
  padding: 28px 12px 12px;
  text-align: center;
}

.site-footer__note {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.45;
  letter-spacing: 0.02em;
}

.lookup-main {
  width: 100%;
  /* Keep search combo and result cards the same width */
  --lookup-column-max: min(460px, 100%);
}

.lookup-heading {
  margin-bottom: 8px;
  text-align: center;
}

.page-lookup .lookup-heading .lookup-page-title {
  --lookup-title-stroke: 3px;
  text-transform: none;
  color: var(--text-main);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.06em;
  padding-bottom: 10px;
  margin-bottom: 0;
  line-height: 1.05;
}

.page-lookup .lookup-heading .lookup-page-title::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--lookup-title-stroke);
  border-radius: 999px;
  background: var(--yellow);
}

/* Rounded pill instead of a text hyphen between Epic and Search */
.page-lookup .lookup-heading .lookup-page-title .lookup-title-dash {
  flex-shrink: 0;
  display: inline-block;
  width: 0.55em;
  min-width: 14px;
  height: var(--lookup-title-stroke);
  min-height: var(--lookup-title-stroke);
  border-radius: 999px;
  background: var(--yellow);
  color: transparent;
  transform: translateY(4px);
}

.lookup-form {
  margin: 24px 0 0;
}

.lookup-turnstile-wrap {
  display: flex;
  justify-content: center;
}

.lookup-turnstile {
  min-height: 65px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lookup-fetch-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  /* Align with Turnstile row so layout doesn’t jump */
  min-height: 65px;
}

.lookup-fetch-loading[hidden] {
  display: none !important;
}

.lookup-fetch-spinner {
  box-sizing: border-box;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(245, 208, 58, 0.22);
  border-top-color: var(--yellow);
  animation: lookup-fetch-spin 0.7s linear infinite;
}

@keyframes lookup-fetch-spin {
  to {
    transform: rotate(360deg);
  }
}

.lookup-query-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lookup-form-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.lookup-input {
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: var(--search-surface);
  color: #ffffff;
  font-size: 0.9rem;
  font-family: inherit;
}

.lookup-input::placeholder {
  color: #ffffff;
  opacity: 1;
}

.lookup-mode-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Width cap ≈ former text field (row had separate 200px “Search by” + this grew) */
.lookup-combo {
  position: relative;
  flex: 1 1 200px;
  max-width: var(--lookup-column-max);
  min-width: 0;
}

.lookup-combo-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: var(--search-surface);
  overflow: hidden;
}

.lookup-combo-row:focus-within {
  border-color: rgba(255, 255, 255, 0.18);
}

.lookup-combo .lookup-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  text-align: left;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Hide blinking caret after Enter submits a valid lookup (see app.js). */
.lookup-combo--hide-caret .lookup-input {
  caret-color: transparent;
}

.lookup-combo .lookup-input:read-only {
  cursor: pointer;
  text-align: center;
  caret-color: transparent;
}

/* Fade out “Click me!” while the combo is active (input or mode menu). */
.lookup-combo .lookup-input:read-only::placeholder {
  transition: opacity 0.28s ease;
}

.lookup-combo:focus-within .lookup-input:read-only::placeholder {
  opacity: 0;
}

.lookup-input-clear[hidden] {
  display: none !important;
}

.lookup-input-clear {
  flex-shrink: 0;
  align-self: stretch;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 3rem;
  min-width: 3rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 0;
  cursor: pointer;
  font-family: inherit;
}

.lookup-input-clear:hover,
.lookup-input-clear:focus {
  background: transparent;
  color: #ffffff;
  outline: none;
}

.lookup-input-clear:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: -4px;
}

.lookup-mode-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 6px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: var(--search-surface);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  /* Fits all mode rows without scrollbar (9 options + padding); still caps on short viewports */
  max-height: min(90vh, 500px);
  overflow-y: auto;
}

.lookup-mode-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.lookup-mode-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lookup-mode-option:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
}

.lookup-mode-option:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: -2px;
}

.lookup-input:focus {
  outline: none;
  border-color: var(--line-soft);
  box-shadow: none;
}

.lookup-error {
  margin-top: 14px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: var(--lookup-column-max);
}

.lookup-error:not([hidden]) {
  animation: lookup-error-in 0.45s var(--lookup-card-ease) both;
}

@keyframes lookup-error-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lookup-output-stack {
  /* Same horizontal alignment as search; space below search/error before results or Turnstile */
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: var(--lookup-column-max);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lookup-results {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: var(--lookup-column-max);
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: 20px;
}

@keyframes lookup-card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lookup-results:not([hidden]) .lookup-account-block {
  opacity: 0;
  animation: lookup-card-in var(--lookup-card-duration) var(--lookup-card-ease) both;
}

.lookup-results:not([hidden]) .lookup-account-block:nth-child(1) {
  animation-delay: calc(var(--lookup-card-stagger) * 1);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(2) {
  animation-delay: calc(var(--lookup-card-stagger) * 2);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(3) {
  animation-delay: calc(var(--lookup-card-stagger) * 3);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(4) {
  animation-delay: calc(var(--lookup-card-stagger) * 4);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(5) {
  animation-delay: calc(var(--lookup-card-stagger) * 5);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(6) {
  animation-delay: calc(var(--lookup-card-stagger) * 6);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(7) {
  animation-delay: calc(var(--lookup-card-stagger) * 7);
}
.lookup-results:not([hidden]) .lookup-account-block:nth-child(8) {
  animation-delay: calc(var(--lookup-card-stagger) * 8);
}

.lookup-account-block {
  display: flex;
  flex-direction: column;
  /* Extra space so each pill label (e.g. NINTENDO) clears the card above */
  gap: 14px;
}

.lookup-result-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-height: 4.5rem;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--search-surface);
  padding: 14px 10px 10px;
  text-align: center;
  box-sizing: border-box;
  transition:
    border-color 0.35s var(--lookup-card-ease),
    box-shadow 0.4s var(--lookup-card-ease);
}

.lookup-pill {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-mid);
  background: var(--search-surface);
  border: 1px solid var(--line-soft);
}

.lookup-box-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 2px;
  min-height: 0;
}

.lookup-result-box--locale {
  min-height: 0;
  /* Sum of this box’s top padding and .lookup-box-body--locale padding-top — lifts pill to top border */
  --locale-pill-offset: calc(14px + 4px);
}

.lookup-box-body--locale {
  justify-content: flex-start;
  width: 100%;
  align-items: stretch;
  padding-top: 4px;
}

.lookup-locale-stack {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  gap: 0;
}

.lookup-locale-col {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 6px 6px;
  text-align: center;
}

/* Pill centered on this column; same vertical axis as the value below */
.lookup-locale-mini-pill--border {
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--locale-pill-offset));
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-mid);
  background: var(--search-surface);
  border: 1px solid var(--line-soft);
  line-height: 1.2;
  white-space: nowrap;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.lookup-locale-vrule {
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
  margin: 2px 0;
  background: var(--line-soft);
  opacity: 0.95;
}

@media (max-width: 380px) {
  .lookup-result-box--locale {
    --locale-pill-offset: 0px;
  }

  .lookup-locale-stack {
    flex-direction: column;
  }

  .lookup-locale-vrule {
    width: 100%;
    height: 1px;
    align-self: stretch;
    margin: 6px 0;
  }

  .lookup-locale-col {
    padding: 6px 2px;
  }

  .lookup-locale-mini-pill--border {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin-bottom: 6px;
    max-width: min(28vw, 140px);
  }
}

.lookup-locale-row__value {
  width: 100%;
  font-size: var(--lookup-value-font-size);
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
  text-align: center;
  color: var(--text-main);
}

.lookup-box-primary {
  font-size: var(--lookup-value-font-size);
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.lookup-box-mono {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: var(--lookup-value-font-size);
  font-weight: 500;
  line-height: 1.3;
  word-break: break-all;
  color: var(--text-main);
}

.lookup-box-muted {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.lookup-box-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.lookup-box-link {
  font-size: var(--lookup-link-font-size);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
  text-decoration: none;
}

.lookup-box-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lookup-box-url {
  display: inline;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  max-width: 100%;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: var(--lookup-link-font-size);
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
  color: var(--yellow);
  text-decoration: none;
}

.lookup-box-url:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lookup-box-link-sep {
  color: var(--text-dim);
  font-size: var(--lookup-link-font-size);
}

@media (min-width: 540px) {
  .lookup-form-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
  }
}

.panel-title {
  text-transform: uppercase;
  font-weight: 800;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.panel-heading {
  margin-bottom: 4px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.error {
  color: var(--yellow);
  background: rgba(245, 208, 58, 0.14);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(245, 208, 58, 0.4);
}

@media (max-width: 520px) {
  body {
    padding: 10px;
  }

  body.page-lookup {
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    padding-top: max(10px, 25vh);
  }
}
