/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-soft: #f2f1ec;
  --border: #e4e0d6;
  --text: #17171a;
  --text-muted: #5b5b62;
  --accent: #4338ca;
  --accent-hover: #362eb0;
  --accent-soft: #eef0fd;
  --danger: #c9392b;
  --danger-soft: #fbe9e7;
  --ok: #1f7a4d;
  --ok-soft: #e8f5ee;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-card: 0 1px 2px rgba(20,20,25,.04), 0 8px 24px rgba(20,20,25,.06);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", 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%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
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 { font-family: var(--display); text-wrap: balance; line-height: 1.12; letter-spacing: -0.01em; font-weight: 700; }
::selection { background: var(--accent); color: #fff; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.1rem; }
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250,249,246,.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.brand-mark { color: var(--accent); font-size: 1.2rem; }
.header-nav { display: none; gap: 1.4rem; font-size: .92rem; font-weight: 500; color: var(--text-muted); }
.header-nav a:hover { color: var(--text); }
@media (min-width: 720px) { .header-nav { display: flex; } }

.site-footer { border-top: 1px solid var(--border); padding-block: 2rem 1.2rem; margin-top: 3rem; color: var(--text-muted); font-size: .88rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; align-items: center; justify-content: space-between; }
.footer-row nav { display: flex; gap: 1.2rem; }
.footer-row nav a:hover { color: var(--text); }
.credits-line { margin-top: .8rem; font-size: .78rem; opacity: .75; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 2.6rem 1.6rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5.2vw, 3.1rem); max-width: 20ch; margin-inline: auto; }
.hero-sub { margin-top: .9rem; font-size: clamp(1rem, 2vw, 1.15rem); color: var(--text-muted); max-width: 52ch; margin-inline: auto; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { display: flex; flex-direction: column; gap: 1.4rem; padding-bottom: 2rem; }
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 1.3rem;
  box-shadow: var(--shadow-card);
}
.tool-card h2 { font-size: 1.3rem; margin-bottom: .3rem; }
.section-sub { color: var(--text-muted); font-size: .95rem; margin-bottom: 1rem; }
.tool-block { margin-bottom: 1.4rem; }
.tool-block:last-of-type { margin-bottom: 0; }

.content-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.content-tab {
  flex: 1; padding: .7rem .8rem; border-radius: var(--radius-s);
  background: var(--surface-soft); font-weight: 600; font-size: .92rem;
  transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.content-tab.is-active { background: var(--accent); color: #fff; }
.content-panel.is-hidden { display: none; }

.field-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .4rem; }
.field-hint { font-size: .82rem; color: var(--text-muted); margin-top: .4rem; }
.text-input {
  width: 100%; padding: .72rem .85rem; border: 1px solid var(--border);
  border-radius: var(--radius-s); background: var(--surface); font-size: .96rem;
  transition: border-color .15s var(--ease-out);
}
.text-input:focus { border-color: var(--accent); }
.field-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .field-grid { grid-template-columns: 1fr 1fr; } }
.field-checkbox { display: flex; align-items: center; }
.field-checkbox label { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }

.tool-grid { display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 860px) { .tool-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

.control-group { margin-bottom: 1.1rem; }
.control-group:last-child { margin-bottom: 0; }

.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 420px) { .style-grid { grid-template-columns: repeat(4, 1fr); } }
.style-btn {
  padding: .55rem .4rem; border: 1.5px solid var(--border); border-radius: var(--radius-s);
  font-size: .82rem; font-weight: 600; background: var(--surface);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.style-btn.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.color-row { display: flex; gap: 1rem; }
.color-field { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; font-weight: 600; }
.color-field input[type="color"] {
  width: 52px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 2px; background: var(--surface); cursor: pointer;
}
.preset-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.preset-swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface);
  outline: 1px solid var(--border); cursor: pointer; overflow: hidden; position: relative;
}
.preset-swatch:hover, .preset-swatch:focus-visible { outline-color: var(--accent); }

.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; margin-bottom: .7rem; }
@media (min-width: 540px) { .emoji-grid { grid-template-columns: repeat(8, 1fr); } }
.emoji-btn {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; border-radius: var(--radius-s); border: 1.5px solid var(--border);
  background: var(--surface);
}
.emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.center-row { display: flex; gap: .6rem; flex-wrap: wrap; }

.tool-preview { display: flex; flex-direction: column; gap: .9rem; }
.qr-preview-frame {
  aspect-ratio: 1; width: 100%; max-width: 340px; margin-inline: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-soft); border-radius: var(--radius-m); padding: 1rem;
}
.qr-preview-frame canvas, .qr-preview-frame svg { max-width: 100%; max-height: 100%; }

.download-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  padding: .78rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), opacity .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-soft); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-small { padding: .5rem .9rem; font-size: .82rem; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.privacy-badge { margin-top: 1.2rem; font-size: .82rem; color: var(--text-muted); }

/* =============================================================
   7. 3D panel
   ============================================================= */
.object3d-card { margin-top: 0; }
.format-grid { display: grid; grid-template-columns: 1fr; gap: .6rem; }
@media (min-width: 640px) { .format-grid { grid-template-columns: repeat(3, 1fr); } }
.format-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  padding: .9rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface); text-align: left;
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.format-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.format-icon { font-size: 1.3rem; }
.format-btn span:nth-child(2) { font-weight: 700; font-size: .95rem; }
.format-btn small { color: var(--text-muted); font-size: .78rem; }

.range-value { font-size: .82rem; color: var(--text-muted); margin-top: .3rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.print-warnings { display: flex; flex-direction: column; gap: .5rem; margin-top: .3rem; }
.warn-pill {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem;
  border-radius: var(--radius-s); font-size: .82rem; font-weight: 600;
}
.warn-pill.is-ok { background: var(--ok-soft); color: var(--ok); }
.warn-pill.is-bad { background: var(--danger-soft); color: var(--danger); }

.viewer3d-frame {
  position: relative; aspect-ratio: 1; width: 100%; max-width: 340px; margin-inline: auto;
  background: var(--surface-soft); border-radius: var(--radius-m); overflow: hidden;
  touch-action: none;
}
.viewer3d-frame canvas { width: 100%; height: 100%; }
.viewer3d-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: .85rem; text-align: center; padding: 1rem;
}
.viewer-hint { text-align: center; font-size: .8rem; color: var(--text-muted); }

/* =============================================================
   8. Ad slots (placeholders)
   ============================================================= */
.ad-slot {
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-m);
  color: var(--text-muted); font-size: .78rem; letter-spacing: .08em;
  margin-block: 1.6rem;
}
.ad-label { font-weight: 700; opacity: .55; }

.corner-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-s);
  padding: .8rem 2.2rem .8rem 1rem; box-shadow: var(--shadow-card);
  font-size: .78rem; color: var(--text-muted);
}
.corner-toast-close {
  position: absolute; top: .3rem; right: .4rem; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font-size: .8rem; color: var(--text-muted);
}
.corner-toast-close:hover { background: var(--surface-soft); }

.ad-dialog { border: 0; border-radius: var(--radius-m); padding: 0; max-width: 360px; width: 90vw; box-shadow: var(--shadow-card); }
.ad-dialog::backdrop { background: rgba(20,20,25,.5); }
.ad-dialog-body { padding: 1.6rem 1.4rem; text-align: center; position: relative; min-height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.ad-dialog-close { position: absolute; top: .6rem; right: .7rem; width: 28px; height: 28px; border-radius: 50%; }
.ad-dialog-close:hover { background: var(--surface-soft); }
.ad-dialog-btn { margin-top: .2rem; }

/* =============================================================
   9. Content sections
   ============================================================= */
.how-section, .ideas-section, .faq-section { padding-block: 1.6rem; }
.how-section h2, .ideas-section h2, .faq-section h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); text-align: center; margin-bottom: 1.6rem; }

.how-steps { list-style: none; display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .how-steps { grid-template-columns: repeat(3, 1fr); } }
.how-steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 1.3rem; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 800; font-size: .9rem; margin-bottom: .6rem;
}
.how-steps h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.how-steps p { color: var(--text-muted); font-size: .92rem; }

.seo-copy { max-width: 74ch; margin: 2rem auto 0; }
.seo-copy h2 { font-size: clamp(1.25rem, 2.6vw, 1.5rem); text-align: left; margin-bottom: .8rem; }
.seo-copy p { color: var(--text-muted); margin-bottom: .9rem; font-size: .96rem; }
.seo-copy strong { color: var(--text); }

.ideas-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 540px) { .ideas-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 1.2rem; }
.idea-emoji { font-size: 1.6rem; display: block; margin-bottom: .5rem; }
.idea-card h3 { font-size: 1rem; margin-bottom: .35rem; }
.idea-card p { color: var(--text-muted); font-size: .9rem; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 74ch; margin-inline: auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: .9rem 1.1rem; }
.faq-item summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { color: var(--text-muted); margin-top: .7rem; font-size: .92rem; }

/* =============================================================
   10. Responsive breakpoints (reference)
   ============================================================= */
@media (min-width: 1280px) {
  .container { padding-inline: 1.5rem; }
}
