:root {
  --bg: #10131a;
  --bg2: #171c26;
  --panel: rgba(22, 28, 38, 0.88);
  --ink: #eef3f8;
  --muted: #8b98ab;
  --line: rgba(238, 243, 248, 0.1);
  --mint: #6ef0c8;
  --mint-ink: #04241a;
  --amber: #ffb020;
  --coral: #ff6b5a;
  --glass: rgba(110, 240, 200, 0.08);
  --font: "Figtree", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Figtree", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 65% 45% at 90% -5%, rgba(110, 240, 200, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at -5% 90%, rgba(255, 176, 32, 0.12), transparent 50%),
    linear-gradient(155deg, #0c0f14 0%, var(--bg) 42%, var(--bg2) 100%);
}
.atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 11px,
      rgba(110, 240, 200, 0.025) 11px,
      rgba(110, 240, 200, 0.025) 12px
    );
  pointer-events: none;
}
.atmosphere::after {
  content: "";
  position: absolute;
  width: min(52vw, 28rem);
  height: min(52vw, 28rem);
  right: -6%;
  top: 12%;
  border: 1px solid rgba(110, 240, 200, 0.18);
  border-radius: 50%;
  box-shadow:
    0 0 0 2.5rem rgba(110, 240, 200, 0.04),
    0 0 0 5.5rem rgba(255, 176, 32, 0.03);
  animation: orbit-pulse 9s ease-in-out infinite;
  pointer-events: none;
}

@keyframes orbit-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.85; }
  50% { transform: scale(1.04) rotate(4deg); opacity: 1; }
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 26, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
}
.brand span { color: var(--mint); }
.top nav { display: flex; gap: 0.75rem; align-items: center; }
.top nav a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 2px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.buy { background: var(--mint); color: var(--mint-ink); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover:not(:disabled) { border-color: rgba(110, 240, 200, 0.45); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
  max-width: 42rem;
  position: relative;
}
.hero::before {
  content: "LAB / 01";
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--amber);
  margin-bottom: 1.25rem;
  animation: fade-slide 0.7s ease both;
}
.brand-hero {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  letter-spacing: -0.045em;
  margin: 0 0 1rem;
  line-height: 0.95;
  animation: fade-slide 0.75s 0.08s ease both;
}
.brand-hero em {
  font-style: normal;
  color: var(--mint);
  border-bottom: 3px solid var(--amber);
}
.hero h1 {
  font-size: clamp(1.2rem, 2.8vw, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.75rem;
  max-width: 24ch;
  letter-spacing: -0.02em;
  animation: fade-slide 0.75s 0.16s ease both;
}
.lede {
  color: var(--muted);
  margin: 0 0 1.75rem;
  max-width: 38ch;
  animation: fade-slide 0.75s 0.22s ease both;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: fade-slide 0.75s 0.28s ease both;
}

@keyframes fade-slide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.strip {
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}
.strip h2 {
  font-family: var(--display);
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}
.strip ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.strip li { margin-bottom: 0.45rem; }

.foot {
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.foot a { color: var(--mint); }

/* —— App —— */
.app-body .workspace {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.status {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.status.unlocked { color: var(--mint); }

.bench {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.bench-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.bench-head h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -0.03em;
}
.bench-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.7rem 0.8rem;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(110, 240, 200, 0.35);
  outline-offset: 1px;
}

.packs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.pack {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pack input { accent-color: var(--mint); width: auto; margin: 0; padding: 0; }
.pack.on {
  border-color: rgba(110, 240, 200, 0.55);
  background: var(--glass);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: end;
}
.meta-row label { min-width: 8rem; flex: 1; }

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.results-head h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -0.03em;
}
.count-pill {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber);
  letter-spacing: 0.06em;
}

.candidates {
  display: grid;
  gap: 0.55rem;
}
.candidate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem 1rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.18);
  animation: fade-slide 0.35s ease both;
}
.candidate:nth-child(odd) { animation-delay: 0.02s; }
.candidate:nth-child(even) { animation-delay: 0.06s; }
.candidate.shortlisted {
  border-color: rgba(110, 240, 200, 0.5);
  background: var(--glass);
}
.cand-main { min-width: 0; }
.cand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
  word-break: break-word;
}
.cand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
}
.score {
  color: var(--mint);
}
.pattern-tag {
  color: var(--amber);
  text-transform: lowercase;
}
.cand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}
.cand-actions .btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.tips {
  margin-top: 0.15rem;
  padding: 0.65rem 0.75rem 0.15rem;
  border-top: 1px dashed var(--line);
  grid-column: 1 / -1;
}
.tips summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
  list-style: none;
}
.tips summary::-webkit-details-marker { display: none; }
.tips summary::before {
  content: "▸ ";
  color: var(--amber);
  font-family: var(--mono);
}
.tips[open] summary::before { content: "▾ "; }
.tips ul {
  margin: 0.55rem 0 0.65rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.tips li { margin-bottom: 0.3rem; }
.tips .warn {
  color: var(--coral);
  font-size: 0.72rem;
  margin: 0 0 0.55rem;
  font-family: var(--mono);
}

.shortlist-panel {
  padding: 1.15rem;
  border: 1px solid rgba(110, 240, 200, 0.28);
  border-radius: 4px;
  background: var(--glass);
}
.shortlist-panel h3 {
  font-family: var(--display);
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.shortlist-panel.locked { opacity: 0.55; }
.short-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.short-list li {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
}
.short-list .empty {
  color: var(--muted);
  border: none;
  background: none;
  padding: 0;
  font-family: var(--font);
}

.empty-state {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  padding: 1.25rem 0.25rem;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg2);
  color: var(--ink);
  padding: 1.25rem;
  max-width: 22rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 {
  font-family: var(--display);
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
dialog p { color: var(--muted); font-size: 0.9rem; }
.err { color: #ff8f8f; font-size: 0.85rem; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--mint);
  color: var(--mint-ink);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6rem 1rem;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 20;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 0.75rem; }
  .candidate {
    grid-template-columns: 1fr;
  }
  .cand-actions { justify-content: flex-start; }
  .atmosphere::after { opacity: 0.45; top: 40%; }
}
