:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d1b19;
  --ink-soft: #5c5853;
  --line: #e7e3dc;
  --accent: #2f4a6d;
  --accent-soft: #e9eef5;
  --radius: 14px;
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; overflow: hidden;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.nav-links { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink-soft); text-decoration: none; font-size: 15px; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-toggle { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--ink); }

/* Hero */
.hero { padding: 72px 0 56px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.1; margin: 16px 0; letter-spacing: -0.02em; }
.hero p.lead { font-size: 18px; color: var(--ink-soft); margin: 0 0 28px; max-width: 34em; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; text-decoration: none;
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 15px;
}
.btn:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero visual: animated phone demo */
.hero { overflow: hidden; }
.hero-visual { position: relative; display: flex; justify-content: center; padding: 20px 0; }
.glow { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .55; z-index: 0; animation: float 9s ease-in-out infinite; }
.glow-a { width: 300px; height: 300px; background: #c9d6ff; top: 0; left: 6%; }
.glow-b { width: 260px; height: 260px; background: #ffd9c2; bottom: 0; right: 4%; animation-delay: -4s; }

.phone {
  position: relative; z-index: 1;
  width: 300px; background: #fff; border-radius: 44px; padding: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 0 0 7px #1d1b19, 0 30px 70px rgba(29, 27, 25, .22);
  display: flex; flex-direction: column; gap: 8px;
}
.phone-status { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px 0; font-size: 12px; font-weight: 600; height: 24px; }
.island { width: 84px; height: 22px; background: #1d1b19; border-radius: 20px; }
.status-icons { display: flex; gap: 5px; align-items: center; }
.status-icons svg { fill: currentColor; }

.phone-toolbar { display: flex; align-items: center; gap: 6px; padding: 2px 6px; }
.tb-title { flex: 1; text-align: center; font-size: 13px; font-weight: 600; }
.tb-btn { width: 30px; height: 30px; border-radius: 10px; background: #f3f1ec; display: grid; place-items: center; }
.tb-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-primary { background: var(--accent); }
.tb-primary svg { stroke: #fff; }

.phone-canvas {
  position: relative; border-radius: 26px; aspect-ratio: 1 / 1.05; overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, #fffdf8 0%, #f3efe6 70%),
    #f3efe6;
}
.phone-canvas::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(29, 27, 25, .09) 1px, transparent 1px);
  background-size: 14px 14px;
}
#sketch { position: relative; width: 100%; height: 100%; padding: 14px 10px 30px; }
.canvas-pill {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 4px 12px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #e5534b; animation: pulse 1.6s infinite; }

/* pencil draw-in */
#sketch .part.draw path, #sketch .part.draw circle, #sketch .part.draw ellipse, #sketch .part.draw rect {
  stroke-dasharray: 1; animation: draw 1s cubic-bezier(.6, 0, .3, 1) both;
}
#sketch .part.draw > *:nth-child(2) { animation-delay: .12s; }
#sketch .part.draw > *:nth-child(3) { animation-delay: .24s; }
#sketch .part.draw > *:nth-child(n+4) { animation-delay: .34s; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  background: #f3f1ec; color: var(--ink-soft); transition: background .3s, color .3s;
}
.chip.active { background: var(--ink); color: #fff; }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 4px 8px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 14px; background: #f7f5f0;
  border: 2px solid transparent; display: grid; place-items: center; overflow: hidden;
  transition: border-color .25s, transform .25s; animation: thumbIn .35s ease both;
}
.thumb:nth-child(2) { animation-delay: .05s; }
.thumb:nth-child(3) { animation-delay: .1s; }
.thumb:nth-child(4) { animation-delay: .15s; }
.thumb svg { width: 86%; height: 86%; }
.thumb-none { font-size: 20px; color: #b8b2a7; }
.thumb.active { border-color: var(--accent); background: #fff; }
.thumb.tap { animation: tap .45s ease; }
.thumb.tap::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(47, 74, 109, .35); animation: ripple .6s ease-out forwards;
}

.float-card {
  position: absolute; z-index: 2; display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 227, 220, .9); border-radius: 16px; padding: 10px 14px;
  box-shadow: 0 12px 30px rgba(29, 27, 25, .1); animation: float 6s ease-in-out infinite;
}
.float-card strong { display: block; font-size: 14px; line-height: 1.2; }
.float-card small { color: var(--ink-soft); font-size: 12px; }
.fc-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fc-icon-dark { background: var(--ink); color: #fff; }
.fc-parts { top: 18%; left: -2%; }
.fc-export { bottom: 22%; right: -4%; animation-delay: -2s; }
.fc-stack { bottom: 3%; left: -10%; animation-delay: -4s; gap: 0; padding: 8px 12px; }
.fc-stack small { margin-left: 8px; font-weight: 600; color: var(--ink); }
.avatar { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; margin-left: -6px; background: #e8e2d6 center/70% no-repeat; }
.avatar:first-child { margin-left: 0; background-color: #dbe4f3; }
.avatar:nth-child(2) { background-color: #f6dccb; }
.avatar:nth-child(3) { background-color: #e3ead9; }
.avatar { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2326231f' stroke-width='1.4' stroke-linecap='round'%3E%3Cellipse cx='10' cy='10' rx='6' ry='7.5'/%3E%3Cpath d='M7.5 9h.01M12.5 9h.01M8 13c1.2 1 2.8 1 4 0'/%3E%3C/svg%3E"); }

@keyframes draw { from { stroke-dashoffset: 1; fill-opacity: 0; } 55% { fill-opacity: 0; } to { stroke-dashoffset: 0; fill-opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 83, 75, .5); } 100% { box-shadow: 0 0 0 8px rgba(229, 83, 75, 0); } }
@keyframes thumbIn { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes tap { 40% { transform: scale(.92); } 100% { transform: scale(1); } }
@keyframes ripple { from { transform: scale(0); opacity: 1; } to { transform: scale(6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .glow, .float-card, .live-dot { animation: none; }
}

/* Sections */
section { padding: 56px 0; }
.section-title { font-size: 30px; margin: 0 0 8px; letter-spacing: -0.01em; }
.section-sub { color: var(--ink-soft); margin: 0 0 32px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin: 10px 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.card .icon { font-size: 26px; }

.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step { position: relative; padding-top: 44px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.step h3 { margin: 0 0 6px; font-size: 18px; }
.step p { margin: 0; color: var(--ink-soft); }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--ink-soft); }

.cta { background: var(--accent); color: #fff; border-radius: 22px; padding: 44px 32px; text-align: center; }
.cta h2 { margin: 0 0 8px; font-size: 28px; }
.cta p { margin: 0 0 22px; opacity: .85; }
.cta .btn { background: #fff; color: var(--ink); }

/* Legal pages */
.legal { padding: 48px 0 72px; }
.legal .container { max-width: 820px; }
.legal h1 { font-size: 38px; margin: 0 0 6px; letter-spacing: -0.02em; }
.legal .meta { color: var(--ink-soft); margin: 0 0 28px; font-size: 15px; }
.legal h2 { font-size: 22px; margin: 36px 0 10px; padding-top: 8px; }
.legal h3 { font-size: 17px; margin: 22px 0 6px; }
.legal p, .legal li { color: #34312d; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px; }
.toc strong { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.toc a { text-decoration: none; }
.note { background: var(--accent-soft); border-radius: 12px; padding: 14px 18px; }
.legal table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.legal th, .legal td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
.legal th { background: var(--surface); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--ink-soft); font-size: 14px; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

.to-top {
  position: fixed; right: 18px; bottom: 18px;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 18px; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; }

@media (max-width: 820px) {
  .hero-grid, .features, .steps { grid-template-columns: 1fr; }
  .hero { padding-top: 44px; }
  .fc-parts { left: 0; }
  .fc-export { right: 0; }
  .fc-stack { display: none; }
  .toc ol { columns: 1; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 14px 20px; }
}

@media (max-width: 520px) {
  .float-card { display: none; }
  .phone { width: 280px; }
}

/* Developer home: brand, apps list */
.brand-icon { font-size: 13px; letter-spacing: .02em; }
.featured-tag {
  position: absolute; z-index: 3; top: -6px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.hero-visual { padding-top: 34px; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.app-card h3 { margin: 0; font-size: 19px; }
.app-card p { margin: 0; color: var(--ink-soft); font-size: 15px; flex: 1; }
.app-head { display: flex; gap: 14px; align-items: center; }
.app-icon {
  flex: none; width: 60px; height: 60px; border-radius: 15px; overflow: hidden;
  background: linear-gradient(145deg, #3c5c86, #22364f); color: #fff; font-size: 26px;
  display: grid; place-items: center;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-cat { font-size: 13px; color: var(--ink-soft); }
.app-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.app-links a:not(.btn) { text-decoration: none; }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.app-card-soon { border-style: dashed; background: transparent; align-items: flex-start; justify-content: center; }
.app-icon-soon { background: var(--accent-soft); color: var(--accent); }
