:root {
  --bg: #080b0d;
  --bg-2: #0f171b;
  --panel: rgba(14, 19, 22, 0.92);
  --panel-2: rgba(19, 28, 33, 0.9);
  --line: #243038;
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #edf3f1;
  --muted: #82939a;
  --signal: #78f3b3;
  --signal-soft: rgba(120, 243, 179, 0.12);
  --amber: #f0b35b;
  --danger: #ff6b72;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Manrope', sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(44, 78, 73, 0.18), transparent 36%),
    linear-gradient(180deg, #06080a 0%, #080b0d 38%, #0b1013 100%);
  color: var(--text);
  font-family: var(--sans);
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

#meshCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.18;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 64px minmax(calc(100vh - 64px), auto);
  max-width: 1520px;
  margin: 0 auto;
  border-inline: 1px solid var(--line-soft);
  background: rgba(7, 10, 12, 0.8);
  backdrop-filter: blur(6px);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 12, 0.93);
}

.brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.brand small {
  color: var(--muted);
  font-size: 9px;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.brand-mark i {
  display: block;
  width: 3px;
  background: var(--signal);
}

.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; }

.network-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 24px;
  color: var(--muted);
  font-size: 12px;
}

.network-state span,
.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px currentColor;
}

.network-state.online span,
.pulse {
  background: var(--signal);
}

.network-state.offline span { background: var(--danger); }
.network-state b { font-weight: 600; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
}

.icon-button,
.identity-button,
.quiet-button,
.primary-button,
.chip-button {
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
}

.icon-button {
  width: 36px;
  height: 36px;
}

.identity-button {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 4px;
}

.identity-button span,
.verified,
.privacy-note,
.contact-card span,
.info-panel span,
.feature-band strong,
.mesh-metrics > p {
  font-family: var(--mono);
}

.identity-button span {
  font-size: 11px;
  color: var(--muted);
}

.identity-button code {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 11px;
}

.sidebar {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
}

.nav-item span {
  width: 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: #9eb7b0;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active {
  color: var(--signal);
  background: var(--signal-soft);
  box-shadow: inset 2px 0 var(--signal);
}

.mesh-metrics {
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid var(--line);
}

.mesh-metrics > p {
  margin: 0 0 12px;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}

.mesh-metrics dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.mesh-metrics dl div {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.mesh-metrics dt { color: var(--muted); }
.mesh-metrics dd {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
}

.privacy-note {
  margin: 8px 0 0;
  padding: 0 10px;
  color: #5d6b71;
  font-size: 10px;
  line-height: 1.65;
}

main {
  grid-column: 2;
  min-width: 0;
}

.view {
  display: none;
  width: min(1040px, calc(100% - 48px));
  margin: 0 auto;
  padding: 40px 0 80px;
}

.view.active { display: block; }

.view-head,
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.2px;
}

.view-head h1,
.section-head h2,
.info-panel h2,
.contact-card h2 {
  margin: 0;
  letter-spacing: 0;
  font-weight: 700;
}

.view-head h1 { font-size: 28px; }
.section-head h2,
.info-panel h2,
.contact-card h2 { font-size: 22px; }

.quiet-button {
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
}

.quiet-button:hover { color: var(--text); }

.primary-button {
  padding: 11px 14px;
  border-radius: 4px;
  background: var(--signal);
  border-color: var(--signal);
  color: #09110d;
  font-size: 12px;
  font-weight: 800;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-stage,
.info-panel,
.composer,
.radar-panel,
.assistant-console,
.contact-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
}

.hero-copy {
  padding: 34px;
}

.hero-copy h1 {
  margin: 0;
  min-height: 98px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 0.96;
  font-weight: 800;
}

.type-line::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 0.95em;
  margin-left: 6px;
  vertical-align: -0.08em;
  background: var(--signal);
  animation: blink 0.75s step-end infinite;
}

.hero-text,
.info-panel p,
.feature-grid p,
.assistant-message,
.radar-copy p,
.protocol-grid p,
.contact-card p,
.contact-card li {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-stage {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(18, 27, 31, 0.86), rgba(8, 12, 14, 0.96)),
    radial-gradient(circle at 50% 45%, rgba(120, 243, 179, 0.12), transparent 38%);
}

.stage-rings,
.stage-rings i {
  position: absolute;
  inset: 0;
}

.stage-rings i {
  inset: auto;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(120, 243, 179, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.stage-rings i:nth-child(1) {
  width: 150px;
  height: 150px;
  animation: pulseRing 4.2s linear infinite;
}

.stage-rings i:nth-child(2) {
  width: 230px;
  height: 230px;
  animation: pulseRing 5.4s linear infinite;
}

.stage-rings i:nth-child(3) {
  width: 310px;
  height: 310px;
  animation: pulseRing 6.2s linear infinite;
}

.stage-card {
  position: relative;
  width: min(290px, calc(100% - 50px));
  padding: 22px;
  border: 1px solid rgba(120, 243, 179, 0.2);
  border-radius: 6px;
  background: rgba(11, 17, 20, 0.82);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.stage-card span,
.feature-grid strong,
.signal-stats span,
.assistant-actions,
.assistant-form input::placeholder,
.message-content time,
.sender,
.verified,
.contact-card span,
.text-link {
  font-family: var(--mono);
}

.stage-card span,
.contact-card span {
  color: var(--signal);
  font-size: 10px;
  letter-spacing: 1px;
}

.stage-card strong {
  display: block;
  margin-top: 14px;
  font-size: 28px;
  font-weight: 700;
}

.stage-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.overview-grid,
.feature-grid,
.assistant-grid,
.contact-grid {
  display: grid;
  gap: 16px;
}

.overview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.info-panel {
  padding: 24px;
  min-height: 220px;
}

.info-panel span {
  color: var(--signal);
  font-size: 10px;
  letter-spacing: 1px;
}

.info-panel h2 {
  margin-top: 18px;
  font-size: 20px;
}

.info-panel p {
  margin: 10px 0 0;
  font-size: 13px;
}

.feature-band,
.assistant-panel {
  margin-top: 22px;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.feature-grid strong {
  display: block;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.feature-grid p {
  margin: 0;
  font-size: 13px;
}

.assistant-grid,
.contact-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
}

.assistant-console {
  display: flex;
  flex-direction: column;
  min-height: 360px;
  overflow: hidden;
}

.assistant-log {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(8, 13, 15, 0.62), rgba(8, 13, 15, 0.95)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 28px);
  overflow: auto;
}

.assistant-message {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.assistant-message.system {
  background: rgba(120, 243, 179, 0.08);
  border: 1px solid rgba(120, 243, 179, 0.18);
}

.assistant-message.user {
  justify-self: end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.assistant-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0c1215;
  color: var(--text);
  padding: 12px 14px;
}

.assistant-actions {
  display: grid;
  gap: 10px;
  align-content: start;
}

.chip-button {
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 6px;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
}

.chip-button:hover {
  color: var(--text);
  border-color: #385048;
}

.composer {
  display: flex;
  gap: 14px;
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.composer-avatar,
.message-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #304047;
  background: #192328;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 11px;
}

.composer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 4px;
}

.composer-body {
  flex: 1;
  min-width: 0;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 55px;
  padding: 1px 0 12px;
  border: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
}

.composer textarea::placeholder,
.feed-toolbar label {
  color: #607078;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.composer-footer > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.composer-footer button {
  border: 0;
  border-radius: 4px;
  background: var(--signal);
  color: #07100c;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 800;
}

.composer-footer button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 10px;
  padding: 0 2px;
}

.feed-toolbar p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.7px;
}

.feed-toolbar p .pulse {
  margin-right: 6px;
  animation: pulse 1.8s infinite;
}

.feed-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}

.feed-toolbar input {
  width: 150px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
}

.message-list { border-top: 1px solid var(--line); }

.message-card {
  display: flex;
  gap: 14px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  animation: messageIn 0.25s ease;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #b6c5cc;
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message-content header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.sender {
  color: #afbdc3;
  font-size: 10px;
}

.own-badge {
  display: none;
  padding: 2px 4px;
  border-radius: 2px;
  background: var(--signal);
  color: #07100c;
  font-family: var(--mono);
  font-size: 8px;
}

.message-card.own .own-badge { display: inline; }

.message-content time {
  margin-left: auto;
  color: #647279;
  font-size: 9px;
}

.message-content > p {
  margin: 7px 0 10px;
  color: #dce4e1;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-content footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.verified {
  color: #61726b;
  font-size: 9px;
}

.recall-button {
  display: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 9px;
}

.message-card.own .recall-button { display: inline; }

.loading-state,
.empty-state {
  display: grid;
  place-items: center;
  padding: 70px 20px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.loading-state span {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.radar-panel {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  min-height: 540px;
  padding: 48px;
}

.radar {
  position: relative;
  width: min(360px, 100%);
  aspect-ratio: 1;
  border: 1px solid rgba(120, 243, 179, 0.35);
  border-radius: 50%;
  overflow: hidden;
  background: repeating-radial-gradient(circle, transparent 0 18%, rgba(120, 243, 179, 0.15) 18.4% 18.7%);
}

.radar-large { margin: 0 auto; width: min(420px, 100%); }

.radar::before,
.radar::after {
  content: '';
  position: absolute;
  background: rgba(120, 243, 179, 0.16);
}

.radar::before {
  left: 50%;
  width: 1px;
  height: 100%;
}

.radar::after {
  top: 50%;
  width: 100%;
  height: 1px;
}

.sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(120, 243, 179, 0.22) 95%, rgba(120, 243, 179, 0.6));
  animation: spin 4s linear infinite;
}

.radar-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 22px var(--signal);
}

.radar-copy {
  padding-left: 38px;
}

.radar-copy strong {
  font-size: 18px;
}

.signal-stats {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.signal-stats div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.signal-stats span {
  color: var(--muted);
  font-size: 10px;
}

.signal-stats b {
  font-family: var(--mono);
  font-size: 11px;
}

.protocol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.protocol-grid article {
  min-height: 200px;
  padding: 28px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(12, 18, 21, 0.84);
}

.protocol-grid article:nth-child(2n) { border-right: 0; }
.protocol-grid article:nth-last-child(-n + 2) { border-bottom: 0; }

.protocol-grid article > span {
  color: var(--signal);
  font-family: var(--mono);
  font-size: 10px;
}

.protocol-grid h2 {
  margin: 24px 0 8px;
  font-size: 15px;
}

.protocol-grid p {
  margin: 0;
  font-size: 12px;
}

.contact-card {
  padding: 24px;
}

.contact-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.contact-card li {
  margin-bottom: 8px;
  font-size: 13px;
}

.cta-stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.text-link {
  color: var(--signal);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  padding: 11px 15px;
  border-radius: 4px;
  background: #eaf5f0;
  color: #101615;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: 0.2s;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; box-shadow: 0 0 4px var(--signal); } }
@keyframes messageIn { from { opacity: 0; transform: translateY(4px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(0.96); opacity: 0.4; }
  50% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.03); opacity: 0.35; }
}

@media (max-width: 980px) {
  .hero-panel,
  .overview-grid,
  .feature-grid,
  .assistant-grid,
  .contact-grid,
  .radar-panel,
  .protocol-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 { min-height: 0; }
  .radar-copy { padding: 28px 0 0; }
  .protocol-grid article,
  .protocol-grid article:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .protocol-grid article:last-child { border-bottom: 0; }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    border: 0;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    height: 58px;
  }

  .brand {
    padding: 0 14px;
    border: 0;
    font-size: 11px;
  }

  .brand small,
  .network-state {
    display: none;
  }

  .top-actions { padding-right: 10px; }
  .identity-button span { display: none; }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    width: auto;
    height: 66px;
    padding: 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: #0b0f11;
  }

  .sidebar nav {
    grid-template-columns: repeat(5, 1fr);
    height: 100%;
  }

  .nav-item {
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0 4px;
    border-radius: 0;
    font-size: 8px;
    text-align: center;
  }

  .nav-item span {
    width: auto;
    font-size: 9px;
  }

  .nav-item.active { box-shadow: inset 0 2px var(--signal); }
  .mesh-metrics,
  .privacy-note { display: none; }

  main { padding-bottom: 66px; }

  .view {
    width: calc(100% - 28px);
    padding: 28px 0 40px;
  }

  .view-head,
  .section-head {
    margin-bottom: 20px;
  }

  .view-head h1,
  .section-head h2,
  .info-panel h2,
  .contact-card h2 {
    font-size: 22px;
  }

  .hero-copy,
  .hero-stage,
  .info-panel,
  .feature-grid article,
  .contact-card,
  .assistant-form,
  .radar-panel {
    padding: 18px;
  }

  .hero-copy h1 {
    font-size: 34px;
    min-height: 0;
  }

  .hero-text { font-size: 14px; }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .composer {
    padding: 13px;
    gap: 10px;
  }

  .composer-avatar {
    width: 32px;
    height: 32px;
  }

  .feed-toolbar label { display: none; }

  .message-card {
    gap: 10px;
    padding: 16px 2px;
  }

  .radar-panel {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
