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

html {
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0e1a;
  color: #e0e6ed;
  overflow: hidden;
  overflow-x: hidden;
}

#app {
  width: 100vw;
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

/* Intro Screen */
.intro-screen {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.intro-background {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  z-index: 0;
}

.intro-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 42%), radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.35) 100%);
  z-index: 1;
}

.intro-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: auto;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.45) 55%, transparent 100%);
}

.intro-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 12px 12px 8px;
  width: min(720px, 100%);
  pointer-events: auto;
}

.intro-title {
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: 0.35em;
  color: #e0e6ed;
  text-shadow: 0 0 16px rgba(74, 144, 226, 0.45);
  margin: 0 0 4px;
  opacity: 0.95;
}

/* Narration Caption - Reusable comic-book style */
.narration-caption {
  background: rgba(232, 180, 76, 0.94);
  color: #2d1f0f;
  padding: 12px 16px 14px;
  border-radius: 8px;
  border: 2px solid #b8873c;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  width: 100%;
  max-width: 720px;
  animation: fadeIn 0.4s ease;
}

.narration-text {
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  line-height: 1.45;
  font-weight: 500;
  text-align: center;
}

.narration-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.narration-btn {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid #b8873c;
  background: rgba(232, 180, 76, 0.3);
  color: #2d1f0f;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.narration-btn:hover {
  background: rgba(232, 180, 76, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(232, 180, 76, 0.4);
}

.narration-btn.secondary {
  background: rgba(45, 31, 15, 0.15);
  color: #3d2817;
}

.narration-btn.secondary:hover {
  background: rgba(45, 31, 15, 0.3);
  box-shadow: 0 4px 12px rgba(45, 31, 15, 0.3);
}

/* Intro-specific positioning */
.intro-text {
  position: absolute;
  bottom: 20vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 700px;
}

.intro-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

/* Cage Screen */
.cage-screen {
  width: 100%;
  height: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  background: linear-gradient(180deg, #0a0e1a 0%, #0d1117 100%);
  animation: fadeIn 0.4s ease;
  overflow-x: hidden;
}

.cage-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 4px;
  color: #6ab0f2;
  text-shadow: 0 0 12px rgba(74, 144, 226, 0.4);
}

.cage-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  max-width: 800px;
}

.cage-cell {
  aspect-ratio: 1;
  border: 2px solid #1a1f26;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
}

.cage-cell.unlocked {
  border-color: #4a90e2;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.2);
}

.cage-cell.unlocked:hover {
  background: #1a2a3a;
  border-color: #6ab0f2;
  box-shadow: 0 0 16px rgba(106, 176, 242, 0.4);
  transform: translateY(-2px);
}

.cage-cell.locked {
  opacity: 0.6;
}

.cell-number {
  font-size: 24px;
  font-weight: 700;
}

.cell-status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
}

.cage-cell.unlocked .cell-status {
  color: #4a90e2;
}

.cell-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.cell-portrait.locked-portrait {
  filter: grayscale(100%) opacity(0.4);
}

.lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  opacity: 0.6;
  z-index: 1;
}

/* Lab View */
.lab-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: linear-gradient(180deg, #0d1117 0%, #0a0e1a 100%);
  overflow: hidden;
  overflow-x: hidden;
}

.lab-title {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 3px;
  margin-bottom: 30px;
  color: #6ab0f2;
  text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.lab-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  animation: fadeIn 0.4s ease;
  overflow-y: auto;
  gap: 15px;
}

/* Stats Panel */
.stats-panel {
  width: 220px;
  background: #0d1117;
  border-right: 1px solid #222;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.stats-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 10px;
  color: #4a90e2;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-name {
  width: 100px;
  font-size: 13px;
  text-transform: capitalize;
  color: #999;
}

.stat-bar {
  flex: 1;
  height: 8px;
  background: #1a1f26;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90e2, #6ab0f2);
  transition: width 0.5s ease;
}

.stat-value {
  width: 35px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #4a90e2;
}

/* Serum Selection */
.serum-selection {
  width: 100%;
  max-width: 900px;
}

.selection-title {
  font-size: 18px;
  margin-bottom: 15px;
  text-align: center;
  color: #6ab0f2;
}

.serum-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.serum-option {
  border: 2px solid #333;
  background: #0d1117;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s;
}

.serum-option.unlocked {
  border-color: #4a90e2;
}

.serum-option.unlocked:hover {
  border-color: #6ab0f2;
  background: #111822;
}

.serum-option.locked {
  opacity: 0.3;
}

.serum-name {
  font-size: 18px;
  font-weight: 600;
  color: #6ab0f2;
}

.serum-fragments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fragment {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fragment.clade-A {
  background: #8b3a3a;
  color: #ffb3b3;
}

.fragment.clade-B {
  background: #3a598b;
  color: #b3d4ff;
}

.fragment.clade-C {
  background: #3a8b5e;
  color: #b3ffd4;
}

.serum-stats {
  font-size: 12px;
  color: #999;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.serum-inject {
  margin-top: 8px;
  padding: 10px 20px;
  background: #4a90e2;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.serum-inject:hover {
  background: #6ab0f2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.serum-locked-msg {
  padding: 20px;
  text-align: center;
  color: #666;
}

/* Injection Wait */
.injection-wait {
  font-size: 24px;
  color: #6ab0f2;
  animation: pulse 1.5s ease infinite;
}

/* Morph Reveal */
.morph-reveal {
  position: relative;
  width: 400px;
  height: 400px;
  margin-bottom: 30px;
}

.reveal-visual {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reveal-visual.active {
  opacity: 1;
}

/* Asset Placeholder */
.asset-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1f26 0%, #2a2f36 100%);
  border: 2px dashed #444;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-label {
  text-align: center;
  color: #666;
  font-family: monospace;
}

.placeholder-hash {
  font-size: 14px;
  margin-bottom: 8px;
  color: #888;
}

.placeholder-beat {
  font-size: 12px;
  color: #666;
}

.placeholder-type {
  font-size: 10px;
  color: #555;
  margin-top: 4px;
  text-transform: uppercase;
}

.asset-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Continue Button */
.continue-btn {
  padding: 12px 40px;
  background: #4a90e2;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.continue-btn:hover {
  background: #6ab0f2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* Breeding Screen */
.breeding-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.breeding-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 2px;
}

.breeding-chamber {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.breeding-msg {
  font-size: 18px;
  color: #999;
}

.breeding-proceed {
  padding: 12px 40px;
  background: #4a90e2;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
}

.breeding-proceed:hover {
  background: #6ab0f2;
}

/* Offspring Screen */
.offspring-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.offspring-title {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 2px;
}

.ending-creature {
  width: 300px;
  height: 300px;
}

/* Montage Screen */
.montage-screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 50px;
  background: linear-gradient(180deg, #0a0e1a 0%, #1a1e2a 100%);
}

.montage-title {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 3px;
}

.montage-sequence {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.montage-beat {
  font-size: 20px;
  color: #6ab0f2;
  text-align: center;
  opacity: 0;
  animation: fadeInSeq 1s ease forwards;
}

.montage-beat:nth-child(1) {
  animation-delay: 0.5s;
}

.montage-beat:nth-child(2) {
  animation-delay: 1.5s;
}

.montage-beat:nth-child(3) {
  animation-delay: 2.5s;
}

/* Ending Screen */
.ending-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 2s ease;
  position: relative;
}

.ending-screen.night {
  background: #050810;
}

.ending-screen.black {
  background: #000;
}

.ending-lab {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 1s ease;
}

.ending-screen.looking-up .ending-lab {
  transform: translateY(-30px);
}

.ending-text {
  font-size: 24px;
  text-align: center;
  max-width: 600px;
  line-height: 1.8;
  padding: 0 20px;
  animation: fadeIn 1.5s ease;
  font-style: italic;
  color: #888;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInSeq {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Creature Display */
.creature-display {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 55vh;
  border: 2px solid #333;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.creature-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.creature-image.breathing {
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.015);
  }
}

.cage-bars-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/generated/overlay_cage_bars.png');
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Injection Sequence */
.injection-sequence {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 55vh;
  border: 2px solid #333;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.injection-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.skip-sequence {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background: rgba(74, 144, 226, 0.8);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.skip-sequence:hover {
  background: rgba(106, 176, 242, 0.9);
}

/* Cinema Mode - Full viewport transformation layer */
.cinema-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.cinema-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cinema-bars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/generated/overlay_cage_bars.png');
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Sound Toggle */
.sound-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(13, 17, 23, 0.8);
  border: 2px solid #4a90e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s;
  font-size: 18px;
}

.sound-toggle:hover {
  background: rgba(74, 144, 226, 0.3);
  border-color: #6ab0f2;
  transform: scale(1.1);
}

.sound-toggle.muted {
  border-color: #666;
  opacity: 0.6;
}

/* Cell Portrait */
.cell-portrait {
  width: 80%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Trait Card Selection */
.trait-selection {
  width: 100%;
  max-width: 1000px;
  flex-shrink: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.selection-prompt {
  text-align: center;
  font-size: 14px;
  color: #999;
  margin-bottom: 12px;
}

.stability-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #333;
}

.stability-label {
  font-size: 14px;
  font-weight: 600;
  color: #6ab0f2;
  min-width: 80px;
}

.stability-bar {
  flex: 1;
  height: 12px;
  background: #1a1f26;
  border-radius: 6px;
  overflow: hidden;
}

.stability-fill {
  height: 100%;
  background: linear-gradient(90deg, #e24a4a, #f2a94a, #4a90e2);
  transition: width 0.5s ease;
}

.stability-bar-fill {
  background: linear-gradient(90deg, #e24a4a, #f2a94a, #4a90e2) !important;
}

.stability-value {
  min-width: 40px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: #6ab0f2;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 5px;
  flex: 1;
  min-height: 0;
}

.trait-card {
  border: 2px solid #333;
  background: #0d1117;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s;
  position: relative;
  font-size: 12px;
}

.trait-card.unlocked {
  border-color: #4a90e2;
  cursor: pointer;
}

.trait-card.unlocked:hover {
  border-color: #6ab0f2;
  background: #111822;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.trait-card.locked {
  opacity: 0.4;
  filter: grayscale(70%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.card-name {
  font-size: 13px;
  font-weight: 600;
  color: #6ab0f2;
}

.card-cost {
  font-size: 11px;
  color: #f2a94a;
  background: rgba(242, 169, 74, 0.1);
  padding: 2px 6px;
  border-radius: 2px;
}

.card-flavor {
  font-size: 10px;
  color: #999;
  line-height: 1.3;
  font-style: italic;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.stat-badge {
  padding: 2px 6px;
  font-size: 9px;
  border-radius: 2px;
  background: rgba(74, 144, 226, 0.15);
  font-weight: 600;
}

.card-select {
  margin-top: 6px;
  padding: 6px 12px;
  background: #4a90e2;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.card-select:hover {
  background: #6ab0f2;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.trait-card.locked .lock-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  opacity: 0.3;
  z-index: 1;
}

.integration-message {
  text-align: center;
  font-size: 18px;
  color: #6ab0f2;
  margin-top: 20px;
  padding: 15px;
  background: rgba(74, 144, 226, 0.1);
  border: 1px solid #4a90e2;
}

.pulse-effect {
  animation: pulse-once 0.6s ease;
}

@keyframes pulse-once {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.05);
    filter: brightness(1.3);
  }
}

.stability-warning {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  25% { transform: translate(-50%, -50%) translateX(-10px); }
  75% { transform: translate(-50%, -50%) translateX(10px); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .cage-screen {
    padding: 20px;
    gap: 25px;
  }

  .cage-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .trait-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }

  .serum-grid {
    grid-template-columns: 1fr;
  }

  .intro-title {
    font-size: 48px;
    letter-spacing: 8px;
  }

  .narration-caption {
    padding: 18px 24px;
    max-width: 90%;
  }

  .narration-text {
    font-size: 1.1rem;
  }

  .intro-text {
    bottom: 15vh;
    width: 95%;
  }

  .creature-display {
    height: 45vh;
  }
}

@media (max-width: 480px) {
  .cage-screen {
    padding: 15px;
    gap: 20px;
  }

  .cage-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .trait-grid {
    grid-template-columns: 1fr;
  }

  .intro-title {
    font-size: 36px;
    letter-spacing: 6px;
  }

  .intro-content {
    padding: 20px;
    gap: 20px;
  }
}

/* —— Feral mind / enclosure scroll (staging) —— */
.cage-sub { color: #8aa; font-size: 0.95rem; margin: 0 0 1rem; text-align: center; }
.mind-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at center, #121820 0%, #0a0e1a 70%);
}
.mind-stage {
  display: grid;
  grid-template-columns: minmax(180px, 320px) minmax(240px, 420px);
  gap: 1.5rem;
  align-items: center;
  max-width: 900px;
  width: 100%;
}
@media (max-width: 700px) {
  .mind-stage { grid-template-columns: 1fr; }
}
.mind-portrait {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(74, 144, 226, 0.25);
  border: 1px solid rgba(106, 176, 242, 0.3);
}
.mind-scroll {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(74, 144, 226, 0.35);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  min-height: 240px;
}
.mind-speech {
  font-size: 1.25rem;
  color: #e8eef7;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.mind-thoughts {
  font-style: italic;
  color: #7a8a9a;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.mind-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.mind-chip {
  background: #1a2332;
  color: #cde;
  border: 1px solid #4a90e2;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.mind-chip:hover:not(:disabled) {
  background: #243044;
  box-shadow: 0 0 12px rgba(74, 144, 226, 0.4);
}
.mind-chip:disabled { opacity: 0.45; cursor: default; }
.mind-reaction {
  color: #b8c8d8;
  margin: 0.75rem 0;
  line-height: 1.45;
}
.mind-hint {
  margin-top: 1.25rem;
  font-size: 0.75rem;
  color: #556;
  letter-spacing: 0.04em;
}
.ending-sub {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #556;
}
.ending-creature {
  max-width: min(360px, 80vw);
  border-radius: 12px;
}


/* —— Mind readiness badge (all screens) —— */
.mind-status-badge {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10050;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #d8e4f0;
  background: rgba(10, 14, 26, 0.88);
  border: 1px solid rgba(74, 144, 226, 0.45);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.mind-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #888;
}
.mind-status-ready .mind-status-dot { background: #3ecf8e; box-shadow: 0 0 8px #3ecf8e; }
.mind-status-cold .mind-status-dot,
.mind-status-warming .mind-status-dot { background: #f0b429; animation: mindPulse 1.2s ease infinite; }
.mind-status-unhealthy .mind-status-dot,
.mind-status-unreachable .mind-status-dot { background: #e24a4a; }
.mind-status-unknown .mind-status-dot { background: #667; }
@keyframes mindPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.mind-wait-note {
  font-size: 0.85rem;
  color: #9ab;
  margin: 0.5rem 0 0.75rem;
}


/* —— Single-page trait board —— */
html, body, #app { height: 100%; overflow: hidden; }
.lab-view.lab-compact {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}
.lab-view.lab-compact .lab-title { font-size: 1rem; margin: 0 0 6px; flex: 0 0 auto; }
.lab-workspace.lab-workspace-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.trait-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.trait-board-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.trait-board-head h2 { margin: 0; font-size: 1.05rem; color: #dce7f5; }
.trait-board-sub { margin: 0; font-size: 0.8rem; color: #8aa; width: 100%; }
.trait-board-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}
.trait-cat {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid rgba(74, 144, 226, 0.28);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.trait-cat-name {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6ab0f2;
  font-weight: 700;
}
.trait-options { display: flex; flex-direction: column; gap: 4px; }
.trait-opt {
  text-align: left;
  border: 1px solid #334;
  background: #151b26;
  color: #cde;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  line-height: 1.25;
}
.trait-opt:hover { border-color: #4a90e2; }
.trait-opt.selected {
  border-color: #e8b44c;
  background: rgba(232, 180, 76, 0.15);
  box-shadow: 0 0 0 1px rgba(232, 180, 76, 0.35);
}
.trait-opt .opt-name { font-weight: 600; display: block; }
.trait-opt .opt-meta { opacity: 0.75; font-size: 0.7rem; }
.trait-board-foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(74,144,226,0.2);
}
.trait-progress { font-size: 0.85rem; color: #9ab; flex: 1 1 auto; }
.btn-roll {
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid #e8b44c;
  background: linear-gradient(180deg, #f0c45a, #c9922e);
  color: #2d1f0f;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-size: 0.95rem;
}
.btn-roll:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.btn-roll:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(232,180,76,0.35); }
.lab-compact .stats-panel { display: none; }
.cinema-layer {
  position: fixed; inset: 0; z-index: 20000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.cinema-layer .cinema-video {
  width: 100%; height: 100%; object-fit: cover;
}
.cinema-caption {
  position: absolute; bottom: 10%; left: 50%; transform: translateX(-50%);
  color: #e8eef7; background: rgba(0,0,0,0.55); padding: 8px 14px;
  border-radius: 8px; font-size: 0.9rem; max-width: 90%; text-align: center;
}
@media (max-height: 700px) {
  .trait-board-body { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .trait-opt { padding: 5px 6px; font-size: 0.72rem; }
}


/* —— Cascaded create board + sliders + birth —— */
.create-board { padding: 8px; height: 100%; box-sizing: border-box; overflow: hidden; }
.create-layout {
  display: grid;
  grid-template-columns: minmax(120px, 28%) 1fr;
  gap: 10px;
  height: 100%;
  min-height: 0;
}
.create-preview {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 0;
}
.create-preview-img {
  width: 100%; max-height: 42vh; object-fit: contain; border-radius: 12px;
  border: 1px solid rgba(74,144,226,0.35); background: #0a0e14;
}
.create-preview-cap { font-size: 0.75rem; color: #8ab; text-transform: capitalize; }
.create-preview-note { font-size: 0.7rem; color: #667; text-align: center; margin: 0; padding: 0 4px; }
.create-main {
  display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden;
}
.create-head { flex: 0 0 auto; }
.create-head h2 { margin: 0 0 4px; font-size: 1.05rem; color: #e8eef7; }
.cascade-rail {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.cascade-step {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 999px; font-size: 0.68rem;
  border: 1px solid #334; color: #889; background: #121820; cursor: default;
}
.cascade-step span { max-width: 4.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cascade-step.active {
  border-color: #4a90e2; color: #dcefff; background: rgba(74,144,226,0.15);
  box-shadow: 0 0 0 1px rgba(74,144,226,0.35);
}
.cascade-step.done { border-color: #3ecf8e; color: #bff5d8; cursor: pointer; }
.cascade-step.locked { opacity: 0.4; }
.cascade-panel {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  background: rgba(13,17,23,0.9); border: 1px solid rgba(74,144,226,0.25);
  border-radius: 10px; padding: 10px;
}
.cascade-options { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.slider-panel {
  flex: 0 0 auto;
  background: rgba(13,17,23,0.85); border: 1px solid rgba(232,180,76,0.25);
  border-radius: 10px; padding: 8px 10px;
}
.slider-row {
  display: grid; grid-template-columns: 7.5rem 1fr 2rem; gap: 8px; align-items: center;
  font-size: 0.75rem; color: #bcd; margin: 4px 0;
}
.slider-row input[type=range] { width: 100%; }
.slider-row b { font-size: 0.72rem; color: #e8b44c; text-align: right; }
.birth-screen {
  min-height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 16px; box-sizing: border-box;
  background: radial-gradient(ellipse at center, #152030 0%, #0a0e1a 70%);
}
.birth-img {
  max-width: min(360px, 80vw); max-height: 38vh; border-radius: 12px;
  border: 1px solid rgba(232,180,76,0.4); box-shadow: 0 0 40px rgba(232,180,76,0.15);
}
.birth-card {
  max-width: 520px; text-align: center; background: rgba(13,17,23,0.92);
  border: 1px solid rgba(232,180,76,0.35); border-radius: 12px; padding: 16px 18px;
}
.birth-kicker { font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: #e8b44c; }
.birth-title { margin: 6px 0; font-size: clamp(1.3rem, 4vw, 1.8rem); color: #f2f6ff; }
.birth-odds { color: #6ab0f2; font-weight: 700; margin: 0 0 8px; }
.birth-line { color: #cde; line-height: 1.45; margin: 0 0 8px; }
.birth-note { font-size: 0.75rem; color: #667; margin: 0 0 12px; }
@media (max-width: 720px) {
  .create-layout { grid-template-columns: 1fr; }
  .create-preview-img { max-height: 22vh; }
  .cascade-step span { display: none; }
}


/* —— Enclosure / aether-glade mind —— */
.encl-screen {
  height: 100%;
  min-height: 100%;
  display: grid;
  grid-template-rows: 1fr auto auto;
  background: #070a10;
  overflow: hidden;
}
.encl-room {
  position: relative;
  min-height: 0;
  background: #0c1018 center/cover no-repeat;
  background-image: linear-gradient(to top, rgba(7,10,16,0.75), rgba(7,10,16,0.15)), var(--room-bg);
  overflow: hidden;
}
.encl-room-shade {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 70%, transparent 0%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}
.encl-ghosts { position: absolute; inset: 0; pointer-events: none; }
.encl-ghost {
  position: absolute;
  left: calc(var(--gx, 20) * 1%);
  top: calc(var(--gy, 30) * 1%);
  width: calc(72px * var(--gs, 1));
  height: calc(72px * var(--gs, 1));
  object-fit: contain;
  border-radius: 50%;
  opacity: 0;
  filter: saturate(0.7) brightness(1.25);
  mix-blend-mode: screen;
  transform: translateY(8px);
  transition: opacity 1.2s ease, transform 1.2s ease, filter 0.4s;
  animation: ghostFloat 4s ease-in-out infinite;
  animation-delay: var(--gd, 0s);
}
.encl-ghost.visible {
  opacity: 0.72;
  transform: translateY(0);
}
.encl-ghost.speaking {
  opacity: 0.95;
  filter: saturate(1) brightness(1.45) drop-shadow(0 0 12px rgba(160,210,255,0.8));
}
@keyframes ghostFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.encl-floor {
  position: absolute; left: 0; right: 0; bottom: 8%;
  height: 40%;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.encl-feral-wrap {
  width: min(28vw, 160px);
  animation: feralPace 6.5s ease-in-out infinite;
}
.encl-feral {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.55));
  border-radius: 8px;
}
@keyframes feralPace {
  0% { transform: translateX(-40px) scaleX(1); }
  45% { transform: translateX(40px) scaleX(1); }
  50% { transform: translateX(40px) scaleX(-1); }
  95% { transform: translateX(-40px) scaleX(-1); }
  100% { transform: translateX(-40px) scaleX(1); }
}
.encl-nameplate {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  font-size: 0.75rem; letter-spacing: 0.06em; color: #cde;
  background: rgba(0,0,0,0.45); padding: 4px 10px; border-radius: 999px;
  max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.encl-scroll {
  background: rgba(10, 14, 22, 0.96);
  border-top: 1px solid rgba(74, 144, 226, 0.3);
  padding: 10px 12px 12px;
  max-height: 42vh;
  overflow: auto;
}
.encl-scroll-label {
  font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: #6ab0f2; margin-bottom: 6px;
}
.encl-speech { font-size: 1.05rem; color: #eef3fa; margin-bottom: 4px; line-height: 1.4; }
.encl-thoughts { font-style: italic; color: #7a8a9a; font-size: 0.9rem; margin-bottom: 8px; }
.encl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
@media (max-width: 600px) {
  .encl-feral-wrap { width: min(36vw, 120px); }
  .encl-ghost { width: 56px; height: 56px; }
  .encl-scroll { max-height: 48vh; }
}
