:root {
  --paper: #f6f1e8;
  --ink: #173c3a;
  --muted: #687875;
  --orange: #f26b38;
  --line: #d8d4ca;
  --white: #fffdf8;
  --shadow: 0 18px 60px rgba(31, 53, 48, .11);
  --font: "Avenir Next", Avenir, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.site-header {
  height: 76px;
  max-width: 1240px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 60, 58, .12);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: .08em; }
.brand-mark { width: 29px; height: 29px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; transform: rotate(-3deg); }
.brand-mark i { display: block; background: var(--ink); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--orange); }
.privacy { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.privacy span { color: #45a36b; font-size: 9px; }

main { min-height: calc(100vh - 146px); }
.intro { max-width: 1120px; margin: 0 auto; padding: 92px 28px 72px; position: relative; }
.intro::before, .intro::after { content: ""; position: absolute; z-index: -1; border: 1px solid rgba(23,60,58,.09); transform: rotate(45deg); }
.intro::before { width: 270px; height: 270px; right: -90px; top: 50px; }
.intro::after { width: 110px; height: 110px; left: -100px; top: 330px; background: rgba(242,107,56,.04); }
.eyebrow { margin: 0 0 16px; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .22em; }
h1 { margin: 0; max-width: 760px; font-size: clamp(48px, 7.2vw, 88px); line-height: 1.02; letter-spacing: -.055em; }
h1 em { color: var(--orange); font-style: normal; }
.lead { max-width: 590px; margin: 25px 0 42px; color: var(--muted); font-size: 18px; line-height: 1.85; }

.upload-zone {
  min-height: 150px;
  padding: 28px 30px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  background: rgba(255,253,248,.78);
  border: 1.5px dashed #aab3ad;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
  cursor: pointer;
  transition: .2s ease;
}
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--orange); background: #fffaf1; transform: translateY(-2px); box-shadow: var(--shadow); }
.upload-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: #e8e5dc; }
.upload-icon svg { width: 31px; stroke: var(--ink); stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.upload-zone strong { display: block; margin-bottom: 7px; font-size: 18px; }
.upload-zone span { color: var(--muted); font-size: 13px; }
.primary-button, .download-button { border: 0; border-radius: 3px; background: var(--orange); color: white; font-weight: 700; cursor: pointer; transition: .2s ease; }
.primary-button { padding: 13px 22px; box-shadow: 5px 5px 0 var(--ink); }
.primary-button:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }

.steps { margin: 60px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 35px; list-style: none; }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.steps b { color: var(--orange); font-family: ui-monospace, monospace; font-size: 12px; }
.steps strong { display: block; margin-bottom: 6px; font-size: 14px; }
.steps span { color: var(--muted); font-size: 12px; line-height: 1.65; }

.workspace { max-width: 1400px; margin: auto; padding: 52px 28px 80px; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 25px; }
.workspace-heading h2 { margin: 0; font-size: 36px; letter-spacing: -.04em; }
.workspace-heading .eyebrow { margin-bottom: 8px; }
.text-button, .icon-button { border: 0; background: transparent; cursor: pointer; }
.text-button { padding: 8px 0; border-bottom: 1px solid var(--ink); font-weight: 700; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.canvas-card, .settings-card { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.canvas-card { min-width: 0; }
.canvas-toolbar { min-height: 56px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.zoom-control { display: flex; align-items: center; gap: 5px; }
.zoom-control button { width: 29px; height: 29px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.zoom-control output { min-width: 52px; text-align: center; color: var(--muted); font-size: 12px; }
.canvas-scroller { height: min(68vh, 760px); min-height: 430px; overflow: auto; display: grid; place-items: center; padding: 28px; background-color: #e9e7e0; background-image: linear-gradient(45deg, #dedbd2 25%, transparent 25%), linear-gradient(-45deg, #dedbd2 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dedbd2 75%), linear-gradient(-45deg, transparent 75%, #dedbd2 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
canvas { display: block; max-width: none; box-shadow: 0 7px 25px rgba(23,35,32,.19); }
canvas.is-grid-editing { touch-action: none; cursor: move; }
.canvas-hint { margin: 0; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.settings-card { padding: 20px; position: sticky; top: 18px; }
.status-row { display: flex; align-items: center; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #45a36b; box-shadow: 0 0 0 4px rgba(69,163,107,.13); }
.status-row.is-working .status-dot { background: var(--orange); animation: pulse 1s infinite; }
.icon-button { width: 28px; height: 28px; margin-left: auto; padding: 5px; }
.icon-button svg, .download-button svg { stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pulse { 50% { opacity: .35; } }
.result-box { margin: 18px 0; padding: 18px; background: var(--ink); color: white; text-align: center; }
.result-box > span, .result-box small { display: block; color: #b9cbc8; font-size: 10px; letter-spacing: .12em; }
.result-box strong { display: flex; justify-content: center; align-items: center; gap: 13px; margin: 5px 0 2px; font-size: 34px; letter-spacing: -.05em; }
.result-box i { color: var(--orange); font-size: 18px; font-style: normal; }
.adjust-grid-button { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); background: white; color: var(--ink); }
.adjust-grid-button svg { width: 18px; stroke: currentColor; stroke-width: 1.8; }
.adjust-grid-button[aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: white; box-shadow: 3px 3px 0 var(--ink); }
.adjust-grid-help { margin: 8px 2px 18px; color: var(--muted); font-size: 10px; line-height: 1.55; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { width: 100%; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
fieldset:not(.line-settings) { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
form label { color: var(--muted); font-size: 11px; }
input[type="number"] { width: 100%; height: 40px; margin-top: 5px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); background: white; font-weight: 700; outline: none; }
input[type="number"]:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(242,107,56,.13); }
details { margin: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { padding: 13px 0; cursor: pointer; font-size: 12px; font-weight: 700; }
summary span { float: right; color: var(--muted); font-size: 10px; font-weight: 400; }
.bounds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-bottom: 15px; }
.line-settings { display: flex; align-items: end; gap: 12px; }
.line-settings legend { margin-bottom: 0; }
.line-settings label:first-of-type { display: grid; grid-template-columns: auto 54px auto; align-items: center; gap: 6px; }
.line-settings input[type="number"] { width: 54px; }
.color-label { margin-left: auto; }
input[type="color"] { display: block; width: 42px; height: 40px; margin-top: 5px; padding: 3px; border: 1px solid var(--line); background: white; cursor: pointer; }
.switch-row { margin: 17px 0; padding-top: 15px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--ink); font-size: 12px; }
.switch-row small { margin-top: 3px; }
input[role="switch"] { appearance: none; width: 38px; height: 22px; padding: 3px; border-radius: 99px; background: #c9cec9; cursor: pointer; transition: .2s; }
input[role="switch"]::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: .2s; }
input[role="switch"]:checked { background: var(--orange); }
input[role="switch"]:checked::after { transform: translateX(16px); }
.download-button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 4px 4px 0 var(--ink); }
.download-button svg { width: 20px; }
.download-button:hover { filter: brightness(.96); transform: translate(1px,1px); box-shadow: 3px 3px 0 var(--ink); }

footer { max-width: 1240px; min-height: 70px; margin: auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(23, 60, 58, .12); color: var(--muted); font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 10; padding: 11px 18px; border-radius: 3px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .settings-card { position: static; }
  .canvas-scroller { height: 60vh; }
}
@media (max-width: 640px) {
  .site-header { height: 64px; padding: 0 18px; }
  .privacy { font-size: 11px; }
  .intro { padding: 62px 18px 50px; }
  .lead { font-size: 15px; margin-bottom: 30px; }
  .upload-zone { grid-template-columns: auto 1fr; padding: 22px 18px; gap: 15px; }
  .upload-icon { width: 48px; height: 48px; }
  .upload-zone span { line-height: 1.5; display: block; }
  .primary-button { grid-column: 1 / -1; width: 100%; }
  .steps { grid-template-columns: 1fr; gap: 18px; margin-top: 38px; }
  .workspace { padding: 36px 12px 60px; }
  .workspace-heading h2 { font-size: 28px; }
  .canvas-scroller { min-height: 340px; padding: 15px; }
  footer { padding: 20px 18px; gap: 10px; flex-direction: column; align-items: start; }
}
