/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --border: #e4e0d8;
  --text: #201f1c;
  --text-soft: #5c584f;
  --accent: #b5502f;
  --accent-ink: #ffffff;
  --accent-soft: #f4e3da;
  --ok: #2f7a4f;
  --warn: #a8641a;
  --danger: #b5302f;
  --radius: 14px;
  --radius-sm: 9px;
  --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: 0 1px 2px rgba(30,25,15,.05), 0 8px 24px -12px rgba(30,25,15,.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161512;
    --surface: #201f1b;
    --border: #34322c;
    --text: #f2efe8;
    --text-soft: #b6b1a5;
    --accent: #e2794f;
    --accent-ink: #1a1310;
    --accent-soft: #3a281f;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -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.15; letter-spacing: -0.01em; font-weight: 800; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1120px; margin-inline: auto; padding-inline: 1.1rem; }

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

/* =============================================================
   3. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--accent); }
.header-nav { display: flex; gap: 1.4rem; font-size: .92rem; font-weight: 600; color: var(--text-soft); }
.header-nav a:hover { color: var(--text); }
@media (max-width: 539px) { .header-nav { display: none; } }

.site-footer { border-top: 1px solid var(--border); padding: 1.6rem 0; margin-top: 2rem; color: var(--text-soft); font-size: .88rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; justify-content: space-between; }
.footer-row nav { display: flex; gap: 1rem; }
.footer-row a:hover { color: var(--text); }

/* =============================================================
   4. Hero + tool
   ============================================================= */
.hero { padding: 2.6rem 0 1.4rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.7rem); max-width: 20ch; margin-inline: auto; }
.hero-sub { margin-top: .8rem; color: var(--text-soft); max-width: 52ch; margin-inline: auto; font-size: 1.02rem; }

.tool-section { padding-bottom: 2rem; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}
@media (min-width: 540px) { .tool-card { padding: 1.5rem; } }

.tool-tabs { display: flex; gap: .4rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.tool-tab {
  padding: .7rem 1rem; font-weight: 700; font-size: .92rem; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s var(--ease-out);
}
.tool-tab.is-active { color: var(--accent); border-color: var(--accent); }
.tool-tab:hover { color: var(--text); }

.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; } }

.field-group { margin-bottom: 1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.field-label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .35rem; color: var(--text-soft); }

input[type="text"], select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: .95rem;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }
input[type="color"] {
  width: 100%; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

.segmented { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-btn {
  padding: .5rem .8rem; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; font-weight: 600;
  color: var(--text-soft); transition: all .18s var(--ease-out);
}
.seg-btn:hover { border-color: var(--accent); color: var(--text); }
.seg-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.center-picker { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.emoji-row { display: flex; flex-wrap: wrap; gap: .3rem; }
.emoji-btn {
  width: 38px; height: 38px; font-size: 1.15rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; transition: border-color .15s;
}
.emoji-btn:hover, .emoji-btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.btn-link { font-size: .82rem; font-weight: 700; color: var(--accent); text-decoration: underline; }

.btn-primary, .btn-secondary {
  padding: .75rem 1.1rem; border-radius: var(--radius-sm); font-weight: 700; font-size: .92rem;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { box-shadow: 0 6px 18px -6px rgba(181,80,47,.55); transform: translateY(-1px); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.warnings { display: flex; flex-direction: column; gap: .4rem; margin-top: .8rem; }
.warning-item { font-size: .82rem; padding: .55rem .7rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--warn); border: 1px solid transparent; }
.warning-item.is-danger { background: #fbe4e2; color: var(--danger); }
.warning-item.is-ok { background: #e2f2e7; color: var(--ok); }
@media (prefers-color-scheme: dark) {
  .warning-item.is-danger { background: #3a1e1c; }
  .warning-item.is-ok { background: #1c3324; }
}

.tool-preview { display: flex; flex-direction: column; }
.preview-2d, .preview-3d {
  aspect-ratio: 1 / 1; width: 100%; max-width: 380px; margin-inline: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.preview-2d canvas { width: 90%; height: 90%; }
.preview-3d canvas { width: 100%; height: 100%; touch-action: none; cursor: grab; }
.preview-3d:active canvas { cursor: grabbing; }
.preview-3d-hint {
  position: absolute; bottom: .5rem; left: 50%; transform: translateX(-50%);
  font-size: .72rem; color: var(--text-soft); background: color-mix(in srgb, var(--surface) 85%, transparent);
  padding: .25rem .6rem; border-radius: 999px; pointer-events: none;
}
.preview-3d-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .85rem; color: var(--text-soft); background: var(--bg);
}
.preview-3d-status.is-hidden { display: none; }

.result-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }
.privacy-badge { text-align: center; font-size: .82rem; color: var(--text-soft); margin-top: .9rem; }
.limits-note { text-align: center; font-size: .76rem; color: var(--text-soft); margin-top: .3rem; opacity: .85; }

.tool-3d-only[hidden] { display: none !important; }

/* =============================================================
   5. Ad slots
   ============================================================= */
.ad-slot {
  border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-soft);
  display: flex; align-items: center; justify-content: center; font-size: .78rem; letter-spacing: .08em;
  font-weight: 700; text-transform: uppercase; margin: 1.6rem 0;
}
.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--incontent { min-height: 250px; max-width: 336px; margin-inline: auto; }

.ad-toast {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 60;
  width: 200px; min-height: 90px; background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; padding: .6rem;
}
.ad-toast-close {
  position: absolute; top: .3rem; right: .4rem; font-size: 1rem; line-height: 1; color: var(--text-soft);
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.ad-toast-close:hover { background: var(--bg); }
.ad-toast-label { font-size: .74rem; font-weight: 700; color: var(--text-soft); letter-spacing: .08em; }
.ad-toast[hidden] { display: none; }

.ad-dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; max-width: 360px; width: 90vw;
  box-shadow: var(--shadow); background: var(--surface); color: var(--text);
}
.ad-dialog::backdrop { background: rgba(20,18,14,.5); }
.ad-dialog-close { display: block; margin-inline: auto 0; margin-bottom: .8rem; font-size: .82rem; font-weight: 700; color: var(--accent); }
.ad-dialog-slot {
  min-height: 220px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: var(--text-soft);
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}

/* =============================================================
   6. Content sections
   ============================================================= */
.content-section { padding: 2.4rem 0; }
.content-section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1.2rem; }

.steps-grid, .ideas-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps-grid, .ideas-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card, .idea-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem;
}
.step-card h3, .idea-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.step-card p, .idea-card p { color: var(--text-soft); font-size: .92rem; }

.seo-copy { max-width: 74ch; margin: 1.8rem 0; color: var(--text-soft); }
.seo-copy p + p { margin-top: .9rem; }

.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 74ch; }
.faq-list details {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1.1rem; background: var(--surface);
}
.faq-list summary { font-weight: 700; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; float: right; color: var(--accent); font-weight: 800; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list p { margin-top: .6rem; color: var(--text-soft); font-size: .92rem; }

/* =============================================================
   7. Responsive
   ============================================================= */
@media (min-width: 720px)  { .container { padding-inline: 1.5rem; } }
@media (min-width: 1280px) { .hero { padding-top: 3.4rem; } }
