/* Stellar Summit Connect — deliberate dark theme.
   Chart colors come from the validated dark-mode palette (see README). */

:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5; /* blue   */
  --series-2: #d95926; /* orange */
  --series-3: #199e70; /* aqua   */
  --accent: var(--series-1);
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }

body {
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 45%, rgba(255,255,255,.30) 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 75%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,.4) 50%, transparent 51%),
    var(--page);
  color: var(--ink);
  min-height: 100vh;
}

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }

/* ---------- top bar ---------- */

.topbar {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--hairline);
  background: rgba(13, 13, 13, 0.85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-star { font-size: 28px; color: var(--accent); }
.brand h1 { font-size: 17px; font-weight: 500; font-family: 'Unbounded', system-ui, sans-serif; }
.brand-sub { font-size: 12.5px; color: var(--ink-muted); }

.tabs { display: flex; gap: 6px; }
.tab {
  background: none; border: 1px solid transparent; color: var(--ink-2);
  padding: 8px 16px; border-radius: 999px; font-size: 14px; cursor: pointer;
}
.tab:hover { background: var(--surface-2); }
.tab.active { background: var(--surface-2); color: var(--ink); border-color: var(--border); }

/* ---------- filters ---------- */

.filters-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.filters-row input[type="search"] { flex: 2 1 260px; }
.filters-row select { flex: 1 1 150px; }

input, select, textarea {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}

.count-line { color: var(--ink-muted); font-size: 13px; margin: 8px 2px 14px; }

/* ---------- builder cards ---------- */

.cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.card-head { display: flex; gap: 12px; align-items: center; }
.card-head-info { min-width: 0; }
.card-name { font-size: 16px; font-weight: 700; }
.card-role { font-size: 13px; color: var(--ink-2); }
.card-place { font-size: 12px; color: var(--ink-muted); }

.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff;
  background: var(--surface-2); border: 1px solid var(--border);
  object-fit: cover; overflow: hidden;
}
img.avatar { object-fit: cover; }
.avatar-lg { width: 76px; height: 76px; font-size: 26px; }
.proj-avatar { border-radius: 10px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink-2); background: var(--surface-2);
}
.badge.cat { color: #9ec5f4; border-color: rgba(57, 135, 229, 0.35); }
.badge.stage-Idea { color: #c3c2b7; border-color: rgba(195, 194, 183, 0.4); }
.badge.stage-MVP { color: #e094b4; border-color: rgba(213, 81, 129, 0.45); }
.badge.stage-Testnet { color: #e8b45c; border-color: rgba(201, 133, 0, 0.5); }
.badge.stage-Mainnet { color: #5fc99a; border-color: rgba(25, 158, 112, 0.55); }
.badge.stage-Not-onchain { color: #b3aaf2; border-color: rgba(144, 133, 233, 0.5); }
.badge.type-Technical { color: #86b6ef; }
.badge.type-Business { color: #f0a482; }
.badge.type-Both { color: #7fd0b0; }

.card-project { font-size: 14px; }
.card-project strong { color: var(--ink); }
.card-oneliner { font-size: 13.5px; color: var(--ink-2); }

.looking-for {
  font-size: 13px; color: var(--ink-2);
  background: var(--surface-2); border-left: 3px solid var(--series-2);
  padding: 8px 10px; border-radius: 6px;
}
.looking-for b { color: var(--ink); font-weight: 600; display: block; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; color: var(--ink-muted); }

.card-links { display: flex; flex-wrap: wrap; gap: 8px; }
.card-links a { color: #86b6ef; font-size: 12.5px; text-decoration: none; word-break: break-all; }
.card-links a:hover { text-decoration: underline; }

.try-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.try-row .btn { text-decoration: none; }
.try-count { font-size: 12px; color: var(--ink-muted); }
.try-quote {
  font-size: 12.5px; color: var(--ink-2); font-style: italic;
  border-left: 2px solid var(--series-3); padding: 4px 8px; margin: 4px 0 0;
}
.try-quote span { color: var(--ink-muted); font-style: normal; font-size: 11.5px; }

.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--hairline);
}
.contact-icons { display: flex; gap: 10px; }
.contact-icons a {
  color: var(--ink-2); text-decoration: none; font-size: 13px;
  padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px;
}
.contact-icons a:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- buttons ---------- */

.btn {
  font-family: inherit; font-size: 14px; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--border);
  padding: 8px 14px; background: var(--surface-2); color: var(--ink);
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: none; }
.btn.small { font-size: 12.5px; padding: 5px 10px; }
.btn.big { padding: 12px 20px; font-size: 15px; width: 100%; margin-top: 6px; }
.btn.connected { background: var(--series-3); border-color: transparent; color: #fff; font-weight: 600; }
.btn:disabled { opacity: 0.7; cursor: default; }

/* ---------- form ---------- */

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
#join-form { max-width: 640px; margin: 20px auto; display: flex; flex-direction: column; gap: 14px; }
#join-form h2 { font-size: 20px; }
.form-hint { font-size: 13px; color: var(--ink-muted); }
#join-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.photo-row { display: flex; align-items: center; gap: 16px; }
#photo-preview { background-size: cover; background-position: center; color: var(--accent); }

.segmented { border: none; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.segmented legend { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.segmented label {
  flex-direction: row !important; align-items: center; gap: 6px !important;
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; cursor: pointer;
}
.segmented label:has(input:checked) { background: var(--surface-2); border-color: var(--accent); color: var(--ink); }
.segmented input { width: auto; accent-color: var(--accent); }

.form-status { font-size: 13.5px; min-height: 18px; }
.form-status.ok { color: #0ca30c; }
.form-status.err { color: #e66767; }

/* ---------- metrics ---------- */

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 18px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tile .tile-value { font-size: 32px; font-weight: 700; line-height: 1.15; }
.tile .tile-label { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }

.metrics-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.metrics-grid h3 { font-size: 15px; margin-bottom: 14px; }

/* horizontal bar chart — single hue, thin marks, rounded data-end, direct labels */
.hbar-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 8px; align-items: center; margin-bottom: 9px; }
.hbar-label { font-size: 12.5px; color: var(--ink-2); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; position: relative; }
.hbar-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar-value { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* tech/business split — segmented bar with 2px surface gaps + legend */
.split-bar { display: flex; height: 18px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.split-seg { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }

.heatmap-panel { grid-column: 1 / -1; }
.heatmap-wrap { overflow-x: auto; }
.heatmap { display: grid; gap: 2px; min-width: 420px; }
.hm-col {
  font-size: 11px; color: var(--ink-muted); text-align: center; padding-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-row {
  font-size: 12px; color: var(--ink-2); padding-right: 10px;
  display: flex; align-items: center; justify-content: flex-end; text-align: right;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 160px;
}
.hm-cell {
  height: 30px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums;
}
.hm-zero { background: rgba(255, 255, 255, 0.04); }

.word-cloud {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
  line-height: 1.3; padding: 4px 0;
}
.word-cloud span { cursor: default; transition: transform 0.12s; }
.word-cloud span:hover { transform: scale(1.12); }

.top-list { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.top-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.top-list .avatar { width: 32px; height: 32px; font-size: 12px; }
.top-list .conn-count { margin-left: auto; color: var(--ink-muted); font-size: 12.5px; }

.conn-feed { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.conn-feed li { font-size: 13px; color: var(--ink-2); }
.conn-feed .conn-arrow { color: var(--series-2); margin: 0 4px; }
.conn-feed time { color: var(--ink-muted); font-size: 11.5px; margin-left: 6px; }

/* ---------- projects in cards & project cards ---------- */

.proj {
  border: 1px solid var(--hairline); border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.proj-summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  cursor: pointer; list-style: none; user-select: none;
}
.proj-summary::-webkit-details-marker { display: none; }
.proj-summary:hover { background: rgba(255, 255, 255, 0.03); border-radius: 10px; }
.proj-sum-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.proj-sum-one {
  font-size: 12.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proj-mini-fallback { color: #c98500; font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }
.proj-chevron { color: var(--ink-muted); font-size: 12px; transition: transform 0.15s; flex-shrink: 0; }
.proj[open] .proj-chevron { transform: rotate(90deg); }
.proj-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 12px 12px; }
.proj-team { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }

.project-card { gap: 12px; }
.proj-banner-wrap { position: relative; margin: -16px -16px 0; }
.proj-banner {
  height: 130px; border-radius: var(--radius) var(--radius) 0 0; display: block;
  width: 100%; max-width: none; object-fit: cover; object-position: top center;
  border-bottom: 1px solid var(--hairline); background: var(--surface-2);
}
.proj-patch {
  height: 130px; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 75% 20%, rgba(255,255,255,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 70%, rgba(255,255,255,.35) 50%, transparent 51%),
    linear-gradient(135deg, color-mix(in srgb, var(--h1) 30%, var(--surface)), color-mix(in srgb, var(--h2) 22%, var(--surface)));
  border-bottom: 1px solid var(--hairline);
}
.proj-patch span {
  font-family: 'Unbounded', system-ui, sans-serif; font-weight: 700; font-size: 34px;
  color: rgba(255, 255, 255, 0.85); letter-spacing: 0.05em;
}
.hot-badge {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(13, 13, 13, 0.8); border: 1px solid var(--series-2);
  color: #f0a482; font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(4px);
}

/* the signature: pointer-reactive foil border + glare, keyed to category hues */
.holo {
  position: relative;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, color-mix(in srgb, var(--h1) 65%, transparent),
      color-mix(in srgb, var(--h2) 45%, transparent) 55%,
      color-mix(in srgb, var(--h1) 60%, transparent)) border-box;
  transition: transform 0.15s ease-out, box-shadow 0.2s;
  will-change: transform;
}
.holo:hover { box-shadow: 0 10px 44px color-mix(in srgb, var(--h1) 22%, transparent); }
.holo-glare {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  border-radius: var(--radius); opacity: 0; transition: opacity 0.25s;
  background: radial-gradient(circle at calc(var(--px, 0.5) * 100%) calc(var(--py, 0.5) * 100%),
    rgba(255, 255, 255, 0.13), transparent 55%);
}
.holo:hover .holo-glare { opacity: 1; }

.proj-title {
  font-family: 'Unbounded', system-ui, sans-serif; font-weight: 500; font-size: 16px;
  letter-spacing: 0.01em; display: flex; align-items: center; gap: 9px;
}
.proj-mini-icon { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }

.crew { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crew-stack { display: flex; }
.crew-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.crew-stack .avatar:first-child { margin-left: 0; }
.crew-names { font-size: 12.5px; color: var(--ink-2); }

.stat-strip {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border-top: 1px solid var(--hairline); padding-top: 10px;
  font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.stat-strip a { color: #86b6ef; text-decoration: none; font-size: 12px; margin-left: auto; }
.stat-strip a + a { margin-left: 0; }
.stat-strip a:hover { text-decoration: underline; }
.proj-members { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.member-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 4px;
}
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }

/* ---------- project blocks in the join form ---------- */

.section-title { font-size: 16px; margin-top: 10px; }
.project-block {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.project-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.project-block.flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color 0.4s; }
.card.flash { outline: 2px solid var(--accent); outline-offset: 3px; }
.project-adder { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.project-adder select { flex: 1 1 220px; width: auto; }
.mini-label { font-size: 12px; color: var(--ink-muted); }
.pb-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip {
  display: inline-flex; align-items: center; border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; color: var(--ink-2);
}
.cat-chip input { display: none; }
.cat-chip:has(input:checked) {
  background: rgba(57, 135, 229, 0.18); border-color: var(--accent); color: var(--ink);
}
.pb-links { display: flex; flex-direction: column; gap: 8px; }
.pb-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- map ---------- */

#map {
  height: min(72vh, 640px); border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
}
.map-toggle-row { align-items: center; justify-content: space-between; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface-2); color: var(--ink);
}
.pin-anchor { background: none; border: none; }
.pin {
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  border: 2px solid #3987e5; background: var(--surface-2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
}
.pin img { width: 100%; height: 100%; object-fit: cover; }
.pin span {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.pin.pin-project { border-radius: 10px; border-color: #c98500; }
.pin-cluster {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3987e5, #9085e9);
  border: 2px solid rgba(255, 255, 255, 0.85); color: #fff;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}
.leaflet-popup-content a { color: #86b6ef; }
.leaflet-container { font-family: inherit; }

/* ---------- sign-in & Q&A ---------- */

#signin-box { max-width: 480px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
.signin-row { display: flex; gap: 10px; flex-wrap: wrap; }
.signin-row input { flex: 1 1 220px; }
.email-row { font-size: 13px; color: var(--ink-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.email-row strong { color: var(--ink); }

.handle-wrap {
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.handle-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.handle-at { padding-left: 12px; color: var(--ink-muted); font-size: 14px; user-select: none; }
.handle-wrap input { border: none; background: none; outline: none !important; padding-left: 3px; }

.city-wrap { position: relative; display: block; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  margin-top: 4px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: block;
}
.suggestions button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  background: none; border: none; color: var(--ink); cursor: pointer; font-size: 13px;
}
.suggestions button span { color: var(--ink-muted); font-size: 12px; }
.suggestions button:hover { background: var(--surface); }

.qa summary {
  cursor: pointer; font-size: 12.5px; color: var(--ink-muted);
  list-style: none; user-select: none;
}
.qa summary::before { content: '▸ '; }
.qa[open] summary::before { content: '▾ '; }
.qa summary::-webkit-details-marker { display: none; }
.qa[open] { display: flex; flex-direction: column; gap: 8px; }
.qa-item {
  border-left: 2px solid var(--series-1); padding: 6px 10px;
  background: rgba(57, 135, 229, 0.06); border-radius: 6px;
  display: flex; flex-direction: column; gap: 5px; font-size: 13px;
}
.qa-q { color: var(--ink); position: relative; padding-right: 20px; }
.qa-a { color: var(--ink-2); padding-left: 12px; }
.qa-by { color: var(--ink-muted); font-size: 11.5px; }
.qa-btn { align-self: flex-start; }
.qa-del {
  position: absolute; right: 0; top: 0; background: none; border: none;
  color: var(--ink-muted); cursor: pointer; font-size: 12px; padding: 2px;
}
.qa-del:hover { color: #e66767; }

/* ---------- constellation ---------- */

#constellation-wrap {
  position: relative; height: min(74vh, 680px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 40%, #15151f 0%, var(--page) 75%);
  overflow: hidden;
}
#constellation { width: 100%; height: 100%; display: block; touch-action: none; }
.constellation-legend { margin: 16px 2px 12px; align-items: center; }
.edge-toggle {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink);
}
.edge-toggle::before { content: '✓'; color: #5fc99a; font-weight: 700; font-size: 12px; }
.edge-toggle:hover { border-color: var(--accent); }
.edge-toggle.off { opacity: 0.45; color: var(--ink-muted); text-decoration: line-through; }
.edge-toggle.off::before { content: '✕'; color: var(--ink-muted); text-decoration: none; }
.legend-line { width: 18px; height: 2px; display: inline-block; }
.legend-dashed {
  background: repeating-linear-gradient(90deg, #d95926 0 4px, transparent 4px 8px);
  width: 18px; height: 2px; display: inline-block;
}
.cv-diamond {
  width: 10px; height: 10px; background: #c98500; display: inline-block;
  transform: rotate(45deg); border-radius: 2px;
}
.cv-diamond-lg {
  width: 26px; height: 26px; background: #c98500; display: inline-block;
  transform: rotate(45deg); border-radius: 4px; margin: 8px; flex-shrink: 0;
}
.cv-tip {
  position: absolute; top: 14px; right: 14px; max-width: 290px; z-index: 20;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; font-size: 13px; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.cv-tip-head { display: flex; gap: 10px; align-items: center; color: var(--ink); }
.cv-tip-links { display: flex; gap: 12px; }
.cv-tip-links a { color: #86b6ef; text-decoration: none; }

/* ---------- AI match ---------- */

.ai-intro { max-width: 640px; margin: 18px auto; display: flex; flex-direction: column; gap: 12px; }
.ai-intro h2 { font-size: 20px; }
#ai-results { margin-top: 18px; }
.ai-match { position: relative; }
.ai-rank {
  position: absolute; top: 12px; right: 14px;
  font-family: 'Unbounded', system-ui, sans-serif; font-size: 15px; color: var(--ink-muted);
}
.ai-reason { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.ai-icebreaker {
  margin: 0; padding: 9px 12px; border-left: 3px solid var(--series-1);
  background: rgba(57, 135, 229, 0.08); border-radius: 6px;
  font-size: 13.5px; color: var(--ink); font-style: italic;
}

/* ---------- gate & export ---------- */

.landing {
  position: fixed; inset: 0; z-index: 100; background: var(--page);
  overflow-y: auto;
}
#landing-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.landing-inner {
  position: relative; max-width: 1080px; margin: 0 auto;
  padding: 9vh 24px 60px; display: flex; flex-direction: column; gap: 48px;
}
.landing-hero { max-width: 640px; display: flex; flex-direction: column; gap: 18px; }
.landing-eyebrow {
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted);
}
.landing-hero h1 {
  font-family: 'Unbounded', system-ui, sans-serif; font-weight: 700;
  font-size: clamp(28px, 5vw, 46px); line-height: 1.15;
}
.landing-sub { font-size: 16px; color: var(--ink-2); line-height: 1.55; }
.gate-inline { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.gate-inline input { flex: 1 1 200px; max-width: 280px; }

.landing-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.landing-tile {
  border: 1px solid transparent; border-radius: var(--radius); padding: 20px;
  background:
    linear-gradient(color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--surface) 88%, transparent)) padding-box,
    linear-gradient(135deg, color-mix(in srgb, var(--h1) 60%, transparent), color-mix(in srgb, var(--h2) 40%, transparent)) border-box;
  display: flex; flex-direction: column; gap: 8px;
}
.landing-icon {
  font-size: 26px; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  border-radius: 14px; margin-bottom: 4px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--h1) 30%, var(--surface-2)), color-mix(in srgb, var(--h2) 22%, var(--surface-2)));
}
.landing-tile h3 { font-size: 15.5px; }
.landing-tile p { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.landing-foot { text-align: center; font-size: 13px; color: var(--ink-muted); }

.export-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Ask AI chat ---------- */

.chat-bubble {
  position: fixed; bottom: 24px; right: 22px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--series-1), #9085e9);
  box-shadow: 0 6px 24px rgba(57, 135, 229, 0.45);
  transition: transform 0.15s;
}
.chat-bubble:hover { transform: scale(1.08); }

.chat-panel {
  position: fixed; bottom: 92px; right: 22px; z-index: 60;
  width: min(380px, calc(100vw - 28px)); height: min(540px, 70vh);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--hairline);
  font-size: 13.5px; font-weight: 600;
}
.chat-close {
  background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 14px;
}
.chat-close:hover { color: var(--ink); }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg {
  max-width: 88%; padding: 9px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.chat-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-err { color: #e66767; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--hairline); }
.chat-form .btn { padding: 8px 13px; }

@media (max-width: 700px) {
  .chat-bubble { bottom: 96px; right: 14px; }
  .chat-panel { bottom: 162px; right: 12px; left: 12px; width: auto; height: min(480px, 55vh); }
}

/* ---------- misc ---------- */

.footer {
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center;
  padding: 22px 16px 30px; border-top: 1px solid var(--hairline);
  font-size: 13px; color: var(--ink-muted);
}
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }

.hidden { display: none !important; }
.empty { text-align: center; padding: 60px 0; color: var(--ink-muted); display: flex; flex-direction: column; gap: 16px; align-items: center; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink);
  padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 50;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

/* ---------- mobile: app-style bottom navigation ---------- */

@media (max-width: 700px) {
  /* backdrop-filter would become the containing block for the fixed tab bar */
  .topbar { position: static; padding: 12px 14px; backdrop-filter: none; }
  .brand h1 { font-size: 15px; }
  .brand-sub { display: none; }
  .brand-star { font-size: 22px; }

  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
    background: rgba(13, 13, 13, 0.92); backdrop-filter: blur(10px);
    border-top: 1px solid var(--hairline);
    display: flex; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; padding: 4px 2px; border: none; border-radius: 10px;
    white-space: nowrap; overflow: hidden;
  }
  .tab::before { content: attr(data-icon); font-size: 17px; line-height: 1.2; }
  .tab[data-view="constellation"] { font-size: 0; }               /* label too long — icon + short word */
  .tab[data-view="constellation"]::before { font-size: 17px; color: var(--accent); }
  .tab[data-view="constellation"]::after { content: 'Stars'; font-size: 10px; }
  .tab.active { background: var(--surface-2); border: none; }

  main { padding-bottom: 96px; }
  .footer { padding-bottom: 104px; }
  .toast { bottom: 92px; width: max-content; max-width: 92vw; }

  /* iOS zooms into inputs under 16px — keep form text at 16px on touch */
  input, select, textarea { font-size: 16px; }

  .filters-row { gap: 8px; }
  .filters-row select { flex: 1 1 44%; }

  #map, #constellation-wrap { height: 60vh; }
  .constellation-legend { gap: 8px 12px; }

  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile .tile-value { font-size: 26px; }
  .hbar-row { grid-template-columns: 96px 1fr 30px; }

  .panel { padding: 16px; }
  #join-form { margin: 12px auto; }
  .landing-inner { padding: 6vh 18px 40px; gap: 32px; }
  .card-foot { flex-wrap: wrap; gap: 8px; }
}
