:root {
  --ink: #19243c;
  --muted: #657084;
  --blue: #3e58db;
  --line: #dce1e9;
  --soft: #f5f7fb;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: #f6f7fa;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.53;
}
button,
a,
input,
textarea {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #819aff;
}
button {
  color: inherit;
}
button svg,
.heading-icon svg {
  flex: none;
}
button {
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
button:hover:not(:disabled) {
  filter: brightness(0.965);
}
.topbar {
  height: 70px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.top-inner,
.workspace {
  width: min(1320px, calc(100% - clamp(40px, 8vw, 144px)));
  margin: auto;
}
.top-inner,
.top-right,
.brand,
.help,
.panel-heading,
.preview-actions,
.hero-tag,
.tabs button,
.example-link,
.primary,
.export-button,
.preview-meta,
.page-footer,
.page-footer span,
.preview-footer,
.preview-footer span,
.format-list button,
.subtle,
.model-state,
.icon-btn,
.material-label,
.section-controls,
.form-actions {
  display: flex;
  align-items: center;
}
.top-inner {
  height: 100%;
  justify-content: space-between;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  gap: 10px;
}
.brand img {
  box-shadow: 0 2px 5px #213dad26;
  border-radius: 10px;
}
.brand strong {
  font-size: 1.45rem;
  letter-spacing: 0.04em;
}
.brand span {
  font-family: Inter, "Helvetica Neue", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  color: #657087;
  padding-left: 11px;
  border-left: 1px solid #d9dfe8;
}
.top-right {
  gap: 21px;
}
.help {
  font-size: 0.86rem;
  gap: 7px;
}
.help {
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  padding: 7px 11px;
}
.workspace {
  padding: 25px 0 20px;
}
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 172px;
  background: linear-gradient(106deg, #2639a7 0%, #334ac8 49%, #465ed6 100%);
  color: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  box-shadow: inset 0 0 0 1px #1f36a123;
}
.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#c2ddff0f 1px, transparent 1px),
    linear-gradient(90deg, #c2ddff0f 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, transparent, #000 48%);
  z-index: -1;
}
.hero-content {
  padding: 27px 36px;
  z-index: 1;
}
.hero-tag {
  gap: 7px;
  font:
    600 0.71rem/1.2 ui-monospace,
    SFMono-Regular,
    monospace;
  letter-spacing: 0.14em;
  color: #e2e7ff;
}
.hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(1.9rem, 3.25vw, 2.68rem);
  line-height: 1.18;
  letter-spacing: 0.015em;
}
.hero p {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.65;
  color: #e6eaff;
}
.blueprint {
  position: absolute;
  inset: 0 0 0 52%;
  pointer-events: none;
}
.guide {
  position: absolute;
  opacity: 0.4;
}
.guide-x {
  left: 6%;
  right: 6%;
  top: 75%;
  border-top: 1px dashed #aec3ff;
}
.guide-y {
  left: 78%;
  top: 5%;
  bottom: 7%;
  border-left: 1px dashed #aec3ff;
}
.diagram {
  position: absolute;
  left: 46%;
  top: 51%;
  width: 155px;
  height: 139px;
  transform: translate(-50%, -50%) rotate(-9deg);
}
.illustrated-sheet,
.back-sheet {
  position: absolute;
  top: 5px;
  left: 20px;
  width: 100px;
  height: 132px;
  border-radius: 6px;
}
.back-sheet {
  transform: translate(12px, 3px) rotate(16deg);
  background: linear-gradient(120deg, #879eed, #a5b5f4);
  border: 1px solid #c9d4fc;
  box-shadow: 8px 8px 15px #17278535;
}
.illustrated-sheet {
  padding: 15px 12px;
  background: linear-gradient(135deg, #fff, #eef2ff 70%, #cbd7fb);
  border: 1px solid #fff;
  box-shadow: 1px 6px 14px #16278544;
}
.illustrated-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.portrait {
  position: relative;
  width: 23px;
  height: 25px;
  overflow: hidden;
  border-radius: 4px;
  background: #d4ddfc;
}
.portrait:before,
.portrait:after {
  content: "";
  display: block;
  background: #8ca2ec;
  position: absolute;
  left: 8px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.portrait:after {
  left: 3px;
  top: 14px;
  width: 18px;
  height: 14px;
}
.marks i,
.sketch-lines i {
  height: 3px;
  border-radius: 3px;
  background: #a7b7e8;
  display: block;
}
.marks i:first-child {
  width: 32px;
  background: #536dc4;
  margin-bottom: 5px;
}
.marks i:last-child {
  width: 22px;
}
.illustrated-rule {
  height: 1px;
  background: #c1cef1;
  margin: 10px 0;
}
.sketch-lines {
  display: grid;
  gap: 5px;
}
.sketch-lines i:first-child,
.sketch-lines i:nth-child(4) {
  height: 4px;
  background: #748cd1;
}
.ink-pen {
  position: absolute;
  top: 29px;
  left: 134px;
  width: 9px;
  height: 94px;
  transform: rotate(31deg);
  border-radius: 4px 4px 0 0;
  background: linear-gradient(90deg, #b3c2fb, #eef3ff 43%, #8d9fda);
  box-shadow: 3px 5px 5px #17278555;
}
.ink-pen:before {
  content: "";
  position: absolute;
  top: 8px;
  right: -3px;
  width: 2px;
  height: 23px;
  background: #cad7ff;
}
.ink-pen:after {
  content: "";
  position: absolute;
  bottom: -10px;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 11px solid #a8b9ed;
}
.seal {
  position: absolute;
  bottom: 3px;
  right: 25px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #d1f7ed;
  color: #25856e;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 3px 8px #23388a44;
}
.drawing-scale {
  position: absolute;
  right: 18px;
  bottom: 12px;
  color: #d7e1fe;
  font:
    500 0.73rem/1.3 ui-monospace,
    monospace;
  letter-spacing: 0.04em;
}
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  margin-top: 21px;
  align-items: start;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 2px 5px #16284a05;
}
.panel-heading {
  min-height: 64px;
  padding: 12px 21px;
  gap: 10px;
  border-bottom: 1px solid #e4e7ee;
}
.heading-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  color: #425dda;
  background: #eef1ff;
}
.heading-icon svg {
  width: 17px;
  height: 17px;
}
.panel-heading h2,
.modal h2 {
  margin: 0;
  font-size: 1.09rem;
  letter-spacing: 0.01em;
}
.example-link {
  border: 0;
  background: transparent;
  color: #4058ca;
  gap: 5px;
  font-size: 0.81rem;
  font-weight: 550;
  padding: 4px 0;
}
.panel-heading > .example-link {
  margin-left: auto;
}
.editor-inside {
  padding: 20px;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 9px;
  background: #eff2f7;
  margin-bottom: 22px;
}
.tabs button {
  border: 1px solid transparent;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 8px 3px;
  background: transparent;
  color: #637086;
  font-size: 0.9rem;
  font-weight: 550;
}
.tabs button.selected {
  background: white;
  color: #3d55cc;
  box-shadow: 0 1px 4px #22365a19;
  border-color: #e1e5ed;
}
.entry-fields,
.edit-form fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.entry-fields,
.edit-form {
  display: grid;
  gap: 17px;
}
.pair {
  display: grid;
  grid-template-columns: 1.16fr 1fr;
  gap: 13px;
}
label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}
label b {
  color: #566de1;
  font-weight: 550;
}
label small {
  font-size: 0.75rem;
  font-weight: 400;
  color: #707b8d;
  margin-left: 5px;
}
input,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #d7dce5;
  background: white;
  border-radius: 7px;
  color: var(--ink);
  padding: 10px 12px;
  line-height: 1.55;
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 7px;
  min-width: 0;
}
textarea {
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: #838d9f;
}
input:focus,
textarea:focus {
  border-color: #657cee;
  outline: 2px solid #e1e6ff;
}
.text-wrap {
  border: 1px solid #d7dce5;
  border-radius: 7px;
  overflow: hidden;
  margin-top: 7px;
}
.text-wrap:focus-within {
  border-color: #657cee;
  outline: 2px solid #e1e6ff;
}
.text-wrap textarea {
  min-height: 105px;
  border: 0;
  outline: 0;
  margin: 0;
  resize: vertical;
  line-height: 1.75;
}
.counter {
  display: block;
  text-align: right;
  padding: 0 11px 8px;
  color: #738098;
  font:
    0.75rem/1.3 ui-monospace,
    monospace;
}
.material-label {
  justify-content: space-between;
}
.tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #f0f4ff;
  color: #3d54ae;
  border: 1px solid #e0e7ff;
  border-radius: 8px;
  padding: 12px;
}
.tip svg {
  flex: none;
  margin-top: 1px;
}
.tip strong {
  font-size: 0.81rem;
}
.tip p {
  margin: 3px 0 0;
  color: #596783;
  line-height: 1.6;
  font-size: 0.82rem;
}
.primary,
.export-button {
  border: 1px solid #3d53d5;
  background: var(--blue);
  color: white;
  border-radius: 7px;
  justify-content: center;
  gap: 6px;
  font-weight: 550;
}
.primary {
  padding: 10px 17px;
}
.generate {
  width: 100%;
  min-height: 43px;
  box-shadow: 0 2px 4px #243d9b24;
  font-size: 0.95rem;
}
.model-state {
  justify-content: center;
  gap: 7px;
  font-size: 0.76rem;
  margin-top: 12px;
  color: #697589;
}
.status-dot,
.tiny-dot {
  background: #8792a5;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.preview-actions {
  margin-left: auto;
  gap: 8px;
}
.icon-btn,
.subtle {
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  justify-content: center;
}
.icon-btn {
  padding: 7px;
  color: #536178;
}
.export-button {
  font-size: 0.85rem;
  padding: 7px 10px;
}
.preview-stage,
.expanded {
  container-type: inline-size;
  background-color: #eef1f6;
  background-image: radial-gradient(#c9d1de 0.85px, transparent 0.85px);
  background-size: 13px 13px;
}
.preview-stage {
  padding: 15px clamp(16px, 2.8vw, 42px) 26px;
  max-height: 740px;
  overflow: auto;
  scrollbar-width: thin;
}
.preview-meta {
  justify-content: space-between;
  margin: 0 0 13px;
  color: #626f82;
  font-size: 0.75rem;
}
.preview-meta > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tiny-dot {
  background: #6983ca;
}
.paper {
  margin: 0 auto;
  width: 100%;
  max-width: 750px;
  min-height: max(560px, min(750px, 100cqw) * 1.4142);
  padding: 0;
  background: white;
  color: #253044;
  border: 1px solid #dfe3eb;
  box-shadow: 0 3px 12px #22385812;
  overflow-wrap: anywhere;
}
.paper > article {
  min-width: 0;
  font:
    10pt/1.5 Arial,
    sans-serif;
  color: #273449;
  white-space: normal;
}
.paper :where(main, header, section, div) {
  min-width: 0;
}
.paper :where(h1, h2, p, ul, ol) {
  margin: 0;
}
.paper :where(h1) {
  font-size: 24pt;
  line-height: 1.2;
}
.paper :where(h2) {
  font-size: 12pt;
}
.paper :where(p, li, h1, h2) {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.paper :where(ul, ol) {
  padding-left: 1.3em;
}
.paper :where(p:empty, h1:empty) {
  display: none;
}
.preview-footer,
.page-footer {
  justify-content: space-between;
  gap: 10px;
  color: #697487;
  font-size: 0.79rem;
}
.preview-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}
.preview-footer span,
.page-footer span {
  gap: 7px;
}
.page-footer {
  padding: 17px 2px;
}
.page-footer button {
  border: 0;
  background: transparent;
  color: #657084;
  font-size: 0.8rem;
}
.feedback {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #266348;
}
.feedback.error {
  color: #a33732;
}
.modal {
  background: transparent;
  border: 0;
  padding: 0;
  width: min(420px, calc(100% - 30px));
  max-height: 88dvh;
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 16px 80px #17264034;
}
.modal.wide {
  width: min(720px, calc(100% - 30px));
}
.modal::backdrop {
  background: #17203672;
}
.modal-frame {
  background: white;
}
.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.help-body,
.edit-form,
.confirm,
.format-list {
  padding: 20px;
}
.help-body h3 {
  font-size: 0.95rem;
  margin: 16px 0 4px;
}
.help-body h3:first-child {
  margin-top: 0;
}
.help-body p,
.confirm p {
  line-height: 1.7;
  font-size: 0.9rem;
  margin: 0;
  color: #546176;
}
.format-list {
  display: grid;
  gap: 9px;
}
.format-list button {
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 12px;
  color: var(--blue);
}
.format-list button > svg:last-child {
  margin-left: auto;
}
.format-list strong,
.format-list small {
  display: block;
}
.format-list strong {
  font-size: 0.95rem;
  color: var(--ink);
}
.format-list small {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}
.expanded {
  padding: 18px;
}
.edit-form fieldset {
  background: #f7f8fb;
  padding: 14px;
  border-radius: 8px;
  display: grid;
  gap: 10px;
}
.section-controls {
  gap: 15px;
}
.section-controls label {
  flex: 1;
}
.form-actions {
  justify-content: space-between;
  gap: 10px;
}
.subtle {
  gap: 5px;
  padding: 9px 12px;
  font-size: 0.9rem;
}
.confirm .form-actions {
  margin-top: 20px;
  justify-content: flex-end;
}
.spin {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.print-only {
  display: none;
}
@media (min-width: 1600px) {
  .workspace {
    padding-top: 32px;
  }
  .hero {
    min-height: 190px;
  }
}
@media (max-width: 960px) {
  .top-inner,
  .workspace {
    width: calc(100% - 36px);
  }
  .workspace-grid {
    grid-template-columns: minmax(0, 0.93fr) minmax(0, 1fr);
    gap: 13px;
  }
  .editor-inside {
    padding: 15px;
  }
  .panel-heading {
    padding: 12px 14px;
  }
  .preview-stage {
    padding: 13px;
  }
  .hero-content {
    padding: 25px;
  }

  .drawing-scale {
    font-size: 0.66rem;
  }
}
@media (max-width: 740px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .workspace {
    padding-top: 15px;
  }
  .topbar {
    height: 58px;
  }
  .top-inner,
  .workspace {
    width: calc(100% - 26px);
  }
  .top-right {
    gap: 8px;
  }
  .brand span {
    font-size: 0.76rem;
  }
  .hero {
    min-height: 150px;
    border-radius: 10px;
  }
  .hero-content {
    padding: 20px;
    max-width: 72%;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero p {
    font-size: 0.82rem;
  }
  .blueprint {
    left: 67%;
  }
  .diagram {
    left: 43%;
    transform: translate(-50%, -50%) rotate(-9deg) scale(0.65);
  }
  .drawing-scale {
    display: none;
  }
  .hero-tag {
    font-size: 0.66rem;
  }
  .workspace-grid {
    margin-top: 14px;
  }
  .preview-stage {
    max-height: none;
    padding: 14px 17px 20px;
  }
  .panel-heading {
    min-height: 57px;
  }

  .page-footer {
    font-size: 0.73rem;
  }
  .top-inner .help {
    font-size: 0.78rem;
  }
  .editor-inside {
    padding: 17px;
  }
  .tip p {
    font-size: 0.8rem;
  }
}
@media print {
  @page {
    size: A4;
    margin: 15mm 16mm;
  }
  html,
  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .workspace,
  .topbar,
  .modal {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .paper {
    width: 100%;
    max-width: none;
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
    padding: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .paper h1,
  .paper h2 {
    break-after: avoid;
  }
  .paper p,
  .paper li {
    orphans: 2;
    widows: 2;
  }
}
