/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #F0EFE9;
  --ink: #17171B;
  --ink-soft: #55565E;
  --line: #E2E0D8;
  --accent: #D2542B;
  --accent-ink: #FFF7F0;
  --ok: #1E7A46;
  --warn: #B5460A;
  --danger: #C22B2B;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 1px 2px rgba(23,23,27,.04), 0 10px 30px -14px rgba(23,23,27,.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151A;
    --surface: #1B1C22;
    --surface-2: #23242C;
    --ink: #F3F2EE;
    --ink-soft: #A7A6AE;
    --line: #302F38;
    --accent: #E8763F;
    --accent-ink: #1B1206;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; 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;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select { font: inherit; color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.is-hidden { display: none !important; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header { padding: 18px 0; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; }
.logo-mark { color: var(--accent); font-size: 1.2rem; }
.header-nav { display: none; gap: 24px; font-weight: 600; font-size: .92rem; color: var(--ink-soft); }
.header-nav a:hover { color: var(--ink); }
@media (min-width: 720px) { .header-nav { display: flex; } }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 40px 0 26px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.7rem); max-width: 18ch; margin: 0 auto; }
.hero-sub { margin: 14px auto 0; max-width: 56ch; color: var(--ink-soft); font-size: 1.02rem; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-card { padding: 6px 0 34px; }
.tool-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.tool-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.tool-col-3d { background: var(--surface-2); }

.panel-title { font-size: 1.1rem; margin-bottom: 4px; }

.field-group { margin-top: 18px; }
.field-group:first-child { margin-top: 0; }
.field-label { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.text-input {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: .95rem; transition: border-color .15s var(--ease-out);
}
.tool-col-3d .text-input { background: var(--surface); }
.text-input:focus { border-color: var(--accent); }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 999px; }
.tool-col-3d .seg { background: var(--surface); }
.seg-4 { border-radius: var(--radius-m); }
.seg-btn {
  padding: 8px 15px; border-radius: 999px; font-size: .86rem; font-weight: 700;
  color: var(--ink-soft); transition: background .15s var(--ease-out), color .15s var(--ease-out);
}
.seg-4 .seg-btn { border-radius: var(--radius-s); }
.seg-btn.is-active { background: var(--ink); color: var(--bg); }

.color-input { display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 6px 10px; background: var(--surface); }
input[type="color"] { width: 32px; height: 32px; border: 0; border-radius: 7px; padding: 0; background: none; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 6px; }
.color-hex { font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); }

.center-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  font-size: .84rem; font-weight: 700; color: var(--ink-soft);
}
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.emoji-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.emoji-opt { font-size: 1.3rem; padding: 6px; border-radius: var(--radius-s); border: 1.5px solid transparent; text-align: center; }
.emoji-opt:hover, .emoji-opt.is-active { border-color: var(--accent); background: var(--surface-2); }
.emoji-custom { grid-column: 1 / -1; margin-top: 4px; }

.logo-upload { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-drop {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border: 1.5px dashed var(--line); border-radius: var(--radius-s); font-size: .86rem; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
}
.upload-drop:hover { border-color: var(--accent); color: var(--ink); }
.link-btn { font-size: .86rem; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.format-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.format-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: var(--radius-m); border: 1.5px solid var(--line);
  background: var(--surface); font-size: .82rem; font-weight: 700; color: var(--ink-soft);
  transition: border-color .15s var(--ease-out), color .15s var(--ease-out);
}
.format-card.is-active { border-color: var(--accent); color: var(--ink); }
.format-icon { font-size: 1.4rem; color: var(--accent); }

.preview-2d { margin-top: 20px; }
.qr-canvas-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 220px; padding: 18px; background: var(--surface-2);
  border-radius: var(--radius-m); border: 1px solid var(--line);
}
.qr-canvas-wrap canvas, .qr-canvas-wrap svg { max-width: 220px; max-height: 220px; }

.download-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.download-row-3d { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: 999px; font-weight: 700; font-size: .94rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-secondary { background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line); flex: 1; }
.btn-secondary:hover { border-color: var(--accent); }

.privacy-badge { margin-top: 16px; font-size: .82rem; color: var(--ink-soft); }

.warnings { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.warning-item {
  display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px;
  border-radius: var(--radius-s); font-size: .82rem; font-weight: 600; line-height: 1.4;
}
.warning-item.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.warning-item.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.warning-item.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.viewer-3d {
  position: relative; margin-top: 16px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface);
  aspect-ratio: 4 / 3; overflow: hidden; touch-action: none;
}
.viewer-3d canvas { width: 100%; height: 100%; display: block; }
.viewer-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px; font-size: .86rem; color: var(--ink-soft); background: var(--surface);
  transition: opacity .2s var(--ease-out);
}
.viewer-status.is-hidden { opacity: 0; pointer-events: none; }

/* =============================================================
   7. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  margin: 30px auto; min-height: 90px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius-m); color: var(--ink-soft);
}
.ad-slot-leaderboard { max-width: 728px; }
.ad-slot-incontent { max-width: 728px; min-height: 250px; }
.ad-label {
  font-family: var(--mono); font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

.ad-dialog {
  border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px;
  width: min(92vw, 420px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card);
}
.ad-dialog::backdrop { background: rgba(15,15,18,.55); }
.ad-dialog-close {
  position: absolute; top: 12px; right: 14px; font-size: 1.3rem; line-height: 1; color: var(--ink-soft);
}
.ad-dialog-body { min-height: 200px; display: flex; align-items: center; justify-content: center; margin: 14px 0; border: 1.5px dashed var(--line); border-radius: var(--radius-s); }
.ad-dialog-btn { width: 100%; }

.ad-corner {
  position: fixed; right: 16px; bottom: 16px; z-index: 500;
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow-card); max-width: 260px; min-height: 56px;
}
.ad-corner-close { font-size: 1.05rem; color: var(--ink-soft); }

/* =============================================================
   8. Sections
   ============================================================= */
.section { padding: 46px 0; }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-bottom: 22px; }

.steps-grid { display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.steps-grid > div {
  counter-increment: step; padding: 20px; border-radius: var(--radius-m);
  background: var(--surface); border: 1px solid var(--line);
}
.steps-grid > div::before {
  content: counter(step); display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: .88rem; margin-bottom: 12px;
}
.steps-grid h3 { font-size: 1.02rem; margin-bottom: 6px; }
.steps-grid p { color: var(--ink-soft); font-size: .92rem; }

.seo-copy { max-width: 74ch; }
.seo-copy p { margin-top: 14px; color: var(--ink-soft); }
.seo-copy p:first-of-type { margin-top: 0; }

.usecases-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .usecases-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .usecases-grid { grid-template-columns: repeat(3, 1fr); } }
.usecases-grid > div { padding: 18px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.usecase-emoji { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.usecases-grid h3 { font-size: .98rem; margin-bottom: 6px; }
.usecases-grid p { color: var(--ink-soft); font-size: .88rem; }

.faq-list { display: flex; flex-direction: column; gap: 10px; max-width: 74ch; }
.faq-list details {
  border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; background: var(--surface);
}
.faq-list summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list p { margin-top: 10px; color: var(--ink-soft); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0 40px; }
.footer-row { display: flex; flex-direction: column; gap: 10px; font-size: .84rem; color: var(--ink-soft); }
@media (min-width: 720px) { .footer-row { flex-direction: row; justify-content: space-between; align-items: center; } }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a:hover { color: var(--ink); }

/* =============================================================
   10. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
