@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap");

:root {
  --ink: #f5f7ff;
  --muted: #aeb7d5;
  --panel: rgba(20, 27, 54, 0.76);
  --panel-solid: #151c38;
  --line: rgba(255, 255, 255, 0.12);
  --violet: #9c83ff;
  --cyan: #4ce1d2;
  --danger: #ff6f8d;
  --success: #5ae6a8;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(74, 67, 170, 0.25), transparent 28rem),
    linear-gradient(145deg, #090d1c 0%, #0f1530 52%, #090e20 100%);
  font-family: "Vazirmatn", system-ui, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
}
.ambient-one { top: 12%; right: -10rem; background: var(--violet); }
.ambient-two { bottom: -12rem; left: 10%; background: var(--cyan); }

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; direction: ltr; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  color: var(--cyan);
  background: rgba(255,255,255,.05);
}
.site-header nav { display: flex; gap: 28px; color: var(--muted); font-size: .92rem; }
.site-header nav a:hover { color: var(--ink); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
footer { padding: 36px 20px; text-align: center; color: #707a9e; font-size: .82rem; }

.hero {
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
}
.eyebrow {
  display: inline-block;
  color: var(--cyan);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.hero h1, .auth-copy h1, .success-card h1 {
  margin: 16px 0 20px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 1.15;
  letter-spacing: -.045em;
}
.hero h1 em { color: var(--violet); font-style: normal; }
.hero-copy > p, .auth-copy > p, .success-card p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 2;
}
.hero-actions, .form-actions { display: flex; gap: 12px; margin-top: 30px; }
.button {
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: #10152b; background: linear-gradient(135deg, #b8a8ff, var(--cyan)); box-shadow: 0 12px 30px rgba(76,225,210,.14); }
.button.secondary { color: var(--ink); background: rgba(255,255,255,.04); border-color: var(--line); }

.demo-card, .auth-card, .success-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(28,37,73,.9), rgba(13,18,39,.86));
  box-shadow: 0 30px 100px rgba(0,0,0,.35);
  backdrop-filter: blur(18px);
}
.demo-card { width: min(100%, 440px); padding: 26px; justify-self: center; transform: rotate(-1.5deg); direction: ltr; }
.demo-meta, .sequence { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.live-dot { color: var(--success); }
.live-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.mini-grid { margin: 34px auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mini-grid span {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255,255,255,.035);
  font: 300 2.4rem/1 system-ui;
}
.mini-grid span:nth-child(2), .mini-grid span:nth-child(6), .mini-grid span:nth-child(7) { color: var(--cyan); border-color: rgba(76,225,210,.34); }
.sequence { padding-top: 20px; border-top: 1px solid var(--line); }
.sequence b { color: var(--ink); letter-spacing: .28em; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 40px 0 80px; }
.features article { padding: 26px; border-top: 1px solid var(--line); }
.features article > span { color: var(--violet); font-size: .72rem; }
.features h2 { margin: 14px 0 8px; font-size: 1.05rem; }
.features p { margin: 0; color: var(--muted); line-height: 1.8; font-size: .9rem; }

.auth-shell { min-height: 690px; display: grid; grid-template-columns: .8fr 1.2fr; align-items: center; gap: clamp(30px, 7vw, 100px); padding: 30px 0 70px; }
.auth-copy h1 { font-size: clamp(2rem, 4.3vw, 4.2rem); }
.rules { list-style: none; padding: 0; margin: 32px 0 0; color: var(--muted); }
.rules li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rules b { display: inline-block; min-width: 45px; color: var(--cyan); direction: ltr; }
.auth-card { width: min(100%, 560px); justify-self: end; padding: clamp(22px, 4vw, 38px); }
.auth-card label { display: block; margin-bottom: 9px; color: var(--muted); font-size: .86rem; }
.auth-card input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: rgba(5,8,19,.42);
  direction: ltr;
}
.auth-card input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(156,131,255,.12); }
.auth-card input:read-only { opacity: .66; }
.grid-header { margin: 25px 0 14px; display: flex; justify-content: space-between; align-items: end; }
.grid-header span { font-weight: 700; }
.grid-header small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.counter { direction: ltr; color: var(--muted); }
.counter b { color: var(--cyan); }

.shape-palette {
  width: 100%;
  min-height: 250px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 12px;
  border-radius: 24px;
  background: rgba(4,7,17,.35);
}
.shape-palette button {
  min-width: 0;
  aspect-ratio: .82;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: rgba(255,255,255,.045);
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.shape-palette button span { font: 300 clamp(2rem, 4vw, 3.2rem)/1 system-ui; }
.shape-palette button small { color: var(--muted); font-size: .7rem; }
.shape-palette button:hover { color: var(--cyan); border-color: rgba(76,225,210,.4); transform: translateY(-3px); }
.shape-palette button.selected { color: #08121a; border-color: var(--cyan); background: var(--cyan); transform: scale(.94); }
.shape-palette button.selected small { color: #17312e; }

.pattern-grid {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  border-radius: 24px;
  touch-action: none;
  user-select: none;
  background: rgba(4,7,17,.35);
}
.node {
  position: relative;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: rgba(255,255,255,.045);
  cursor: crosshair;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.node span { display: block; font: 300 clamp(2rem, 5vw, 3.2rem)/1 system-ui; pointer-events: none; }
.node:hover { color: var(--cyan); border-color: rgba(76,225,210,.4); }
.node.selected { color: #08121a; border-color: var(--cyan); background: var(--cyan); transform: scale(.94); }
.node.invalid { color: var(--danger); border-color: var(--danger); animation: shake .25s linear; }
.trail { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail polyline { fill: none; stroke: rgba(156,131,255,.72); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.picked { min-height: 50px; margin-top: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); font-size: .78rem; }
.picked b { color: var(--ink); font: 500 1.22rem/1 system-ui; direction: ltr; letter-spacing: .18em; }
.message { min-height: 24px; margin-top: 10px; color: var(--danger); font-size: .82rem; }
.message.success { color: var(--success); }
.message.info { color: var(--cyan); }
.form-actions { margin-top: 10px; }
.form-actions .primary { flex: 1; }

.success-card { max-width: 680px; margin: 80px auto; padding: 60px 36px; text-align: center; }
.success-card h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.success-card p { margin: 0 auto 28px; }
.success-icon { width: 76px; height: 76px; margin: 0 auto 24px; display: grid; place-items: center; border-radius: 50%; color: #0c1d1a; background: var(--success); font-size: 2rem; box-shadow: 0 0 40px rgba(90,230,168,.26); }

@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (max-width: 840px) {
  .hero, .auth-shell { grid-template-columns: 1fr; }
  .hero { padding: 70px 0; }
  .demo-card, .auth-card { justify-self: center; }
  .auth-copy { text-align: center; }
  .auth-copy > p { margin-inline: auto; }
  .features { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .site-header { width: min(100% - 28px, 1180px); padding: 20px 0; }
  .site-header nav { gap: 14px; font-size: .78rem; }
  main { width: min(100% - 24px, 1180px); }
  .hero { min-height: 0; padding-top: 50px; }
  .hero-actions { flex-direction: column; }
  .demo-card { padding: 18px; }
  .auth-shell { padding-top: 35px; }
  .auth-card { padding: 18px; border-radius: 22px; }
  .pattern-grid { gap: 10px; padding: 10px; }
  .shape-palette { min-height: 0; padding: 12px; grid-template-columns: repeat(3, 1fr); }
  .shape-palette button { aspect-ratio: 1; }
  .shape-palette button:last-child { grid-column: 2; }
  .node { border-radius: 16px; }
  .grid-header small { max-width: 230px; }
  .form-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
