/*
  S2 STATION - main stylesheet
  ============================
  Structure of this file:
    1. Tokens (colors, type, spacing)
    2. Reset and base
    3. Astronomical background
    4. Station container and chrome
    5. Header and primary navigation
    6. Welcome / archival intro
    7. Three column layout (visual logs / journal+vessels / themes)
    8. Visual logs gallery
    9. Journal and vessel list entries
    10. Station themes (video embeds)
    11. Entry pages (journal/vessel single page layout)
    12. Fixed, always-visible entry navigation console (journal/vessel pages)
    13. Footer
    14. Utility and decorative elements
    15. Responsive rules
    16. Reduced motion
*/

/* ---------- 1. TOKENS ---------- */

:root {
  /* base palette */
  --void: #04050a;
  --navy-deep: #080b16;
  --panel: #0d1122;
  --panel-alt: #11162a;
  --panel-raised: #171d38;
  --border-dim: #333d66;
  --border-faint: #1c2238;

  --purple-deep: #45336f;
  --purple-soft: #b791e6;
  --blue-cool: #6fa8d9;
  --moss: #5a7048;
  --moss-soft: #8fd17a;
  --grey: #7c869e;
  --pink-soft: #d98bc4;
  --teal-soft: #6fd0c9;

  --text-main: #d3d8ea;
  --text-dim: #98a1c2;
  --text-faint: #5c6480;
  --text-bright: #f2f4fb;

  --status-ok: #8fd17a;
  --status-warn: #dbb355;
  --status-idle: #6fa8d9;

  /* tag palette: add new palette colors here only if needed */
  --tag-grey: #8b95b3;
  --tag-amber: #dba64c;
  --tag-green: #5f9457;
  --tag-red: #c76370;

  /* type */
  --font-body: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-mono: "Courier New", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* spacing */
  --space-1: 0.4rem;
  --space-2: 0.8rem;
  --space-3: 1.4rem;
  --space-4: 2.2rem;
  --space-5: 3.4rem;

  --container-max: 1180px;
  --radius-small: 2px;
}

/* ---------- 2. RESET AND BASE ---------- */

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

html {
  background: var(--void);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--void);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--blue-cool);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--purple-soft);
  border-bottom-color: currentColor;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 1px dashed var(--moss-soft);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--font-body);
  color: var(--text-bright);
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
  max-width: 68ch;
}

ul, ol {
  margin: 0 0 var(--space-3);
  padding-left: 1.2em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 3. ASTRONOMICAL BACKGROUND ---------- */

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 12%, rgba(140, 100, 200, 0.30), transparent 55%),
    radial-gradient(ellipse at 82% 18%, rgba(217, 139, 196, 0.16), transparent 50%),
    radial-gradient(ellipse at 78% 82%, rgba(90, 190, 185, 0.20), transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(90, 112, 72, 0.20), transparent 50%),
    linear-gradient(180deg, var(--void) 0%, var(--navy-deep) 55%, var(--void) 100%);
}

.star {
  position: absolute;
  background: #dfe4f5;
  border-radius: 50%;
  opacity: var(--star-opacity, 0.5);
  will-change: opacity;
}

.symbol-star {
  position: absolute;
  color: #dfe4f5;
  line-height: 1;
  opacity: var(--star-opacity, 0.5);
  will-change: opacity;
  user-select: none;
  pointer-events: none;
}

.star--twinkle {
  animation: twinkle var(--twinkle-duration, 6s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: var(--star-opacity, 0.5); }
  50% { opacity: calc(var(--star-opacity, 0.5) * 0.25); }
}

.orbit-line {
  position: absolute;
  border: 1px solid rgba(111, 143, 175, 0.08);
  border-radius: 50%;
}

.far-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.05;
  background: var(--purple-soft);
}

/* ---------- 4. STATION CONTAINER AND CHROME ---------- */

.station {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: var(--space-5) auto;
  background:
    linear-gradient(180deg, rgba(35, 45, 80, 0.9), rgba(24, 31, 59, 0.94));

  border: 1px solid var(--border-dim);
  box-shadow:
    0 0 0 1px rgba(4, 5, 10, 0.6),
    0 30px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-small);
}

.station::before {
  content: "";
  display: block;
  height: 4px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--border-dim) 0,
      var(--border-dim) 10px,
      transparent 10px,
      transparent 18px
    );
  opacity: 0.5;
}

.station-inner {
  padding: var(--space-4) var(--space-4) var(--space-5);
}

@media (max-width: 640px) {
  .station-inner {
    padding: var(--space-3) var(--space-2) var(--space-4);
  }
}

.panel-corner-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* ---------- 5. HEADER AND PRIMARY NAVIGATION ---------- */

.station-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-faint);
}

.station-id {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.station-id .symbol {
  color: var(--moss-soft);
  font-size: 1.6rem;
}

.station-title {
  font-size: 2.8rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.station-title a {
  color: inherit;
  border-bottom: none;
}

.station-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

.station-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.station-status iframe {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-small);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-ok);
  margin-right: 0.4em;
  box-shadow: 0 0 6px rgba(143, 174, 122, 0.6);
}

.primary-nav {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.primary-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 0.2em 0;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--moss-soft);
}

/* ---------- 5b. HEADER ACTIONS (station button) ---------- */

.header-actions {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.station-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-main);
  padding: 0.55em 1.1em;
  border: 1px solid var(--border-dim);
  background: rgba(13, 17, 34, 0.6);
  border-bottom: 1px solid var(--border-dim);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.station-button:hover,
.station-button:focus-visible {
  color: var(--moss-soft);
  border-color: var(--moss-soft);
  background: rgba(143, 209, 122, 0.08);
}

.station-button .symbol {
  color: var(--moss-soft);
}

/* ---------- 6. WELCOME / ARCHIVAL INTRO ---------- */

.welcome-panel {
  position: relative;
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  background: rgba(8, 11, 22, 0.55);
  border: 1px solid var(--border-faint);
  border-left: 2px solid var(--moss);
}

.welcome-panel::before {
  content: "◑ STATION RECORD";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.welcome-panel p {
  max-width: 100ch;
  color: var(--text-main);
  font-size: 1.05rem;
  margin: 0;
}

/* ---------- 7. THREE COLUMN LAYOUT ---------- */

.station-columns {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.station-column {
  min-width: 0;
}

.column-heading {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-faint);
}

.column-heading .symbol {
  color: var(--moss-soft);
  font-size: 1.3rem;
}

/* ---------- 8. VISUAL LOGS GALLERY ---------- */

.gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.gallery-item {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-faint);
  padding: 0.5rem 0.5rem 0.7rem;
}

.gallery-item img {
  border: 1px solid var(--border-dim);
  width: 100%;
  height: auto;
}

.gallery-item.weight-tall img { aspect-ratio: 3 / 4; object-fit: cover; }
.gallery-item.weight-wide img { aspect-ratio: 16 / 10; object-fit: cover; }
.gallery-item.weight-square img { aspect-ratio: 1 / 1; object-fit: cover; }

.gallery-caption {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.03em;
}

.gallery-caption .label {
  color: var(--text-dim);
}

/* ---------- 9. JOURNAL AND VESSEL LIST ENTRIES ---------- */

.record-group {
  margin-bottom: var(--space-4);
}

.record-group:last-child {
  margin-bottom: 0;
}

.record-group-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.record-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.record-entry {
  position: relative;
  border: 1px solid var(--border-faint);
  background: rgba(13, 17, 34, 0.5);
  padding: var(--space-2) var(--space-3);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.record-entry a.record-link {
  display: block;
  color: var(--text-bright);
  font-size: 0.98rem;
  border-bottom: none;
}

.record-entry a.record-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.record-entry:hover {
  border-color: var(--purple-soft);
  background: rgba(13, 17, 34, 0.75);
}

.record-entry:hover .record-link,
.record-entry:focus-within .record-link {
  color: var(--purple-soft);
}

.record-meta {
  display: flex;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 0.35em;
  letter-spacing: 0.03em;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  margin-top: 0.55em;
}

.record-tags[hidden],
.entry-tags[hidden] {
  display: none;
}

.record-excerpt {
  margin-top: 0.5em;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* ---------- 9b. CHAT WIDGET (spans columns 2 and 3) ---------- */

.chat-widget-row {
  grid-column: 2 / 4;
}

.chat-widget-wrap {
  width: 180%;
  overflow: hidden;
  border: 1px solid var(--border-faint);
  background: var(--panel);
  padding: 0.5rem;
}

.chat-widget-wrap ws-widget,
.chat-widget-wrap iframe {
  display: block;
  width: 100% !important;
  height: 520px;
}

@media (max-width: 640px) {
  .chat-widget-wrap ws-widget,
  .chat-widget-wrap iframe {
    height: 420px;
  }
}

/* ---------- 10. STATION THEMES ---------- */

.themes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.theme-item {
  border: 1px solid var(--border-faint);
  background: var(--panel);
  padding: 0.5rem;
}

.theme-item .video-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border: 1px solid var(--border-dim);
  overflow: hidden;
  background: #000;
}

.theme-item .video-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.theme-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

/* ---------- 11. ENTRY PAGES (journal / vessel single page) ---------- */

.entry-page-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-4);
  align-items: start;
}

.entry-content {
  min-width: 0;
}

.entry-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-faint);
}

.entry-kicker {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.entry-title {
  font-size: 1.9rem;
  margin-bottom: var(--space-2);
}

.entry-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.entry-meta-row .meta-label {
  color: var(--text-faint);
  margin-right: 0.4em;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: var(--space-2);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  padding: 0.15em 0.6em;
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.tag--grey {
  color: var(--tag-grey);
}

.tag--amber {
  color: var(--tag-amber);
}

.tag--green {
  color: var(--tag-green);
}

.tag--red {
  color: var(--tag-red);
}

.entry-body h2 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-top: var(--space-4);
}

.entry-body h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  font-weight: bold;
  margin-top: var(--space-3);
}

.entry-body ul,
.entry-body ol {
  max-width: 68ch;
  margin: 0 0 var(--space-3);
  padding-left: 2em;
  list-style-position: outside;
  list-style-type: "✦  ";
}

.entry-body li {
  margin-bottom: 0.5em;
}

.entry-body li:last-child {
  margin-bottom: 0;
}

.entry-figure {
  max-width: 68ch;
  border: 1px solid var(--border-faint);
  background: var(--panel);
  padding: 0.5rem;
  margin-right: auto;
  margin-left: 0;
}

.entry-figure img {
  border: 1px solid var(--border-dim);
}

.entry-figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.entry-divider {
  border: none;
  border-top: 1px dashed var(--border-dim);
  margin: var(--space-4) 0;
}

.related-links {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-faint);
}

.related-links h2 {
  font-size: 0.95rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.editor-note {
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--border-dim);
  background: rgba(111, 143, 175, 0.05);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.editor-note strong {
  color: var(--status-warn);
}

/* ---------- 12. ENTRY NAVIGATION CONSOLE ----------*/

.entry-nav {
  position: sticky;
  top: var(--space-3);
  align-self: start;
  background: rgba(8, 11, 22, 0.7);
  border: 1px solid var(--border-dim);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.entry-nav-title {
  color: var(--text-main);
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-faint);
}

.entry-nav-section {
  margin-bottom: var(--space-3);
}

.entry-nav-section:last-child {
  margin-bottom: 0;
}

.entry-nav-section-label {
  color: var(--text-faint);
  margin-bottom: 0.5em;
  letter-spacing: 0.04em;
}

.entry-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.entry-nav a {
  color: var(--text-dim);
  border-bottom: none;
}

.entry-nav a:hover,
.entry-nav a:focus-visible,
.entry-nav a[aria-current="page"] {
  color: var(--moss-soft);
}

.entry-nav a[aria-current="page"]::before {
  content: "▸ ";
}

/* ---------- 13. FOOTER ---------- */

.station-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
}

/* ---------- 14. UTILITY AND DECORATIVE ---------- */

.symbol-divider {
  text-align: center;
  color: var(--text-faint);
  letter-spacing: 0.6em;
  font-size: 0.8rem;
  margin: var(--space-4) 0;
  user-select: none;
}

/* ---------- 15. RESPONSIVE ---------- */

@media (max-width: 980px) {
  .station-columns {
    grid-template-columns: 1fr;
  }

  .chat-widget-row {
    grid-column: 1 / -1;
  }

  .entry-page-body {
    grid-template-columns: 1fr;
  }

  .entry-nav {
    position: static;
    order: -1;
  }

  .entry-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.8em 1.2em;
  }

  .entry-nav-section {
    margin-bottom: var(--space-2);
  }
}

@media (max-width: 640px) {
  .station-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .station-status {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }

  .entry-title {
    font-size: 1.5rem;
  }
}

/* ---------- 16. REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .star--twinkle {
    animation: none;
    opacity: var(--star-opacity, 0.5);
  }

  * {
    scroll-behavior: auto !important;
  }
}

/* ---------- 17. COOKIE CLICKER MINIGAME (entry nav) ---------- */

.cookie-clicker {
  text-align: center;
}

.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid var(--border-dim);
  background: radial-gradient(circle at 35% 30%, var(--moss-soft), var(--moss) 75%);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(143, 209, 122, 0.35);
  transition: transform 0.1s ease, filter 0.15s ease;
}

.cookie-btn:hover {
  filter: brightness(1.1);
}

.cookie-btn:active,
.cookie-btn.cookie-pop {
  transform: scale(0.88);
}

.cookie-counts {
  margin-top: 0.6em;
  font-size: 0.68rem;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.cookie-counts .cookie-mine,
.cookie-counts .cookie-global {
  color: var(--text-bright);
}

/* ---------- 18. HANGOUT PAGE ---------- */

.hangout-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.hangout-section {
  min-width: 0;
}

.hangout-games-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

@media (max-width: 640px) {
  .hangout-games-grid {
    grid-template-columns: 1fr;
  }
}

.hangout-section-heading {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-faint);
}

.hangout-section-heading .symbol {
  color: var(--moss-soft);
  font-size: 1.3rem;
}

/* who-am-i panel reuses the welcome-panel look from the station page */
.hangout-panel {
  position: relative;
  padding: var(--space-4);
  background: rgba(8, 11, 22, 0.55);
  border: 1px solid var(--border-faint);
  border-left: 2px solid var(--purple-deep);
}

.hangout-panel::before {
  content: "◑ WHO'S HERE";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.hangout-panel p {
  max-width: 100ch;
  color: var(--text-main);
  font-size: 1.05rem;
}

.hangout-panel p:last-child {
  margin-bottom: 0;
}

.hangout-alias {
  font-family: var(--font-mono);
  color: var(--purple-soft);
}

/* cursor widget */
.cursor-widget-wrap {
  border: 1px solid var(--border-faint);
  background: var(--panel);
  padding: 0.5rem;
}

/* standalone cookie clicker panel (hangout page, outside the entry-nav) */
.cookie-panel {
  border: 1px solid var(--border-dim);
  background: rgba(8, 11, 22, 0.7);
  padding: var(--space-3);
  max-width: 260px;
  font-family: var(--font-mono);
}

/* space invaders minigame */
.invaders-wrap {
  border: 1px solid var(--border-dim);
  background: var(--panel);
  padding: var(--space-3);
  max-width: 520px;
}

.invaders-screen {
  border: 1px solid var(--border-dim);
  background: #000;
  padding: 0.4rem;
}

.invaders-output {
  display: block;
  width: 100%;
  height: 260px;
  resize: none;
  border: none;
  background: transparent;
  color: var(--moss-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: pre;
  overflow: auto;
}

.invaders-output:focus-visible {
  outline: none;
}

.invaders-controls {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.invaders-btn {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--text-main);
  padding: 0.6em 0.8em;
  border: 1px solid var(--border-dim);
  background: rgba(13, 17, 34, 0.6);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.invaders-btn:hover,
.invaders-btn:focus-visible {
  color: var(--moss-soft);
  border-color: var(--moss-soft);
  background: rgba(143, 209, 122, 0.08);
}

.invaders-note {
  margin-top: var(--space-2);
  margin-bottom: 0;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
}

@media (max-width: 640px) {
  .invaders-output {
    font-size: 0.6rem;
  }
}
