/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6faf7;
  --surface: #ffffff;
  --surface-2: #eaf3ec;
  --ink: #142a1e;
  --muted: #4c5b52;
  --border: #dbe8de;
  --accent: #23a866;
  --accent-dark: #187d4c;
  --accent-ink: #ffffff;
  --ok: #1f7a45;
  --warn: #a15b1f;
  --danger: #b3412c;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-soft: 0 1px 2px rgba(20,42,30,.05), 0 8px 24px -12px rgba(20,42,30,.2);
  --display: "Baloo 2", "Manrope", system-ui, sans-serif;
  --sans: "Manrope", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10160f; --surface: #171d16; --surface-2: #1e2620;
    --ink: #eaf3ec; --muted: #a9b8ae; --border: #2b352e;
    --accent: #35c47e; --accent-dark: #4fd694; --accent-ink: #08130d;
  }
}
:root[data-theme="dark"] {
  --bg: #10160f; --surface: #171d16; --surface-2: #1e2620;
  --ink: #eaf3ec; --muted: #a9b8ae; --border: #2b352e;
  --accent: #35c47e; --accent-dark: #4fd694; --accent-ink: #08130d;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; scrollbar-gutter: stable; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.1; font-weight: 700; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.wrap { max-width: 1160px; margin-inline: auto; padding-inline: 20px; }
.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; }
.hint { font-size: .82rem; color: var(--muted); margin-top: .5rem; }

/* =============================================================
   4. Header / footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--display); font-size: 1.3rem; font-weight: 800; }
.logo span { color: var(--accent); }
.top-nav { display: none; gap: 1.5rem; font-weight: 600; font-size: .92rem; }
.top-nav a:hover { color: var(--accent-dark); }
@media (min-width: 720px) { .top-nav { display: flex; } }

.site-footer { border-top: 1px solid var(--border); padding: 2.2rem 0; color: var(--muted); font-size: .85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; justify-content: space-between; }
.legal-links a { text-decoration: underline; text-underline-offset: 2px; }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2.6rem 0 1.6rem; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); max-width: 22ch; }
.hero-sub { margin-top: .8rem; max-width: 60ch; color: var(--muted); font-size: 1.05rem; }

/* =============================================================
   6. Tool card
   ============================================================= */
.tool-section { padding-bottom: 1.6rem; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 1.2rem; }
.tool-grid { display: grid; gap: 1.4rem; grid-template-columns: minmax(0, 1fr); margin-top: 1.2rem; }
.tool-grid > .tool-col { min-width: 0; }
@media (min-width: 960px) { .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.segmented { display: flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { flex: 1; padding: .6rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700; color: var(--muted); text-align: center; }
.segmented button.is-active { background: var(--accent); color: var(--accent-ink); }
.small-segmented { flex: 1; }
.small-segmented button { padding: .5rem .5rem; font-size: .8rem; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; cursor: pointer; color: var(--muted); transition: border-color .2s var(--ease-out), background .2s var(--ease-out); margin-top: 1.2rem; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.dropzone svg { color: var(--accent); }
.dz-title { font-weight: 700; color: var(--ink); }
.dz-sub { font-size: .82rem; }

.photo-strip { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.photo-thumb { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); cursor: pointer; background: var(--surface-2); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb.is-selected { border-color: var(--accent); }
.photo-thumb .thumb-badge { position: absolute; bottom: 2px; right: 2px; font-size: .65rem; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; padding: 0 3px; }
.photo-thumb .thumb-remove { position: absolute; top: 0; right: 0; background: rgba(0,0,0,.6); color: #fff; width: 18px; height: 18px; line-height: 18px; font-size: .8rem; border-radius: 0 0 0 6px; }

.editor-block { margin-top: 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.crop-stage { position: relative; width: 100%; max-width: 320px; margin-inline: auto; aspect-ratio: 1/1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); touch-action: none; cursor: grab; background: var(--surface-2); background-image: conic-gradient(#0000 90deg,#0001 0 180deg,#0000 0 270deg,#0001 0); background-size: 20px 20px; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }

.range-row, .select-row, .text-row, .check-row, .color-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; font-size: .88rem; }
.range-row span, .select-row span, .text-row span { color: var(--muted); flex: 0 0 auto; }
.range-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); }
.range-row input[type="number"] { width: 5.5rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }
.select-row select { padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }
.text-row input[type="text"] { flex: 1; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }

.tool-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tool-row input[type="text"] { flex: 1; min-width: 8rem; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }
.tool-row input[type="color"] { width: 2.4rem; height: 2.4rem; border: 1px solid var(--border); border-radius: 6px; padding: 0; background: none; }
.brush-row { flex: 1 1 100%; }

.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .3rem; }
.emoji-grid button { font-size: 1.3rem; padding: .35rem; border-radius: 8px; text-align: center; }
.emoji-grid button:hover { background: var(--surface-2); }

.btn { padding: .85rem 1.2rem; border-radius: 999px; font-weight: 700; font-size: .95rem; text-align: center; transition: transform .15s var(--ease-out), opacity .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-ghost { background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; padding: .3rem 0; align-self: flex-start; font-size: .82rem; }

.field-block { margin-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }

/* preview / WhatsApp mockup */
.preview-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; height: 100%; display: flex; flex-direction: column; gap: .8rem; }
.preview-title { font-weight: 700; font-size: .9rem; }

.wa-chat { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; padding: 1rem; }
.wa-chat-bg { position: absolute; inset: 0; background-color: #d9dfc7; background-image: radial-gradient(circle at 20% 30%, #ffffff22 0 6px, transparent 7px), radial-gradient(circle at 70% 60%, #ffffff22 0 6px, transparent 7px), radial-gradient(circle at 40% 80%, #ffffff22 0 6px, transparent 7px); background-size: 90px 90px; }
.wa-bubble-row { position: relative; display: flex; }
.wa-sticker-slot { width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.wa-sticker-slot canvas, .wa-sticker-slot img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.18)); }
.wa-sticker-empty { font-size: .78rem; color: #5b6350; background: #ffffffaa; padding: .5rem .8rem; border-radius: 10px; text-align: center; }
.wa-time { position: relative; align-self: flex-start; font-size: .68rem; color: #5b6350; margin-top: .3rem; background: #ffffffaa; padding: 1px 6px; border-radius: 6px; }

.pack-summary { font-size: .85rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .65rem .8rem; }
.anim-pack-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.anim-pack-strip img { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--border); object-fit: contain; background: var(--surface); }

.download-row { display: flex; flex-direction: column; gap: .6rem; }
.privacy-badge { font-size: .78rem; color: var(--muted); }

/* =============================================================
   7. Ad placeholders
   ============================================================= */
.ad-slot { min-height: 90px; margin: 1.6rem auto; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; background: var(--surface-2); }
.ad-slot--leaderboard { max-width: 1160px; }
.ad-slot--incontent { max-width: 720px; min-height: 250px; }

.corner-toast { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .8rem 1.1rem; box-shadow: var(--shadow-soft); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.corner-toast[hidden] { display: none; }
.corner-toast button { font-size: 1.1rem; line-height: 1; color: var(--muted); }

.download-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; max-width: 360px; width: calc(100% - 2rem); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-soft); }
.download-dialog::backdrop { background: rgba(10, 20, 14, .45); }
.dialog-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.3rem; color: var(--muted); }
.dialog-ad-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.dialog-ad-slot { min-height: 200px; border: 1px dashed var(--border); border-radius: var(--radius-sm); margin: .6rem 0 1rem; background: var(--surface-2); }
.dialog-msg { text-align: center; margin-bottom: 1rem; font-size: .92rem; }
.download-dialog .btn { width: 100%; }

/* =============================================================
   8. Content sections
   ============================================================= */
.section { padding: 3rem 0; }
.section-alt { background: var(--surface-2); }
.section h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 1.6rem; }
.prose { max-width: 760px; }
.prose p { margin-bottom: 1rem; color: var(--ink); }
.prose p + p { color: var(--muted); }

.steps { list-style: none; display: grid; gap: 1.2rem; }
.steps li h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.steps li p { color: var(--muted); font-size: .92rem; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; }
.idea-card h3 { font-size: 1rem; margin-bottom: .35rem; font-family: var(--sans); }
.idea-card p { color: var(--muted); font-size: .9rem; }

details { border-bottom: 1px solid var(--border); padding: .9rem 0; }
details summary { cursor: pointer; font-weight: 700; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; color: var(--accent-dark); }
details[open] summary::before { content: "– "; }
details p { margin-top: .6rem; color: var(--muted); font-size: .92rem; }

/* =============================================================
   9. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .dropzone { transition: none; }
}
