:root {
  --B8: #eef4ff;
  --B9: #f5f8ff;
  --B11: #ffffff;
  --G1: #147a3f;
  --G10: #e8f7ee;
  --P1: #2f2a8f;
  --P2: #4a42b8;
  --P4: #6f66df;
  --P6: #766cf0;
  --P8: #deddf7;
  --P9: #efedff;
  --P10: #f7f6ff;
  --R2: #d92d20;
  --Y1: #8a5b00;
  --Y2-1: #fff4d6;
  --N1: #20242f;
  --N2: #303545;
  --N3: #4d5568;
  --N4: #646d80;
  --N6: #8b94a7;
  --N8: #d7dce5;
  --N9: #eef1f6;
  --BG-light-1: #ffffff;
  --BG-light-2: #f6f8fb;
  --S1-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --S2-float: 0 4px 16px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--BG-light-2);
  color: var(--N1);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.site-home[hidden],
.app-layout[hidden] {
  display: none !important;
}

.site-home {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(90deg, var(--N9) 1px, transparent 1px),
    linear-gradient(var(--N9) 1px, transparent 1px),
    linear-gradient(180deg, var(--B11), var(--BG-light-2));
  background-size: 32px 32px, 32px 32px, auto;
}

.site-home::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, var(--B11), transparent 32%, var(--BG-light-2));
  pointer-events: none;
}

.home-shell {
  position: relative;
  z-index: 1;
  width: min(1128px, 100%);
  padding: 32px;
  transform: translateY(clamp(-56px, -6vh, -36px));
}

.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

.home-logo {
  display: block;
  width: min(420px, 100%);
  height: auto;
}

.home-slogan {
  margin: 0;
  color: var(--N4);
  font-size: 16px;
  line-height: 22px;
  font-weight: 500;
}

.business-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.business-card {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 176px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--N8);
  border-radius: 16px;
  color: var(--N1);
  background: var(--B11);
  box-shadow: var(--S1-card);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.business-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: var(--N9);
}

.business-card span {
  position: relative;
  z-index: 1;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.business-card-primary {
  border-color: var(--P8);
  background: linear-gradient(135deg, var(--P10), var(--B11));
}

.business-card-primary::before {
  background: var(--P6);
}

.business-card:hover:not(:disabled),
.business-card:focus-visible:not(:disabled) {
  transform: translateY(-4px);
  border-color: var(--P8);
  background: var(--P10);
  box-shadow: var(--S2-float);
}

.business-card:active:not(:disabled) {
  transform: translateY(-1px);
}

.business-card:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: var(--N4);
  background: var(--N9);
  box-shadow: none;
}

.brand-home-link {
  color: inherit;
  text-decoration: none;
  outline: none;
}

.brand-home-link:hover,
.brand-home-link:focus-visible {
  color: var(--P2);
}

.blank-business-mode .tree,
.blank-business-mode .ready-badge,
.blank-business-mode #editorModeBadge,
.blank-business-mode #editorMount,
.blank-business-mode .export-actions,
.blank-business-mode #resetBtn,
.blank-business-mode .board {
  display: none;
}

.app-layout {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 340px;
  gap: 16px;
  padding: 16px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  background: var(--BG-light-1);
  border: 1px solid var(--N8);
  border-radius: 12px;
  box-shadow: var(--S1-card);
}

.panel-left,
.panel-right {
  overflow-y: auto;
  padding: 20px;
}

.module-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--N9);
}

.module-category,
.ready-badge,
.editor-head span {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 9999px;
  font-size: 12px;
  line-height: 16px;
}

.module-category {
  color: var(--P2);
  background: var(--P10);
}

.module-head h2,
.panel h2,
.preview-header h1 {
  margin: 0;
  color: var(--N1);
}

.module-head h2 {
  margin-top: 12px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.tree {
  margin-top: 20px;
}

.tree details {
  border: 1px solid var(--N8);
  border-radius: 8px;
  background: var(--B11);
}

.tree details + details {
  margin-top: 12px;
}

.tree summary {
  cursor: pointer;
  padding: 12px;
  color: var(--N2);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.tree ul {
  margin: 0;
  padding: 0 8px 8px;
}

.tree li {
  list-style: none;
  min-height: 32px;
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--N3);
  font-size: 13px;
  line-height: 18px;
  outline: none;
}

.tree li:hover,
.tree li:focus-visible,
.tree li.active {
  color: var(--P2);
  background: var(--P10);
}

.panel-center {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--N8);
  padding: 16px 20px;
}

.preview-header h1 {
  font-size: 22px;
  line-height: 30px;
  font-weight: 600;
}

.ready-badge {
  color: var(--G1);
  background: var(--G10);
}

.preview-wrap {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: hidden;
  overflow-x: hidden;
  padding: 24px;
  background:
    linear-gradient(90deg, var(--N9) 1px, transparent 1px),
    linear-gradient(var(--N9) 1px, transparent 1px),
    var(--BG-light-2);
  background-size: 24px 24px;
}

.board {
  width: var(--module-board-width, 1128px);
  transform: scale(var(--preview-scale, 1));
  transform-origin: top center;
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border: 1px solid var(--N8);
  border-radius: 8px;
  background: var(--N9);
  box-shadow: var(--S2-float);
}

.component {
  flex: 0 0 auto;
  width: 1080px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.panel h2,
.editor-head h2 {
  font-size: 18px;
  line-height: 26px;
  font-weight: 500;
}

.editor-head span {
  color: var(--P2);
  background: var(--P10);
}

.editor-group {
  margin-bottom: 20px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-row label {
  margin-bottom: 0;
}

.button-small {
  width: auto;
  height: 32px;
  padding: 0 12px;
}

.editor-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--N3);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

.editor-group input,
.editor-group textarea {
  width: 100%;
  border: 1px solid var(--N8);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--N1);
  background: var(--B11);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  outline: none;
}

.editor-group input {
  height: 40px;
}

.editor-group textarea {
  resize: vertical;
}

.editor-group input:focus,
.editor-group textarea:focus {
  border-color: var(--P6);
  box-shadow: 0 0 0 2px var(--P10);
}

button {
  width: 100%;
  height: 40px;
  cursor: pointer;
  border-radius: 8px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

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

.button-primary {
  border: 1px solid var(--P6);
  color: var(--B11);
  background: var(--P6);
}

.button-primary:hover:not(:disabled) {
  background: var(--P4);
}

.button-secondary {
  border: 1px solid var(--N8);
  color: var(--N3);
  background: var(--B11);
}

.button-secondary:hover:not(:disabled) {
  color: var(--P2);
  border-color: var(--P8);
  background: var(--P10);
}

.export-actions {
  margin: 24px 0 8px;
}

#exportStatus {
  min-height: 16px;
  margin: 8px 0 0;
  color: var(--N6);
  font-size: 12px;
  line-height: 16px;
}

.editor-empty {
  margin: 0;
  color: var(--N6);
  font-size: 13px;
  line-height: 20px;
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 220px minmax(420px, 1fr) 300px;
  }
}

@media (max-width: 960px) {
  .site-home {
    align-items: flex-start;
    padding: 24px 16px;
  }

  .home-shell {
    padding: 24px 0;
    transform: translateY(-16px);
  }

  .home-brand {
    justify-content: center;
    margin-bottom: 32px;
  }

  .business-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .business-card {
    min-height: 128px;
  }

  .app-layout {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }

  .panel-left {
    order: 1;
  }

  .panel-center {
    order: 2;
  }

  .panel-right {
    order: 3;
  }

  .preview-wrap {
    padding: 16px;
  }

  .board {
    padding: 16px;
    gap: 16px;
  }
}

@media (max-width: 520px) {
  .home-brand {
    gap: 12px;
  }

  .home-logo {
    width: min(320px, 100%);
  }

  .home-slogan {
    font-size: 14px;
    line-height: 20px;
  }

  .business-card span {
    font-size: 18px;
    line-height: 26px;
  }
}
