:root {
  --bg: #F5F7F7;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #EDF1F1;
  --ink: #101B22;
  --ink-soft: #4B5B63;
  --ink-faint: #7C8B90;
  --line: #DCE3E4;
  --line-strong: #C2CCCD;
  --teal: #0C9C90;
  --teal-dark: #087C72;
  --teal-tint: #E3F5F3;
  --coral: #FF6B4A;
  --coral-dark: #DE4C2C;
  --coral-tint: #FFE9E2;
  --ad-bg: #ECE8DD;
  --ad-line: #CBC2AA;
  --ad-ink: #6B6250;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(16, 27, 34, 0.08);
  --shadow-md: 0 6px 24px rgba(16, 27, 34, 0.10);
  --shadow-lg: 0 16px 48px rgba(16, 27, 34, 0.16);
  --font-display: 'Archivo', 'Arial Black', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1416;
    --bg-elevated: #101B1E;
    --bg-sunken: #0D171A;
    --ink: #E9F2F1;
    --ink-soft: #A6B7B6;
    --ink-faint: #708082;
    --line: #1E2C2F;
    --line-strong: #2A3A3D;
    --teal: #2FD9CB;
    --teal-dark: #26B3A7;
    --teal-tint: #10302D;
    --coral: #FF8768;
    --coral-dark: #FF6B4A;
    --coral-tint: #331F19;
    --ad-bg: #1B1F1A;
    --ad-line: #35392E;
    --ad-ink: #B8AF98;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #0A1416;
  --bg-elevated: #101B1E;
  --bg-sunken: #0D171A;
  --ink: #E9F2F1;
  --ink-soft: #A6B7B6;
  --ink-faint: #708082;
  --line: #1E2C2F;
  --line-strong: #2A3A3D;
  --teal: #2FD9CB;
  --teal-dark: #26B3A7;
  --teal-tint: #10302D;
  --coral: #FF8768;
  --coral-dark: #FF6B4A;
  --coral-tint: #331F19;
  --ad-bg: #1B1F1A;
  --ad-line: #35392E;
  --ad-ink: #B8AF98;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  padding-inline: 20px;
}
.wrap { max-width: 1180px; margin-inline: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800; line-height: 1.08; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { line-height: 1.6; color: var(--ink-soft); margin: 0; }
a { color: var(--teal-dark); }
:is(button, [role="tab"], a, input, select, textarea):focus-visible {
  outline: 2.5px solid var(--coral);
  outline-offset: 2px;
}
img, svg { max-width: 100%; }
.mono { font-family: var(--font-mono); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 14px;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--ink); display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.topbar-tag { color: var(--ink-faint); font-size: 0.82rem; display: none; }
@media (min-width: 720px) { .topbar-tag { display: block; } }
.topbar-cta {
  font-size: 0.82rem; color: var(--ink-soft); font-family: var(--font-mono);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px;
  white-space: nowrap;
}

/* ---------- hero ---------- */
.hero { padding-block: 40px 24px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--teal-dark); background: var(--teal-tint); border-radius: 999px; padding: 6px 12px;
  margin-bottom: 14px;
}
.hero h1 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); max-width: 18ch; }
.hero-sub { margin-top: 14px; font-size: 1.08rem; max-width: 56ch; }
.hero-kw { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-kw span {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}

/* ---------- tool layout ---------- */
.tool {
  display: grid; grid-template-columns: 1fr; gap: 18px;
  margin-top: 28px;
}
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: start; }
}
.panel {
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.panel-pad { padding: 22px; }
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field-group label { font-size: 0.82rem; font-weight: 650; color: var(--ink); }
.field-hint { font-size: 0.76rem; color: var(--ink-faint); }
input[type="text"], input[type="url"], textarea, select {
  font-family: var(--font-body); font-size: 0.95rem; color: var(--ink);
  background: var(--bg-sunken); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; width: 100%;
}
input[type="text"]:focus, input[type="url"]:focus, textarea:focus, select:focus { border-color: var(--teal); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn {
  font-family: var(--font-body); font-weight: 650; font-size: 0.86rem; color: var(--ink-faint);
  background: none; border: none; padding: 9px 4px; cursor: pointer; border-bottom: 2.5px solid transparent;
  margin-right: 14px;
}
.tab-btn[aria-selected="true"] { color: var(--ink); border-color: var(--coral); }
.tab-panel[hidden] { display: none; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch-input { position: relative; width: 42px; height: 42px; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line-strong); flex: none; }
.swatch-input input[type="color"] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); border: none; padding: 0; cursor: pointer; }

.shape-options, .product-options { display: flex; gap: 8px; flex-wrap: wrap; }
.opt-btn {
  font-family: var(--font-body); font-size: 0.84rem; font-weight: 600; color: var(--ink-soft);
  background: var(--bg-sunken); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 13px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.opt-btn[aria-pressed="true"] { border-color: var(--teal); color: var(--ink); background: var(--teal-tint); }
.opt-btn:hover { border-color: var(--line-strong); }

.emoji-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.emoji-btn { font-size: 1.3rem; background: var(--bg-sunken); border: 1.5px solid var(--line); border-radius: var(--radius-sm); width: 44px; height: 44px; cursor: pointer; }
.emoji-btn[aria-pressed="true"] { border-color: var(--coral); background: var(--coral-tint); }

.btn {
  font-family: var(--font-body); font-weight: 700; font-size: 0.92rem;
  border-radius: 999px; padding: 12px 22px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--coral) 45%, transparent); }
.btn-primary:hover { background: var(--coral-dark); }
.btn-secondary { background: var(--ink); color: var(--bg); }
.btn-secondary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- preview column ---------- */
.preview-sticky { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 14px; }
.preview-tabs { display: flex; background: var(--bg-sunken); border-radius: 999px; padding: 4px; gap: 4px; }
.preview-tabs button {
  flex: 1; border: none; background: none; padding: 8px 10px; border-radius: 999px;
  font-family: var(--font-body); font-weight: 650; font-size: 0.84rem; color: var(--ink-soft); cursor: pointer;
}
.preview-tabs button[aria-selected="true"] { background: var(--bg-elevated); color: var(--ink); box-shadow: var(--shadow-sm); }
.preview-stage {
  aspect-ratio: 1 / 1; border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: repeating-conic-gradient(var(--bg-sunken) 0% 25%, var(--bg-elevated) 0% 50%) 0 0 / 24px 24px;
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.preview-stage canvas, .preview-stage #threeCanvas { width: 100%; height: 100%; display: block; }
.preview-stage.mode-3d { background: var(--bg-sunken); cursor: grab; }
.preview-stage.mode-3d:active { cursor: grabbing; }
.preview-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 0.72rem; color: var(--ink-faint); font-family: var(--font-mono); pointer-events: none; }
.scan-badge {
  position: absolute; top: 10px; left: 10px; font-family: var(--font-mono); font-size: 0.7rem;
  padding: 5px 9px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--line); color: var(--ink-soft);
}
.scan-badge.ok { color: var(--teal-dark); border-color: var(--teal); }
.scan-badge.warn { color: var(--coral-dark); border-color: var(--coral); }

.download-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.download-grid .btn { width: 100%; }
.download-note { font-size: 0.74rem; color: var(--ink-faint); text-align: center; }

/* ---------- ad placeholders ---------- */
.ad {
  background: var(--ad-bg); border: 1.5px dashed var(--ad-line); border-radius: var(--radius);
  color: var(--ad-ink); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase;
  position: relative;
}
.ad-banner { width: 100%; height: 90px; margin-block: 32px; }
.ad-inline { width: 100%; height: 250px; margin-block: 10px; max-width: 336px; margin-inline: auto; }
.ad-corner {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 260px; height: 84px; z-index: 60; box-shadow: var(--shadow-lg);
  animation: ad-in 0.4s ease both;
}
.ad-corner .ad-close {
  position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg); border: none; cursor: pointer; font-size: 0.7rem; line-height: 1;
  display: grid; place-items: center;
}
@keyframes ad-in { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ad-label-sub { font-size: 0.62rem; opacity: 0.7; text-transform: none; letter-spacing: 0; display: block; margin-top: 4px; }

.ad-modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 14, 16, 0.55); z-index: 90;
  display: grid; place-items: center; padding: 20px;
}
.ad-modal {
  background: var(--bg-elevated); border-radius: var(--radius-lg); max-width: 380px; width: 100%;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.ad-modal-body { height: 220px; }
.ad-modal-footer { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ad-modal-footer p { font-size: 0.8rem; }

/* ---------- generic sections ---------- */
section { padding-block: 56px; }
.section-head { max-width: 640px; margin-bottom: 32px; }
.section-eyebrow { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal-dark); margin-bottom: 8px; display: block; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.section-head p { margin-top: 10px; font-size: 1rem; }

/* how it works */
.steps { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 780px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.step-num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--coral-dark); background: var(--coral-tint); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 14px; font-weight: 700; }
.step h3 { font-size: 1.08rem; margin-bottom: 8px; }
.step p { font-size: 0.9rem; }

/* use cases */
.cases { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .cases { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cases { grid-template-columns: repeat(3, 1fr); } }
.case-card { background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.case-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--teal-tint); color: var(--teal-dark); display: grid; place-items: center; font-size: 1.2rem; }
.case-card h3 { font-size: 1rem; }
.case-card p { font-size: 0.87rem; }
.case-tag { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }

/* faq */
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 800px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elevated); overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 16px 18px; font-family: var(--font-body); font-weight: 650; font-size: 0.94rem; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-q .chev { transition: transform 0.2s ease; flex: none; color: var(--ink-faint); }
.faq-item[data-open="true"] .chev { transform: rotate(180deg); }
.faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: max-height 0.25s ease, padding 0.25s ease; }
.faq-item[data-open="true"] .faq-a { padding: 0 18px 16px; max-height: 400px; }
.faq-a p { font-size: 0.88rem; }

footer { border-top: 1px solid var(--line); padding-block: 28px; margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.footer-inner p { font-size: 0.78rem; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
