:root {
  --bg: #060807;
  --surface: #0D110E;
  --surface-2: #141A16;
  --border: #1D2721;
  --accent: #3DDC6A;
  --accent-soft: rgba(61, 220, 106, 0.10);
  --accent-glow: rgba(61, 220, 106, 0.22);
  --text: #EDF5EF;
  --dim: #8A968E;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --content-w: 780px;   /* single source of truth for the centered content column */
}

/* visually hidden but available to assistive tech */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* consistent keyboard focus ring across every interactive element */
a.brand:focus-visible,
.ghost-btn:focus-visible,
.chip:focus-visible,
.card-actions a:focus-visible,
.card-actions button:focus-visible,
.copy-btn:focus-visible,
.composer button:focus-visible,
button.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 7, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  transition: transform 0.5s var(--ease);
}

.brand:hover .brand-logo {
  transform: rotate(-12deg) scale(1.08);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.accent { color: var(--accent); }

.topbar-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--dim);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}

.ghost-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.icon { width: 14px; height: 14px; }

/* ---------- conversation ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.conversation {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 32px 24px 16px;
}

.conversation > * {
  max-width: var(--content-w);
  margin-left: auto;
  margin-right: auto;
}

/* hero */

.hero {
  text-align: center;
  padding: 9vh 16px 0;
  animation: fadeUp 0.7s var(--ease) both;
  transition: opacity 0.35s, transform 0.35s var(--ease);
}

.hero.leaving {
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
}

.hero-logo {
  width: 74px;
  height: 74px;
  margin-bottom: 24px;
  animation: floatIn 1s var(--ease) both;
}

.hero-title {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--dim);
  font-size: 15.5px;
  margin: 0 0 32px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease), box-shadow 0.25s;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px -8px var(--accent-glow);
}

/* messages */

.msg {
  display: flex;
  margin-bottom: 18px;
  animation: fadeUp 0.45s var(--ease) both;
}

.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }

.bubble {
  max-width: 100%;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14.5px;
  padding: 12px 17px;
  border-radius: 16px;
}

.msg.user .bubble {
  background: var(--accent);
  color: #04170A;
  font-weight: 600;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 4px 24px -6px var(--accent-glow);
}

.msg.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
}

/* typing indicator */

.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 6px 2px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: pulse 1.2s infinite var(--ease);
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* ---------- cards ---------- */

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  width: 100%;
  list-style: none;
  margin-block: 12px 0;
  padding: 0;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 18px;
  animation: fadeUp 0.5s var(--ease) both;
  animation-delay: var(--d, 0ms);
  transition: border-color 0.25s, transform 0.3s var(--ease), box-shadow 0.3s;
}

/* when a card is a real <button> (clickable sniper summary cards) */
button.card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.card:hover {
  border-color: rgba(61, 220, 106, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 34px -14px var(--accent-glow);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.card-sub {
  font-size: 12.5px;
  color: var(--dim);
  margin-top: 4px;
}

.tag {
  display: inline-block;
  vertical-align: middle;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2.5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-right: 7px;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.card-body {
  font-size: 13px;
  color: var(--dim);
  margin-top: 9px;
  line-height: 1.5;
}

.card-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.card-actions a, .card-actions button {
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s var(--ease);
}

.card-actions a:hover, .card-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.card-actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04170A;
  font-weight: 650;
}

.card-actions .primary:hover {
  color: #04170A;
  filter: brightness(1.1);
}

.sniper-section { margin-top: 12px; }

/* label row: text + copy button, flexbox instead of float so nothing
   needs clearing and vertical alignment is exact */
.sniper-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
}

.sniper-label span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.sniper-section p {
  margin: 0;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.export-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- composer ---------- */

.composer {
  display: flex;
  gap: 10px;
  padding: 14px 24px calc(18px + env(safe-area-inset-bottom));
  max-width: calc(var(--content-w) + 48px); /* 24px side padding matches .conversation's, so columns align */
  width: 100%;
  margin: 0 auto;
}

.composer input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.composer input::placeholder { color: var(--dim); }

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 30px -12px var(--accent-glow);
}

.composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  background: var(--accent);
  color: #04170A;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), filter 0.2s, box-shadow 0.25s;
}

.composer button .icon { width: 18px; height: 18px; }

.composer button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 8px 26px -10px var(--accent-glow);
}

.composer button:active { transform: scale(0.94); }

/* ---------- animations ---------- */

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

@keyframes floatIn {
  0% { opacity: 0; transform: translateY(18px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .conversation { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .ghost-btn { padding: 7px 11px; font-size: 12px; }
  .conversation { padding: 20px 14px 10px; }
  .composer { padding: 10px 14px 16px; }
  .hero { padding-top: 6vh; }
}

/* ================= v2: 3D + ambient motion ================= */

/* drifting green aurora behind everything */
body { position: relative; overflow: hidden; }

body::before, body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

body::before {
  width: 62vw; height: 62vw;
  top: -22vw; right: -16vw;
  background: radial-gradient(circle, rgba(61, 220, 106, 0.09), transparent 62%);
  animation: drift1 22s ease-in-out infinite alternate;
}

body::after {
  width: 52vw; height: 52vw;
  bottom: -18vw; left: -12vw;
  background: radial-gradient(circle, rgba(61, 220, 106, 0.06), transparent 62%);
  animation: drift2 28s ease-in-out infinite alternate;
}

@keyframes drift1 { to { transform: translate(-9vw, 7vh) scale(1.18); } }
@keyframes drift2 { to { transform: translate(7vw, -6vh) scale(1.12); } }

.app { position: relative; z-index: 1; }

/* hero logo: 3D float with glow */
.hero-logo {
  filter: drop-shadow(0 0 26px rgba(61, 220, 106, 0.35));
  animation: floatIn 1s var(--ease) both, heroFloat 7s 1.1s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: perspective(600px) rotateY(-14deg) translateY(0); }
  50% { transform: perspective(600px) rotateY(14deg) translateY(-9px); }
}

/* cards: 3D flip-in entrance + mouse-follow tilt */
.cards { perspective: 1000px; }

.card {
  transform-style: preserve-3d;
  animation-name: cardIn;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) rotateX(-9deg); }
  to { opacity: 1; transform: none; }
}

.card:hover {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-2px);
  transition: transform 0.08s linear, border-color 0.25s, box-shadow 0.3s;
}

/* chips: shine sweep */
.chip { position: relative; overflow: hidden; }

.chip::after {
  content: "";
  position: absolute;
  top: 0; left: -80%;
  width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.10), transparent);
  transform: skewX(-20deg);
  transition: left 0.65s var(--ease);
  pointer-events: none;
}

.chip:hover::after { left: 125%; }

/* user bubble pop-in */
.msg.user { animation-name: popIn; animation-duration: 0.35s; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

/* send button: icon flies out and returns */
.composer button.sending .icon { animation: fly 0.55s var(--ease); }

@keyframes fly {
  0% { transform: none; opacity: 1; }
  45% { transform: translateX(16px); opacity: 0; }
  46% { transform: translateX(-16px); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* export buttons: icon dips on hover */
.ghost-btn:hover .icon { animation: dip 0.5s var(--ease); }

@keyframes dip {
  40% { transform: translateY(3px); }
  100% { transform: none; }
}

/* ================= v3: match transparency + composer life ================= */

.title-extras { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.top-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #04170A;
  white-space: nowrap;
  box-shadow: 0 0 16px -2px var(--accent-glow);
  animation: badgePulse 2.4s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 14px -2px var(--accent-glow); }
  50% { box-shadow: 0 0 26px 0 var(--accent-glow); }
}

.match-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2.5px 9px;
  border-radius: 999px;
  border: 1px dashed rgba(61, 220, 106, 0.4);
  color: var(--dim);
  white-space: nowrap;
}

.typing-bubble { display: flex; align-items: center; gap: 10px; }

.typing-status {
  font-size: 12.5px;
  color: var(--dim);
  animation: fadeUp 0.4s var(--ease);
}

/* ================= footer / credit ================= */

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--dim);
  opacity: 0.75;
  padding: 0 24px 12px;
  letter-spacing: 0.02em;
}

.footer-name {
  color: var(--accent);
  font-weight: 600;
}

/* ================= v5: auto-hunt + follow-up radar ================= */

.new-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  white-space: nowrap;
}

.new-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s infinite var(--ease);
}

.followup-card {
  border-color: rgba(61, 220, 106, 0.35);
  box-shadow: 0 0 22px -12px var(--accent-glow);
}

.footer-sep { margin: 0 4px; opacity: 0.6; }

/* ================= v6: listing age ================= */

.age-chip { color: var(--dim); }

.age-chip.stale {
  color: #D9A441;
  border-bottom: 1px dotted rgba(217, 164, 65, 0.5);
  cursor: help;
}

/* ================= v7: brand link + basics ================= */

a.brand {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.copy-btn {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: #04170A;
  background: var(--accent);
  border-color: var(--accent);
}

/* ================= v8: classification cursor =================
   A targeting reticle that classifies what it's over, the way a
   surveillance system would. Colour is never decorative here:
     white  · irrelevant  — nothing actionable under the pointer
     blue   · indigo      — actionable: open, save, run a command
     amber  · contingency — the system is working (searching boards)
     red    · threat      — a listing old enough to likely be filled
   Pointer devices only; touch and reduced-motion users get the
   normal cursor and no animation.                                */

:root {
  /* the only four colours the reticle may ever be */
  --poi-irrelevant: #FFFFFF;
  --poi-threat:     #ED1C24;
  --poi-contingency:#FFD100;
  --poi-indigo:     #0D9BFF;
}

@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  /* text editing still needs a real caret */
  input, textarea, [contenteditable] { cursor: text; }

  .poi {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.22s var(--ease);
    will-change: transform;
  }

  .poi.ready { opacity: 1; }
  .poi.over-text { opacity: 0; }

  .poi-box {
    width: 100%;
    height: 100%;
    transform: scale(1);
    transition: transform 0.28s var(--ease), color 0.18s linear;
    color: var(--poi-irrelevant);
  }

  .poi svg { display: block; width: 100%; height: 100%; overflow: visible; }

  .poi svg path {
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;   /* weight stays even when the box scales */
    filter: drop-shadow(0 0 4px currentColor);
  }

  /* indigo — something you can act on: lock on tight */
  .poi.is-active .poi-box {
    color: var(--poi-indigo);
    transform: scale(0.62);
  }

  /* indigo, wide — a result card: frame it like a subject */
  .poi.is-target .poi-box {
    color: var(--poi-indigo);
    transform: scale(1.42);
  }

  /* contingency — boards are being searched */
  .poi.is-busy .poi-box {
    color: var(--poi-contingency);
    animation: poiScan 1.6s linear infinite;
  }

  /* threat — stale listing, probably already filled */
  .poi.is-danger .poi-box {
    color: var(--poi-threat);
    animation: poiAlert 0.9s var(--ease) infinite;
  }

  @keyframes poiScan {
    0%   { transform: scale(1) rotate(0deg); }
    50%  { transform: scale(1.12) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
  }

  @keyframes poiAlert {
    0%, 100% { transform: scale(1.18); }
    50%      { transform: scale(1.32); }
  }

  /* the classification readout, POI-style */
  .poi-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 6px);
    font-family: "Cascadia Mono", Consolas, ui-monospace, monospace;
    font-size: 8px;
    letter-spacing: 0.18em;
    white-space: nowrap;
    color: currentColor;
    opacity: 0;
    transition: opacity 0.18s linear;
  }
  .poi.is-danger .poi-label { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .poi-box { animation: none !important; transition: color 0.18s linear !important; }
}

/* ================= v9: sort controls ================= */

.sortbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.sortbar-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin-right: 2px;
}

.sort-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.sort-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sort-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #04170A;
  font-weight: 650;
}

.sort-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
