/* ── Reset / Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #020408;
  --bg2: #060c14;
  --bg3: #0a1520;
  --panel: rgba(6,14,26,0.95);
  --border: rgba(40,80,140,0.4);
  --accent: #4488ff;
  --accent2: #2255cc;
  --text: #8ab0d0;
  --textBright: #ddeeff;
  --danger: #ff4444;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 13px;
}

/* ── App Layout ─────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* ── Toolbar ────────────────────────────────────────────── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  height: 42px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.toolbar-galaxy-label {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 120px;
}

.toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar-spacer { flex: 1; }

.toolbar-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text);
  opacity: 0.7;
}

.toolbar-stats strong { color: var(--textBright); }

/* ── Panes ──────────────────────────────────────────────── */
#panes {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

#pane-editor {
  display: flex;
  flex-direction: column;
  width: 45%;
  min-width: 200px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#pane-viewer {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

#pane-divider {
  width: 5px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}
#pane-divider:hover, #pane-divider.dragging {
  background: var(--accent);
}

/* ── Pane top bars ─────────────────────────────────────── */
#editor-topbar, #viewer-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  height: 28px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 11px;
}

.pane-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.7;
}

#coord-display {
  font-family: monospace;
  font-size: 11px;
  color: var(--text);
  opacity: 0.75;
  flex: 1;
}

#add-star-hint {
  font-size: 11px;
  color: #88bbff;
  background: rgba(30,60,120,0.5);
  padding: 2px 8px;
  border-radius: 3px;
}
#add-star-hint kbd {
  background: rgba(255,255,255,0.12);
  padding: 1px 4px;
  border-radius: 2px;
  font-family: monospace;
  font-size: 10px;
}

/* ── Map Canvas ─────────────────────────────────────────── */
#map-canvas {
  flex: 1;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ── 3D Canvas ──────────────────────────────────────────── */
#canvas {
  position: absolute;
  inset: 28px 0 0 0; /* leave room for viewer-topbar */
  width: 100%;
  height: calc(100% - 28px);
  display: block;
}

/* ── Controls hint ─────────────────────────────────────── */
#controls-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  pointer-events: none;
  z-index: 2;
}
#controls-hint span {
  font-size: 11px;
  color: var(--text);
  opacity: 0.40;
}

/* ── Ctrl buttons (toolbar) ────────────────────────────── */
.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(20,50,90,0.6);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--textBright);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.ctrl-btn:hover { background: rgba(40,80,150,0.7); border-color: rgba(80,130,220,0.6); }
.ctrl-btn.active { background: rgba(40,100,200,0.8); border-color: var(--accent); color: #fff; }
.btn-icon { font-size: 13px; line-height: 1; }

/* ── Star Panel ─────────────────────────────────────────── */
#star-panel {
  position: fixed;
  z-index: 50;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  backdrop-filter: blur(10px);
  pointer-events: all;
  top: 80px;
  right: 20px;
}

.sp-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none; border: none;
  color: var(--text); font-size: 18px; cursor: pointer;
  opacity: 0.6; line-height: 1;
}
.sp-close:hover { opacity: 1; }

.sp-name-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  padding-right: 20px;
}
.sp-name {
  font-size: 13px; font-weight: 600;
  color: var(--textBright); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-action-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text); font-size: 11px; padding: 2px 7px;
  border-radius: 3px; cursor: pointer; white-space: nowrap;
}
.sp-action-btn:hover { border-color: var(--accent); color: var(--textBright); }

.sp-rename-form {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 6px;
}
.sp-rename-form input {
  width: 100%; padding: 5px 8px;
  background: rgba(10,20,40,0.8);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--textBright); font-size: 12px;
}
.sp-form-btns { display: flex; gap: 6px; }
.sp-save-btn { flex: 1; padding: 5px; font-size: 11px; }

/* Coordinate editor */
.sp-coords {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(10,20,40,0.6);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.sp-coords-row {
  display: flex; align-items: center; gap: 4px;
}
.sp-coord-label {
  font-size: 10px; font-weight: 700;
  color: var(--accent); opacity: 0.8;
  width: 10px; text-align: center;
}
.sp-coord-input {
  width: 58px; padding: 3px 5px;
  background: rgba(10,20,40,0.9);
  border: 1px solid var(--border); border-radius: 3px;
  color: var(--textBright); font-size: 11px; font-family: monospace;
}
.sp-coord-btn {
  width: 100%; font-size: 11px; padding: 4px 0;
}

.sp-info { font-size: 11px; line-height: 1.7; color: var(--text); }
.sp-system { color: var(--textBright); font-weight: 600; }
.sp-spectral { opacity: 0.85; }
.sp-components { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.sp-comp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.sp-user-tag {
  display: inline-block; margin-top: 4px;
  font-size: 10px; padding: 2px 6px;
  background: rgba(40,100,200,0.3); border: 1px solid rgba(80,140,255,0.4);
  border-radius: 3px; color: #88aaff;
}

/* ── Status Bar ─────────────────────────────────────────── */
#status-bar {
  position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 18px; font-size: 12px; color: var(--textBright);
  z-index: 100; pointer-events: none; backdrop-filter: blur(8px);
}
#status-bar.error { border-color: var(--danger); color: var(--danger); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,4,8,0.85); backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; max-height: 85vh; overflow-y: auto;
}

.modal-header { text-align: center; margin-bottom: 20px; }
.modal-header h1 { font-size: 26px; color: var(--textBright); letter-spacing: 0.05em; }
.modal-header p  { font-size: 13px; color: var(--text); margin-top: 6px; }
.modal-footer { margin-top: 20px; display: flex; justify-content: center; }

/* Galaxy selector */
.galaxy-selector { width: min(700px, 94vw); }
.galaxy-category { margin-bottom: 20px; }
.category-header { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); opacity: 0.7; margin-bottom: 8px; }
.galaxy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

.galaxy-card {
  padding: 10px; border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.galaxy-card:hover { border-color: rgba(80,130,220,0.6); background: rgba(20,40,80,0.5); }
.galaxy-card.selected { border-color: var(--accent); background: rgba(30,70,160,0.4); }

.cat-spiral    { background: radial-gradient(ellipse at 50% 60%, rgba(30,50,120,0.4), transparent 70%); }
.cat-elliptical { background: radial-gradient(ellipse at 50% 50%, rgba(80,50,20,0.35), transparent 70%); }
.cat-irregular  { background: radial-gradient(ellipse at 40% 55%, rgba(20,80,40,0.35), transparent 70%); }
.cat-special    { background: radial-gradient(ellipse at 50% 45%, rgba(80,20,80,0.35), transparent 70%); }

.card-code { font-size: 10px; font-weight: 700; color: var(--accent); opacity: 0.7; letter-spacing: 0.06em; }
.card-name { font-size: 12px; font-weight: 600; color: var(--textBright); margin: 3px 0; }
.card-desc { font-size: 10px; color: var(--text); opacity: 0.7; line-height: 1.4; }
.card-example { font-size: 10px; color: var(--text); opacity: 0.5; margin-top: 4px; font-style: italic; }

/* Generate dialog */
.generate-dialog { width: min(380px, 90vw); }
.generate-dialog h2 { font-size: 18px; color: var(--textBright); margin-bottom: 16px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text); margin-bottom: 5px; }
.form-group label strong { color: var(--textBright); }
.type-select { width: 100%; padding: 6px 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; color: var(--textBright); font-size: 12px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

#generate-type-info { font-size: 11px; color: var(--text); opacity: 0.7; margin: -6px 0 8px; min-height: 1.4em; }

.dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Star name dialog */
.star-name-dialog { width: min(340px, 90vw); }
.star-name-dialog h3 { font-size: 16px; color: var(--textBright); margin-bottom: 12px; }
.star-name-dialog input {
  width: 100%; padding: 8px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--textBright); font-size: 13px; margin-bottom: 12px;
}

/* Shared buttons */
.btn-primary {
  padding: 8px 18px; background: var(--accent); border: none; border-radius: 5px;
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #5599ff; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 8px 18px; background: rgba(20,40,80,0.7);
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--text); font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(30,60,110,0.9); }

.hidden { display: none !important; }

/* ── Context Menu ────────────────────────────────────────── */
#ctx-menu {
  position: fixed;
  z-index: 300;
  background: rgba(6,14,26,0.97);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 0;
  min-width: 170px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  user-select: none;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--textBright);
  transition: background 0.1s;
  white-space: nowrap;
}
.ctx-item:hover { background: rgba(40,80,160,0.5); }
.ctx-item .ctx-icon { font-size: 14px; width: 16px; text-align: center; opacity: 0.85; }
.ctx-item.ctx-danger { color: #ff7070; }
.ctx-item.ctx-danger:hover { background: rgba(160,40,40,0.4); }
.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Star Creation Dialog ────────────────────────────────── */
.star-create-dialog { width: min(500px, 94vw); }
.star-create-dialog h3 { font-size: 16px; color: var(--textBright); margin-bottom: 14px; }

.star-create-layout {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.star-preview-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#star-create-preview {
  border-radius: 8px;
  background: #020408;
  border: 1px solid var(--border);
  display: block;
}

.star-preview-caption {
  font-size: 10px;
  color: var(--text);
  opacity: 0.65;
  text-align: center;
  max-width: 130px;
}

.star-create-controls { flex: 1; min-width: 0; }
.star-create-controls .form-group { margin-bottom: 10px; }
.star-create-controls .form-group label {
  display: block; font-size: 11px; color: var(--text); margin-bottom: 4px; font-weight: 600;
}
.star-create-controls input[type="text"] {
  width: 100%; padding: 6px 8px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
  color: var(--textBright); font-size: 12px;
}

.spectral-select-row {
  display: flex; align-items: center; gap: 7px;
}
.spectral-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  box-shadow: 0 0 5px currentColor;
}

/* out-of-bounds indicator for add mode */
.editor-forbidden-cursor { cursor: not-allowed !important; }

/* ── System View Sub-Toolbar ─────────────────────────────── */
#sys-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 34px;
  background: rgba(4,10,22,0.97);
  border-bottom: 1px solid rgba(60,100,200,0.35);
  flex-shrink: 0;
  z-index: 10;
}
#sys-topbar.hidden { display: none; }

.sys-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  opacity: 0.65;
  white-space: nowrap;
}
.sys-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--textBright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sys-btn { font-size: 11px; padding: 4px 9px; }

/* Back-to-galaxy button */
.back-btn {
  background: rgba(20,50,100,0.8) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
  gap: 4px;
}
.back-btn:hover { background: rgba(40,80,160,0.9) !important; }

/* ── Generate modal: sci-fi toggle ─────────────────────────── */
.gen-scifi-row { margin-top: 4px; }
.gen-toggle-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--textBright); cursor: pointer;
  user-select: none;
}
.gen-toggle-label input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.gen-scifi-hint { font-size: 10px; color: var(--text); opacity: 0.55; margin-top: 4px; line-height: 1.4; }

/* ── Body Panel (planet / object info) ──────────────────────── */
#body-panel {
  position: fixed;
  z-index: 50;
  width: 256px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  backdrop-filter: blur(10px);
  pointer-events: all;
  top: 80px;
  right: 20px;
}

.bp-info { font-size: 11px; line-height: 1.7; color: var(--text); margin-top: 4px; }

.bp-type-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 20px; border: 1px solid;
  margin-bottom: 6px; white-space: nowrap;
}
.bp-scifi-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(255,153,0,0.2); border: 1px solid rgba(255,153,0,0.4);
  border-radius: 3px; padding: 1px 4px; color: #ffaa44;
}
.bp-detail { opacity: 0.85; margin-bottom: 2px; }
.bp-detail strong { color: var(--textBright); }
.bp-moons { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bp-moon-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.18);
}

.bp-actions {
  display: flex; gap: 6px; margin-top: 10px;
}
.bp-action-btn {
  flex: 1; font-size: 11px; padding: 5px 4px;
  white-space: nowrap; text-align: center;
}
.bp-delete { color: #ff7070 !important; border-color: rgba(200,60,60,0.4) !important; }
.bp-delete:hover { background: rgba(160,40,40,0.4) !important; }

/* ── Add Body Dialog ─────────────────────────────────────────── */
.add-body-dialog { width: min(360px, 92vw); }
.add-body-dialog h3 { font-size: 16px; color: var(--textBright); margin-bottom: 14px; }


/* ── Moon list controls ─────────────────────────────────────── */
.bp-moons-section { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.bp-moons-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px;
}
.bp-moons-title { font-size: 11px; font-weight: 600; color: var(--textBright); letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.7; }
.bp-btn-xs {
  font-size: 10px; padding: 2px 7px; line-height: 1.5;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; color: var(--accent); cursor: pointer;
}
.bp-btn-xs:hover { background: rgba(68,136,255,0.12); }

.bp-moon-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 5px; border-radius: 4px; cursor: pointer;
  font-size: 11px; color: var(--text);
  border: 1px solid transparent;
  transition: background 0.12s;
}
.bp-moon-item:hover { background: rgba(68,136,255,0.08); }
.bp-moon-item.selected {
  background: rgba(68,136,255,0.14);
  border-color: rgba(68,136,255,0.3);
  color: var(--textBright);
}
.bp-moon-dot2 {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.18);
}
.bp-moon-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-moon-type-tag { font-size: 10px; opacity: 0.55; flex-shrink: 0; }
.bp-moon-remove {
  font-size: 11px; color: #ff7070; cursor: pointer;
  background: none; border: none; padding: 0 2px;
  line-height: 1; flex-shrink: 0; opacity: 0.6;
}
.bp-moon-remove:hover { opacity: 1; }

.bp-moon-detail {
  font-size: 10px; color: var(--text); line-height: 1.5;
  padding: 4px 6px 4px 21px; opacity: 0.85;
}

.bp-moon-type-sel { width: 100%; margin-top: 4px; }

/* ── Holomap 3D overlay ─────────────────────────────────────── */
#holomap-overlay {
  position: absolute;
  top: 28px; /* viewer-topbar height */
  left: 0;
  width: 100%;
  height: calc(100% - 28px);
  pointer-events: none;
  z-index: 5;
}

/* ── Ambience Selector ──────────────────────────────────────── */
.toolbar-ambience {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ambience-label {
  font-size: 11px;
  color: var(--text);
  opacity: 0.7;
  white-space: nowrap;
}
.ambience-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--textBright);
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
  height: 26px;
}
.ambience-select:focus { outline: 1px solid var(--accent); }

/* ── Holomap Button ─────────────────────────────────────────── */
.holomap-btn {
  border-color: rgba(0,180,220,0.3) !important;
  color: #66ccdd !important;
}
.holomap-btn:hover {
  background: rgba(0,180,220,0.12) !important;
  border-color: rgba(0,200,255,0.5) !important;
}
.holomap-btn.active {
  background: rgba(0,200,255,0.18) !important;
  border-color: rgba(0,220,255,0.7) !important;
  color: #00eeff !important;
  box-shadow: 0 0 10px rgba(0,200,255,0.35);
  text-shadow: 0 0 8px rgba(0,220,255,0.8);
}

/* ── Black Hole Note (star creation dialog) ─────────────────── */
.bh-note {
  font-size: 11px;
  color: #aa88cc;
  background: rgba(60,0,80,0.3);
  border: 1px solid rgba(100,20,140,0.5);
  border-radius: 5px;
  padding: 7px 10px;
  margin-bottom: 8px;
  line-height: 1.5;
}

/* ── Black Hole tag in star panel ───────────────────────────── */
.sp-bh-note {
  font-size: 10px;
  color: #aa88cc;
  opacity: 0.85;
  margin-top: 4px;
  font-style: italic;
}

/* ── Travel Calculator Modal ────────────────────────────────── */
.tc-modal-box {
  width: min(1200px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 16px;
  gap: 12px;
  overflow: hidden;
}

.tc-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  flex-shrink: 0;
}

.tc-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tc-title-icon { font-size: 20px; line-height: 1; }

.tc-title {
  font-size: 18px;
  color: var(--textBright);
  margin: 0;
  white-space: nowrap;
}

.tc-subtitle {
  font-size: 11px;
  color: var(--text);
  opacity: 0.7;
}

.tc-close {
  position: absolute;
  top: 0; right: 0;
  font-size: 22px;
}

/* Route selection bar */
.tc-route-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tc-star-sel {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.tc-sel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.8;
  white-space: nowrap;
}

.tc-star-select {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
}

.tc-swap-btn {
  background: rgba(30,60,120,0.6);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--textBright);
  font-size: 16px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.tc-swap-btn:hover { background: rgba(50,90,180,0.7); border-color: var(--accent); }

.tc-route-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 12px;
  background: rgba(10,25,50,0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex: 1;
  min-width: 180px;
  min-height: 36px;
}

.tc-no-sel {
  font-size: 11px;
  color: var(--text);
  opacity: 0.55;
  font-style: italic;
}

.tc-dist-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tc-dist-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--accent);
  opacity: 0.7;
  text-transform: uppercase;
}
.tc-dist-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--textBright);
  font-family: monospace;
}
.tc-dist-sub {
  font-size: 10px;
  color: var(--text);
  opacity: 0.6;
  font-family: monospace;
}

/* Galaxy scale bar */
.tc-scale-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: rgba(10,20,40,0.5);
  border: 1px solid var(--border);
  border-radius: 5px;
  min-width: 0;
  overflow: hidden;
}

.tc-scale-label {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.tc-scale-label strong { color: var(--textBright); }

.tc-scale-slider {
  flex: 1 1 120px;
  min-width: 80px;
  max-width: 220px;
  accent-color: var(--accent);
}

.tc-scale-hint {
  font-size: 10px;
  color: var(--text);
  opacity: 0.45;
  font-style: italic;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Legend */
.tc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.tc-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text);
  opacity: 0.75;
}

.tc-leg-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* Results table */
.tc-table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 0;
}

.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tc-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg2);
}

.tc-table th {
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0.8;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tc-th-hint {
  font-weight: 400;
  font-size: 9px;
  opacity: 0.5;
  margin-left: 4px;
}

.tc-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(40,80,140,0.15);
  vertical-align: middle;
  color: var(--text);
}

.tc-mode-row:hover td { background: rgba(30,60,120,0.2); }

/* Category separator rows */
.tc-cat-sep td {
  padding: 10px 10px 4px;
  background: rgba(6,14,26,0.7);
  border-bottom: 1px solid rgba(40,80,140,0.25);
}

.tc-cat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Name column */
.tc-col-name {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 200px;
}

.tc-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.tc-name-wrap { flex: 1; }

.tc-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--textBright);
  line-height: 1.4;
  cursor: help;
}

/* Inline config slider */
.tc-config-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.tc-slider {
  width: 90px;
  accent-color: var(--accent);
  cursor: pointer;
}

.tc-slider-val {
  font-size: 10px;
  color: var(--accent);
  font-family: monospace;
  white-space: nowrap;
  min-width: 70px;
}

/* Other columns */
.tc-col-uni  { font-size: 11px; color: var(--text); opacity: 0.75; min-width: 140px; }
.tc-col-speed { font-family: monospace; font-size: 12px; color: #88ccff; white-space: nowrap; }
.tc-col-dist  { font-family: monospace; font-size: 12px; white-space: nowrap; }
.tc-col-real  { font-family: monospace; font-size: 12px; color: var(--textBright); font-weight: 600; white-space: nowrap; }
.tc-col-ship  { font-family: monospace; font-size: 12px; color: #aaddbb; white-space: nowrap; }
.tc-col-notes { font-size: 10px; color: var(--text); opacity: 0.7; max-width: 220px; line-height: 1.5; }

.tc-instant { color: #44ffaa; font-weight: 700; }

.tc-variance {
  display: block;
  color: #ffaa44;
  font-size: 11px;
}

.tc-detour-extra {
  font-size: 10px;
  color: #ffaa44;
  opacity: 0.85;
}

.tc-no-sel-cell {
  text-align: center;
  padding: 30px;
  color: var(--text);
  opacity: 0.45;
  font-style: italic;
}

/* Footer */
.tc-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text);
  opacity: 0.45;
  flex-shrink: 0;
  padding-top: 4px;
}

.tc-footer strong { color: var(--textBright); opacity: 0.8; }

/* Scrollbar styling inside table wrap */
.tc-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.tc-table-wrap::-webkit-scrollbar-track { background: var(--bg2); }
.tc-table-wrap::-webkit-scrollbar-thumb { background: rgba(80,130,220,0.4); border-radius: 3px; }
.tc-table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(80,130,220,0.7); }
