/* ── Evolution Lab — Styles ──────────────── */

:root {
  /* Atelier Kommune — varm palet (ingen neon-cyan, ingen lilla-identitet, ingen kølig sort) */
  --lab-bg-color: #171311;                  /* espresso, ikke kølig sort */
  --lab-surface: rgba(32, 25, 20, 0.68);    /* varm panel-overflade */
  --lab-surface-2: rgba(46, 36, 29, 0.78);  /* varmt løftet panel */
  --lab-border: rgba(244, 239, 230, 0.10);  /* varm hvid kant, lav alpha */
  --lab-text: #f4efe6;                       /* varm hvid */
  --lab-muted: rgba(244, 239, 230, 0.5);
  --lab-accent: #c96a3d;                     /* terracotta (brand/fokus) */
  --lab-accent-glow: rgba(201, 106, 61, 0.3);
  --lab-banana: #FFD700;                     /* guld — ikke forbudt */
  --lab-sten: #7B8794;                       /* stengrå — ikke forbudt */
  --lab-species: #d7a928;                    /* sennep (universer/arts-identitet) */
  --lab-danger: #ef4444;                     /* semantisk rød */
  --lab-glass-blur: blur(16px);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--lab-bg-color);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(215, 169, 40, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(201, 106, 61, 0.06) 0%, transparent 40%);
  color: var(--lab-text);
  overflow: hidden;
  height: 100vh;
}

/* ── Layout ───────────────────────────────── */

.lab-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  width: 100vw;
  gap: 0;
  overflow: hidden;
}

/* ── Header ───────────────────────────────── */

.lab-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--lab-surface);
  backdrop-filter: var(--lab-glass-blur);
  -webkit-backdrop-filter: var(--lab-glass-blur);
  border-bottom: 1px solid var(--lab-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.lab-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, var(--lab-species));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lab-title-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(215, 169, 40, 0.5));
}

.lab-title-sub {
  font-size: 0.75rem;
  color: var(--lab-muted);
  font-weight: 500;
  -webkit-text-fill-color: var(--lab-muted);
}

/* ── HUD strip ────────────────────────────── */

.lab-hud {
  display: flex;
  gap: 24px;
  align-items: center;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lab-muted);
  font-weight: 600;
}

.hud-value {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.hud-value.gen { color: var(--lab-accent); text-shadow: 0 0 12px var(--lab-accent-glow); }
.hud-value.alive { color: var(--lab-banana); text-shadow: 0 0 12px rgba(255, 215, 0, 0.3); }
.hud-value.species { color: var(--lab-species); text-shadow: 0 0 12px rgba(215, 169, 40, 0.3); }

/* Seasons */
.hud-season {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.5s ease;
  border: 1px solid transparent;
}
.season-0 { background: rgba(46, 204, 113, 0.1); color: #2ecc71; border-color: rgba(46, 204, 113, 0.25); }
.season-1 { background: rgba(241, 196, 15, 0.1); color: #f1c40f; border-color: rgba(241, 196, 15, 0.25); }
.season-2 { background: rgba(230, 126, 34, 0.1); color: #e67e22; border-color: rgba(230, 126, 34, 0.25); }
.season-3 { background: rgba(52, 152, 219, 0.1); color: #3498db; border-color: rgba(52, 152, 219, 0.25); }

/* Day/Night indicator */
.hud-daytime {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 1s ease, color 1s ease;
  border: 1px solid transparent;
}
.dt-day   { background: rgba(241, 196, 15, 0.12); color: #f1c40f; border-color: rgba(241, 196, 15, 0.3); }
.dt-dawn  { background: rgba(230, 126, 34, 0.12); color: #e67e22; border-color: rgba(230, 126, 34, 0.3); }
.dt-dusk  { background: rgba(155, 89, 182, 0.15); color: #9b59b6; border-color: rgba(155, 89, 182, 0.3); }
.dt-night { background: rgba(44, 62, 80, 0.5);    color: #85c1e9; border-color: rgba(52, 152, 219, 0.3); }

/* ── Controls ─────────────────────────────── */

.lab-controls {
  display: flex;
  gap: 8px;
}

.lab-btn {
  background: var(--lab-surface-2);
  color: var(--lab-text);
  border: 1px solid var(--lab-border);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.lab-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lab-btn:active {
  transform: translateY(1px);
}

/* ── Tastatur-fokus på knapper ── */
.lab-btn:focus-visible,
.event-btn:focus-visible {
  outline: 2px solid var(--lab-accent, #c96a3d);
  outline-offset: 2px;
}

/* ── On-screen forklaring + legend overlay ── */
.lab-overlay-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  max-width: 320px;
  background: rgba(15, 15, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: opacity 0.3s;
  z-index: 5;
  backdrop-filter: blur(6px);
}
.lab-overlay-info:hover {
  opacity: 0.7;
}
.lab-overlay-info.collapsed .lab-info-content {
  display: none;
}
.lab-info-line {
  margin: 0 0 4px;
}
.lab-info-icon {
  display: inline-block;
  width: 1.2em;
}
.lab-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.lab-legend .legend-item {
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lab-legend .legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.lab-legend .legend-banana::before { background: #FFD700; }
.lab-legend .legend-sten::before { background: #7B8794; }
.lab-legend .legend-fossil::before { background: #555; }
.lab-legend .legend-species::before { background: #4ade80; }

/* ── Arena (main area) ────────────────────── */

.lab-arena {
  display: block;
  overflow: hidden;
  position: relative;
  background: #171311;
}

#arena-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #171311;
}

/* ── Sidebar ──────────────────────────────── */

.lab-sidebar {
  grid-row: 2 / 4;
  background: var(--lab-surface);
  backdrop-filter: var(--lab-glass-blur);
  -webkit-backdrop-filter: var(--lab-glass-blur);
  border-left: 1px solid var(--lab-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
  z-index: 5;
}

.lab-sidebar::-webkit-scrollbar { width: 6px; }
.lab-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--lab-border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lab-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Organism profile ─────────────────────── */

.profile-empty {
  font-size: 0.85rem;
  color: var(--lab-muted);
  text-align: center;
  padding: 30px 0;
  font-style: italic;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border: 1px dashed rgba(255,255,255,0.1);
}

.profile-header {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #fff;
}

.profile-section {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lab-species);
  margin: 16px 0 8px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.profile-row span:first-child { color: var(--lab-muted); }
.profile-row span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Species list ─────────────────────────── */

.species-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.species-row:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.species-name {
  flex: 1;
  font-weight: 700;
  color: var(--lab-species);
}

.species-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

.species-gen {
  font-size: 0.7rem;
  color: var(--lab-muted);
}

.species-empty {
  font-size: 0.85rem;
  color: var(--lab-muted);
  text-align: center;
  padding: 16px 0;
}

/* ── Log feed ─────────────────────────────── */

.lab-footer {
  grid-column: 1 / 2;
  background: var(--lab-surface);
  backdrop-filter: var(--lab-glass-blur);
  -webkit-backdrop-filter: var(--lab-glass-blur);
  border-top: 1px solid var(--lab-border);
  padding: 12px 24px;
  height: 140px;
  overflow-y: auto;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
  z-index: 10;
}

.lab-footer::-webkit-scrollbar { width: 6px; }
.lab-footer::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.log-entry {
  font-size: 0.78rem;
  color: var(--lab-muted);
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-entry::before {
  content: "»";
  color: rgba(255,255,255,0.2);
}

.log-entry.log-species {
  color: var(--lab-species);
  font-weight: 600;
}
.log-entry.log-species::before { color: var(--lab-species); }

/* ── Chart ────────────────────────────────── */

.chart-section { padding: 16px 20px; }

#chart-canvas {
  display: block;
  width: 100%;
  height: 120px;
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.chart-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--lab-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-item::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-banana::before { background: #FFD700; box-shadow: 0 0 5px #FFD700; }
.legend-sten::before   { background: #7B8794; }
.legend-survival::before { background: var(--lab-accent); box-shadow: 0 0 5px var(--lab-accent); }

/* ── Environmental event buttons ─────────── */

.lab-events {
  display: flex;
  gap: 8px;
  border-left: 1px solid var(--lab-border);
  padding-left: 20px;
}

.event-btn {
  background: rgba(255,255,255,0.03);
  color: var(--lab-muted);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.event-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

.event-btn.active {
  animation: event-pulse 1.5s ease-in-out infinite alternate;
  color: #fff;
}

.event-btn.active.storm  { background: rgba(215, 169, 40,0.15); border-color: var(--lab-species); text-shadow: 0 0 8px var(--lab-species); }
.event-btn.active.expose { background: rgba(251,146,60,0.15); border-color: #fb923c; text-shadow: 0 0 8px #fb923c; }
.event-btn.active.upgrade{ background: rgba(231,76,60,0.15); border-color: #e74c3c; text-shadow: 0 0 8px #e74c3c; }

@keyframes event-pulse {
  from { box-shadow: 0 0 5px currentColor; }
  to   { box-shadow: 0 0 15px currentColor; }
}

/* ── Season badge ─────────────────────────── */

.hud-season {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.5s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.season-0 { color: #4ade80; border-color: rgba(74,222,128,0.3); background: rgba(74,222,128,0.1); box-shadow: 0 0 15px rgba(74,222,128,0.1); }
.season-1 { color: #93c5fd; border-color: rgba(147,197,253,0.4); background: rgba(147,197,253,0.15); box-shadow: 0 0 15px rgba(147,197,253,0.1); }
.season-2 { color: #cbd5e1; border-color: rgba(148,163,184,0.4); background: rgba(148,163,184,0.15); box-shadow: 0 0 15px rgba(148,163,184,0.1); }
.season-3 { color: #f87171; border-color: rgba(248,113,113,0.4); background: rgba(248,113,113,0.15); box-shadow: 0 0 15px rgba(248,113,113,0.1); }

/* ── Hall of Fame ─────────────────────────── */

.hof-empty {
  font-size: 0.8rem;
  color: var(--lab-muted);
  text-align: center;
  padding: 16px 0;
  font-style: italic;
}

.hof-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.04);
  transition: transform 0.2s, background 0.2s;
}

.hof-row:hover {
  transform: translateX(4px);
  background: rgba(255,255,255,0.05);
}

.hof-medal { 
  font-size: 1.4rem; 
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.hof-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.hof-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lab-muted);
}

.hof-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ── Extinct species ──────────────────────── */

.species-extinct {
  opacity: 0.5;
  background: transparent;
  border-color: transparent;
}
.species-extinct:hover { background: rgba(255,0,0,0.05); }

.species-extinct .species-name,
.species-extinct .species-count {
  text-decoration: line-through;
  color: var(--lab-danger);
}

.extinct-badge {
  font-size: 0.6rem;
  color: var(--lab-danger);
  margin-left: 6px;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Trait color markers ──────────────────── */

.trait-high { color: #fb923c; font-weight: 800; text-shadow: 0 0 8px rgba(251, 146, 60, 0.4); }
.trait-low  { color: var(--lab-accent); font-weight: 800; text-shadow: 0 0 8px rgba(201, 106, 61, 0.4); }

/* ── HUD event countdown ──────────────────── */

.hud-event {
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(4px);
  box-shadow: 0 0 15px rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

/* ── S.T.E.N. notification ────────────────── */

.sten-notif {
  position: fixed;
  bottom: 20px;
  left: 240px; /* Offset to clear the log box on the bottom left */
  transform: none;
  background: rgba(10, 13, 17, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(231,76,60,0.4);
  border-left: 4px solid #e74c3c;
  border-radius: 4px;
  padding: 14px 20px 12px;
  max-width: 400px;
  width: 92%;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
  z-index: 200;
  opacity: 1;
  box-shadow: 0 10px 40px rgba(231,76,60,0.2), 0 0 0 1px rgba(255,255,255,0.05);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sten-notif.hidden { 
  opacity: 0; 
  pointer-events: none; 
  transform: translateY(20px);
}

.sten-notif-header {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #e74c3c;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 0 8px rgba(231,76,60,0.5);
}

.sten-notif-body {
  line-height: 1.6;
}

.sten-notif-bar {
  height: 3px;
  background: rgba(231,76,60,0.15);
  margin-top: 12px;
  border-radius: 2px;
  overflow: hidden;
}

.sten-notif-progress {
  height: 100%;
  background: #e74c3c;
  width: 100%;
  transition: width linear;
  box-shadow: 0 0 10px #e74c3c;
}

/* ── Species rename input ─────────────────── */

/* ── Chronicle Cutscene — kompakt narration-bar ── */

.chronicle-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  width: 90%;
  max-width: 600px;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.chronicle-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

.chronicle-bar-inner {
  background: rgba(10, 13, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--chronicle-accent, var(--lab-species));
  border-radius: 8px;
  padding: 10px 16px 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 24px var(--chronicle-glow, rgba(215, 169, 40,0.1));
  font-family: 'Inter', system-ui, sans-serif;
  color: #e2e8f0;
  animation: chronicle-slide-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chronicle-slide-up {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.chronicle-bar-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chronicle-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--chronicle-accent, var(--lab-species));
  text-shadow: 0 0 8px var(--chronicle-glow, rgba(215, 169, 40,0.3));
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.chronicle-child {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(255,255,255,0.4);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 2px 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.chronicle-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

.chronicle-margin {
  font-family: 'Caveat', 'Comic Sans MS', cursive;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  margin-top: 4px;
  padding-left: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-margin::before {
  content: "✏️ ";
  opacity: 0.5;
}

.chronicle-bar-progress {
  height: 2px;
  background: rgba(215, 169, 40, 0.08);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 6px;
}

.chronicle-progress {
  height: 100%;
  background: var(--chronicle-accent, var(--lab-species));
  width: 100%;
  box-shadow: 0 0 6px var(--chronicle-glow, rgba(215, 169, 40,0.3));
  transition: width linear;
}

#btn-chronicle-toggle.active {
  background: rgba(215, 169, 40, 0.15);
  border-color: rgba(215, 169, 40, 0.5);
  color: var(--lab-species);
}

/* ── Chronicle Log entries ─────────────────── */

.chronicle-entries {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 100%;
  overflow-y: auto;
  padding: 4px;
}

.chronicle-entry {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid;
  background: rgba(255,255,255,0.03);
  transition: background 0.2s;
}

.chronicle-entry:hover { background: rgba(255,255,255,0.06); }

.chronicle-entry-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.chronicle-entry-body { flex: 1; min-width: 0; }

.chronicle-entry-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
}

.chronicle-entry-gen {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
}

.chronicle-entry-type {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chronicle-entry-species {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  font-style: italic;
}

.chronicle-entry-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.7);
}

/* ── Species rename input ─────────────────── */

.species-name-edit {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--lab-accent);
  border-radius: 4px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  width: 100%;
  outline: none;
  padding: 4px 8px;
  font-family: inherit;
  box-shadow: 0 0 10px rgba(201, 106, 61,0.1);
}

/* ── Follow / Replay active btn ────────────── */

.lab-btn.active {
  background: rgba(201, 106, 61, 0.12);
  border-color: var(--lab-accent);
  color: var(--lab-accent);
  box-shadow: 0 0 12px rgba(201, 106, 61,0.2);
}

/* ── Brain Scan panel ─────────────────────── */

.brain-scan-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--lab-border);
}

.bs-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lab-accent);
  margin-bottom: 10px;
  text-shadow: 0 0 8px rgba(201, 106, 61,0.4);
}

.bs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bs-col { min-width: 0; }

.bs-section {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--lab-muted);
  margin-bottom: 6px;
}

.bs-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  border-radius: 3px;
  padding: 1px 3px;
  transition: background 0.15s;
}

.bs-row.bs-active {
  background: rgba(215, 169, 40,0.08);
}

.bs-label {
  font-size: 0.55rem;
  color: var(--lab-muted);
  width: 44px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-bar-bg {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}

.bs-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.bs-val {
  font-size: 0.52rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.5);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* NEAT topology display */
.bs-topo {
  display: inline-block;
  font-size: 0.5rem;
  color: rgba(215, 169, 40,0.7);
  margin-left: 6px;
  font-weight: 400;
}
.bs-topo-viz {
  margin-top: 6px;
  display: flex;
  justify-content: center;
}
.bs-topo-viz svg {
  max-width: 100%;
  height: auto;
}

/* ── Replay panel overlay ─────────────────── */

#replay-panel {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 13, 17, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 106, 61,0.3);
  border-left: 4px solid var(--lab-accent);
  border-radius: 6px;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 16px;
  z-index: 300;
  box-shadow: 0 8px 40px rgba(201, 106, 61,0.15);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.replay-gen {
  color: var(--lab-accent);
  font-size: 0.8rem;
}

#btn-replay-stop {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
#btn-replay-stop:hover { background: rgba(239,68,68,0.3); }

.replay-scrubber {
  width: 180px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

.replay-scrubber-fill {
  height: 100%;
  width: 0%;
  background: var(--lab-accent);
  border-radius: 3px;
  box-shadow: 0 0 8px var(--lab-accent-glow);
  transition: width 0.05s linear;
}

.replay-time {
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
  font-weight: 500;
  min-width: 32px;
  text-align: right;
}

.replay-speed-btn {
  background: rgba(201, 106, 61,0.1);
  color: var(--lab-accent);
  border: 1px solid rgba(201, 106, 61,0.25);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 36px;
}
.replay-speed-btn:hover { background: rgba(201, 106, 61,0.2); }
.replay-speed-btn:active { transform: scale(0.95); }

/* ── Species Card Modal ───────────────────── */

.sp-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sp-fade-in 0.2s ease;
}

@keyframes sp-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sp-modal-inner {
  background: rgba(14, 18, 26, 0.98);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 28px;
  max-width: 600px;
  width: calc(100vw - 48px);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: sp-slide-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 30px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.05);
}

@keyframes sp-slide-in {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.sp-close {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--lab-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.sp-close:hover { background: rgba(239,68,68,0.2); color: #ef4444; border-color: #ef4444; }

.sp-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sp-icon { font-size: 2.5rem; line-height: 1; flex-shrink: 0; }

.sp-header-info { flex: 1; }

.sp-name-edit {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  cursor: pointer;
  display: inline-block;
  border-bottom: 1px dashed rgba(255,255,255,0.2);
  transition: border-color 0.2s;
}
.sp-name-edit:hover { border-color: var(--lab-accent); }

.sp-meta {
  font-size: 0.78rem;
  color: var(--lab-muted);
  margin-bottom: 8px;
}

.sp-extinct-tag {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 6px;
}

.sp-pop-badge {
  display: inline-block;
  background: rgba(201, 106, 61,0.1);
  color: var(--lab-accent);
  border: 1px solid rgba(201, 106, 61,0.25);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.sp-body { display: flex; flex-direction: column; gap: 20px; }

.sp-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 16px;
}

.sp-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lab-muted);
  margin-bottom: 14px;
}

.sp-charts-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

#sp-radar { display: block; }

.sp-radar-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.6rem;
  color: var(--lab-muted);
}

.sp-traits-list { flex: 1; min-width: 0; }

.sp-trait-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sp-trait-label {
  font-size: 0.72rem;
  color: var(--lab-muted);
  width: 80px;
  flex-shrink: 0;
}

.sp-trait-bar-bg {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.sp-trait-bar {
  height: 100%;
  background: var(--lab-accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.sp-trait-val {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  width: 52px;
  text-align: right;
}

.sp-strat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sp-strat-label {
  font-size: 0.75rem;
  color: var(--lab-muted);
  width: 110px;
  flex-shrink: 0;
}

.sp-strat-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}

.sp-strat-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  box-shadow: 0 0 6px currentColor;
}

.sp-strat-pct {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  width: 38px;
  text-align: right;
}

#sp-spark, #sp-nn { display: block; border-radius: 6px; width: 100%; }

.sp-nn-caption {
  font-size: 0.6rem;
  color: var(--lab-muted);
  text-align: center;
  margin-top: 6px;
}

/* ── Fossil-arkiv (fanen "Fossiler") ─────── */
.fossil-empty,
.chronicle-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--lab-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.fossil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 10px 14px;
  overflow-y: auto;
}
.fossil-card {
  background: var(--lab-surface-2);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fossil-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--lab-border);
}
.fossil-icon { font-size: 1.4rem; line-height: 1; }
.fossil-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fossil-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lab-muted);
}
.fossil-name {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fossil-stats { font-size: 0.62rem; color: var(--lab-muted); font-variant-numeric: tabular-nums; }
.fossil-traits { display: flex; flex-direction: column; gap: 3px; }
.fossil-trait-row {
  display: grid;
  grid-template-columns: 42px 1fr 32px;
  align-items: center;
  gap: 5px;
}
.fossil-trait-k { font-size: 0.6rem; color: var(--lab-muted); }
.fossil-bar-bg { height: 5px; background: rgba(0, 0, 0, 0.3); border-radius: 3px; overflow: hidden; }
.fossil-bar { height: 100%; border-radius: 3px; }
.fossil-trait-v {
  font-size: 0.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--lab-text);
}
.fossil-release-btn {
  background: var(--lab-accent-glow);
  border: 1px solid var(--lab-accent);
  color: var(--lab-text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.fossil-release-btn:hover { background: var(--lab-accent); }

/* Art-badges (sidebar artsliste) — farve/kant sættes inline pr. badge */
.sp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  padding: 0 3px;
  border-radius: 4px;
  border: 1px solid var(--lab-border);
  margin-left: 2px;
  vertical-align: middle;
}

/* ── Footer tab bar ──────────────────────── */

.lab-footer {
  background: var(--lab-surface);
  backdrop-filter: var(--lab-glass-blur);
  -webkit-backdrop-filter: var(--lab-glass-blur);
  border-top: 1px solid var(--lab-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.footer-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--lab-border);
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}

.footer-tab {
  background: none;
  border: none;
  border-right: 1px solid var(--lab-border);
  color: var(--lab-muted);
  padding: 7px 18px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.footer-tab:hover { color: #fff; background: rgba(255,255,255,0.05); }

.footer-tab.tab-active {
  color: var(--lab-accent);
  background: rgba(201, 106, 61,0.06);
  border-bottom: 2px solid var(--lab-accent);
  margin-bottom: -1px;
}

.footer-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.footer-content #log-feed {
  height: 100%;
  overflow-y: auto;
  padding: 8px 16px;
}

#timeline-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Featured Observation ─────────────────── */

.featured-section {
  padding-bottom: 8px;
}

.featured-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid;
  background: rgba(255,255,255,0.04);
  transition: transform 0.2s;
}

.featured-card:hover { transform: translateX(2px); }

.featured-legendary {
  border-color: #f97316;
  background: rgba(249,115,22,0.08);
  box-shadow: 0 0 16px rgba(249,115,22,0.15);
}
.featured-rare {
  border-color: #fbbf24;
  background: rgba(251,191,36,0.06);
}
.featured-species {
  border-color: var(--lab-species);
  background: rgba(215, 169, 40,0.06);
}
.featured-extinct {
  border-color: #ef4444;
  background: rgba(239,68,68,0.05);
}
.featured-dominant {
  border-color: #4ade80;
  background: rgba(74,222,128,0.05);
}
.featured-idle {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.02);
}

.featured-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px currentColor);
}

.featured-legendary .featured-icon { color: #f97316; }
.featured-rare .featured-icon { color: #fbbf24; }
.featured-species .featured-icon { color: var(--lab-species); }
.featured-extinct .featured-icon { color: #ef4444; }
.featured-dominant .featured-icon { color: #4ade80; }

.featured-text { flex: 1; min-width: 0; }

.featured-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.featured-desc {
  font-size: 0.7rem;
  color: var(--lab-muted);
  margin-top: 2px;
}

/* ── Mission Cards ────────────────────────── */

.mission-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all 0.3s;
}

.mission-card:last-of-type { margin-bottom: 4px; }

.mission-card.mission-done {
  background: rgba(74, 222, 128, 0.07);
  border-color: rgba(74, 222, 128, 0.25);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.08);
}

.mission-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mission-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.mission-info { flex: 1; min-width: 0; }

.mission-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.mission-done .mission-title { color: #4ade80; }

.mission-desc {
  font-size: 0.67rem;
  color: var(--lab-muted);
  line-height: 1.4;
}

.mission-check {
  color: #4ade80;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
  text-shadow: 0 0 8px rgba(74,222,128,0.5);
}

.mission-progress-bg {
  margin-top: 7px;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.mission-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--lab-species), var(--lab-accent));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.mission-progress-label {
  position: absolute;
  right: 0;
  top: -14px;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
}

.mission-footer {
  font-size: 0.62rem;
  color: var(--lab-muted);
  text-align: center;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin-top: 4px;
}
