:root {
  --bg-deep: #081226;
  --bg-mid: #0f223f;
  --bg-light: #1b3a66;
  --paper: #f4f7fb;
  --ink: #132238;
  --ink-soft: #425a78;
  --line: #d5deeb;
  --accent: #ffce53;
  --accent-ink: #3a2a00;
  --card: #ffffff;
  --shadow: 0 14px 36px rgba(8, 18, 38, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(140deg, var(--bg-deep), var(--bg-mid) 42%, var(--bg-light));
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 206, 83, 0.22), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(103, 188, 255, 0.2), transparent 38%);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 24px;
}

.hero,
.controls,
.results-panel,
.detail-panel,
.footer {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Barlow Condensed", "Franklin Gothic Medium", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
  margin-top: 4px;
}

.subtitle {
  margin: 8px 0 0;
  max-width: 64ch;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-secondary {
  background: #d8e8ff;
  color: #113766;
  border-color: #a0c0e8;
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 230px;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.control {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.control span {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.control input,
.control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.content-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.results-panel,
.detail-panel {
  min-height: 62vh;
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-head p {
  margin: 0;
  color: var(--ink-soft);
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 64vh;
  overflow: auto;
}

.result-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 10px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.result-item:hover {
  border-color: #7ea0c9;
}

.result-item.active {
  border-color: #26558d;
  box-shadow: inset 0 0 0 1px #26558d;
}

.result-item h3 {
  font-size: 1.2rem;
}

.meta-line {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.snippet {
  margin: 0;
  color: var(--ink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.pill {
  border-radius: 999px;
  background: #e6edf8;
  color: #20406a;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
}

.pill.muted {
  background: #edf1f7;
  color: #4b6281;
}

.detail-text {
  white-space: pre-wrap;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  min-height: 260px;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1rem;
}

.related-wrap {
  margin-top: 12px;
}

.related-wrap h3 {
  margin-bottom: 8px;
}

.related-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.related-list button {
  border: 1px solid #c4d2e6;
  border-radius: 999px;
  background: #fff;
  color: #1f4674;
  cursor: pointer;
  padding: 4px 10px;
}

.empty-state {
  color: var(--ink-soft);
}

.footer {
  margin-top: 14px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .results-panel,
  .detail-panel {
    min-height: unset;
  }

  .results-list {
    max-height: 42vh;
  }
}
