:root {
  --bg: #0b1020;
  --panel: #0f162d;
  --panel2: #0b1226;
  --border: #233055;
  --text: #e6e9f2;
  --muted: #9aa6c3;
  --blue: #3b82f6;
  --blue2: #1d4ed8;
  --red: #ef4444;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: black;
  color: var(--text);
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: #000;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  pointer-events: none; /* Let clicks pass through to map */
}

.main {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  padding: 12px;
  overflow: hidden;
  pointer-events: none;
}

.panel.right {
  width: 360px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: auto; /* Re-enable clicks for chat */
}
.panel.right.hidden {
  transform: none;
  opacity: 1;
  pointer-events: auto;
  width: 40px;
  border: 0;
  background: transparent;
  overflow: visible;
}
.panel.right.hidden .panel-title,
.panel.right.hidden #openDocs,
.panel.right.hidden #chat,
.panel.right.hidden .composer {
  display: none;
}
.panel.right.hidden .panel-header {
  padding: 0;
  border-bottom: 0;
  background: transparent;
  justify-content: flex-end;
}
.panel.right.hidden .panel-header-actions {
  gap: 0;
}
.panel.right.hidden #toggleChat {
  width: 36px;
  height: 36px;
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 1200;
  display: inline-flex;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 14px;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-title { font-weight: 800; }
.panel-header-actions { display: inline-flex; align-items: center; gap: 8px; }
.panel-meta { font-size: 12px; color: var(--muted); }
.panel-body { padding: 12px; }
.panel-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.chat {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 900px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}
.msg.user {
  align-self: flex-end;
  border-color: rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.12);
}
.msg.assistant {
  align-self: flex-start;
  border-color: rgba(255, 255, 255, 0.1);
  background: transparent;
}
.msg .role { font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; }
.msg .text { white-space: pre-wrap; line-height: 1.35; }
.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.quick-option {
  border: 1px solid rgba(147, 197, 253, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: var(--text);
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.quick-option:hover { background: rgba(59, 130, 246, 0.20); }
.quick-option:active { transform: scale(0.98); }
.quick-option:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }

.composer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 8px;
}

.textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
.textarea:focus { border-color: rgba(59,130,246,0.7); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

.input {
  width: 280px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}

.btn {
  border: 1px solid rgba(59,130,246,0.4);
  background: linear-gradient(180deg, rgba(59,130,246,0.95), rgba(29,78,216,0.95));
  color: white;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary {
  border: 1px solid var(--border);
  background: rgba(33, 38, 45, 0.65);
  color: var(--text);
}
.btn-compact {
  padding: 7px 10px;
  border-radius: 10px;
  font-weight: 900;
}
.btn.danger {
  border: 1px solid rgba(239,68,68,0.4);
  background: linear-gradient(180deg, rgba(239,68,68,0.95), rgba(185,28,28,0.95));
}

.composer-actions { display: flex; gap: 8px; justify-content: flex-end; }

.icon-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn:active { transform: scale(0.98); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }

.iss-icon {
  background: transparent;
  border: 0;
}
.iss-chip {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(147, 197, 253, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15), 0 4px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  user-select: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: block;
  pointer-events: auto;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
}
.modal-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  z-index: 1;
}
.modal-title { font-weight: 900; letter-spacing: 0.2px; }
.modal-body {
  flex: 1;
  padding: 14px 14px 18px;
  overflow: auto;
}

.about-shell {
  min-height: calc(100vh - 56px);
  padding: 18px 0 28px;
}
.about-page {
  width: min(1040px, calc(100vw - 24px));
  margin: 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.about-top {
  padding: 16px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.about-top-title {
  font-weight: 950;
  letter-spacing: 0.2px;
  font-size: 18px;
}
.about-top-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.about-inner {
  display: flex;
  gap: 18px;
  padding: 14px 16px 18px;
}
.about-toc {
  width: 230px;
  flex: 0 0 auto;
  position: sticky;
  top: 72px;
  align-self: flex-start;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 14px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.about-toc-title {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.about-toc a {
  display: block;
  color: rgba(230, 233, 242, 0.92);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.about-toc a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}
.about-content {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
  color: var(--text);
}
.about-content h2 {
  margin: 18px 0 10px;
  font-size: 15px;
  letter-spacing: 0.2px;
}
.about-content p { margin: 0 0 10px; color: rgba(230, 233, 242, 0.95); }
.about-content ul { margin: 0 0 10px 18px; padding: 0; }
.about-content li { margin: 6px 0; color: rgba(230, 233, 242, 0.95); }
.about-content hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  margin: 14px 0;
}
.about-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}
.about-callout {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(230, 233, 242, 0.95);
  margin-bottom: 12px;
}
.about-foot {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .about-inner { flex-direction: column; }
  .about-toc {
    width: 100%;
    position: relative;
    top: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 0;
    padding-bottom: 12px;
    max-height: none;
  }
}

.empty {
  border: 1px dashed rgba(154,166,195,0.35);
  background: rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 16px;
}
.empty-title { font-weight: 900; }
.empty-sub { color: var(--muted); margin-top: 6px; font-size: 13px; line-height: 1.35; }

.footnote { font-size: 11px; color: var(--muted); }

@media (max-width: 1100px) {
  .input { width: 200px; }
}
