:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #5b6b7f;
  --line: #e2e8f0;
  --bg: #f7f9fc;
  --card: #ffffff;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --teal: #0f766e;
  --shadow: 0 10px 30px rgba(15, 23, 42, .07);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .12);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
svg { display: block; }
.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 72px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; }
.brand-accent { color: var(--brand); }
.header-nav { display: flex; gap: 24px; margin-left: auto; font-size: .92rem; color: var(--ink-soft); }
.header-nav a:hover { color: var(--brand); }
.header-nav .nav-back { color: var(--brand); font-weight: 700; }
.nav-back-mobile { display: none; }
.site-footer a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--brand-dark); }
.header-cta { padding: 9px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .88rem; font-weight: 650; }
.header-cta:hover { background: var(--brand); }

/* HERO */
.hero { position: relative; overflow: hidden; padding: 68px 0 58px; background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 55%, #f0fdfa 100%); }
.hero::after { content:""; position:absolute; width:520px; height:520px; right:-180px; top:-260px; border-radius:50%; background:radial-gradient(circle, rgba(79,70,229,.13), transparent 70%); pointer-events:none; }
.hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 60px; }
.eyebrow { display: inline-block; font-size: .76rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 6px 12px; border-radius: 999px; }
.hero h1 { margin: 18px 0 18px; font-size: clamp(2.2rem, 4.6vw, 3.65rem); font-weight: 850; }
.hero h1 span { color: var(--brand); }
.hero p { max-width: 620px; font-size: 1.08rem; color: var(--ink-soft); }
.hero-points { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.hero-points span { display: flex; align-items: center; gap: 7px; }
.hero-points svg { width: 18px; height: 18px; color: var(--teal); }
.hero-visual { position: relative; height: 300px; display: grid; place-items: center; }
.hero-orbit { position: relative; width: 300px; height: 260px; }
.hero-card { position: absolute; width: 190px; height: 190px; border-radius: 26px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.hero-card span { font-size: .68rem; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.hero-card-back { transform: rotate(-11deg) translate(-40px, 8px); }
.hero-card-front { transform: rotate(8deg) translate(48px, -8px); }
.mini-qr { display: grid; grid-template-columns: repeat(3, 20px); grid-template-rows: repeat(3, 20px); gap: 5px; }
.mini-qr i { background: #e2e8f0; border-radius: 4px; }
.mini-qr.dark i { background: var(--brand); }
.mini-qr.dark i:nth-child(5) { background: #c7d2fe; border-radius: 50%; }

/* TOOL */
.tool-section { padding: 56px 0 30px; }
.section-heading { margin-bottom: 30px; }
.section-heading.center { text-align: center; max-width: 680px; margin: 0 auto 36px; }
.section-heading h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 800; }
.section-heading p { color: var(--ink-soft); margin-top: 10px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 24px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.controls { padding: 6px 26px 24px; }
.control-block { padding: 22px 0; border-bottom: 1px solid var(--line); }
.control-block:last-child { border-bottom: 0; padding-bottom: 4px; }
.block-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.block-title h3 { font-size: 1.02rem; }
.step-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 800; }
.field { margin-bottom: 15px; border: 0; padding: 0; min-width: 0; }
label, legend { display: block; font-size: .85rem; font-weight: 650; color: var(--ink-soft); margin-bottom: 7px; padding: 0; }
.hint { font-weight: 450; color: var(--muted); }
.field input[type="text"] { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field input[type="text"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); background: #fff; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.input-with-icon input { padding-left: 40px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 999px; padding: 6px 11px; font-size: .78rem; font-weight: 600; }
.chip:hover, .chip:focus-visible { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.color-field input[type="color"] { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(15,23,42,.12); border-radius: 7px; }
.color-field span { font-size: .82rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-soft); }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.segmented button { display: grid; place-items: center; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); }
.segmented button svg { width: 22px; height: 22px; fill: currentColor; }
.segmented button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.file-label { display: flex; align-items: center; gap: 8px; width: fit-content; padding: 8px 13px; border: 1px dashed #cbd5e1; border-radius: 10px; color: var(--ink-soft); font-size: .83rem; cursor: pointer; }
.file-label:hover { border-color: var(--brand); color: var(--brand); }
.file-label svg { width: 17px; height: 17px; }
.link-button { border: 0; background: none; color: var(--brand); font-size: .8rem; font-weight: 650; padding: 6px 0; }
.shape-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--muted); font-size: .76rem; font-weight: 650; text-align: center; }
.shape-card svg { width: 38px; height: 38px; }
.shape-card.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.contrast-note { margin-top: 8px; font-size: .78rem; color: var(--teal); font-weight: 600; }
.contrast-note.warn { color: #b45309; }

/* PREVIEW */
.preview-panel { overflow: hidden; position: sticky; top: 92px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; padding: 4px; background: #f1f5f9; border-radius: 10px; }
.tab { border: 0; background: transparent; padding: 7px 18px; border-radius: 8px; font-size: .84rem; font-weight: 650; color: var(--muted); }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15,23,42,.1); }
.live-badge { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); font-weight: 600; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.preview-body { padding: 18px 20px 8px; }
.pane[hidden] { display: none; }
.canvas-wrap { display: grid; place-items: center; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-height: 340px; }
#qrCanvas { width: min(100%, 420px); height: auto; border-radius: 6px; box-shadow: 0 8px 22px rgba(15,23,42,.1); }
.three-wrap { position: relative; min-height: 340px; background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f1f5f9 75%); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: grab; }
.three-wrap:active { cursor: grabbing; }
.three-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.three-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: .85rem; color: var(--muted); }
.preview-caption { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; font-size: .75rem; color: var(--muted); margin-top: 10px; }
.preview-caption svg { width: 15px; height: 15px; }
.download-area { padding: 16px 20px 22px; border-top: 1px solid var(--line); background: #fcfdff; }
.download-label { font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 11px; border: 1px solid var(--line); font-weight: 700; transition: transform .12s, box-shadow .12s, background .12s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { width: 100%; padding: 14px 20px; background: var(--brand); color: #fff; border-color: var(--brand); text-align: left; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 8px 20px rgba(79,70,229,.25); }
.btn-primary strong { display: block; font-size: .95rem; }
.btn-primary small { display: block; font-size: .73rem; font-weight: 500; opacity: .85; }
.btn-secondary { padding: 11px 14px; background: #fff; color: var(--ink-soft); font-size: .84rem; }
.btn-secondary small { font-size: .68rem; font-weight: 500; color: var(--muted); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.download-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.file-note { text-align: center; font-size: .73rem; color: var(--muted); margin-top: 12px; }

/* AD PLACEHOLDERS */
.ad { position: relative; border: 1px dashed #cbd5e1; background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px); color: var(--muted); display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.ad-tag { position: absolute; top: 8px; left: 10px; font-size: .62rem; font-weight: 800; letter-spacing: .12em; color: #475569; border: 1px solid #cbd5e1; padding: 2px 6px; border-radius: 4px; background: #fff; z-index: 1; }
.ad-tag.tiny { position: static; font-size: .55rem; padding: 1px 5px; align-self: flex-start; }
.ad-inner { display: flex; align-items: center; gap: 16px; }
.ad-inner strong { display: block; font-size: .86rem; color: var(--ink-soft); }
.ad-inner small { font-size: .72rem; }
.ad-placeholder-icon { width: 44px; height: 30px; border: 2px solid #cbd5e1; border-radius: 4px; background: #fff; }
.ad-placeholder-icon.square { width: 42px; height: 42px; }
.ad-placeholder-icon.big { width: 70px; height: 50px; margin: 0 auto 14px; }
.ad-horizontal { min-height: 100px; margin-top: 26px; }
.ad-mid { min-height: 200px; margin-top: 54px; }
.ad-corner { position: fixed; right: 16px; bottom: 16px; z-index: 60; width: 180px; min-height: 60px; padding: 10px 12px; border: 1px dashed #cbd5e1; border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; font-size: .68rem; color: var(--muted); }
.ad-corner strong { font-size: .74rem; color: var(--ink-soft); }
.ad-corner-close, .modal-close { position: absolute; top: 3px; right: 8px; border: 0; background: none; font-size: 1.2rem; line-height: 1; color: #94a3b8; }
.ad-corner-close:hover, .modal-close:hover { color: var(--ink); }
.ad-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.ad-modal[hidden] { display: none; }
.ad-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(3px); }
.ad-modal-card { position: relative; width: min(380px, 100%); padding: 26px 22px 22px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; border: 1px dashed #cbd5e1; }
.ad-modal-card .ad-tag { top: 12px; left: 14px; }
.ad-modal-placeholder { padding: 20px 12px 16px; }
.ad-modal-placeholder h3 { font-size: 1.12rem; }
.ad-modal-placeholder p { font-size: .85rem; color: var(--ink-soft); margin: 8px 0; }
.ad-modal-placeholder small { font-size: .7rem; color: var(--muted); }
.modal-action { width: 100%; }

/* CONTENT SECTIONS */
.content-section { padding: 64px 0; }
.content-section.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps, .ideas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step-card { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.step-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); margin-bottom: 16px; }
.step-icon svg { width: 25px; height: 25px; }
.step-kicker { font-size: .72rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--teal); }
.step-card h3 { font-size: 1.15rem; margin: 6px 0 8px; }
.step-card p, .idea-card p { font-size: .9rem; color: var(--ink-soft); }
.ideas-grid { grid-template-columns: repeat(3, 1fr); }
.idea-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.idea-emoji { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); font-size: 1.35rem; margin-bottom: 14px; }
.idea-card h3 { font-size: 1.05rem; margin-bottom: 7px; }

.faq-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 60px; align-items: start; }
.faq-intro h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin: 14px 0; }
.faq-intro > p { color: var(--ink-soft); }
.faq-help { margin-top: 28px; padding: 20px; border-radius: 14px; background: var(--brand-soft); display: flex; flex-direction: column; gap: 4px; font-size: .86rem; }
.faq-help a { color: var(--brand); font-weight: 700; margin-top: 6px; }
.faq-list details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-list details:first-child { border-top: 1px solid var(--line); }
.faq-list summary { cursor: pointer; font-weight: 650; font-size: .98rem; list-style: none; position: relative; padding-right: 30px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 4px; top: 0; font-size: 1.2rem; color: var(--brand); font-weight: 400; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { margin-top: 10px; font-size: .9rem; color: var(--ink-soft); }

.final-cta { padding: 0 0 64px; }
.final-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 34px 40px; border-radius: 20px; background: linear-gradient(120deg, var(--ink), #312e81); color: #fff; box-shadow: var(--shadow-lg); }
.final-inner h2 { font-size: 1.6rem; }
.final-inner p { color: #cbd5e1; margin-top: 6px; }
.btn-link { width: auto; padding: 13px 22px; text-decoration: none; font-size: .9rem; background: #fff; color: var(--brand); border-color: #fff; }
.btn-link:hover { background: var(--brand-soft); }

.site-footer { padding: 26px 0 100px; border-top: 1px solid var(--line); background: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; font-size: .8rem; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 120; padding: 10px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .84rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .header-nav { display: none; }
  .nav-back-mobile { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: auto; border: 1px solid var(--line); border-radius: 10px; color: var(--brand); font-size: 1.1rem; font-weight: 700; }
  .nav-back-mobile:hover { background: var(--brand-soft); }
  .hero-inner { grid-template-columns: 1fr; gap: 20px; }
  .hero-visual { display: none; }
  .tool-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .faq-layout { grid-template-columns: 1fr; gap: 28px; }
  .steps, .ideas-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .container { width: min(100% - 28px, 1180px); }
  .header-inner { height: 62px; gap: 12px; }
  .header-cta { padding: 8px 12px; font-size: .8rem; }
  .hero { padding: 46px 0 40px; }
  .hero h1 { font-size: 2.1rem; }
  .hero-points { gap: 10px 16px; font-size: .82rem; }
  .controls { padding: 4px 18px 20px; }
  .shape-cards { gap: 6px; }
  .shape-card { font-size: .68rem; padding: 10px 3px; }
  .steps, .ideas-grid { grid-template-columns: 1fr; }
  .canvas-wrap, .three-wrap { min-height: 280px; }
  .final-inner { flex-direction: column; align-items: flex-start; padding: 26px; }
  .ad-horizontal, .ad-mid { min-height: 110px; }
  .ad-corner { width: 150px; right: 10px; bottom: 10px; }
  .footer-inner { flex-direction: column; padding-bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
