:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d2128;
  --muted: #5f6672;
  --line: #e3dfd6;
  --accent: #0f7b6c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f2ef;
  --warn: #b4441c;
  --viewer-bg: #e9e6df;
  --model-base: #2b2f36;
  --model-top: #f5b301;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b; --surface: #1e2126; --ink: #eceae6; --muted: #a2a8b2; --line: #2d3138;
    --accent: #3cc3ad; --accent-ink: #0c1412; --accent-soft: #19302c; --warn: #f08a5d;
    --viewer-bg: #23262c; --model-base: #6b7380; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1e2126; --ink: #eceae6; --muted: #a2a8b2; --line: #2d3138;
  --accent: #3cc3ad; --accent-ink: #0c1412; --accent-soft: #19302c; --warn: #f08a5d;
  --viewer-bg: #23262c; --model-base: #6b7380; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

header.top { border-bottom: 1px solid var(--line); background: var(--surface); }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
header nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: 15px; }

h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.02em; margin: 28px 0 8px; }
.lede { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }

/* landing */
.hero { padding: 24px 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 8px 0 40px; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .ico { font-size: 32px; }
.card h2 { margin: 8px 0 4px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .soon { display: inline-block; font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 99px; margin-top: 10px; }
.card.disabled { opacity: .6; pointer-events: none; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 48px; }
.steps div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.steps b { display: block; color: var(--accent); }

/* generator page */
.gen { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px; }
@media (min-width: 860px) { .gen { grid-template-columns: 1.3fr 1fr; align-items: start; } .gen .side { position: sticky; top: 16px; } }

.viewer {
  background: var(--viewer-bg); border-radius: var(--radius); aspect-ratio: 4 / 3; width: 100%;
  overflow: hidden; touch-action: none; position: relative;
}
.viewer canvas { width: 100%; height: 100%; display: block; }
.status { margin: 10px 2px 0; font-size: 15px; color: var(--muted); min-height: 1.5em; }
.status.ok { color: var(--accent); }
.status.warn { color: var(--warn); }
.status.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tip { font-size: 14px; color: var(--muted); margin: 4px 2px 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field input[type=text], .field input[type=number], .field select {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.field-check > span { margin: 0; font-weight: 500; }
.field-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.advanced { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 15px; margin-bottom: 12px; }

.btn {
  display: block; width: 100%; text-align: center; font: inherit; font-weight: 700; font-size: 17px;
  padding: 14px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
}
.btn:disabled { opacity: .45; cursor: wait; }
.btn.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.order-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.order-box p { margin: 0 0 10px; font-size: 15px; color: var(--muted); }

.about { color: var(--muted); font-size: 15px; max-width: 70ch; margin-bottom: 40px; }
.about h2 { color: var(--ink); font-size: 19px; }

footer { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: 14px; }
