/* ═══════════════════════════════════════════════════════
   AMOEBOID — style.css
   Brutalist slab — Viscous Falls × Sundered Grove palette
   ═══════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Bombardier';
  src: url('assets/fonts/Bombardier-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Palette — deep dark green ── */
  /* BIG: dominant darks */
  --bg:          #000000;
  --bg-deep:     #020a04;
  --bg-teal:     #030c05;
  --metal-deep:  #040a04;
  --metal-mid:   #071208;
  --metal-face:  #091508;
  --metal-edge:  #102010;
  --metal-hi:    #183018;
  --metal-rivet: #030804;
  --rivet-ring:  #0e1e0e;
  --scratch:     #081008;

  /* MEDIUM: mid greens */
  --violet:      #30a840;
  --teal-mid:    #228830;
  --purple-mid:  #186020;
  --muted:       #4a8858;   /* muted lines — readable mid-green */
  --ink:         #d8f8e0;   /* body text — bright pale green */
  --ink-dim:     #90c8a0;   /* dim lines — clearly visible */

  /* SMALL: bright neon green pops */
  --green:       #40ff60;
  --green-dim:   #2a7840;   /* echo/ascii — was near-black, now visible */
  --green-mid:   #28c840;
  --amber:       #80ff90;
  --coral:       #20e840;

  --font:      'Bombardier', 'IBM Plex Mono', monospace;
  --font-sans: 'Bombardier', 'IBM Plex Sans', sans-serif;
  --line:      1.75;
}

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

html, body {
  height: 100%;
  background: #000;
  color: var(--green);
  font-family: var(--font);
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: var(--line);
  overflow: hidden;
  cursor: default;
}

/* ── Flow field canvas ───────────────────────────────── */
#canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

/* ── CRT effects ─────────────────────────────────────── */
.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px, transparent 2px,
    rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px
  );
  filter: url(#crt-wave);
}

/* SVG filter for wavy CRT distortion */
#crt-filter {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 499;
  background: radial-gradient(ellipse at center,
    transparent 40%, rgba(0,0,0,0.5) 80%, rgba(0,0,0,0.9) 100%
  );
}

/* ── Layout: left slab + right panel ─────────────────── */
.layout {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: stretch;
  padding: clamp(12px, 2vh, 28px) clamp(12px, 2vw, 28px);
  gap: clamp(12px, 2vw, 24px);
}

/* ── Slab centering wrapper ──────────────────────────── */
.slab-wrap {
  width: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
}

/* ── The slab ────────────────────────────────────────── */
.slab {
  width: 100%;
  background: var(--metal-face);
  border: 6px solid #000;
  outline: 2px solid rgba(255,255,255,0.04);
  outline-offset: -8px;
  box-shadow:
    /* sharp bevel — top/left light hit */
    inset 0  5px 0 rgba(255,255,255,0.12),
    inset 0 -5px 0 rgba(0,0,0,0.98),
    inset  5px 0 0 rgba(255,255,255,0.08),
    inset -5px 0 0 rgba(0,0,0,0.95),
    /* mid bevel layer */
    inset 0  10px 8px rgba(0,0,0,0.3),
    inset 0 -10px 8px rgba(0,0,0,0.5),
    /* outer death shadow */
    0 0 0 3px #000,
    0 10px 0 rgba(0,0,0,0.98),
    0 16px 4px rgba(0,0,0,0.8),
    0 40px 100px rgba(0,0,0,1),
    0 8px 16px rgba(0,0,0,0.95);
  display: flex;
  flex-direction: column;
  position: relative;
  background-image:
    /* brushed metal horizontal grain */
    repeating-linear-gradient(
      180deg,
      transparent 0px, transparent 3px,
      rgba(255,255,255,0.012) 3px, rgba(255,255,255,0.012) 4px
    ),
    /* top score lines — double ruled */
    linear-gradient(180deg,
      transparent 0px,
      transparent 60px,
      rgba(255,255,255,0.06) 60px,
      rgba(255,255,255,0.06) 61px,
      rgba(0,0,0,0.8) 61px,
      rgba(0,0,0,0.8) 64px,
      rgba(255,255,255,0.04) 64px,
      rgba(255,255,255,0.04) 65px,
      transparent 65px
    ),
    /* bottom score lines */
    linear-gradient(180deg,
      transparent calc(100% - 65px),
      rgba(255,255,255,0.04) calc(100% - 65px),
      rgba(255,255,255,0.04) calc(100% - 64px),
      rgba(0,0,0,0.8) calc(100% - 64px),
      rgba(0,0,0,0.8) calc(100% - 61px),
      rgba(255,255,255,0.06) calc(100% - 61px),
      rgba(255,255,255,0.06) calc(100% - 60px),
      transparent calc(100% - 60px)
    );
}

/* ── Top / bottom bars ───────────────────────────────── */
.slab-bar {
  height: 60px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.08) 0%,
    var(--metal-hi) 8%,
    var(--metal-mid) 45%,
    var(--metal-deep) 85%,
    rgba(0,0,0,0.4) 100%
  );
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
}

.slab-bar-top {
  border-bottom: 4px solid #000;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(255,255,255,0.03),
    0 4px 10px rgba(0,0,0,0.9);
}
.slab-bar-bottom {
  border-top: 4px solid #000;
  flex-direction: row-reverse;
  box-shadow:
    inset 0 3px 0 rgba(0,0,0,0.6),
    inset 0 -2px 0 rgba(255,255,255,0.06);
}

.slab-label {
  flex: 1;
  text-align: center;
  font-family: var(--font);
  font-size: 11px;
  color: #4a3860;
  letter-spacing: 0.35em;
  user-select: none;
  text-shadow: 0 1px 0 rgba(0,0,0,0.9), 0 -1px 0 rgba(255,255,255,0.04);
}

/* scratch/knurl texture on bottom bar */
.slab-scratches {
  flex: 1;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.5) 0px, rgba(0,0,0,0.5) 2px,
    rgba(255,255,255,0.04) 2px, rgba(255,255,255,0.04) 3px,
    transparent 3px, transparent 7px,
    rgba(0,0,0,0.3) 7px, rgba(0,0,0,0.3) 8px
  );
  border-top: 1px solid rgba(0,0,0,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* ── Rivets ──────────────────────────────────────────── */
.rivet {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%,
      #383838 0%,
      #1a1a1a 30%,
      #080808 65%,
      #000 100%
    );
  border: 2px solid #000;
  box-shadow:
    /* top-left catch light */
    inset 0 3px 3px rgba(255,255,255,0.10),
    inset 3px 0 3px rgba(255,255,255,0.06),
    /* bottom-right sink into shadow */
    inset 0 -3px 3px rgba(0,0,0,0.98),
    inset -3px 0 3px rgba(0,0,0,0.9),
    /* outer ring shadow — drilled in */
    0 3px 6px rgba(0,0,0,0.98),
    0 1px 2px rgba(0,0,0,0.9),
    0 0 0 1px rgba(255,255,255,0.05);
  flex-shrink: 0;
}

/* ── Slab body ───────────────────────────────────────── */
.slab-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Side columns ────────────────────────────────────── */
.slab-col {
  width: 52px;
  flex-shrink: 0;
  background: linear-gradient(90deg,
    rgba(0,0,0,0.5) 0%,
    var(--metal-mid) 20%,
    var(--metal-hi) 45%,
    var(--metal-mid) 75%,
    rgba(0,0,0,0.6) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 20px 0;
  border-left: 4px solid #000;
  border-right: 4px solid #000;
  box-shadow:
    inset 3px 0 0 rgba(255,255,255,0.07),
    inset -3px 0 0 rgba(0,0,0,0.8),
    inset 6px 0 12px rgba(0,0,0,0.3);
}

/* ── Screen well ─────────────────────────────────────── */
.slab-screen-well {
  flex: 1;
  padding: 20px;
  background: linear-gradient(145deg,
    var(--metal-hi) 0%,
    var(--metal-mid) 30%,
    var(--metal-face) 60%,
    var(--metal-deep) 100%
  );
  min-height: 0;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.5),
    inset 4px 4px 8px rgba(0,0,0,0.4);
}

.slab-screen-inner {
  height: 100%;
  background: #04030a;
  border: 5px solid #000;
  box-shadow:
    inset 6px 6px 16px rgba(0,0,0,0.98),
    inset -3px -3px 10px rgba(0,0,0,0.7),
    inset 0 0 60px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Spotlight — static centered glow on screen */
.slab-screen-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 42%,
    rgba(255,255,255,0.28) 0%,
    rgba(220,240,255,0.18) 25%,
    rgba(180,220,255,0.08) 55%,
    transparent 75%
  );
  pointer-events: none;
}

/* Screen flicker */
.screen-flicker {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  opacity: 0;
  background: rgba(168,255,120,0.015);
  animation: flicker 16s step-end infinite;
}
@keyframes flicker {
  0%,90%,92.5%,100% { opacity: 0; }
  91%,92% { opacity: 1; }
}

/* ── Terminal viewport (scrollable) ─────────────────── */
#terminal-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1.5rem 0.5rem;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(64,184,200,0.2) transparent;
  cursor: text;
  position: relative;
  z-index: 1;
}
#terminal-viewport::-webkit-scrollbar { width: 4px; }
#terminal-viewport::-webkit-scrollbar-track { background: transparent; }
#terminal-viewport::-webkit-scrollbar-thumb { background: rgba(74,122,58,0.25); }

/* ── Input row ───────────────────────────────────────── */
.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.5rem 0.75rem;
  gap: 0;
  flex-shrink: 0;
  background: linear-gradient(0deg, rgba(10,8,32,1) 60%, transparent);
  position: relative;
  z-index: 1;
}

.prompt {
  color: var(--green-mid);
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  font-size: inherit;
}

.cmd-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: var(--font);
  font-size: inherit;
  line-height: var(--line);
  caret-color: var(--green);
  width: 100%;
  padding: 0;
  cursor: text;
}

/* ── Terminal output ─────────────────────────────────── */
.terminal-output {
  display: flex;
  flex-direction: column;
}

.line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.75em;
  opacity: 0;
  animation: fadein 0.05s forwards;
}
@keyframes fadein { to { opacity: 1; } }

.line-dim    { color: var(--ink-dim); }
.line-muted  { color: var(--muted); }
.line-bright { color: var(--green); font-weight: 600; }
.line-amber  { color: var(--amber); }
.line-coral  { color: var(--coral); }
.line-violet { color: var(--violet); }
.line-head   { color: var(--green-mid); font-weight: 600; letter-spacing: 0.05em; }
.line-label  { color: var(--ink-dim); }
.line-link   { color: var(--green-mid); text-decoration: underline; cursor: pointer; }
.line-link:hover { color: var(--green); }
.line-error  { color: var(--coral); }
.line-echo   { color: var(--green-dim); }
.line-gap    { min-height: 0.85em; }
.line-ascii  { color: var(--green-dim); font-size: 0.72em; line-height: 1.25; letter-spacing: 0.02em; }

/* ── Scrollbar ───────────────────────────────────────── */
::selection { background: var(--green-dim); color: #000; }

/* ── Right panel ─────────────────────────────────────── */
.right-panel {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.panel-img {
  border: 1px solid rgba(120,232,255,0.1);
  border-radius: 2px;
  object-fit: cover;
  display: block;
}

/* ── Entry cards ─────────────────────────────────────── */
.entry-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 14px;
  margin: 3px 0;
  border: 1px solid rgba(120,232,255,0.08);
  border-radius: 2px;
  cursor: pointer;
  background: rgba(8,6,18,0.9);
  transition: border-color 0.15s;
  max-width: 680px;
  animation: fadein 0.05s forwards;
}
.entry-card-hover { border-color: rgba(120,232,255,0.3); }

.entry-thumb {
  width: 240px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 1px;
  overflow: hidden;
  background: #050310;
  border: 1px solid rgba(120,232,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 13px;
  color: #2a1e40;
}

.entry-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; justify-content: center; }
.entry-title { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--green); }
.entry-desc  { font-family: var(--font-sans); font-size: 12px; color: var(--ink-dim); line-height: 1.5; }

/* ── Retro windows ───────────────────────────────────── */
.retro-window {
  position: fixed;
  width: 640px;
  height: 480px;
  min-width: 320px;
  min-height: 200px;
  background: #020a04;
  border: 1px solid #1a401a;
  box-shadow:
    inset 1px 1px 0 #1a401a,
    inset -1px -1px 0 #040c04,
    0 12px 40px rgba(0,0,0,0.98);
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  overflow: hidden;
  z-index: 600;
}

.retro-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  height: 36px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #0f2210, #0a1a0a);
  border-bottom: 1px solid #102010;
  cursor: move;
  user-select: none;
}

.retro-titlebar-title { font-size: 12px; color: var(--green-mid); font-weight: 600; letter-spacing: 0.08em; pointer-events: none; }
.retro-titlebar-btns  { display: flex; gap: 6px; }

.retro-btn {
  width: 26px; height: 22px;
  background: #071008;
  border: 1px solid #1e401e;
  box-shadow: inset 1px 1px 0 #1a301a, inset -1px -1px 0 #020802;
  color: #2a502a;
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border-radius: 2px;
}
.retro-btn:hover { color: var(--green); border-color: var(--green-mid); background: #0a1a0a; }
.retro-btn:active { box-shadow: inset -1px -1px 0 #1a301a, inset 1px 1px 0 #020802; }
.retro-btn-close:hover { color: #ff4444; border-color: #aa2222; background: #1a0606; }

.retro-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  overscroll-behavior: contain;
}

.retro-resizer {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  cursor: se-resize;
  background: linear-gradient(135deg,
    transparent 40%, #2a2a2a 40%, #2a2a2a 50%,
    transparent 50%, transparent 65%,
    #2a2a2a 65%, #2a2a2a 75%, transparent 75%
  );
}

.retro-body h1 { font-family:var(--font);font-size:1.15em;font-weight:600;color:var(--green);margin:1.2rem 0 0.55rem;border-bottom:1px solid rgba(120,232,255,0.12);padding-bottom:0.3rem; }
.retro-body h2 { font-family:var(--font);font-size:0.95em;font-weight:600;color:var(--green-mid);margin:1.2rem 0 0.4rem; }
.retro-body h3 { font-family:var(--font);font-size:0.88em;font-weight:600;color:var(--amber);margin:1rem 0 0.3rem; }
.retro-body p  { font-family:var(--font-sans);color:var(--ink);font-size:0.86em;line-height:1.8;margin:0.35rem 0; }
.retro-body strong { color:var(--green);font-weight:600; }
.retro-body em     { color:var(--ink-dim);font-style:italic; }
.retro-body a      { color:var(--green-mid);text-decoration:underline; }
.retro-body a:hover{ color:var(--green); }
.retro-body .wikilink { color:var(--green-mid);text-decoration:underline;cursor:pointer;border-bottom:1px dashed var(--green-mid); }
.retro-body .wikilink:hover { color:var(--green); }
.retro-body ul,.retro-body ol { padding-left:1.1rem;margin:0.35rem 0; }
.retro-body li { font-family:var(--font-sans);color:var(--ink);font-size:0.86em;line-height:1.8; }
.retro-body li::marker { color:var(--muted); }
.retro-body blockquote { border-left:2px solid var(--muted);margin:0.5rem 0;padding:0.2rem 0 0.2rem 0.8rem;color:var(--ink-dim);font-style:italic; }
.retro-body code { font-family:var(--font);font-size:0.82em;background:rgba(120,232,255,0.05);color:var(--green-mid);padding:1px 4px;border-radius:1px; }
.retro-body pre  { background:#020a04;border:1px solid #0e2010;padding:0.8rem 1rem;overflow-x:auto;margin:0.5rem 0; }
.retro-body pre code { background:transparent;padding:0;color:var(--ink);font-size:0.8em;line-height:1.7; }
.retro-body table { width:100%;border-collapse:collapse;margin:0.5rem 0;font-size:0.8em; }
.retro-body th { font-family:var(--font);color:var(--green-mid);font-weight:600;text-align:left;padding:4px 8px;border-bottom:1px solid #2a1850; }
.retro-body td { font-family:var(--font-sans);color:var(--ink);padding:3px 8px;border-bottom:1px solid #0d0820;vertical-align:top; }
.retro-body tr:hover td { background:rgba(120,232,255,0.02); }
.retro-body img { max-width:100%;height:auto;display:block;margin:0.6rem 0;border:1px solid #0e2010; }
.retro-body hr  { border:none;border-top:1px solid #1a1030;margin:1.1rem 0; }
.retro-body::-webkit-scrollbar { width:4px; }
.retro-body::-webkit-scrollbar-track { background:#020a04; }
.retro-body::-webkit-scrollbar-thumb { background:#1a4020; }
.retro-body::-webkit-scrollbar-thumb:hover { background:#1e4820; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .line-ascii { font-size: 0.5em; letter-spacing: 0; }
  .slab-col { width: 24px; }
  .entry-thumb { width: 100px; height: 70px; }
}