/* DCOSMOS-CODEX: collection codex */
.codex-sub-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.codex-sub-title {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.codex-sub-progress {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-data);
}
.codex-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.codex-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
}
.codex-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}
.codex-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.codex-cell.codex-discovered {
  border-color: var(--border-light);
}
.codex-cell.codex-undiscovered {
  opacity: 0.5;
}
.codex-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.codex-icon-locked {
  background: var(--text-dim);
  opacity: 0.3;
}
.codex-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-data);
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
}
.codex-label-locked {
  color: var(--text-dim);
  font-size: 14px;
}
.codex-count {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-data);
}
.codex-dev-hint {
  color: var(--accent-dim);
  font-style: italic;
}
.codex-completion {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.codex-completion-pct {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-data);
}
.codex-completion-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dev-intro { text-align: center; margin-bottom: 14px; }
.dev-intro p { color: var(--text-dim); font-size: 13px; max-width: 560px; margin: 6px auto 0; }

.dev-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}
.dev-controls label {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.4px;
}
.dev-controls select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  max-width: 78vw;
}
.dev-controls select:focus { outline: none; border-color: var(--accent); }

.dev-stage {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  height: min(62vh, 620px);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #020408;
}
#devCanvas { width: 100%; height: 100%; display: block; touch-action: none; }

/* One-handed phone reality: the stage keeps a workable height and the
   dropdown stays reachable (mobile is the primary surface). */
@media (max-width: 720px), (max-height: 500px) {
  .dev-stage { height: min(56vh, 480px); border-radius: 10px; }
  .dev-controls { flex-wrap: wrap; }
}

/* On a phone the header stays one row: the galaxy button on the left,
   the other buttons on the right. The mobile map height reads --header-h
   at runtime, so the header height is accounted for automatically. */
@media (max-width: 480px) {
  header { padding: 8px 62px 8px 10px; }
  header nav { gap: 6px; }
  header nav button { padding: 4px 8px; font-size: 10.5px; letter-spacing: 0.3px; }
}

/* ── Atlas galaxy button (DCOSMOS-HOMESCREEN) ──────────────────── */
/* The home button: anchored to the left edge of the header, larger than
   every other control, always visible and glowing. margin-right pushes
   the rest of the nav to the right side. */
header nav .nav-atlas {
  width: 84px;
  height: 84px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-dim, rgba(245, 158, 11, 0.45));
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.22);
  animation: atlasBreathe 4.5s ease-in-out infinite;
  flex-shrink: 0;
  margin-right: 10px;
}
header nav .nav-atlas svg { width: 44px; height: 44px; }
header nav .nav-atlas { position: relative; }
.atlas-mode-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-panel, #0d1526);
  border: 1px solid var(--accent-dim, rgba(245, 158, 11, 0.45));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.atlas-mode-badge[hidden] { display: none; }
header nav .nav-atlas:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.4);
}
header nav .nav-atlas.active {
  background: var(--accent-glow, rgba(245, 158, 11, 0.12));
  border-color: var(--accent);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.35);
}
header nav .nav-atlas svg { display: block; }
@keyframes atlasBreathe {
  0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.16); }
  50% { box-shadow: 0 0 22px rgba(245, 158, 11, 0.36); }
}
@media (max-width: 480px) {
  header nav .nav-atlas { width: 64px; height: 64px; }
  header nav .nav-atlas svg { width: 34px; height: 34px; }
}

/* ── Round nav buttons (Lab, Survey, Dev) ──────────────────────── */
header nav .nav-round {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
header nav .nav-round:hover {
  color: var(--text-secondary);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}
header nav .nav-round.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}
header nav .nav-round svg { display: block; width: 28px; height: 28px; }
@media (max-width: 480px) {
  header nav .nav-round { width: 48px; height: 48px; }
  header nav .nav-round svg { width: 24px; height: 24px; }
}

/* ── Survey Scan (DCOSMOS-SURVEYSCAN) ──────────────────────────── */
/* The SCAN toggle sits beneath the DATA button; findings list in the
   body sheet reads as banked knowledge. */
/* .btn-body-scan lives with the other canvas controls in cosmos-reveal.css */
.finding-row { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.finding-row:last-child { border-bottom: none; }
.finding-name { color: var(--accent); font-size: 12.5px; letter-spacing: 0.3px; }
.finding-name.undiscovered { color: var(--text-dim); }
.finding-blurb { color: var(--text-dim); font-size: 11.5px; line-height: 1.45; margin-top: 2px; font-style: italic; }
.finding-name.civ { color: #5ec4c4; }

/* ── DCOSMOS-PLANETNAME: the naming card + designation styling ─────────── */
/* A small centered card floating over the reveal canvas — in-app, calm,
   one input and two honest buttons. Never window.prompt. */
.name-sheet {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  z-index: 60;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  width: min(320px, calc(100% - 48px));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}
.name-sheet[hidden] { display: none; }
.name-sheet-title {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.name-sheet input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(10, 14, 24, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  padding: 9px 10px;
  outline: none;
}
.name-sheet input:focus { border-color: var(--accent); }
.name-sheet-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.name-sheet-row button { padding: 7px 14px; font-size: 13px; }

/* The body sheet's naming affordance and the formal designation line
   shown beneath a player-given name (DCOSMOS-ROMANNUM keeps it in sight). */
.sheet-desig {
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.6px;
  margin: -2px 0 6px 0;
}
.btn-name-world {
  display: inline-block;
  margin: 2px 0 10px 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}
.btn-name-world:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ── DCOSMOS-TORCH: the flashlight button in the scanner viewfinder ────── */
.scanner-torch {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(4, 8, 16, 0.62);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.scanner-torch.on {
  background: rgba(245, 158, 11, 0.85);
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.55);
}
.scanner-torch[hidden] { display: none; }

/* ── Surveyor naming card (DCOSMOS-SURVEYORS) ──────── */
.surveyor-card {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}
.surveyor-card[hidden] { display: none; }
.surveyor-card-inner {
  background: var(--bg-panel);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 28px 24px 20px;
  width: min(320px, 90vw);
  text-align: center;
}
.surveyor-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 16px;
}
#surveyorInput {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-data);
  font-size: 14px;
  padding: 8px 10px;
  text-align: center;
  margin-bottom: 12px;
}
#surveyorInput:focus { border-color: var(--accent); outline: none; }
.surveyor-actions {
  display: flex;
  gap: 8px;
}
.surveyor-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 4px;
  font-family: var(--font-data);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
}
#surveyorGo {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
  font-weight: 600;
}
.surveyor-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.surveyor-profile[hidden] { display: none; }
.surveyor-profile-name {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  white-space: nowrap;
}
.surveyor-profile-tally {
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--text-dim);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.surveyor-profile-edit {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.5;
}

