:root {
  --bg: #0f0f0e;
  --panel: #181818;
  --panel2: #202020;
  --text: #f6f3ec;
  --muted: #a8a29a;
  --line: rgba(255,255,255,.12);
  --accent: #ff7a18;
  --ok: #9ee7a2;
  --danger: #ff746d;
  --radius: 22px;
  font-family: Helvetica, Arial, system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -20%, #24211d 0, #0f0f0e 42%, #090909 100%); color: var(--text); }
body { -webkit-font-smoothing: antialiased; }
.shell { width: min(980px, 100%); margin: 0 auto; padding: 26px 16px 64px; }
.hero { padding: 26px 4px 18px; }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 8px 0 8px; font-size: clamp(38px, 8vw, 76px); line-height: .9; letter-spacing: -.055em; }
.lead { margin: 0; max-width: 680px; color: var(--muted); font-size: 16px; line-height: 1.65; }
.panel, .note { background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.34); }
.section-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.step { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #111; display: grid; place-items: center; font-weight: 900; }
h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.02em; }
.section-head p, .note p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.note p + p { margin-top: 10px; }
.field { display: grid; gap: 8px; margin: 14px 0; }
.field span { color: var(--text); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.25); color: var(--text); padding: 13px 14px; font: inherit; outline: none; }
textarea { resize: vertical; min-height: 118px; }
input:focus, textarea:focus { border-color: rgba(255,122,24,.72); box-shadow: 0 0 0 4px rgba(255,122,24,.1); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
button { border: 0; border-radius: 999px; padding: 12px 18px; color: var(--text); background: var(--panel2); font-weight: 900; cursor: pointer; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .48; cursor: wait; transform: none; }
.primary { background: var(--accent); color: #111; }
.ghost { border: 1px solid var(--line); background: transparent; }
.status { min-height: 28px; margin-top: 14px; padding: 10px 12px; border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); font-size: 13px; line-height: 1.45; }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.pattern-stage { margin-top: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(0,0,0,.17); overflow: hidden; }
.pattern-stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.pattern-stage-head h3 { margin: 0; font-size: 15px; letter-spacing: .02em; }
.pattern-stage-head span { color: var(--muted); font-size: 12px; line-height: 1.45; text-align: right; }
.empty-pattern { padding: 34px 14px; color: var(--muted); font-size: 13px; text-align: center; }
.pattern-list.empty { display: block; padding: 0; }
.pattern-list { display: grid; gap: 14px; padding: 14px; margin: 0; }
.pattern-card { border: 1px solid var(--line); border-radius: 18px; background: rgba(0,0,0,.2); overflow: hidden; }
.pattern-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 12px 0; color: var(--muted); font-size: 13px; }
.canvas-wrap { padding: 12px; }
canvas.pattern { width: 100%; max-height: 72vh; object-fit: contain; display: block; border-radius: 14px; background: #111; image-rendering: auto; }
.pattern-card .actions { padding: 0 12px 12px; margin: 0; }
.result-field textarea { min-height: 138px; }
@media (min-width: 760px) { .panel, .note { padding: 24px; } .pattern-list.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
