:root {
  color-scheme: dark;
  --bg: #07090d;
  --bg-elev: #0d1219;
  --bg-panel: #101722;
  --line: #1c2736;
  --line-soft: #15202e;
  --text: #d7dee8;
  --muted: #7d8b9d;
  --faint: #4d5b6d;
  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.14);
  --accent-2: #7c9cff;
  --accent-3: #f0abfc;
  --warn: #fbbf24;
  --hot: #fb7185;
  --radius: 14px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(94, 234, 212, 0.08), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(124, 156, 255, 0.08), transparent 50%),
    radial-gradient(700px 400px at 50% 100%, rgba(240, 171, 252, 0.05), transparent 50%),
    var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.72);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 35% 35%, #5eead4, transparent 45%),
    radial-gradient(circle at 70% 65%, #7c9cff, transparent 50%),
    #121a24;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 20px rgba(94, 234, 212, 0.2);
}

.brand h1 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand p {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1px;
}

.modes {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}

.mode-btn:hover {
  color: var(--text);
  border-color: #2a3a50;
}

.mode-btn.active {
  color: #041016;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.top-links {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.top-links a {
  color: var(--muted);
}
.top-links a:hover {
  color: var(--accent);
}

/* Main */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 0;
  min-height: 0;
}

@media (max-width: 960px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(420px, 52vh) auto;
  }
}

.stage {
  position: relative;
  border-right: 1px solid var(--line);
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 50% at 50% 48%, rgba(30, 48, 70, 0.35), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 40%);
}

@media (max-width: 960px) {
  .stage {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.stage-hint {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 5;
  font-size: 0.72rem;
  color: var(--faint);
  font-family: var(--mono);
  letter-spacing: 0.02em;
  pointer-events: none;
}

.cell-svg {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: block;
  touch-action: manipulation;
}

.organelle {
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.organelle:hover,
.organelle.is-hot {
  filter: brightness(1.25) drop-shadow(0 0 8px rgba(94, 234, 212, 0.35));
}

.organelle.is-dim {
  opacity: 0.28;
  filter: saturate(0.5);
}

.organelle.is-active {
  filter: brightness(1.35) drop-shadow(0 0 12px rgba(94, 234, 212, 0.55));
}

.label-float {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--muted);
  pointer-events: none;
  user-select: none;
}

.label-float.on {
  fill: var(--accent);
}

/* Panel */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(13, 18, 25, 0.55);
}

.panel-scroll {
  flex: 1;
  overflow: auto;
  padding: 22px 22px 28px;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.panel h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.lede {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 18px;
}

.primitive {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(94, 234, 212, 0.25);
  color: var(--accent);
  font-size: 0.78rem;
  font-family: var(--mono);
  margin-bottom: 18px;
}

.bullets {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.bullets li {
  position: relative;
  padding: 10px 12px 10px 28px;
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #c2cbd8;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.5);
}

.section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin: 6px 0 12px;
  font-family: var(--mono);
}

.life-list {
  display: grid;
  gap: 10px;
}

.life-card {
  text-align: left;
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: inherit;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

.life-card:hover,
.life-card.active {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.06);
}

.life-card h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.life-card p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover,
.chip.active {
  color: var(--accent);
  border-color: rgba(94, 234, 212, 0.4);
}

.loop-note {
  margin-top: 20px;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed rgba(124, 156, 255, 0.35);
  background: rgba(124, 156, 255, 0.06);
  font-size: 0.84rem;
  line-height: 1.5;
  color: #b7c3da;
}

.loop-note strong {
  color: var(--accent-2);
  font-weight: 600;
}

.empty-state .kicker {
  color: var(--accent-2);
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--faint);
  font-family: var(--mono);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--faint);
  font-family: var(--mono);
}

/* Tooltip (mobile-friendly top ribbon) */
.hover-tag {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 23, 34, 0.92);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.hover-tag.show {
  opacity: 1;
}

/* Views */
.view {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view.hidden {
  display: none !important;
}

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.view-nav {
  display: flex;
  gap: 6px;
}

.view-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-btn:hover {
  color: var(--text);
  border-color: #2a3a50;
}

.view-btn.active {
  color: #041016;
  background: var(--accent-2);
  border-color: var(--accent-2);
  font-weight: 600;
}

/* Lab layout */
.lab {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(240px, 300px);
  min-height: calc(100vh - 110px);
  min-height: calc(100dvh - 110px);
  border-top: 1px solid transparent;
}

@media (max-width: 1100px) {
  .lab {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(380px, 50vh) auto;
  }
}

.lab-side,
.lab-right {
  border-right: 1px solid var(--line);
  background: rgba(13, 18, 25, 0.55);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lab-right {
  border-right: none;
  border-left: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .lab-side,
  .lab-right {
    border: none;
    border-bottom: 1px solid var(--line);
  }
}

.lab-side-scroll,
.lab-right-scroll {
  overflow: auto;
  padding: 16px 16px 28px;
  flex: 1;
}

.lab-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 12px 0;
}

.lab-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.lab-tab.active {
  color: #041016;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.lab-h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.lab-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(30, 48, 70, 0.25), transparent 70%);
}

#lab-canvas {
  width: 100%;
  flex: 1;
  min-height: 360px;
  display: block;
  cursor: crosshair;
  background: #0a1018;
}

.lab-stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.85);
}

.lab-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lab-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.lab-stats strong {
  color: var(--text);
  font-weight: 500;
}

.lab-hint {
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--faint);
  pointer-events: none;
}

.btn {
  appearance: none;
  border: 1px solid rgba(94, 234, 212, 0.4);
  background: var(--accent);
  color: #041016;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.btn.ghost {
  background: var(--bg-elev);
  color: var(--muted);
  border-color: var(--line);
  font-weight: 500;
}

.btn.ghost:hover {
  color: var(--text);
}

.btn.small {
  font-size: 0.75rem;
  padding: 5px 10px;
  margin-top: 8px;
}

.btn:hover {
  filter: brightness(1.05);
}

.speed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}

.speed input {
  width: 90px;
}

.type-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.type-card {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: inherit;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.type-card:hover,
.type-card.active {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.06);
}

.type-card .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.type-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.type-era {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--faint);
}

.type-story,
.mode-blurb {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 14px;
}

.sliders {
  display: grid;
  gap: 10px;
}

.slider-row {
  display: grid;
  gap: 4px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}

.slider-label em {
  font-style: normal;
  font-family: var(--mono);
  color: var(--accent);
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.kit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.preset-grid {
  display: grid;
  gap: 8px;
}

.preset-card {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: inherit;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.preset-card strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.preset-card span {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.preset-card:hover,
.preset-card.active {
  border-color: rgba(124, 156, 255, 0.5);
  background: rgba(124, 156, 255, 0.07);
}

.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.bar-val {
  text-align: right;
  color: var(--faint);
}

.lab-log {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.45;
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
}

.lab-log .log-t {
  color: var(--faint);
  margin-right: 6px;
}

.lab-log .faint {
  color: var(--faint);
}

.evo-list {
  display: grid;
  gap: 12px;
}

.evo-card {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 12px 14px;
}

.evo-card.active {
  border-color: rgba(94, 234, 212, 0.4);
}

.evo-era {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.evo-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.evo-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 8px;
}

.evo-card ul {
  margin: 0 0 4px 1rem;
  font-size: 0.78rem;
  color: #c2cbd8;
  line-height: 1.4;
}

/* topbar wrap for extra nav */
.topbar {
  gap: 10px 14px;
}

@media (max-width: 720px) {
  .view-nav {
    order: 3;
    width: 100%;
  }
  .modes {
    order: 4;
    width: 100%;
    justify-content: flex-start;
  }
}

/* Functional naming */
.name-stack {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(16, 23, 34, 0.9);
}

.name-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 0.8rem;
}

.name-row.emph .name-val {
  color: var(--accent);
  font-weight: 600;
}

.name-layer {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.name-val {
  color: var(--text);
  line-height: 1.3;
}

.name-val.mono,
.name-row.sys .name-val {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.name-row.muted-row .name-val {
  color: var(--faint);
  font-style: italic;
}

.name-lineage {
  margin-top: 4px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--warn);
  line-height: 1.35;
}

.name-hint {
  font-size: 0.78rem;
  margin: -6px 0 14px;
  line-height: 1.4;
}

.name-hint.ok {
  color: var(--accent);
}

.name-hint.warn {
  color: var(--warn);
}

.name-sub {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
  margin-bottom: 6px;
}

.sci-inline {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 0.85em;
}

.verb-line {
  font-size: 0.88rem;
  color: var(--accent);
  margin: -4px 0 12px;
  line-height: 1.4;
}

.linkish {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.linkish:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Tour — always topmost; card/offer draggable */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
  isolation: isolate;
}

.tour-root.hidden {
  display: none !important;
}

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, 0.5);
  pointer-events: auto;
  z-index: 1;
}

.tour-backdrop.soft {
  background: rgba(3, 5, 8, 0.72);
}

.tour-spotlight {
  position: fixed;
  border: 2px solid rgba(94, 234, 212, 0.9);
  border-radius: 12px;
  box-shadow:
    0 0 0 9999px rgba(3, 5, 8, 0.52),
    0 0 28px rgba(94, 234, 212, 0.3);
  pointer-events: none;
  z-index: 2;
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tour-spotlight.hidden {
  display: none;
}

/* Outline only — never raise page content above the tour layer */
.tour-target {
  outline: 2px solid rgba(94, 234, 212, 0.35);
  outline-offset: 2px;
}

.tour-card,
.tour-offer {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #0f1620;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 16px;
  padding: 0 18px 14px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 3;
  pointer-events: auto;
  touch-action: none;
}

.tour-card.is-dragging,
.tour-offer.is-dragging {
  opacity: 0.96;
  cursor: grabbing;
  user-select: none;
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(94, 234, 212, 0.45);
}

.tour-offer {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}

.tour-offer.hidden,
.tour-card.hidden {
  display: none;
}

.tour-drag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -18px 12px;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.08), transparent);
  border-radius: 16px 16px 0 0;
}

.tour-drag:active {
  cursor: grabbing;
}

.tour-drag-grip {
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: #3a4a5c;
  box-shadow: 0 6px 0 #3a4a5c;
  margin-right: 2px;
  flex-shrink: 0;
}

.tour-drag-hint {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.tour-progress {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.tour-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.tour-body {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tour-offer h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.tour-offer p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tour-nav {
  display: flex;
  gap: 8px;
}

.tour-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ——— Cell dossier collectible card ——— */
.cell-card-host {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 12;
  width: min(340px, calc(100% - 20px));
  max-height: calc(100% - 88px);
  overflow: auto;
  pointer-events: auto;
}

.cell-card-host.hidden {
  display: none;
}

.ccard {
  --cc: #5eead4;
  position: relative;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--cc) 55%, #1c2736);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--cc) 18%, #0c121a) 0%, #0a0f16 42%, #0d1520 100%);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  padding: 12px 14px 16px;
  overflow: hidden;
}

.ccard-shine {
  pointer-events: none;
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.07) 48%,
    transparent 62%
  );
  transform: rotate(-8deg);
}

.ccard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.ccard-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
}

.ccard-badge.live {
  color: #041016;
  background: var(--accent);
  border-color: var(--accent);
}

.ccard-badge.dead {
  color: #fff;
  background: #9f1239;
  border-color: #fb7185;
}

.ccard-close {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.ccard-close:hover {
  color: var(--text);
  border-color: #3a4a5c;
}

.ccard-art {
  display: grid;
  place-items: center;
  position: relative;
  margin: 4px 0 10px;
  z-index: 1;
}

.ccard-orb {
  width: 108px;
  height: 108px;
  position: relative;
}

.ccard-orb-core {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cc) 80%, #fff), var(--cc) 45%, #0a1018 75%);
  box-shadow:
    0 0 24px color-mix(in srgb, var(--cc) 45%, transparent),
    inset 0 0 20px rgba(0, 0, 0, 0.35);
}

.ccard-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ccard-id {
  position: absolute;
  right: 8px;
  top: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

.ccard-names {
  text-align: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.ccard-fn {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 4px;
}

.ccard-sci,
.ccard-sys,
.ccard-lineage {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  line-height: 1.35;
}

.ccard-lineage {
  color: var(--warn);
  margin-top: 2px;
}

.ccard-stats {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.ccard-stat-lab {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--muted);
  margin-bottom: 3px;
}

.ccard-stat-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.ccard-stat-fill {
  height: 100%;
  border-radius: 999px;
}

.ccard-block {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 0 4px;
  position: relative;
  z-index: 1;
}

.ccard-block h3 {
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.ccard-tick {
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: none;
}

.ccard-mood,
.ccard-summary {
  font-size: 0.86rem;
  line-height: 1.45;
  color: #c9d3e0;
  margin-bottom: 8px;
}

.ccard-block.highlight {
  background: rgba(94, 234, 212, 0.05);
  margin: 0 -8px;
  padding: 10px 8px 8px;
  border-radius: 10px;
  border-top: none;
  border: 1px solid rgba(94, 234, 212, 0.12);
}

.ccard-block.fatal {
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.25);
  border-radius: 10px;
  margin: 8px 0;
  padding: 10px;
}

.ccard-block.fatal p {
  font-size: 0.86rem;
  color: #fecdd3;
  line-height: 1.4;
}

.ccard-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.ccard-grid2 em {
  font-style: normal;
  color: var(--faint);
  margin-right: 6px;
}

.ccard-events {
  list-style: none;
  display: grid;
  gap: 5px;
  margin: 6px 0 8px;
}

.ccard-events li {
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: 8px;
  border-left: 3px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: #b8c2d0;
}

.ccard-events li.sev-ok {
  border-left-color: var(--accent);
}

.ccard-events li.sev-warn {
  border-left-color: var(--warn);
}

.ccard-events li.sev-bad,
.ccard-events li.sev-fatal {
  border-left-color: var(--hot);
}

.ccard-env {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--faint);
  line-height: 1.5;
  margin-bottom: 4px;
}

.ccard-env code {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 1px 4px;
  border-radius: 4px;
  margin-right: 3px;
}

.ccard-env code.dmg {
  color: #fda4af;
}

.ccard-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin-bottom: 6px;
}

.ccard-param {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.ccard-param b {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text);
}

.ccard-mode-note {
  font-size: 0.75rem;
  color: var(--faint);
  line-height: 1.4;
}

.ccard-timeline {
  display: grid;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
  margin-bottom: 8px;
}

.ccard-hist {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 42px 44px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 0.7rem;
  line-height: 1.3;
}

.ccard-hist:hover {
  border-color: rgba(94, 234, 212, 0.35);
}

.ccard-hist .ht {
  font-family: var(--mono);
  color: var(--accent);
}

.ccard-hist .hk {
  font-family: var(--mono);
  color: var(--faint);
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  padding-top: 1px;
}

.ccard-hist .hs {
  color: var(--muted);
}

.ccard-mem {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--faint);
  line-height: 1.4;
}

.ccard-mem code {
  color: var(--muted);
}

.ccard-step-detail {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(124, 156, 255, 0.35);
  background: rgba(124, 156, 255, 0.06);
}

.ccard-step-detail.hidden {
  display: none;
}

.ccard-step-detail h3 {
  font-size: 0.75rem;
  color: var(--accent-2);
  margin-bottom: 6px;
}

.ccard-step-detail p {
  font-size: 0.82rem;
  color: #c2cbd8;
  margin-bottom: 8px;
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .cell-card-host {
    position: fixed;
    top: auto;
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 48vh;
    z-index: 30;
  }
}
