:root {
  --paper: #f3f1f7;
  --panel: #fff;
  --ink: #1b1226;
  --muted: #6c6478;
  --line: rgba(27, 18, 38, 0.12);
  --accent: #5b1f9a;
  --accent-2: #7a34c4;
  --hot: #e24a2b;
  --r: 20px;
  --font: "Vazirmatn", Tahoma, system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 20px/1.8 var(--font);
}
a {
  color: inherit;
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(18px, 4vw);
  transition:
    background 0.25s,
    border-color 0.25s;
  border-bottom: 1px solid transparent;
}
.top.solid {
  background: rgba(243, 241, 247, 0.88);
  backdrop-filter: blur(14px);
  border-color: var(--line);
}
.logo {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1px;
}
.logo i {
  font-style: normal;
  color: var(--accent);
}
.top nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 20px;
  font-weight: 600;
}
.top nav a:not(.btn) {
  color: var(--muted);
}
.top nav a:not(.btn):hover {
  color: var(--ink);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}
.btn.dark {
  background: var(--ink);
  color: #fff;
}
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 14px;
}
.btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero {
  position: relative;
  height: 100svh;
  min-height: 620px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ink);
}
.hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-card {
  position: relative;
  background: var(--paper);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 56px);
  width: min(660px, calc(100% - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.hero h1 {
  font-size: clamp(44px, 7vw, 84px);
  line-height: 1.08;
  letter-spacing: -3px;
  margin: 0 0 16px;
  font-weight: 900;
}
.hero p {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 26px;
  max-width: 44ch;
}
.sec {
  padding: clamp(70px, 10vw, 130px) max(20px, 5vw);
  max-width: 1280px;
  margin: auto;
}
.sec h2 {
  font-size: clamp(30px, 4.5vw, 54px);
  line-height: 1.2;
  letter-spacing: -1.5px;
  margin: 0 0 14px;
  font-weight: 800;
}
.lead {
  color: var(--muted);
  max-width: 52ch;
  margin: 0;
}
.paths {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 44px;
}
.path {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 70px;
  min-height: 300px;
  padding: 32px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.2s;
}
.path:hover {
  border-color: var(--ink);
}
.path h3 {
  font-size: 30px;
  margin: 0 0 8px;
  line-height: 1.3;
}
.path p {
  margin: 0;
  color: var(--muted);
}
.path.dark {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.path.dark p {
  color: #bdb3cc;
}
.path .btn {
  align-self: flex-start;
}
.path.dark .btn {
  border-color: #fff;
  color: #fff;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
}
.steps li {
  counter-increment: s;
  border-top: 2px solid var(--ink);
  padding-top: 18px;
}
.steps li::before {
  content: counter(s, persian);
  color: var(--accent);
  font-weight: 800;
  font-size: 24px;
}
.steps h3 {
  margin: 6px 0 6px;
  font-size: 22px;
}
.steps p {
  margin: 0;
  color: var(--muted);
}
.chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 14px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  display: grid;
  gap: 2px;
  font-size: 12px;
  line-height: 1.5;
}
.chips i {
  display: block;
  aspect-ratio: 1.3;
  border-radius: 12px;
  background: var(--c);
  box-shadow:
    inset 0 3px rgba(255, 255, 255, 0.45),
    inset 0 -5px 7px rgba(0, 0, 0, 0.2);
  margin-bottom: 6px;
}
.chips b {
  direction: ltr;
  text-align: right;
}
.chips span {
  color: var(--muted);
  direction: ltr;
  text-align: right;
}
.foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 26px max(20px, 5vw);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.wrap {
  max-width: 1500px;
  margin: auto;
  padding: 92px max(14px, 2.5vw) 40px;
}
.narrow {
  max-width: 1000px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 14px;
  font-weight: 800;
}
.page-title {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.2;
  letter-spacing: -1.5px;
  margin: 0 0 6px;
  font-weight: 900;
}
.sub {
  color: var(--muted);
  margin: 0 0 24px;
}
.builder {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}
.palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.swatch {
  aspect-ratio: 1.15;
  border: 0;
  padding: 0;
  border-radius: 9px;
  background: var(--c);
  cursor: pointer;
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.5),
    inset 0 -3px 5px rgba(0, 0, 0, 0.22);
}
.swatch[aria-pressed="true"] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.current {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
}
.current i,
.dot {
  width: 28px;
  height: 22px;
  border-radius: 7px;
  background: var(--c);
  flex: none;
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.45),
    inset 0 -3px 4px rgba(0, 0, 0, 0.2);
}
.current small {
  display: block;
  color: var(--muted);
  direction: ltr;
  text-align: right;
}
.head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  flex-wrap: wrap;
}
.dims {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.dims input,
.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
.dims input {
  width: 74px;
  text-align: center;
}
.warn {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ffe9e2;
  border: 1px solid #f3b5a3;
  color: #8a2a12;
  font-weight: 700;
}
.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 14px;
}
.tool {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.tool:hover {
  background: #efeaf6;
}
.tool[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.grow {
  flex: 1;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.grid-wrap {
  direction: ltr;
  overflow: auto;
  max-height: calc(100vh - 270px);
  min-height: 360px;
  padding: 14px;
  background: #dcd6e6;
  border-radius: 16px;
}
.grid-wrap canvas {
  display: block;
  margin: 0 auto;
  touch-action: none;
  cursor: crosshair;
}
.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.stat span {
  color: var(--muted);
  font-size: 13px;
}
.stat strong {
  font-size: 22px;
}
.colors {
  display: grid;
  gap: 9px;
  padding-top: 14px;
  max-height: 340px;
  overflow: auto;
}
.color-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.color-row .dot {
  width: 22px;
  height: 16px;
  border-radius: 5px;
}
.color-row small {
  color: var(--muted);
  direction: ltr;
  text-align: right;
}
.drop {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  padding: 34px;
  border: 2px dashed #c2b8d2;
  border-radius: var(--r);
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: #f7f1fd;
}
.drop input {
  display: none;
}
.controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: end;
  margin: 18px 0;
}
.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 14px;
}
.controls .field {
  margin: 0;
}
.field input[type="number"] {
  width: 84px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding-bottom: 10px;
}
.preview {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 22px;
  background: #dcd6e6;
  border-radius: var(--r);
  overflow: auto;
  direction: ltr;
}
.preview canvas {
  max-width: 100%;
  height: auto;
}
.preview .msg {
  color: var(--muted);
  direction: rtl;
}
.stack {
  max-width: 860px;
  margin: auto;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(20px, 4vw, 34px);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 24px;
}
.sum {
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
}
.sum canvas {
  max-width: 180px;
  height: auto;
  background: #dcd6e6;
  border-radius: 12px;
  padding: 8px;
}
.sum dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 24px;
}
.sum dt {
  color: var(--muted);
}
.sum dd {
  margin: 0;
  font-weight: 800;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field.full input,
.field.full textarea {
  width: 100%;
}
.field textarea {
  resize: vertical;
}
.field input:invalid:not(:placeholder-shown) {
  border-color: var(--hot);
}
.err {
  color: #8a2a12;
  background: #ffe9e2;
  border: 1px solid #f3b5a3;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-weight: 600;
}
.ok {
  color: #1b5e2b;
  background: #e5f5e8;
  border: 1px solid #a9d8b3;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .builder {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .builder .summary {
    grid-column: 1/-1;
  }
}
@media (max-width: 850px) {
  .top nav a:not(.btn) {
    display: none;
  }
  .paths,
  .steps {
    grid-template-columns: 1fr;
  }
  .foot {
    flex-direction: column;
  }
}
@media (max-width: 760px) {
  .builder {
    grid-template-columns: 1fr;
  }
  .palette {
    grid-template-columns: repeat(8, 1fr);
  }
  .two {
    grid-template-columns: 1fr;
  }
  .grid-wrap {
    max-height: 62vh;
  }
}

/* نوار ابزار مرتب: گروه‌های هم‌قد و هم‌تراز */
.tools{gap:10px 14px}
.tools .grp{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.tools .grp+.grp{padding-inline-start:14px;border-inline-start:1px solid var(--line)}
.tool{display:inline-flex;align-items:center;justify-content:center;min-height:40px;white-space:nowrap}
.tools .btn.sm{min-height:40px}

/* ===== UI خلاق استودیو ===== */
@keyframes rise{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
@keyframes bob{50%{transform:translateY(-6px)}}
@keyframes scan{from{clip-path:inset(0 0 100% 0)}to{clip-path:inset(0)}}
@keyframes pulse{50%{transform:scale(1.015)}}
@keyframes pop{from{transform:scale(.9);opacity:0}}
.logo i{display:inline-block;animation:bob 2.6s ease-in-out infinite}
.panel,.card{animation:rise .55s cubic-bezier(.2,.7,.2,1) both}
.panel:nth-child(2),.card:nth-child(2){animation-delay:.08s}.panel:nth-child(3),.card:nth-child(3){animation-delay:.16s}
.swatch{transition:transform .15s}
.swatch:hover{transform:scale(1.18) rotate(-4deg)}
.grid-wrap{position:relative}
.ghost{position:absolute;pointer-events:none;z-index:2;border:2px solid var(--accent-2);border-radius:7px;background:var(--c,transparent);opacity:.6;box-shadow:0 0 0 4px rgba(122,52,196,.22)}
.statusbar{display:flex;flex-wrap:wrap;gap:6px 24px;margin-top:10px;font-size:13px;color:var(--muted)}
.statusbar b{color:var(--ink)}
.wristbox{padding:10px;margin-bottom:14px;border-radius:14px;overflow:hidden;background:radial-gradient(circle at 30% 20%,#fff,#e6e0ef)}
.wristbox canvas{display:block;margin:auto}
.h2b{margin-top:4px}
.drop b::before{content:"◆ ◇ ◆ ◇ ◆";display:block;color:var(--accent);letter-spacing:.5em;font-size:14px}
.drop.over{animation:pulse .9s ease-in-out infinite}
#out.reveal{animation:scan 1.2s cubic-bezier(.2,.7,.2,1)}
.ok{animation:pop .5s cubic-bezier(.2,.9,.3,1.3)}
@media(prefers-reduced-motion:reduce){.panel,.card,.logo i{animation:none}}
