:root {
  --bg: #000000;
  --bg-elev: #031108;
  --ink: #b8ffd0;
  --muted: #86e8ab;
  --phosphor: #00ff6a;
  --pink: #e83a7a;
  --line: rgba(0, 255, 106, 0.28);
  --font-d: "Orbitron", "Share Tech Mono", ui-monospace, monospace;
  --font-b: "Share Tech Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
html { color-scheme: dark; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--ink);
  position: relative;
}
a { color: var(--phosphor); }
:focus-visible {
  outline: 2px solid var(--phosphor);
  outline-offset: 3px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0);
}
.skip {
  position: absolute; left: 0.75rem; top: -3rem; z-index: 60;
  background: var(--phosphor); color: #000; padding: 0.4rem 0.7rem; font-weight: 700;
}
.skip:focus { top: 0.75rem; }

.matrix-rain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  opacity: 0.14; user-select: none; contain: strict;
}
.matrix-rain span {
  position: absolute; top: -120%;
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 13px; line-height: 1.15; letter-spacing: 0.12em;
  color: var(--phosphor);
  text-shadow: 0 0 8px rgba(0, 255, 106, 0.55);
  animation: rain-fall linear infinite;
  white-space: nowrap;
}
.matrix-rain span::after {
  content: "01アカサタナハマヤラワ012日体01カキクケコサシスセソ01";
}
.matrix-rain span:nth-child(1) { left: 2%; animation-duration: 11s; animation-delay: -2s; }
.matrix-rain span:nth-child(2) { left: 8%; animation-duration: 8s; animation-delay: -5s; font-size: 11px; }
.matrix-rain span:nth-child(3) { left: 14%; animation-duration: 13s; animation-delay: -1s; }
.matrix-rain span:nth-child(4) { left: 21%; animation-duration: 9s; animation-delay: -7s; }
.matrix-rain span:nth-child(5) { left: 28%; animation-duration: 12s; animation-delay: -3s; font-size: 15px; }
.matrix-rain span:nth-child(6) { left: 35%; animation-duration: 7s; animation-delay: -4s; }
.matrix-rain span:nth-child(7) { left: 42%; animation-duration: 14s; animation-delay: -8s; }
.matrix-rain span:nth-child(8) { left: 49%; animation-duration: 10s; animation-delay: -6s; }
.matrix-rain span:nth-child(9) { left: 56%; animation-duration: 8.5s; animation-delay: -1.5s; }
.matrix-rain span:nth-child(10) { left: 63%; animation-duration: 11.5s; animation-delay: -9s; }
.matrix-rain span:nth-child(11) { left: 70%; animation-duration: 9.5s; animation-delay: -2.5s; font-size: 12px; }
.matrix-rain span:nth-child(12) { left: 77%; animation-duration: 13.5s; animation-delay: -4.5s; }
.matrix-rain span:nth-child(13) { left: 83%; animation-duration: 7.5s; animation-delay: -6.5s; }
.matrix-rain span:nth-child(14) { left: 89%; animation-duration: 12.5s; animation-delay: -0.8s; }
.matrix-rain span:nth-child(15) { left: 94%; animation-duration: 10.5s; animation-delay: -3.8s; }
.matrix-rain span:nth-child(16) { left: 98%; animation-duration: 15s; animation-delay: -11s; font-size: 10px; }
@keyframes rain-fall {
  from { transform: translateY(0); }
  to { transform: translateY(220vh); }
}
.scan {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 255, 106, 0.035) 3px
  );
}

.top, .layout, .gate { position: relative; z-index: 2; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.88);
}
.logo {
  font-family: var(--font-d); font-size: 1.05rem; font-weight: 700;
  color: var(--phosphor); text-decoration: none; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.logo span { color: var(--pink); }
.top nav { display: flex; gap: 1rem; font-size: 0.85rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a.on, .top nav a:hover { color: var(--phosphor); }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.2fr);
  gap: 0;
  min-height: calc(100vh - 52px);
}
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.chat, .results { padding: 1.25rem 1.35rem 2rem; }
.chat { border-right: 1px solid var(--line); background: rgba(0, 0, 0, 0.82); }
.results { background: rgba(0, 8, 4, 0.86); }
h1, h2 {
  font-family: var(--font-d); margin: 0 0 0.4rem;
  color: var(--phosphor); letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(0, 255, 106, 0.35);
}
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; text-transform: uppercase; }
.lede, .meta, .note { color: var(--muted); font-size: 0.9rem; }
.log { min-height: 180px; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.bubble {
  max-width: 92%; padding: 0.65rem 0.8rem; border-radius: 4px;
  font-size: 0.92rem; line-height: 1.4;
}
.bubble.bot {
  background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: 0 0 12px rgba(0, 255, 106, 0.08);
}
.bubble.you {
  align-self: flex-end; background: rgba(232, 58, 122, 0.16);
  border: 1px solid rgba(232, 58, 122, 0.45); color: #ffd0e2;
}
.ask { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.ask input {
  background: #000; border: 1px solid var(--line); color: var(--phosphor);
  border-radius: 4px; padding: 0.55rem 0.7rem; font: inherit;
  caret-color: var(--phosphor);
}
.ask input::placeholder { color: var(--muted); opacity: 0.85; }
#zip { width: 5.5rem; }
#mood { flex: 1; min-width: 10rem; }
button, .primary, .ghost {
  appearance: none; border: 0; border-radius: 4px; padding: 0.55rem 1rem;
  font: 700 0.85rem var(--font-b); cursor: pointer; text-decoration: none;
  display: inline-block; touch-action: manipulation; min-height: 44px;
}
.primary {
  background: var(--phosphor); color: #001408;
  box-shadow: 0 0 16px rgba(0, 255, 106, 0.35);
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
.matcher-status {
  display: inline-block; margin: 0 0 0.55rem;
  padding: 0.28rem 0.55rem; border: 1px solid var(--line);
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.matcher-status.off {
  color: #ffb3cc; border-color: rgba(232, 58, 122, 0.7);
  background: rgba(232, 58, 122, 0.12);
}
.matcher-status.on {
  color: var(--phosphor); border-color: var(--line);
  background: rgba(0, 255, 106, 0.08);
}
.cards { display: grid; gap: 0.85rem; margin-top: 0.8rem; }
.card {
  display: grid; grid-template-columns: 96px 1fr; gap: 0.8rem;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 4px;
  overflow: hidden; text-decoration: none; color: inherit;
  box-shadow: 0 0 0 1px rgba(0, 255, 106, 0.04);
}
.card:hover, .card:focus-visible {
  border-color: var(--phosphor);
  box-shadow: 0 0 18px rgba(0, 255, 106, 0.22);
}
.card img, .card-ph {
  width: 96px; height: 100%; min-height: 88px; object-fit: cover; background: #001408;
}
.card-ph {
  display: grid; place-items: center; color: var(--phosphor);
  font-size: 1.6rem; text-shadow: 0 0 10px rgba(0, 255, 106, 0.6);
}
.card .pad { padding: 0.7rem 0.8rem 0.8rem; }
.card h3 { margin: 0 0 0.25rem; font-size: 1rem; color: var(--ink); font-family: var(--font-b); }
.venue, .why, .tm { font-size: 0.78rem; color: var(--muted); margin: 0 0 0.28rem; }
.tm { color: var(--phosphor); letter-spacing: 0.04em; }
.pct {
  color: var(--phosphor); font-weight: 700; font-family: var(--font-d);
  font-size: 0.82rem; letter-spacing: 0.06em;
}
.pct.unscored { color: #ffb3cc; font-family: var(--font-b); font-weight: 700; }
.gate {
  position: fixed; inset: 0; background: #000; display: flex;
  align-items: center; justify-content: center; z-index: 40; padding: 1.5rem;
}
.gate[hidden] { display: none; }
.gate-card {
  max-width: 26rem; text-align: center;
  border: 1px solid var(--line); padding: 1.5rem 1.25rem;
  background: rgba(0, 10, 4, 0.92);
  box-shadow: 0 0 40px rgba(0, 255, 106, 0.12);
}
.row { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .matrix-rain span { animation: none; top: 8%; opacity: 0.35; }
  .card, .primary { transition: none; }
}

.rep-bar {
  margin: 0.9rem 0 0.4rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.rep-bar label { display: block; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
#rep { width: 100%; margin: 0.4rem 0; accent-color: var(--phosphor, var(--gold, #fbbf24)); }
.theme-btns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.theme-btns button {
  min-height: 36px; padding: 0.35rem 0.65rem; font-size: 0.72rem;
  letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
}
.theme-btns button.on { border-color: var(--phosphor, var(--gold, #fbbf24)); color: var(--phosphor, var(--gold, #fbbf24)); }
.theme-btns button:disabled { opacity: 0.35; cursor: not-allowed; }
.playa-ascii {
  margin: 0.6rem 0 0;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 13px; line-height: 1.15;
  color: #ff6b1a;
  text-shadow: 0 0 8px rgba(255, 80, 0, 0.55);
  white-space: pre;
}

/* 0% LynxLogix */
html[data-theme="lynx"] {
  --bg: #05060c; --bg-elev: #12141c; --ink: #eef1f8; --muted: #9aa3b8;
  --phosphor: #fbbf24; --pink: #22d3ee; --line: rgba(251, 191, 36, 0.35);
  --font-d: "Cormorant Garamond", Georgia, serif;
  --font-b: "DM Sans", system-ui, sans-serif;
}
html[data-theme="lynx"] .matrix-rain { opacity: 0.05; }
html[data-theme="lynx"] .logo {
  text-transform: none; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 0.55rem;
}
html[data-theme="lynx"] .logo img {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.45), 0 0 16px rgba(34, 211, 238, 0.3);
}
html[data-theme="lynx"] .primary { background: linear-gradient(90deg, #fbbf24, #22d3ee); color: #081018; }
html[data-theme="lynx"] .matrix-rain { opacity: 0.04; }
html[data-theme="lynx"] h1 {
  background: linear-gradient(90deg, #fbbf24, #22d3ee, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
}

/* 20% CodeBrite rainbow terminal */
html[data-theme="codebrite"] {
  --bg: #07070b; --bg-elev: #101018; --ink: #e8e9f0; --muted: #9aa0b4;
  --phosphor: #39ff14; --pink: #ff2bd6; --line: rgba(57, 255, 20, 0.35);
  --font-d: "IBM Plex Mono", ui-monospace, monospace;
  --font-b: "IBM Plex Mono", ui-monospace, monospace;
}
html[data-theme="codebrite"] .matrix-rain { opacity: 0.18; }
html[data-theme="codebrite"] h1, html[data-theme="codebrite"] .pct {
  background: linear-gradient(90deg, #ff0040, #ff7a00, #ffe600, #39ff14, #00d4ff, #bf00ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
}
html[data-theme="codebrite"] .primary {
  background: linear-gradient(90deg, #ff0040, #ffe600, #39ff14, #00d4ff);
  color: #07070b;
}

/* 30% Gotham Guru — NYC nights */
html[data-theme="gotham"] {
  --bg: #050508; --bg-elev: #12141c; --ink: #f4e9c8; --muted: #9a9178;
  --phosphor: #f5d000; --pink: #c9a227; --line: rgba(245, 208, 0, 0.28);
  --font-d: "Oswald", Impact, sans-serif;
  --font-b: "DM Sans", system-ui, sans-serif;
}
html[data-theme="gotham"] .matrix-rain { display: none; }
html[data-theme="gotham"] body {
  background:
    radial-gradient(1200px 400px at 50% 0%, rgba(245, 208, 0, 0.08), transparent 55%),
    linear-gradient(#050508, #0b0c12);
}
html[data-theme="gotham"] .logo { letter-spacing: 0.18em; }
html[data-theme="gotham"] .primary { background: #f5d000; color: #111; }

/* 40% ASCII Burning Man / lost in the code */
html[data-theme="playa"] {
  --bg: #120800; --bg-elev: #1c0e04; --ink: #ffd7b0; --muted: #c4844a;
  --phosphor: #ff6b1a; --pink: #ff3b00; --line: rgba(255, 107, 26, 0.4);
  --font-d: "VT323", ui-monospace, monospace;
  --font-b: "VT323", ui-monospace, monospace;
}
html[data-theme="playa"] .matrix-rain { opacity: 0.22; }
html[data-theme="playa"] .matrix-rain span::after {
  content: "▲△▲ THE MAN ▲ LOST IN THE CODE ░▒▓█ /\\/\\ PLAYA 0101 BURN ";
}
html[data-theme="playa"] .playa-ascii { display: block; }
html[data-theme="playa"] .primary { background: #ff6b1a; color: #120800; }
