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

:root {
  --black: #020202;
  --panel: #141416;
  --panel-soft: #1c1c1f;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.11);
  --yellow: #f5d03a;
  --yellow-glow: rgba(245, 208, 58, 0.22);
  --yellow-glow-soft: rgba(245, 208, 58, 0.09);
  --yellow-dot: rgba(245, 208, 58, 0.1);
  --yellow-dot-faint: rgba(245, 208, 58, 0.06);
  --text-main: #f5f5f5;
  --text-mid: #b5b5bf;
  --text-dim: #8b8b97;
  --search-surface: rgba(12, 12, 14, 0.92);
  --bg-page: #0a0a0c;
  /* Fine tiled film grain (SVG); opacity lives in the filter graphic */
  --bg-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.22'/%3E%3C/svg%3E");
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen,
    Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 26px;
  position: relative;
  overflow-x: hidden;
  background: var(--bg-page);
  color: var(--text-main);
}

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 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 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 {
  scroll-behavior: smooth;
}

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

  body.page-lookup {
    transition: none;
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    var(--bg-grain),
    radial-gradient(ellipse 120% 90% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 52%),
    radial-gradient(ellipse 100% 75% at 50% 100%, rgba(0, 0, 0, 0.14), transparent 55%),
    linear-gradient(195deg, rgba(255, 255, 255, 0.04) 0%, transparent 42%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.2) 100%);
  background-size: 200px 200px, auto, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-blend-mode: soft-light, normal, normal, normal, normal;
  z-index: -1;
  pointer-events: none;
}

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

.page-lookup .container {
  max-width: 860px;
}

.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 6px;
}

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

.lookup-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-main);
  font-weight: 800;
}

.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: rgba(12, 12, 14, 0.98);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  max-height: min(55vh, 320px);
  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:disabled {
  opacity: 1;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  cursor: not-allowed;
}

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

.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-results {
  margin-top: 22px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: var(--lookup-column-max);
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-margin-top: 20px;
}

.lookup-account-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lookup-result-box {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--search-surface);
  padding: 22px 16px 16px;
  text-align: center;
}

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

.lookup-box-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.lookup-box-primary {
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.lookup-region-value {
  text-transform: none;
}

.lookup-box-mono {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.82rem;
  font-weight: 500;
  word-break: break-all;
  color: var(--text-main);
}

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

.lookup-box-secondary {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  word-break: break-all;
}

.lookup-inline-code {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.72rem;
  color: var(--yellow);
  word-break: break-all;
}

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

.lookup-box-link {
  font-size: 0.72rem;
  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: 0.78rem;
  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: 0.75rem;
}

@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-title span {
  color: var(--yellow);
}

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

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

.loader {
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top: 3px solid var(--yellow);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

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

.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);
  }
}
