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

:root {
  --bg: #05050d;
  --bg2: #0d0d1a;
  --accent: #00ffe7;
  --accent2: #7b2fff;
  --text: #c8d8e8;
  --muted: #4a5a6a;
  --danger: #ff3b6b;
  --font: 'Courier New', Courier, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 999;
}

header {
  width: 100%;
  border-bottom: 1px solid var(--muted);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--accent);
}

.status-pill {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.25rem 0.75rem;
  animation: blink 2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0.3; }
}

main {
  width: 100%;
  max-width: 860px;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.transmission-header {
  text-align: center;
}

.transmission-tag {
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: var(--danger);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: 0.1em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 30px var(--accent2), 0 0 60px rgba(123,47,255,0.3);
  margin-bottom: 1rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
}

.divider {
  border: none;
  border-top: 1px solid var(--muted);
  opacity: 0.4;
}

/* quest card */
.quest-card {
  background: var(--bg2);
  border: 1px solid var(--muted);
  border-left: 3px solid var(--accent2);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
}

.quest-card::before {
  content: 'INCOMING';
  position: absolute;
  top: -0.6rem;
  left: 1.5rem;
  background: var(--bg2);
  padding: 0 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--accent2);
}

.quest-id {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.quest-title {
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: 0.05em;
}

.quest-body {
  color: var(--text);
  line-height: 1.7;
  font-size: 0.9rem;
}

.quest-body .redacted {
  background: var(--muted);
  color: transparent;
  user-select: none;
  border-radius: 2px;
}

.answer-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.answer-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--muted);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  outline: none;
  letter-spacing: 0.1em;
  transition: border-color 0.2s;
}

.answer-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0,255,231,0.15);
}

.answer-form input::placeholder {
  color: var(--muted);
}

.answer-form button {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.answer-form button:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(0,255,231,0.3);
}

.feedback {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  min-height: 1.2em;
  transition: color 0.2s;
}

.feedback.correct { color: var(--accent); }
.feedback.wrong   { color: var(--danger); }

/* lore ticker */
.lore-ticker {
  border: 1px solid var(--muted);
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  overflow: hidden;
  white-space: nowrap;
}

.lore-ticker span {
  display: inline-block;
  animation: ticker 22s linear infinite;
}

@keyframes ticker {
  from { transform: translateX(100%); }
  to   { transform: translateX(-100%); }
}

footer {
  margin-top: auto;
  padding: 2rem;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-align: center;
}

/* viz container + tabs */
.viz-container {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--muted);
}

.viz-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--muted);
  background: var(--bg2);
}

.viz-tabs::-webkit-scrollbar { display: none; }

.viz-tab {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-right: 1px solid var(--muted);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  padding: 0.6rem 1rem;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.15s, background 0.15s;
  min-height: 36px;
  white-space: nowrap;
}

.viz-tab:last-child { border-right: none; }

.viz-tab:hover {
  color: var(--text);
  background: rgba(0,255,231,0.04);
}

.viz-tab.active {
  color: var(--accent);
  background: rgba(0,255,231,0.07);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

#transit-viz {
  width: 100%;
  height: clamp(200px, 40vw, 320px);
  display: block;
}

/* substack section */
.substack-section {
  border: 2px solid var(--accent);
  border-radius: 4px;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(0,255,231,0.05) 0%, rgba(123,47,255,0.05) 100%);
  box-shadow: 0 0 20px rgba(0,255,231,0.1), inset 0 0 20px rgba(0,255,231,0.02);
  position: relative;
  overflow: hidden;
}

.substack-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(0,255,231,0.05) 2px,
    rgba(0,255,231,0.05) 4px
  );
  pointer-events: none;
}

.substack-header {
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
}

.substack-section h2 {
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(0,255,231,0.3);
}

.substack-tagline {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.substack-tagline strong {
  color: var(--accent);
}

.substack-embed-wrapper {
  position: relative;
  z-index: 1;
  margin: 1.5rem 0;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(0,0,0,0.4) 0%, rgba(5,5,13,0.3) 100%);
  border: 1px solid var(--accent2);
  border-radius: 2px;
  box-shadow: inset 0 0 15px rgba(0,255,231,0.05);
}

.substack-embed-wrapper iframe {
  display: block;
  border-radius: 2px;
  filter: brightness(1.1) contrast(1.05);
}

.substack-cta {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin: 1rem 0 0 0;
  animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* mobile breakpoints */
@media (max-width: 480px) {
  header {
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .logo {
    font-size: 1.1rem;
  }

  .status-pill {
    font-size: 0.65rem;
  }

  main {
    padding: 2rem 1.25rem;
    gap: 2rem;
  }

  h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
  }

  .quest-card {
    padding: 1.5rem;
  }

  .quest-card::before {
    left: 1rem;
  }

  .answer-form {
    flex-direction: column;
    gap: 0.5rem;
  }

  .answer-form input {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    min-height: 44px;
  }

  .answer-form button {
    padding: 0.75rem 1rem;
    min-height: 44px;
    width: 100%;
  }

  .subtitle {
    font-size: 0.7rem;
    word-break: break-word;
  }

  .lore-ticker {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
  }

  .lore-ticker span {
    animation: ticker 30s linear infinite;
  }

  footer {
    padding: 1.5rem 1.25rem;
    font-size: 0.6rem;
  }
}
