/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #16181d;
  --ink-2: #4a4e57;
  --muted: #7c808a;
  --line: #e6e2d9;
  --line-2: #d8d3c7;
  --accent: #ef5b25;
  --accent-ink: #c2410c;
  --accent-soft: #fff0e8;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c8202f;
  --radius: 18px;
  --radius-s: 11px;
  --shadow: 0 1px 2px rgba(22,24,29,.05), 0 12px 32px -12px rgba(22,24,29,.14);
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Space Grotesk", "Manrope", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--ink); color: #fff; z-index: 9999; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.muted { color: var(--muted); font-weight: 500; }
.mobile-only { display: none; }
[hidden] { display: none !important; }

/* =============================================================
   4. Header & hero
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: rgba(246,244,239,.9); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.logo-mark { width: 28px; height: 28px; }
.nav { display: flex; gap: 22px; font-size: .92rem; font-weight: 600; color: var(--ink-2); }
.nav a { text-decoration: none; }
.nav a:hover { color: var(--accent-ink); }

.hero { padding: 22px 16px 16px; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 4.6vw, 2.9rem); }
.hero .sub { margin-top: 8px; color: var(--ink-2); max-width: 720px; font-size: clamp(.95rem, 1.6vw, 1.08rem); }

/* =============================================================
   5. Tool card
   ============================================================= */
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); padding: 12px; }
.noscript { padding: 16px; background: var(--accent-soft); border-radius: var(--radius-s); margin-bottom: 12px; }
.tool-grid {
  display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "content" "preview" "design" "obj";
}
.p-content { grid-area: content; }
.p-preview { grid-area: preview; }
.p-design { grid-area: design; }
.p-3d { grid-area: obj; }

.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 12px; }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .82rem; font-weight: 800; }
.label { font-size: .84rem; font-weight: 700; color: var(--ink-2); margin: 14px 0 7px; }
.label:first-of-type { margin-top: 0; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 8px; }
.err { margin-top: 10px; font-size: .88rem; font-weight: 700; color: var(--bad); }

/* tabs */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: #efece5; border-radius: 12px; margin-bottom: 12px; }
.tab { padding: 8px 6px; border-radius: 9px; font-size: .88rem; font-weight: 700; color: var(--ink-2); transition: background .2s, color .2s; white-space: nowrap; }
.tab.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* fields */
.field { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; font-weight: 700; color: var(--ink-2); min-width: 0; }
.field input[type=text], .field input[type=url], .field select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s);
  background: var(--surface); font-size: 1rem; font-weight: 500; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,91,37,.16); }
#in-url { font-size: 1.02rem; padding: 14px; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; margin-top: 10px; }
.field-inline input { max-width: 90px; text-align: center; padding: 8px 10px !important; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
.pane .row2:first-child { margin-top: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--ink-2); align-self: end; padding-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.range output { float: right; font-weight: 800; color: var(--ink); }
.range input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 6px 12px; border: 1.5px solid var(--line-2); border-radius: 99px; font-size: .84rem; font-weight: 700; background: var(--surface); transition: border-color .2s, background .2s; }
.chip.is-on { border-color: var(--ink); background: var(--ink); color: #fff; }

/* styles */
.styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-opt { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px 8px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); font-size: .76rem; font-weight: 700; transition: border-color .2s, box-shadow .2s; }
.style-opt svg { width: 30px; height: 30px; fill: var(--ink); }
.style-opt.is-on, .fmt.is-on, .seg-opt.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239,91,37,.14); }

/* colors */
.colors { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 14px; position: relative; }
.color-group .label { margin-top: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.15); position: relative; transition: transform .15s; }
.sw:hover { transform: scale(1.08); }
.sw.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.sw-custom { overflow: hidden; background: conic-gradient(#f33, #fd3, #3d6, #3be, #63f, #f3c, #f33); }
.sw-custom input { position: absolute; inset: -8px; width: 46px; height: 46px; opacity: 0; cursor: pointer; }
.swap { grid-column: 1 / -1; justify-self: start; order: 3; margin-top: 8px; padding: 5px 12px; border-radius: 99px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.swap:hover { border-color: var(--accent); }

/* segmented */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-opt { padding: 9px 6px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); font-size: .86rem; font-weight: 700; }
.emoji-grid, .emoji-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.emoji-row { margin-top: 0; }
.emo { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 1.2rem; line-height: 1; display: grid; place-items: center; }
.emo.is-on { border-color: var(--accent); background: var(--accent-soft); }
.emo-none { font-size: .7rem; font-weight: 800; color: var(--muted); }
.emoji-row .emo { width: 34px; height: 34px; font-size: 1.05rem; }
.upload { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 14px; border: 1.5px dashed var(--line-2); border-radius: var(--radius-s); background: var(--surface); font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.upload:hover { border-color: var(--accent); }
.upload input { width: 0; height: 0; opacity: 0; position: absolute; }
.upload::before { content: "⬆"; display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; }

/* formats */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fmt { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.fmt svg { width: 46px; height: 34px; color: var(--ink); margin-bottom: 4px; }
.fmt strong { font-size: .84rem; line-height: 1.2; }
.fmt span { font-size: .72rem; color: var(--muted); font-weight: 600; line-height: 1.25; }

/* checks */
.checks { list-style: none; padding: 0; margin-top: 14px; display: grid; gap: 6px; }
.checks li { display: flex; gap: 9px; align-items: flex-start; font-size: .84rem; line-height: 1.4; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.checks li::before { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: #fff; margin-top: 1px; }
.checks li.ok::before { content: "✓"; background: var(--ok); }
.checks li.warn::before { content: "!"; background: var(--warn); }
.checks li.bad::before { content: "✕"; background: var(--bad); }
.checks li.bad { border-color: rgba(200,32,47,.35); background: #fff5f5; }
.checks li.info::before { content: "i"; background: var(--ink-2); }

/* preview */
.p-preview { display: flex; flex-direction: column; gap: 10px; }
.pv-3d { position: relative; height: 290px; border-radius: 14px; overflow: hidden; background: radial-gradient(120% 90% at 50% 20%, #ffffff 0%, #ece8df 70%, #e2ddd2 100%); border: 1px solid var(--line); touch-action: none; }
.viewer { position: absolute; inset: 0; cursor: grab; }
.viewer:active { cursor: grabbing; }
.viewer canvas { width: 100% !important; height: 100% !important; }
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; font-size: .9rem; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.pv-3d[data-state=ready] .viewer-msg { display: none; }
.pv-3d[data-state=busy] .viewer-msg { display: grid; place-items: end center; padding-bottom: 38px; }
.viewer-tag { position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.85); font-size: .72rem; font-weight: 700; color: var(--ink-2); pointer-events: none; }
.dims { font-size: .84rem; font-weight: 700; color: var(--ink-2); text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; font-weight: 800; transition: transform .15s var(--ease-out), background .2s, box-shadow .2s; }
.btn:active { transform: translateY(1px); }
.btn-primary { width: 100%; padding: 15px 18px; background: var(--accent); color: #fff; font-size: 1.02rem; box-shadow: 0 8px 20px -8px rgba(239,91,37,.7); }
.btn-primary:hover { background: #e14d17; }
.btn-primary svg { width: 22px; height: 22px; }
.btn-primary small { font-size: .72rem; font-weight: 800; background: rgba(255,255,255,.22); padding: 2px 7px; border-radius: 99px; }
.btn-primary[aria-busy=true] { opacity: .75; pointer-events: none; }
.btn-ghost { padding: 10px 16px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: .9rem; }
.btn-ghost:hover { border-color: var(--ink); }
.link-btn { font-size: .84rem; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; align-self: center; }
.link-btn:hover { color: var(--accent-ink); }

.pv-2d { display: flex; gap: 14px; align-items: center; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.qr-box { flex: none; width: 128px; height: 128px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.qr-box canvas { width: 100% !important; height: 100% !important; }
.pv-2d-side { min-width: 0; }
.small-title { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 8px; }
.demo-note { font-size: .78rem; font-weight: 800; color: var(--accent-ink); margin-bottom: 4px; }
.btn-row { display: flex; gap: 8px; }

.privacy { margin: 14px 4px 0; font-size: .88rem; color: var(--ink-2); }

/* =============================================================
   6. Ads (placeholders)
   ============================================================= */
.ad-slot { display: grid; place-items: center; border: 1.5px dashed #c9c3b5; border-radius: 12px; background: repeating-linear-gradient(45deg, #f1eee7, #f1eee7 10px, #ece8df 10px, #ece8df 20px); color: #9a9486; font-size: .78rem; font-weight: 800; letter-spacing: .18em; }
.ad-leaderboard { min-height: 100px; margin: 28px auto 0; max-width: 970px; }
.ad-incontent { min-height: 250px; margin: 8px auto 0; max-width: 970px; }
.ad-rect { width: 300px; max-width: 100%; height: 250px; margin: 12px auto; }

.ad-pop { border: 0; border-radius: 18px; padding: 22px 20px 18px; width: min(360px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); text-align: center; color: var(--ink); background: var(--surface); }
.ad-pop::backdrop { background: rgba(22,24,29,.5); }
.ad-pop[open] { animation: popIn .35s var(--ease-out); }
.ad-pop-title { font-weight: 800; color: var(--ok); }
.ad-pop-x { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border-radius: 50%; font-size: 1.5rem; line-height: 1; color: var(--ink-2); }
.ad-pop-x:hover { background: var(--bg); }
.ad-pop-close { width: 100%; }

.ad-toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 300px; max-width: calc(100vw - 32px); height: 96px; display: grid; place-items: center; border-radius: 14px; border: 1.5px dashed #c9c3b5; background: repeating-linear-gradient(45deg, #faf8f3, #faf8f3 10px, #f1eee7 10px, #f1eee7 20px); color: #9a9486; font-size: .78rem; font-weight: 800; letter-spacing: .18em; box-shadow: 0 16px 40px -14px rgba(0,0,0,.35); animation: toastIn .45s var(--ease-out); }
.ad-toast-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--ink-2); font-size: 1.1rem; line-height: 1; letter-spacing: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding-top: 56px; }
.section-title { font-family: var(--display); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; margin-bottom: 20px; }
.steps { list-style: none; padding: 0; display: grid; gap: 14px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 12px; }
.step-ico svg { width: 24px; height: 24px; }
.step h3 { font-size: 1.08rem; margin-bottom: 6px; }
.step p, .idea p, .tip p { color: var(--ink-2); font-size: .95rem; }

.ideas { display: grid; gap: 12px; grid-template-columns: 1fr; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.idea-emo { font-size: 1.7rem; display: block; margin-bottom: 6px; }
.idea h3 { font-size: 1.04rem; margin-bottom: 4px; }

.tips { display: grid; gap: 12px; margin-bottom: 18px; }
.tip { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 14px 18px; }
.tip h3 { font-size: 1rem; margin-bottom: 4px; }
.prose > p { color: var(--ink-2); max-width: 820px; }

.faq { display: grid; gap: 8px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 18px; }
.faq summary { cursor: pointer; padding: 15px 28px 15px 0; font-weight: 700; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 1.3rem; font-weight: 600; color: var(--accent-ink); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 16px; color: var(--ink-2); }

.site-footer { margin-top: 64px; border-top: 1px solid var(--line); padding: 28px 0 90px; font-size: .88rem; color: var(--ink-2); }
.footer-inner { display: grid; gap: 8px; }
.footer-inner a { text-underline-offset: 3px; }

/* legal pages */
.legal { max-width: 760px; padding-top: 32px; }
.legal h1 { font-family: var(--display); font-size: 2rem; margin-bottom: 16px; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 8px; }
.legal p, .legal li { color: var(--ink-2); margin-bottom: 8px; }
.todo { background: #fff6d6; padding: 0 4px; border-radius: 4px; }

/* =============================================================
   8. Effects
   ============================================================= */
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } }

/* =============================================================
   9. Responsive
   ============================================================= */
@media (max-width: 539px) {
  .nav { gap: 14px; font-size: .84rem; }
  .nav a:first-child { display: none; }
  .mobile-only { display: flex; margin-top: 14px; }
  .panel { padding: 14px; }
  .tool-card { padding: 8px; border-radius: var(--radius); }
  .ad-toast { left: 16px; right: 16px; width: auto; height: 72px; bottom: 12px; }
}
@media (min-width: 540px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .colors { grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .ideas { grid-template-columns: 1fr 1fr; }
  .pv-3d { height: 330px; }
  .qr-box { width: 140px; height: 140px; }
}
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .tips { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .hero { padding: 34px 16px 22px; }
  .tool-card { padding: 16px; }
  .tool-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    grid-template-areas: "content preview" "design preview" "obj preview";
    align-items: start;
  }
  .p-preview { grid-row: 1 / span 3; position: sticky; top: 16px; }
  .pv-3d { height: 400px; }
  .ideas { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 1fr auto; align-items: center; }
  .footer-inner .muted { grid-column: 1 / -1; }
}
@media (min-width: 1280px) {
  .pv-3d { height: 440px; }
}

/* =============================================================
   10. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-toast { animation: none; }
}
