/* ── Bottom sheet (selected body / full system data) ── */

.reveal-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 12;
  max-height: 42%;
  display: flex;
  flex-direction: column;
  background: rgba(8, 14, 26, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px 14px 0 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(110%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}
.reveal-sheet.open { transform: translateY(0); }
.reveal-sheet::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.sheet-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sheet-scroll {
  overflow-y: auto;
  min-height: 0;
  margin-top: 8px;
  padding-right: 30px; /* clear the close button */
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.sheet-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.body-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.sheet-name {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.sheet-kind {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.sheet-flavor {
  margin-top: 8px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.85;
}

/* DCOSMOS-SURFVIEW: procedural surface preview canvas */
.surface-preview-wrap {
  margin: 10px 0 6px;
  text-align: center;
}
.surface-preview-wrap canvas {
  width: 200px;
  height: 200px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: block;
  margin: 0 auto;
}
.surface-preview-label {
  font-family: var(--font-data);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* The sheet shows exactly one of its two content blocks. */
.sheet-body { display: none; }
.reveal-sheet[data-mode="body"] .sheet-body { display: block; }
.reveal-sheet .reveal-data { display: none; }
.reveal-sheet[data-mode="full"] .reveal-data { display: block; }

.reveal-data {
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.reveal-data h3 {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.reveal-data .system-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.reveal-data .system-name {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 600;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}
/* DCOSMOS-FAVSTAR: star toggle on the system data sheet */
.btn-fav-star {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-fav-star:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-fav-star.favorited {
  color: var(--accent);
  border-color: var(--accent);
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}
/* DCOSMOS-SHARECARD: share button next to the fav star */
.btn-share-card {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-share-card:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.reveal-data .system-sentence {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* DCOSMOS-NARRATE: procedural discovery narration (field notes) */
.reveal-data .system-narration {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 14px;
  padding: 6px 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.06);
  opacity: 0;
  animation: narrationFadeIn 0.6s ease 0.5s forwards;
}
@keyframes narrationFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.data-section {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.data-section:last-child { border-bottom: none; }
.data-section h4 {
  font-family: var(--font-data);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.data-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}
.data-label { color: var(--text-dim); }
.data-value { color: var(--text-primary); text-align: right; }
.data-value.candidate {
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}
.data-value.unresolved { color: var(--text-dim); font-style: italic; }
/* DCOSMOS-CIVILIZ: civilization detail styling */
.data-value.civ-detected {
  color: #4ade80;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
}
.civ-section h4 {
  color: #4ade80;
}
.civ-signal {
  font-family: var(--font-data);
  letter-spacing: 1px;
  color: #4ade80;
}

/* DCOSMOS-BIOLAYER: biosignature confidence color coding */
.bio-section h4 {
  color: #34d399;
}
.finding-name.bio-high {
  color: #34d399;
  font-weight: 600;
}
.finding-name.bio-mod {
  color: #fbbf24;
  font-weight: 600;
}
.finding-name.bio-low {
  color: #f87171;
  font-weight: 600;
}
.data-value.bio-high {
  color: #34d399;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
}

/* DCOSMOS-REVISIT: survey progress bar in the reveal data sheet */
.survey-progress-section {
  padding-bottom: 12px;
}
.survey-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.survey-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.survey-progress-info {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-data);
  font-size: 10px;
  margin-bottom: 4px;
}
.survey-pct {
  color: var(--accent);
}
.survey-visits {
  color: var(--text-dim);
}
.survey-badge-full {
  font-family: var(--font-data);
  font-size: 10px;
  color: #4ade80;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.survey-next-unlock {
  font-family: var(--font-data);
  font-size: 9px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
}

/* DCOSMOS-ECOLIFE: ecosystem section in the body sheet */
.eco-section h4 { color: #a3e635; }
.eco-chain {
  font-family: var(--font-data);
  font-size: 10px;
  color: #a3e635;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  opacity: 0.85;
}
.eco-organism {
  margin-bottom: 5px;
  padding-left: 6px;
  border-left: 2px solid rgba(163, 230, 53, 0.15);
}
.eco-name {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
}
.eco-dominant { color: #a3e635; }
.eco-badge {
  font-family: var(--font-data);
  font-size: 8px;
  letter-spacing: 1px;
  color: #a3e635;
  margin-left: 6px;
  vertical-align: middle;
}
.eco-role {
  font-family: var(--font-data);
  font-size: 9px;
  color: var(--text-dim);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.eco-desc {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.reveal-actions {
  margin: 16px auto 32px;
  display: flex;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s, transform 0.5s;
}
.reveal-actions.visible {
  opacity: 1;
  transform: translateY(0);
}

.unresolved-list {
  margin-top: 4px;
  padding-left: 0;
  list-style: none;
}
.unresolved-list li {
  font-size: 9px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 2px;
}
.unresolved-list li::before {
  content: "? ";
  color: var(--accent-dim);
}

/* Desktop: the sheet is a fixed-width card, bottom-right of the stage. */
@media (min-width: 721px) {
  .reveal-sheet {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 320px;
    max-height: 72%;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 12px 16px 14px;
    transform: translateY(14px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.05);
  }
  .reveal-sheet.open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .reveal-sheet::before { display: none; }
}
/* Mobile: full-bleed canvas — viewport minus header minus the action bar.
   --header-h is kept current by app.js on resize. Short screens count as
   mobile too, so a phone rotated to landscape stays full-bleed instead of
   falling into the desktop letterbox. */
@media (max-width: 720px), (max-height: 500px) {
  .reveal-canvas,
  .reveal-overlay {
    border-radius: 0;
  }
  .reveal-actions {
    width: 100%;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(8, 14, 26, 0.9);
    border-top: 1px solid var(--border);
  }
  .reveal-actions button {
    flex: 1;
    padding: 11px 0;
  }
}
/* ── DCOSMOS-ANOMALY: investigate button + badge ── */
.btn-investigate {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 10px;
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-investigate:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent);
}
.anomaly-inv-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  font-family: var(--font-data);
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 3px;
}
.anomaly-inv-finding {
  margin-top: 3px;
  font-family: var(--font-data);
  font-size: 10px;
  font-style: italic;
  color: var(--text-secondary);
  opacity: 0.85;
}
