/* ── 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;
  /* Owner 2026-09-03: same size as the journal's close button
     (cosmos-journal.css .journal-close) now that the minimize button is gone. */
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 28px;
  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-left: 30px; padding-right: 30px; /* balanced to keep content centered under the absolute-positioned close/minimize buttons */
  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;
  flex-shrink: 0;
}
/* The plain color dot (still used for belt/kuiper rows, no icon-language
   shape approved for those yet) keeps its round ring; an icon-language svg
   swatch (star/asteroid/comet/moon/planet) draws its own outline already,
   so a square border around it would look wrong. */
span.body-swatch {
  border-radius: 50%;
  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;
}
/* The recovered log block renders upright: its damage glyphs
   (block and shade characters) come from a fallback face with no
   italic, and a synthesized oblique leans them against the letters
   around them. */
.sheet-flavor.sheet-log {
  font-style: normal;
}
/* The wreck panel's collapsible sections (Ship's log, Description): the
   same details/summary fold the surface preview uses, closed by default,
   the summary in the sheet's small uppercase label voice. */
.sheet-fold {
  margin: 8px 0 4px;
}
.sheet-fold > summary {
  cursor: pointer;
  padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  user-select: none;
}
.sheet-fold > summary::marker {
  color: var(--text-dim);
}
.sheet-fold > .sheet-flavor {
  margin-top: 4px;
}
.sheet-log-icon {
  vertical-align: -3px;
  margin-right: 5px;
}
/* A log a scan has just recovered and nobody has opened yet: the closed
   summary wears an accent border and a steady glow (no animation, nothing
   blinks). Opening the fold ends it -- js/reveal-pane.js drops the class. */
.sheet-fold.sheet-log-new:not([open]) > summary {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.45);
}
/* DCOSMOS-SURFFOLD (owner ask, long overdue): the surface view folds
   behind a small picture-frame button so the stats above it sit high on
   the card. Folded is the default -- the panel's height collapses to
   zero, its canvas stays unpainted until the button opens it, and the
   0.2s ease glide (no bounce) is the whole fold/unfold animation. */
.surface-fold {
  margin: 8px 0 4px;
}
.btn-surface-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s;
}
.btn-surface-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.surface-fold-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.surface-fold.open .surface-fold-panel {
  max-height: 280px;
}
/* DCOSMOS-SURFVIEW: procedural surface preview canvas, inside the fold panel above */
.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 {
  /* Shared nameplate voice with the galaxy title and the cluster-view
     names (js/galaxymap-nameplate.js, DESIGN_DECISIONS.md nameplate
     ruling) so the name reads in one continuous typeface crossing cluster
     -> galaxy -> system: the map's own DATA_FONT, uppercase, the same
     0.5em hand letter-spacing ratio the canvas surfaces draw by hand, and
     normal weight (canvas fillText carries no weight token). Only the
     typography changed here -- the text itself, its color, and its glow
     are unchanged from before this ruling. */
  font-family: var(--font-data);
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}
/* The whole-system quick reference card (owner spec 2026-09-01): name,
   descriptor, three buttons, divider, star row, planet strip, dwarf row,
   all centered. */
.reveal-data .system-card {
  text-align: center;
}
.reveal-data .system-card .system-name-row {
  justify-content: center;
}
.reveal-data .system-descriptor {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.reveal-data .system-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
/* The three buttons share one box: 30px square, the same border and
   hover as the old favorite star button. The share button keeps its own
   chain-link markup (assets/code-popover.js); its class rule below lines
   its box up with the other two. */
.system-card-btn,
.reveal-data .system-buttons .code-link-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.system-card-btn:hover,
.reveal-data .system-buttons .code-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.system-card-btn svg {
  display: block;
  width: 18px;
  height: 18px;
  overflow: visible;
}
/* The favorite ribbon: an outline until the system is a favorite, then
   filled in the accent color. */
.btn-fav-star.favorited {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-fav-star.favorited .fav-ribbon-icon path {
  fill: currentColor;
}
.reveal-data .system-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0 10px;
}
.reveal-data .system-stars,
.reveal-data .system-dwarfs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
/* The planet strip: a contained band behind the planet dots. */
.reveal-data .system-planets {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}
/* One icon button per body. The button itself draws nothing; the icon
   inside it is the whole mark. */
.panel-body-icon {
  background: none;
  border: none;
  padding: 3px;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.panel-body-icon svg {
  display: block;
  overflow: visible;
}
.panel-star-icon { width: 26px; height: 26px; }
.panel-planet-icon { width: 18px; height: 18px; border-radius: 50%; }
.panel-dwarf-icon { width: 12px; height: 12px; border-radius: 50%; }
/* The habitable-candidate ring: a box-shadow ring outside the icon, so it
   changes no spacing or centering wherever the icon appears (this strip
   and the body card). Never drawn on the 3D model. */
.hab-ring {
  border-radius: 50%;
  box-shadow: 0 0 0 2px #34d399;
}
/* The body card above a tapped icon (js/panel-body-taps.js): the hover
   tooltip's own look, fading out over the camera's glide home. */
.panel-body-card.fading {
  opacity: 0;
  transition: opacity 0.7s ease;
}
.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;
}
/* Plain civilization facts a scan reveals for an authored inhabited world */
.civ-note {
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.35;
}
/* 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);
}
/* 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;
}
