/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --ink: #14161B;
  --ink-2: #4A4F5C;
  --ink-3: #7B8090;
  --line: #E4E2DB;
  --line-2: #D3D0C7;
  --accent: #F2511B;
  --accent-ink: #C23E0F;
  --accent-soft: #FFE9DF;
  --ok: #18794E;
  --warn: #A35200;
  --bad: #C0262D;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(20,22,27,.05), 0 8px 28px -12px rgba(20,22,27,.16);
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --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; 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, textarea { 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: min(1200px, 100% - 32px); margin-inline: auto; }
.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; }

/* =============================================================
   4. Header / hero
   ============================================================= */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--display); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.logo b { color: var(--accent); font-weight: 700; }
.header-nav { display: none; gap: 22px; font-size: .92rem; font-weight: 600; color: var(--ink-2); }
.header-nav a { text-decoration: none; }
.header-nav a:hover { color: var(--ink); }

.hero { padding: 22px 0 14px; }
.hero h1 { font-family: var(--display); font-size: clamp(1.55rem, 1.1rem + 2.4vw, 2.6rem); font-weight: 700; }
.hero-sub { margin-top: 8px; color: var(--ink-2); max-width: 760px; font-size: clamp(.93rem, .88rem + .3vw, 1.05rem); }

/* =============================================================
   5. Tool
   ============================================================= */
.tool {
  display: grid; gap: 14px;
  grid-template-areas: "content" "preview" "design" "object";
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel-content { grid-area: content; }
.panel-preview { grid-area: preview; }
.panel-design { grid-area: design; }
.panel-object { grid-area: object; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.noscript { padding: 14px; background: var(--accent-soft); border-radius: var(--radius-s); }

.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.tab { padding: 6px 16px; border-radius: 999px; font-weight: 700; font-size: .9rem; color: var(--ink-2); transition: background .2s var(--ease-out), color .2s; }
.tab.is-active { background: var(--ink); color: #fff; }
.mode { display: none; }
.mode.is-active { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: .84rem; font-weight: 600; background: var(--surface); transition: border-color .2s, background .2s; }
.chip:hover { border-color: var(--ink-3); }
.chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }

.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: .84rem; font-weight: 700; margin-bottom: 5px; color: var(--ink-2); }
.field small, .group-label small { font-weight: 500; color: var(--ink-3); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s);
  background: #fff; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,22,27,.08); }
#inUrl { font-size: 17px; padding: 14px 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; padding-top: 24px; }
.hint { font-size: .83rem; color: var(--ink-3); line-height: 1.45; }
.hint:empty { display: none; }
.grid-2 { display: grid; gap: 10px; grid-template-columns: 1fr; }

/* --- preview --- */
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-2d, .qr-3d { position: relative; min-width: 0; }
.qr-box { aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; padding: 6px; }
.qr-box canvas, .qr-box svg { width: 100% !important; height: 100% !important; object-fit: contain; }
.tool.is-sample .qr-box { opacity: .55; }
.sample-badge { display: none; position: absolute; top: 8px; left: 8px; right: 8px; text-align: center; font-size: .72rem; font-weight: 700; background: rgba(20,22,27,.82); color: #fff; padding: 4px 8px; border-radius: 999px; }
.tool.is-sample .sample-badge { display: block; }
.dl-row { display: flex; gap: 6px; margin-top: 8px; }
.dl-row .btn { flex: 1; white-space: nowrap; padding: 9px 6px; }
.viewer { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(120% 90% at 50% 15%, #FFFFFF 0%, #ECEAE4 70%, #E2DFD7 100%); touch-action: none; 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; text-align: center; padding: 14px; font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.viewer-msg[hidden] { display: none; }
.viewer-hint { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: .7rem; color: var(--ink-3); pointer-events: none; }
.dims { margin-top: 8px; font-size: .8rem; color: var(--ink-2); text-align: center; font-weight: 600; min-height: 2.4em; line-height: 1.3; }

.dl-3d { margin-top: 14px; display: grid; gap: 6px; justify-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: .92rem; transition: transform .15s var(--ease-out), background .2s, border-color .2s, box-shadow .2s; }
.btn:active { transform: translateY(1px); }
.btn-ghost { border: 1.5px solid var(--line-2); background: #fff; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(242,81,27,.7); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-big { width: 100%; padding: 15px 18px; font-size: 1.05rem; border-radius: 14px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-file { cursor: pointer; }
.link-btn { font-size: .85rem; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.link-btn:hover { color: var(--ink); }
.status { font-size: .84rem; min-height: 1.3em; color: var(--ink-2); text-align: center; }
.status.is-error { color: var(--bad); font-weight: 600; }

/* --- design --- */
.group { margin-bottom: 16px; }
.group:last-child { margin-bottom: 0; }
.group-label { display: block; font-size: .84rem; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; }
.palettes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pal { display: flex; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); padding: 0; transition: border-color .2s, transform .15s; }
.pal i { width: 20px; height: 30px; display: block; }
.pal:hover { transform: translateY(-1px); }
.pal.is-active { border-color: var(--ink); }
.color-field { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); padding: 7px 10px; font-size: .88rem; font-weight: 600; cursor: pointer; background: #fff; }
.color-field input { width: 34px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.styles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.style-btn { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border: 1.5px solid var(--line-2); border-radius: var(--radius-s); font-size: .72rem; font-weight: 700; background: #fff; }
.style-btn svg { width: 28px; height: 28px; fill: currentColor; }
.style-btn.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }

/* --- object --- */
.formats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.fmt { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 10px 6px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; transition: border-color .2s, background .2s; }
.fmt svg { width: 46px; height: 38px; color: var(--ink-2); margin-bottom: 2px; }
.fmt b { font-size: .86rem; }
.fmt small { font-size: .72rem; color: var(--ink-3); font-weight: 600; }
.fmt.is-active { border-color: var(--accent); background: var(--accent-soft); }
.fmt.is-active svg { color: var(--accent-ink); }
.range { display: block; margin-bottom: 6px; }
.range > span { display: flex; justify-content: space-between; font-size: .84rem; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.range output { color: var(--ink); font-variant-numeric: tabular-nums; }
.range input { width: 100%; accent-color: var(--accent); }
.checks { list-style: none; padding: 0; display: grid; gap: 6px; margin: 10px 0; }
.checks li { display: flex; gap: 8px; font-size: .84rem; line-height: 1.4; padding: 8px 10px; border-radius: 10px; background: #F2F7F4; color: #13492F; }
.checks li::before { content: "✓"; font-weight: 800; flex: none; }
.checks li.warn { background: #FFF4E5; color: #6B3A00; }
.checks li.warn::before { content: "!"; }
.checks li.bad { background: #FDECEC; color: #8A1C21; }
.checks li.bad::before { content: "✕"; }
.checks li.info { background: #EEF2FB; color: #24345E; }
.checks li.info::before { content: "i"; font-style: italic; }

.privacy { margin: 14px 0 0; font-size: .86rem; color: var(--ink-2); text-align: center; }

/* =============================================================
   6. Ads (placeholders)
   ============================================================= */
.ad-slot { display: grid; place-content: center; justify-items: center; gap: 2px; border: 1.5px dashed #C9C5BA; border-radius: 12px; background: repeating-linear-gradient(45deg, #F1EFEA 0 10px, #EDEBE5 10px 20px); color: #8A8578; text-align: center; }
.ad-slot span { font-weight: 800; letter-spacing: .14em; font-size: .85rem; }
.ad-slot small { font-size: .7rem; opacity: .8; }
.ad-leaderboard { margin: 26px auto 0; min-height: 100px; max-width: 728px; }
.ad-incontent { margin: 8px auto; min-height: 280px; max-width: 336px; }

.ad-modal { border: 0; border-radius: 18px; padding: 22px 20px 18px; width: min(360px, calc(100% - 24px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); text-align: center; color: var(--ink); }
.ad-modal::backdrop { background: rgba(20,22,27,.55); }
.ad-modal[open] { display: grid; gap: 14px; justify-items: center; animation: pop .3s var(--ease-out); }
.ad-modal-title { font-weight: 800; }
.ad-modal-slot { width: 300px; max-width: 100%; height: 250px; }
.ad-close { position: absolute; top: 6px; right: 8px; width: 32px; height: 32px; border-radius: 50%; font-size: 1.4rem; line-height: 1; color: var(--ink-2); display: grid; place-items: center; }
.ad-close:hover { background: var(--bg); color: var(--ink); }
.ad-toast { position: fixed; right: 14px; bottom: 14px; z-index: 50; width: min(320px, calc(100% - 28px)); background: #fff; border-radius: 14px; box-shadow: 0 18px 50px -14px rgba(0,0,0,.35); padding: 26px 10px 10px; animation: slideUp .45s var(--ease-out); }
.ad-toast[hidden] { display: none; }
.ad-toast .ad-close { top: 0; right: 2px; width: 28px; height: 28px; font-size: 1.2rem; }
.ad-toast-slot { height: 100px; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } }

/* =============================================================
   7. Content sections
   ============================================================= */
.section { padding: 44px 0 8px; }
.section-title { font-family: var(--display); font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.9rem); margin-bottom: 18px; }
.steps { list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 10px; }
.step-ico svg { width: 24px; height: 24px; }
.steps h3 { font-size: 1.05rem; margin-bottom: 6px; }
.steps p { color: var(--ink-2); font-size: .94rem; }
.ideas { display: grid; gap: 12px; grid-template-columns: 1fr; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.idea-emoji { font-size: 1.7rem; display: block; margin-bottom: 6px; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.idea h3 { font-size: 1.02rem; margin-bottom: 5px; }
.idea p { color: var(--ink-2); font-size: .93rem; }
.prose-cols { display: grid; gap: 8px 32px; }
.prose h3 { font-size: 1.05rem; margin: 14px 0 6px; }
.prose p { color: var(--ink-2); font-size: .96rem; }
.faq { display: grid; gap: 8px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--accent); flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding-bottom: 14px; color: var(--ink-2); font-size: .95rem; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); padding: 22px 0; font-size: .86rem; color: var(--ink-2); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* legal pages */
.legal { max-width: 760px; padding: 32px 0; }
.legal h1 { font-family: var(--display); font-size: 1.9rem; margin-bottom: 14px; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal p, .legal li { color: var(--ink-2); margin-bottom: 8px; }
.legal .todo { background: #FFF4E5; padding: 2px 6px; border-radius: 6px; color: #6B3A00; font-weight: 600; }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .formats { grid-template-columns: repeat(4, 1fr); }
  .ideas { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .styles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .header-nav { display: flex; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .prose-cols { grid-template-columns: 1fr 1fr; }
  .panel { padding: 20px; }
  }
@media (min-width: 960px) {
  .hero { padding: 34px 0 20px; }
  .tool {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-areas: "content preview" "design preview" "object preview";
    align-items: start;
  }
  .panel-preview { position: sticky; top: 14px; }
  .ideas { grid-template-columns: repeat(3, 1fr); }
  }
@media (max-width: 539px) {
  .viewer-hint { font-size: .62rem; }
  .dims { font-size: .72rem; }
  .panel { padding: 14px; }
}
@media (max-width: 380px) {
  .preview-grid { gap: 8px; }
}

/* =============================================================
   9. Reduced motion (only intrusive)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .ad-toast, .ad-modal[open] { animation: none; }
}
