/* ==========================================================================
   RETRO INVADERS — landing page
   ========================================================================== */

:root {
  --bg: #050a07;
  --bg-soft: #081009;
  --panel: #0a120d;
  --panel-2: #0c1711;
  --line: rgba(61, 255, 133, 0.16);
  --line-strong: rgba(61, 255, 133, 0.38);
  --fg: #d9f7e3;
  --muted: #8fb5a0;
  --green: #3dff85;
  --green-soft: #9dffc2;
  --green-dim: #1f8f4d;
  --yellow: #ffd84d;
  --cyan: #5ce1ff;
  --magenta: #ff6ad5;
  --red: #ff5b5b;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --pixel: "Press Start 2P", var(--mono);
  --radius: 6px;
  --wrap: 1080px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 640px at 50% -12%, rgba(61, 255, 133, 0.11), transparent 70%),
    radial-gradient(760px 480px at 100% 22%, rgba(92, 225, 255, 0.05), transparent 70%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint CRT scanlines over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 4px
  );
  opacity: 0.35;
}

::selection { background: var(--green); color: #04130a; }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-soft); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 2px;
}

img, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.35; margin: 0; text-wrap: balance; }

code, kbd, pre { font-family: var(--mono); }

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }

.sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sprite {
  width: 1.25em;
  height: 1em;
  fill: currentColor;
  display: inline-block;
  vertical-align: -0.12em;
  flex: none;
}
.sprite-ship { width: 1.75em; }
.sprite-ufo { width: 2.25em; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(5, 10, 7, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(61, 255, 133, 0.55);
}
.brand:hover { color: var(--green-soft); }
.brand-sprite { color: var(--green); width: 22px; height: 17.6px; }

.site-nav { display: flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 13px; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--fg); background: rgba(61, 255, 133, 0.08); }
.site-nav .nav-gh {
  color: var(--green);
  border: 1px solid var(--line-strong);
  margin-left: 8px;
}
.site-nav .nav-gh:hover { background: rgba(61, 255, 133, 0.12); border-color: var(--green); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding: clamp(56px, 9vw, 104px) 0 64px; text-align: center; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--green-dim);
}
.kicker .prompt { color: var(--green); }
.cursor { color: var(--green); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(1.6rem, 4.6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  margin-bottom: 24px;
}
.nowrap { white-space: nowrap; }
.hero h1 em {
  font-style: normal;
  color: var(--green);
  text-shadow: 0 0 28px rgba(61, 255, 133, 0.35);
}

.lede {
  max-width: 720px;
  margin: 0 auto 36px;
  color: #b9d9c6;
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
}
.lede strong { color: var(--fg); letter-spacing: 0.04em; }
.lede code, .section-lede code, .note code, .card code, .rules code {
  font-size: 0.88em;
  color: var(--green-soft);
  background: rgba(61, 255, 133, 0.08);
  border: 1px solid rgba(61, 255, 133, 0.14);
  border-radius: 3px;
  padding: 0.06em 0.38em;
  white-space: nowrap;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 44px;
}

.cmd-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #07110b;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 30px rgba(61, 255, 133, 0.08) inset;
  font-family: var(--mono);
  font-size: 14px;
}
.cmd-box code { color: var(--fg); white-space: nowrap; }
.cmd-box .dollar { color: var(--green); margin-right: 6px; }

.copy-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(61, 255, 133, 0.1);
  color: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.copy-btn:hover { background: var(--green); color: #04130a; }
.copy-btn:active { transform: translateY(1px); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  color: var(--green);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: rgba(61, 255, 133, 0.1); border-color: var(--green); color: var(--green-soft); }

.facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 auto 56px;
  padding: 0;
  max-width: 820px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
  text-align: left;
}
.facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--panel);
}
.facts b {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
  letter-spacing: 0.03em;
}
.facts span { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

/* --------------------------------------------------------------------------
   Terminal / video frames
   -------------------------------------------------------------------------- */

.terminal, .video-frame {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid rgba(61, 255, 133, 0.28);
  border-radius: 8px;
  background: #030805;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(61, 255, 133, 0.1),
    0 32px 80px rgba(0, 0, 0, 0.65);
}

.terminal::after, .video-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
  opacity: 0.55;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0a140f;
  border-bottom: 1px solid rgba(61, 255, 133, 0.14);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #1d3a2a; }
.dots i:nth-child(1) { background: #3a2323; }
.dots i:nth-child(2) { background: #3a3323; }
.dots i:nth-child(3) { background: #1d3a2a; }
.terminal-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.terminal img { width: 100%; }

.video-frame video { width: 100%; background: #030805; }
.video-frame figcaption {
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(61, 255, 133, 0.12);
  background: #060d09;
}

/* --------------------------------------------------------------------------
   Ticker
   -------------------------------------------------------------------------- */

.ticker {
  border-block: 1px solid var(--line);
  background: rgba(61, 255, 133, 0.03);
  overflow: hidden;
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--green-dim);
  white-space: nowrap;
  user-select: none;
}
.ticker-track { display: inline-flex; animation: scroll 42s linear infinite; }
.ticker-track span { padding-right: 2em; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: clamp(64px, 9vw, 104px) 0; }
.section + .section { border-top: 1px solid rgba(61, 255, 133, 0.07); }

.section h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 900;
  margin-bottom: 14px;
}
.section-lede {
  max-width: 720px;
  margin: 0 0 40px;
  color: var(--muted);
  font-size: 0.98rem;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.cards, .play-grid, .tech-grid { min-width: 0; }
.cards > *, .play-grid > *, .tech-grid > * { min-width: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 16px;
  height: 16px;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  border-radius: var(--radius) 0 0 0;
}
.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(61, 255, 133, 0.06);
}
.card-sprite { width: 30px; height: 24px; color: var(--green); margin-bottom: 18px; }
.card-sprite.sprite-ship { width: 42px; }
.card-sprite.sprite-ufo { width: 54px; }
.card:nth-child(2) .card-sprite { color: var(--yellow); }
.card:nth-child(3) .card-sprite { color: var(--cyan); }
.card:nth-child(4) .card-sprite { color: var(--magenta); }
.card:nth-child(5) .card-sprite { color: var(--green-soft); }
.card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 10px; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.8; }

/* --------------------------------------------------------------------------
   Play section
   -------------------------------------------------------------------------- */

.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.panel {
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.panel h3 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 18px;
}

.keys { width: 100%; border-collapse: collapse; }
.keys th, .keys td { text-align: left; padding: 10px 0; border-bottom: 1px dashed rgba(61, 255, 133, 0.12); vertical-align: middle; }
.keys tr:last-child th, .keys tr:last-child td { border-bottom: 0; }
.keys th { width: 52%; font-weight: 400; }
.keys td { color: var(--muted); font-size: 0.9rem; }

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 1px 7px;
  margin: 0 1px;
  font-size: 0.78rem;
  line-height: 1.6;
  text-align: center;
  color: var(--fg);
  background: #0d1a12;
  border: 1px solid #2a4a36;
  border-bottom-width: 2px;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.note { margin: 16px 0 0; font-size: 0.82rem; color: var(--muted); }

.rules { margin: 0 0 22px; padding-left: 1.15em; color: var(--muted); font-size: 0.9rem; }
.rules li { margin-bottom: 8px; }
.rules li::marker { color: var(--green-dim); }

.scores {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.scores li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(61, 255, 133, 0.1);
  border-radius: 4px;
  background: rgba(61, 255, 133, 0.03);
  font-size: 0.85rem;
}
.scores .sprite { width: 20px; height: 16px; }
.scores .sprite-ufo { width: 36px; }
.scores li:nth-child(1) .sprite { color: var(--yellow); }
.scores li:nth-child(2) .sprite { color: var(--cyan); }
.scores li:nth-child(3) .sprite { color: var(--green); }
.scores li:nth-child(4) .sprite { color: var(--magenta); }
.scores span { color: var(--muted); flex: 1; }
.scores b { font-family: var(--mono); font-weight: 600; color: var(--green-soft); letter-spacing: 0.04em; }

/* --------------------------------------------------------------------------
   Tech section
   -------------------------------------------------------------------------- */

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.specs { margin: 0; }
.specs div {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(61, 255, 133, 0.12);
  font-size: 0.88rem;
}
.specs div:last-child { border-bottom: 0; }
.specs dt { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.specs dd { margin: 0; color: var(--fg); }

.code {
  max-width: 100%;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #050c08;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--green-soft);
}
.code .c { color: #4f7a5f; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
  background: rgba(0, 0, 0, 0.2);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.footer-brand {
  margin: 0;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--green);
  text-shadow: 0 0 16px rgba(61, 255, 133, 0.4);
}
.footer-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; color: var(--muted); text-shadow: none; }
.glyph { color: var(--green); }
.footer-meta { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.footer-meta a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted rgba(143, 181, 160, 0.4); }
.footer-meta a:hover { color: var(--green); }
.footer-credit {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed rgba(61, 255, 133, 0.12);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.footer-credit strong { color: var(--green-soft); font-weight: 600; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 100;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 18px;
  border-radius: 4px;
  background: var(--green);
  color: #04130a;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-nav a:not(.nav-gh) { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { width: min(var(--wrap), 100% - 32px); }
  .brand span { font-size: 9px; }
  .brand-sprite { width: 18px; height: 14.4px; }
  .facts { margin-bottom: 40px; }
  .cmd-box { font-size: 12.5px; padding-left: 14px; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .terminal-bar { font-size: 10.5px; }
  .section { padding: 56px 0; }
  .specs div { grid-template-columns: 1fr; gap: 2px; }
  .code { font-size: 11px; padding: 14px; }
}

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor, .ticker-track { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .card:hover { transition: none; transform: none; }
}
