:root {
  --bg: #08111f;
  --bg-accent: #13233f;
  --panel: rgba(9, 18, 34, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #9eb0c7;
  --accent: #9effd2;
  --accent-strong: #42f5b9;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(66, 245, 185, 0.18), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(111, 176, 255, 0.18), transparent 28%),
    linear-gradient(135deg, var(--bg), #050914 56%, var(--bg-accent));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
}

.page-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.topbar-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-width: 0;
  flex: 1;
}

.headline-block {
  min-width: 0;
}

.headline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.7rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.lead-inline {
  margin: 0;
  max-width: 40ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.menu-button,
.icon-button,
.ghost-button,
.primary-button,
.sidebar-backdrop,
.chip {
  border: 0;
  cursor: pointer;
}

.menu-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.menu-button {
  gap: 4px;
  flex-direction: column;
  flex-shrink: 0;
}

.menu-button span,
.icon-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.icon-button {
  position: relative;
  flex-shrink: 0;
}

.icon-button span:first-child {
  position: absolute;
  transform: rotate(45deg);
}

.icon-button span:last-child {
  position: absolute;
  transform: rotate(-45deg);
}

.ghost-button,
.primary-button,
.chip {
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  text-align: center;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #041019;
  font-weight: 700;
}

.ghost-button:hover,
.primary-button:hover,
.chip:hover,
.menu-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.canvas-panel {
  min-width: 0;
}

.canvas-frame,
.composer-panel,
.sidebar,
.stats-strip article,
.control-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.canvas-frame {
  position: relative;
  overflow: hidden;
  min-height: 620px;
}

#particleCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 620px;
}

.canvas-overlay {
  position: absolute;
  inset: auto 18px 18px auto;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(3, 8, 16, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-overlay p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.composer-panel {
  margin-top: 18px;
  padding: 18px 20px 20px;
}

.composer-label,
label {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

input[type="text"],
select,
input[type="range"] {
  width: 100%;
  margin-top: 8px;
}

input[type="text"],
select {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 13px 14px;
}

input[type="range"] {
  accent-color: var(--accent-strong);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.chip {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  z-index: 30;
  padding: 20px;
  transform: translateX(calc(-100% - 24px));
  transition: transform 220ms ease;
  overflow-y: auto;
  border-radius: 28px;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(2, 6, 14, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.stats-strip {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-strip article {
  padding: 14px 16px;
}

.stats-strip strong {
  display: block;
  margin-bottom: 4px;
  text-transform: capitalize;
}

.stats-strip span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.control-card {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.control-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

@media (max-width: 920px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-actions,
  .headline-row {
    width: 100%;
  }

  .lead-inline {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 18px;
  }

  .topbar-actions,
  .headline-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .canvas-frame,
  #particleCanvas {
    min-height: 460px;
  }

  .sidebar {
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-width: none;
  }
}
