:root {
  --bg: #0A0F1E;
  --panel: #121B33;
  --panel-raised: #17223F;
  --accent: #E8B858;
  --text: #EDF1F8;
  --muted: #8B95AC;
  --border: rgba(237, 241, 248, 0.09);
  --radius: 10px;
  --serif: "Spectral", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  position: relative;
}

/* A quiet, deliberate night-sky field: a soft radial glow suggesting a
   horizon, plus a scattering of small fixed stars. No animation — this is
   the one visual metaphor, stated once, not sprinkled throughout. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(232, 184, 88, 0.08), transparent 60%),
    radial-gradient(1px 1px at 12% 20%, rgba(237,241,248,0.5), transparent),
    radial-gradient(1px 1px at 28% 65%, rgba(237,241,248,0.35), transparent),
    radial-gradient(1.5px 1.5px at 42% 15%, rgba(237,241,248,0.6), transparent),
    radial-gradient(1px 1px at 63% 48%, rgba(237,241,248,0.4), transparent),
    radial-gradient(1px 1px at 78% 72%, rgba(237,241,248,0.3), transparent),
    radial-gradient(1.5px 1.5px at 88% 28%, rgba(237,241,248,0.55), transparent),
    radial-gradient(1px 1px at 95% 85%, rgba(237,241,248,0.3), transparent),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 2rem) 4rem;
}

.hero {
  text-align: center;
  padding-top: clamp(1rem, 6vh, 3rem);
}

.kicker {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}

.subhead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 50ch;
  margin: 0 auto 2.25rem;
  line-height: 1.5;
}

.search-form {
  display: flex;
  gap: 0.6rem;
  max-width: 560px;
  margin: 0 auto;
}

#search-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#search-input::placeholder {
  color: var(--muted);
}

#search-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 184, 88, 0.18);
}

#search-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #1A1304;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.3rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}

#search-button:hover { filter: brightness(1.08); }
#search-button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
#search-button:disabled { opacity: 0.6; cursor: progress; }

.star { font-size: 0.9rem; }

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 1rem;
}

.results-section, .status-section {
  margin-top: 3rem;
}

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 1.1rem;
}

.results-header h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0;
}

.results-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: reveal 0.35s ease both;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .results-list { animation: none; }
}

.result-item {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--format-color, var(--accent));
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  text-decoration: none;
  color: inherit;
}

.result-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.2rem;
}

.result-title {
  font-weight: 600;
  font-size: 0.98rem;
}

.result-format {
  font-size: 0.72rem;
  color: var(--format-color, var(--accent));
  font-weight: 600;
  white-space: nowrap;
}

.result-breadcrumb {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.result-reason {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.status-section p {
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
}

.status-section.is-error p {
  color: #E89090;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 2rem 1rem 3rem;
}
