:root {
  --bg: #0f1a17;
  --bg-2: #16241f;
  --ink: #e8f0ec;
  --muted: #9bb0a6;
  --accent: #c8f542;
  --accent-2: #3dd6c3;
  --line: rgba(232, 240, 236, 0.12);
  --danger: #ff7a6e;
  --ok: #7dffb3;
  --font: "Instrument Sans", system-ui, sans-serif;
  --display: "Syne", "Instrument Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(61, 214, 195, 0.22), transparent 55%),
    radial-gradient(900px 600px at -10% 20%, rgba(200, 245, 66, 0.12), transparent 50%),
    linear-gradient(160deg, var(--bg), var(--bg-2) 45%, #101c19);
  line-height: 1.5;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.top,
main,
footer {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 6vw;
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-cta {
  color: var(--bg) !important;
  background: var(--accent);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
}

.hero {
  min-height: calc(100vh - 4.5rem);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
  padding: 2rem 6vw 4rem;
  position: relative;
  overflow: hidden;
}

.brand {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  margin: 0 0 0.4rem;
  line-height: 0.95;
  background: linear-gradient(100deg, var(--ink) 20%, var(--accent-2) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.9s ease both;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(1.4rem, 3.2vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
  max-width: 16ch;
  animation: rise 0.9s ease 0.08s both;
}

.lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34ch;
  margin: 0 0 1.6rem;
  animation: rise 0.9s ease 0.16s both;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 0.9s ease 0.24s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  background: var(--accent);
  color: #132019;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.hero-visual {
  position: relative;
  min-height: 320px;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: float 7s ease-in-out infinite;
}

.orb-a {
  width: 220px;
  height: 220px;
  right: 12%;
  top: 10%;
  background: radial-gradient(circle at 30% 30%, var(--accent), transparent 65%);
  opacity: 0.85;
}

.orb-b {
  width: 280px;
  height: 280px;
  left: 8%;
  bottom: 5%;
  background: radial-gradient(circle at 40% 40%, var(--accent-2), transparent 70%);
  opacity: 0.7;
  animation-delay: -2.5s;
}

.grid-lines {
  position: absolute;
  inset: 10% 5%;
  border: 1px solid var(--line);
  background:
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(to bottom, var(--line) 1px, transparent 1px) 0 0 / 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, #000 20%, transparent 75%);
  animation: pulse 5s ease-in-out infinite;
}

.section {
  padding: 4.5rem 6vw;
  border-top: 1px solid var(--line);
}

.section h2 {
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}

.section-lead {
  color: var(--muted);
  margin: 0 0 2rem;
  max-width: 42ch;
}

.services {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2rem;
}

.services h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.services p {
  margin: 0;
  color: var(--muted);
}

.lead-section form {
  max-width: 480px;
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(200, 245, 66, 0.55);
}

.form-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.95rem;
}

.form-status.ok {
  color: var(--ok);
}

.form-status.err {
  color: var(--danger);
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 6vw 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

footer a {
  color: var(--accent-2);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.7;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 1.5rem;
  }

  .hero-visual {
    min-height: 220px;
    order: -1;
  }

  .services {
    grid-template-columns: 1fr;
  }

  .brand {
    font-size: clamp(2.4rem, 14vw, 3.6rem);
  }
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.plan {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.plan h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.price {
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.faq details {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
}

.faq p {
  color: var(--muted);
  margin: 0.5rem 0 0;
}

/* Cabinet */
.sb-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 5vw 3rem;
}

.sb-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.sb-nav button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
}

.sb-nav button.active {
  background: var(--accent);
  color: #132019;
  border-color: transparent;
}

.card-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.thread {
  display: grid;
  gap: 0.5rem;
  max-height: 320px;
  overflow: auto;
  margin: 0.75rem 0;
}

.bubble {
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.bubble.admin {
  border-color: rgba(61, 214, 195, 0.35);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

input, select, textarea, button.btn {
  font: inherit;
}

.muted { color: var(--muted); }

/* Hub / sphere — top-centered spatial nav */
.hub-body {
  overflow-x: hidden;
}

.hub-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 6vw 0.25rem;
}

.hub-stage {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  padding: 0.5rem 4vw 0;
}

.sphere-wrap {
  position: relative;
  width: min(72vw, 440px);
  height: min(72vw, 440px);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.sphere-wrap.grown {
  width: min(86vw, 520px);
  height: min(86vw, 520px);
}

.orb-fallback {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(200, 245, 66, 0.55), transparent 42%),
    radial-gradient(circle at 70% 65%, rgba(61, 214, 195, 0.35), transparent 50%),
    radial-gradient(circle at 50% 50%, #2a9f90, #0f2a24 70%);
  box-shadow:
    0 0 60px rgba(61, 214, 195, 0.35),
    inset 0 -20px 40px rgba(0, 0, 0, 0.35);
  z-index: 0;
  animation: orbPulse 4.5s ease-in-out infinite;
}

.sphere-wrap.has-webgl .orb-fallback {
  opacity: 0;
  pointer-events: none;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .orb-fallback { animation: none; }
}

#sphere {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 12px 48px rgba(61, 214, 195, 0.28));
  border-radius: 50%;
}

.sphere-hint {
  position: absolute;
  left: 50%;
  bottom: -0.15rem;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.85;
}

.sphere-wrap.grown .sphere-hint {
  opacity: 0;
}

.sphere-labels {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.sphere-labels button {
  pointer-events: auto;
  position: absolute;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  min-height: 44px;
  min-width: 44px;
  background: rgba(232, 240, 236, 0.14);
  border: 1px solid rgba(232, 240, 236, 0.22);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  transition: transform 0.22s ease, color 0.2s, background 0.2s, box-shadow 0.22s;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  z-index: 6;
}

.sphere-wrap.grown .sphere-labels button {
  font-size: 0.92rem;
  transform: scale(1.04);
}

.sphere-labels button:hover,
.sphere-labels button:focus-visible {
  color: #132019;
  background: var(--accent);
  border-color: transparent;
  outline: none;
  transform: scale(1.06);
}

.sphere-labels button.on {
  color: #132019;
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 10px 32px rgba(200, 245, 66, 0.28);
}

.sphere-labels button:nth-child(1) { top: -0.35rem; left: 50%; transform: translateX(-50%); }
.sphere-labels button:nth-child(2) { top: 26%; right: -1.25rem; }
.sphere-labels button:nth-child(3) { bottom: 12%; right: 0.25rem; }
.sphere-labels button:nth-child(4) { bottom: -0.35rem; left: 50%; transform: translateX(-50%); }
.sphere-labels button:nth-child(5) { top: 26%; left: -1.25rem; }

.sphere-labels button.on:nth-child(1),
.sphere-labels button:hover:nth-child(1),
.sphere-labels button:focus-visible:nth-child(1),
.sphere-labels button.on:nth-child(4),
.sphere-labels button:hover:nth-child(4),
.sphere-labels button:focus-visible:nth-child(4) {
  transform: translateX(-50%) scale(1.06);
}

.hub-main {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 6vw 5rem;
  text-align: center;
}

.hub-panel {
  display: none;
  animation: fadeUp 0.4s ease;
}

.hub-panel.active { display: block; }

.hub-panel h1,
.hub-panel h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.section-lead {
  color: var(--muted);
  margin: 0 auto 1.25rem;
  max-width: 38ch;
}

.about-list {
  margin: 0 auto;
  padding-left: 1.1rem;
  color: var(--muted);
  text-align: left;
  max-width: 36ch;
}

.about-list li { margin: 0.4rem 0; }

.hub-main .plans-grid,
.hub-main .faq {
  text-align: left;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-panel { animation: none; }
  .sphere-wrap,
  .sphere-labels button { transition: none; }
}

/* Modal auth */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 14, 12, 0.72);
  display: grid;
  place-items: center;
  padding: 1rem;
  backdrop-filter: blur(6px);
}

.modal[hidden] { display: none !important; }

.modal-card {
  width: min(420px, 100%);
  background: linear-gradient(160deg, #16241f, #101c19);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.35rem 1.5rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: left;
}

.auth-form input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  min-height: 44px;
}

.form-status { min-height: 1.25rem; font-size: 0.9rem; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }

body.modal-open { overflow: hidden; }

@media (max-width: 640px) {
  .sphere-wrap {
    width: min(92vw, 360px);
    height: min(92vw, 360px);
  }
  .sphere-wrap.grown {
    width: min(96vw, 400px);
    height: min(96vw, 400px);
  }
  .sphere-labels button {
    font-size: 0.72rem;
    padding: 0.45rem 0.7rem;
  }
  .sphere-labels button:nth-child(2) { right: -4%; }
  .sphere-labels button:nth-child(5) { left: -4%; }
  .hub-main { padding: 1.5rem 5vw 4rem; }
}
