:root {
  color-scheme: light;
  --page: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-tint: #eef7f4;
  --ink: #151b23;
  --ink-soft: #344054;
  --muted: #667085;
  --line: #d9e1e8;
  --line-strong: #b9c5d1;
  --green: #13a06f;
  --green-dark: #087455;
  --blue: #1f6feb;
  --yellow: #d99a19;
  --red: #d92d20;
  --violet: #7c3aed;
  --shadow-soft: 0 10px 26px rgba(21, 27, 35, 0.07);
  --shadow-panel: 0 18px 45px rgba(21, 27, 35, 0.09);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
}

main {
  flex: 1 0 auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1280px, calc(100% - 36px));
  margin: 0 auto;
}

.workspace-stage > .shell {
  width: min(1120px, calc(100% - 36px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(217, 225, 232, 0.92);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.topbar__inner {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand__copy {
  display: grid;
  gap: 1px;
}

.brand__copy strong {
  font-size: 15px;
  line-height: 1;
}

.brand__copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.primary-nav {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.primary-nav button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

.primary-nav button:hover {
  background: #eef2f6;
  color: var(--ink);
}

.topbar__actions,
.hero-actions,
.form-actions,
.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.solid-btn,
.ghost-btn,
.plain-btn,
.download-btn,
.view-tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 850;
  line-height: 1.1;
}

.solid-btn {
  background: var(--green);
  color: #fff;
}

.solid-btn:hover {
  background: var(--green-dark);
}

.ghost-btn,
.download-btn,
.view-tab {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-btn:hover,
.download-btn:hover,
.view-tab:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.plain-btn {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.plain-btn:hover {
  background: #eef2f6;
  color: var(--ink);
}

.logo-uploader {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.logo-uploader:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.workspace-stage {
  background: var(--page);
  padding: 30px 0 44px;
  scroll-margin-top: 80px;
}

.quick-create {
  border: 0;
  background: transparent;
}

.quick-create {
  margin-bottom: 12px;
}

.quick-type-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.quick-type {
  display: grid;
  grid-template-columns: auto auto;
  min-height: 48px;
  min-width: 0;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
  text-align: left;
}

.quick-type:hover,
.quick-type.is-active {
  border-color: rgba(19, 160, 111, 0.42);
  background: #effaf6;
}

.quick-type__icon {
  display: inline-grid;
  width: fit-content;
  min-width: 34px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 950;
}

.quick-type strong {
  font-size: 15px;
}

.view-switcher {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.view-tab {
  min-width: 112px;
}

.view-tab.is-active {
  border-color: rgba(19, 160, 111, 0.34);
  background: #eaf8f3;
  color: var(--green-dark);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 356px);
  gap: 14px;
  align-items: start;
}

.tool-rail,
.builder-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.tool-rail {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.tool-rail__head {
  display: grid;
  gap: 4px;
  padding: 3px 2px;
}

.tool-rail__head strong {
  font-size: 15px;
}

.tool-rail__head span {
  color: var(--muted);
  font-size: 12px;
}

.tool-tabs {
  display: grid;
  gap: 8px;
}

.tool-tab {
  display: grid;
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

.tool-tab span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tool-tab strong {
  margin-top: 4px;
  font-size: 14px;
}

.tool-tab.is-active {
  border-color: rgba(19, 160, 111, 0.46);
  background: #ecfdf5;
  box-shadow: inset 3px 0 0 var(--green);
}

.tool-rail__admin {
  width: 100%;
}

.builder-panel,
.preview-panel {
  padding: 18px;
  min-width: 0;
}

.workspace-view {
  display: none;
}

.workspace-view.is-active {
  display: block;
}

.panel-head,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h1,
.panel-head h3 {
  margin: 4px 0 0;
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.18;
  letter-spacing: 0;
}

.builder-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.mode-pane {
  display: none;
  gap: 14px;
}

.mode-pane.is-active {
  display: grid;
}

.form-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title strong {
  font-size: 15px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.field,
.color-field,
.range-field,
.check-field {
  display: grid;
  gap: 7px;
}

.field span,
.color-field span,
.range-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(19, 160, 111, 0.14);
}

.split-fields,
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.style-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.color-field,
.range-field {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.color-field input {
  width: 100%;
  height: 34px;
  border: 0;
  padding: 0;
  background: transparent;
}

.range-field input {
  width: 100%;
  accent-color: var(--green);
}

.upload-zone {
  display: grid;
  min-height: 124px;
  place-items: center;
  border: 1px dashed #a8b5c2;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 20px;
  text-align: center;
}

.upload-zone input,
.logo-uploader input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-zone__icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--green-dark);
  font-size: 27px;
  line-height: 1;
}

.upload-zone__title {
  font-weight: 900;
}

.upload-zone__meta {
  color: var(--muted);
  font-size: 12px;
}

.upload-zone__status {
  margin-top: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--green-dark);
}

.logo-row,
.form-actions {
  flex-wrap: wrap;
}

.check-field {
  display: inline-flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--muted);
  font-weight: 850;
}

.check-field input {
  accent-color: var(--green);
}

.inline-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-message.is-error {
  color: var(--red);
}

.preview-panel {
  position: sticky;
  top: 84px;
}

.preview-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.qrcode-preview,
.qr-preview {
  margin-top: 14px;
}

.canvas-frame {
  display: grid;
  min-height: 322px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
}

#qrCanvas {
  display: block;
  width: min(100%, 300px);
  height: auto;
  border-radius: 7px;
  background: #fff;
}

.qr-preview__caption {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.download-btn {
  width: 100%;
}


@media (max-width: 1180px) {
  .workbench {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  }

  .preview-panel {
    grid-column: auto;
  }

  .canvas-frame {
    min-height: 264px;
  }

  #qrCanvas {
    width: min(100%, 260px);
  }
}

@media (max-width: 960px) {
  .hero-grid,
}

@media (max-width: 840px) {
  .topbar__inner {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar__inner {
    padding: 10px 0;
  }

  .primary-nav {
    width: 100%;
  }

  .topbar__actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar__actions button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    white-space: nowrap;
  }

  .view-switcher {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-tab {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .split-fields,
  .style-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 24px, 1280px);
  }

  .workspace-stage > .shell {
    width: min(100% - 24px, 1120px);
  }

  .workspace-stage {
    padding-top: 20px;
  }

  .quick-type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-type {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .quick-create {
    padding: 18px;
  }

  .topbar__actions {
    grid-template-columns: 1fr;
  }

  .topbar__actions button {
    white-space: normal;
  }

  .builder-panel,
  .preview-panel {
    padding: 14px;
  }

  .panel-head,
  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

}

/* ICP Footer */
.site-footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 8px 16px 12px;
  color: rgba(102, 112, 133, 0.48);
  font-size: 10px;
  line-height: 1.2;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: rgba(102, 112, 133, 0.72);
}
