:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #fbfbfc;
  --ink: #17191f;
  --muted: #707784;
  --line: #e5e7ec;
  --line-strong: #d7dbe3;
  --brand: #ef5350;
  --brand-strong: #dc3d39;
  --brand-soft: #fff1f0;
  --blue: #2f6fed;
  --green: #13a66b;
  --shadow: 0 14px 34px rgba(22, 28, 45, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #fff2f1 0, transparent 32rem),
    linear-gradient(180deg, #fff 0, var(--bg) 22rem);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(229, 231, 236, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(680px, 1fr) 300px;
  gap: 18px;
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.control-column,
.summary-column,
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.upload-panel,
.panel:not(.preview-panel) {
  padding: 22px;
}

.panel-heading,
.panel-title,
.preview-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.panel-title {
  align-items: center;
  margin-bottom: 18px;
}

.panel-title.split {
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading h1,
.panel-title h2,
.preview-header h2,
.price-panel h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.panel-heading p,
.preview-header p,
.hint,
.pay-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.section-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--brand);
  font-weight: 800;
}

.drop-zone {
  margin-top: 18px;
  min-height: 178px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fffafa);
  text-align: center;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.drop-zone input {
  display: none;
}

.upload-symbol {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: #ffe8e5;
  font-size: 28px;
  font-weight: 700;
}

.drop-zone small,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.sample-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.ai-q-btn {
  width: 100%;
  min-height: 58px;
  margin-top: 12px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: #151923;
  background: linear-gradient(135deg, #ffd44d, #ffb800);
  border: 1px solid #f0aa00;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(255, 184, 0, 0.22);
  font-size: 15px;
  font-weight: 900;
}

.ai-q-btn small {
  color: rgba(21, 25, 35, 0.68);
  font-size: 11px;
  font-weight: 700;
}

.ai-q-btn:disabled {
  cursor: wait;
  opacity: 0.68;
}

.ai-q-btn {
  display: none;
}

.link-btn {
  border: 0;
  color: var(--brand);
  background: transparent;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 700;
}

.full-link {
  width: 100%;
  margin-top: 8px;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label,
.field > span,
.range-label label {
  color: #303642;
  font-size: 13px;
  font-weight: 700;
}

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

.field textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  padding: 12px;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(239, 83, 80, 0.12);
}

.custom-palette-field[hidden] {
  display: none;
}

input[type="range"] {
  accent-color: var(--brand);
  width: 100%;
  margin: 8px 0 0;
}

.range-label,
.grid-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.range-label span {
  justify-self: end;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 8px;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: #f0f2f5;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.segmented button {
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segmented button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(239, 83, 80, 0.24);
}

.mode-segmented {
  grid-template-columns: repeat(2, 1fr);
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  color: #303642;
  font-size: 13px;
  font-weight: 700;
}

.toggle-row input {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--brand);
}

.toggle-row span {
  display: grid;
  gap: 2px;
}

.toggle-row small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.highlight-toggle {
  padding: 14px;
  border: 1px solid #ffd7cf;
  border-radius: 14px;
  background: #fff7e7;
}

.highlight-toggle small {
  color: #9a5a2c;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, opacity 0.12s;
}

.primary-btn {
  min-height: 42px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(239, 83, 80, 0.22);
}

.primary-btn:hover:not(:disabled),
.ghost-btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.5;
  box-shadow: none;
}

.ghost-btn {
  min-height: 38px;
  color: #333944;
  background: #fff;
  border-color: var(--line-strong);
  padding: 0 14px;
  font-weight: 800;
}

.ghost-btn.full,
.primary-btn.full {
  width: 100%;
}

.primary-btn.compact {
  padding: 0 16px;
}

.primary-btn.tall {
  min-height: 50px;
}

.preview-panel {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header {
  justify-content: space-between;
  padding: 24px 24px 16px;
}

.preview-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  color: #333944;
  background: #fff;
  border-color: var(--line-strong);
  font-size: 20px;
  font-weight: 800;
}

.zoom-chip {
  min-height: 34px;
  padding: 0 12px;
  color: #465162;
  background: #fff;
  border-color: var(--line-strong);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}

.zoom-chip.active {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 10px 22px rgba(245, 74, 74, 0.22);
}

.canvas-stage {
  position: relative;
  flex: 1;
  height: calc(100vh - 170px);
  min-height: 620px;
  max-height: calc(100vh - 170px);
  margin: 0 24px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background-color: #fafafa;
  background-image: linear-gradient(#ededed 1px, transparent 1px),
    linear-gradient(90deg, #ededed 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: auto;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
}

.canvas-stage.panning {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  z-index: 1;
}

.empty-state span {
  margin: 0 auto 10px;
  color: #c5c9d1;
  font-size: 44px;
}

.empty-state strong {
  color: #454c58;
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 13px;
}

#patternCanvas {
  display: none;
  margin: 40px auto;
  background: #fff;
  box-shadow: var(--shadow);
  max-width: none;
  height: auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-grid div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.metric-grid small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}

.metric-grid strong {
  display: block;
  font-size: 19px;
}

.metric-grid em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}

.metric-grid em.active {
  color: #08794f;
}

.color-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.color-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.08);
}

.color-row strong {
  display: block;
  font-size: 13px;
}

.color-row small {
  color: var(--muted);
  font-size: 11px;
}

.count-pill {
  color: #606774;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.edit-panel .panel-title {
  margin-bottom: 14px;
}

.edit-panel .panel-title span {
  color: var(--green);
  background: #e8faf1;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tool-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #454c58;
  background: #fff;
  font-weight: 900;
}

.tool-btn.active {
  color: #fff;
  border-color: transparent;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(239, 83, 80, 0.18);
}

.compact-field {
  margin-bottom: 8px;
}

.sr-only-select {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
  pointer-events: none;
}

.current-color {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.current-color strong {
  display: block;
  font-size: 15px;
}

.current-color small {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-color em {
  justify-self: end;
  min-width: 48px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.edit-color-search {
  width: 100%;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.edit-color-search:focus {
  border-color: #ffaaa4;
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.08);
}

.edit-color-search:disabled {
  color: var(--muted);
  background: #f6f7f9;
}

.empty-swatch {
  background: linear-gradient(135deg, #f0f2f5 25%, #fff 25%, #fff 50%, #f0f2f5 50%, #f0f2f5 75%, #fff 75%);
  background-size: 10px 10px;
}

.edit-color-grid {
  display: grid;
  gap: 7px;
  max-height: 210px;
  margin-bottom: 12px;
  overflow: auto;
  padding-right: 4px;
}

.edit-color-chip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}

.edit-color-chip.used {
  background: #fffefe;
}

.edit-color-chip.active {
  border-color: #ffaaa4;
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.08);
}

.edit-color-chip strong,
.edit-color-chip small {
  display: block;
}

.edit-color-chip strong {
  font-size: 12px;
}

.edit-color-chip small {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-color-chip b {
  color: #606774;
  background: #f6f7f9;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
}

.color-empty {
  margin: 0;
  padding: 10px 4px;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.price-panel h2 {
  margin-bottom: 12px;
}

.plan-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.plan-list button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.plan-list button span {
  font-weight: 900;
}

.plan-list button strong {
  color: var(--brand);
  font-size: 18px;
}

.plan-list button small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.plan-list .recommended {
  border-color: #ffc9c5;
  background: var(--brand-soft);
}

.marketing-section {
  width: min(1500px, calc(100% - 44px));
  margin: 0 auto 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.section-head {
  text-align: center;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-head p {
  margin: 8px auto 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.feature-card {
  display: flex;
  gap: 12px;
  min-height: 98px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.feature-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
}

.feature-icon.purple {
  color: #5c5ce2;
  background: #ececff;
}

.feature-icon.blue {
  color: #6a4df0;
  background: #f0eaff;
}

.feature-icon.green {
  color: #13a66b;
  background: #dffbea;
}

.feature-icon.orange {
  color: #ff7b2c;
  background: #fff0dc;
}

.feature-icon.pink {
  color: #e94291;
  background: #ffe9f4;
}

.feature-icon.cyan {
  color: #2584ff;
  background: #e7f1ff;
}

.feature-icon.yellow {
  color: #8b5a00;
  background: #fff0bd;
}

.feature-card h3 {
  margin: 1px 0 7px;
  font-size: 15px;
  line-height: 1.3;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.example-flow {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 56px minmax(220px, 1fr);
  align-items: center;
  gap: 28px;
  max-width: 1060px;
  margin: 0 auto;
}

.example-card {
  min-height: 188px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(22, 28, 45, 0.06);
}

.example-label {
  color: var(--blue);
  background: #eef3ff;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.flow-arrow {
  justify-self: center;
  color: #8a92a0;
  font-size: 24px;
  font-weight: 900;
}

.sample-image {
  width: 160px;
  height: 160px;
  justify-self: center;
  display: block;
  object-fit: cover;
  border-radius: 14px;
  background: #f7f7f8;
}

.pattern-image {
  object-fit: contain;
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(9, 12, 20, 0.48);
  backdrop-filter: blur(12px);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  position: relative;
  width: min(480px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.26);
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #f2f3f5;
  font-size: 24px;
}

.modal-kicker {
  width: fit-content;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.modal h2 {
  margin: 14px 0 8px;
  font-size: 26px;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.modal-plans div {
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfbfc;
}

.modal-plans .hot {
  border-color: #ffc9c5;
  background: var(--brand-soft);
}

.modal-plans strong,
.modal-plans span {
  display: block;
}

.modal-plans strong {
  font-size: 13px;
}

.modal-plans span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.modal-error {
  min-height: 18px;
  color: var(--brand) !important;
  font-size: 12px;
  font-weight: 800;
}

.buy-box {
  margin-top: 14px;
  padding: 13px;
  border-radius: 14px;
  background: #f6f7f9;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.buy-box strong,
.buy-box span {
  display: block;
}

.buy-box strong {
  color: var(--ink);
}

.mini-buy-btn {
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--brand);
  padding: 8px 10px;
  font-weight: 900;
}

.purchase-modal {
  width: min(560px, 100%);
}

.purchase-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.purchase-plans article {
  padding: 15px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfbfc;
}

.purchase-plans article.best {
  border-color: #ffc9c5;
  background: var(--brand-soft);
  box-shadow: 0 12px 24px rgba(239, 83, 80, 0.11);
}

.purchase-plans span,
.purchase-plans strong,
.purchase-plans small {
  display: block;
}

.purchase-plans span {
  color: #363d48;
  font-weight: 900;
}

.purchase-plans strong {
  margin: 8px 0 6px;
  color: var(--brand);
  font-size: 25px;
  line-height: 1;
}

.purchase-plans small {
  color: var(--muted);
  line-height: 1.45;
}

.payment-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f9fb;
}

.qr-placeholder {
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 6px;
  border: 2px dashed #ffc9c5;
  border-radius: 16px;
  color: var(--brand);
  background: #fff;
  text-align: center;
  font-weight: 900;
}

.qr-placeholder small {
  max-width: 100px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.payment-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.payment-card p {
  margin: 0 0 12px;
  font-size: 13px;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.copy-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  color: #fff;
  background: rgba(20, 23, 30, 0.9);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  transition: opacity 0.18s, transform 0.18s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  body {
    background: #f5f7fa;
    font-size: 17px;
  }

  .topbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 19px;
  }

  .brand strong {
    font-size: 18px;
  }

  .brand small {
    display: none;
  }

  .top-actions .ghost-btn:first-child {
    display: none;
  }

  .top-actions {
    gap: 7px;
  }

  .top-actions #downloadBtnTop {
    display: none;
  }

  .ghost-btn,
  .primary-btn.compact {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 14px;
    font-size: 16px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .control-column {
    order: 1;
  }

  .preview-column {
    order: 2;
  }

  .summary-column {
    order: 3;
  }

  .panel {
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(22, 28, 45, 0.06);
  }

  .upload-panel,
  .panel:not(.preview-panel) {
    gap: 16px;
  }

  .panel-heading,
  .panel-title {
    gap: 10px;
  }

  .panel-heading h1,
  .panel-title h2,
  .price-panel h2 {
    font-size: 25px;
    line-height: 1.2;
  }

  .panel-heading p,
  .section-head p {
    font-size: 17px;
    line-height: 1.45;
  }

  .section-icon {
    width: 28px;
    height: 28px;
    font-size: 17px;
  }

  .drop-zone {
    min-height: 190px;
    border-radius: 18px;
  }

  .upload-symbol {
    width: 66px;
    height: 66px;
    font-size: 38px;
  }

  .drop-zone strong {
    font-size: 20px;
  }

  .drop-zone small,
  .drop-zone .hint {
    font-size: 15px;
  }

  .segmented {
    min-height: 56px;
  }

  .segmented button {
    font-size: 18px;
  }

  .grid-pair {
    gap: 10px;
  }

  .marketing-section {
    width: calc(100% - 28px);
    padding: 22px;
    margin-bottom: 16px;
  }

  .feature-grid,
  .example-flow,
  .example-card {
    grid-template-columns: 1fr;
  }

  .example-flow {
    gap: 14px;
  }

  .flow-arrow {
    transform: rotate(90deg);
  }

  .example-card {
    justify-items: center;
    text-align: center;
  }

  .preview-panel {
    min-height: 0;
    padding: 0;
  }

  .canvas-stage {
    height: clamp(460px, 72vh, 760px);
    height: clamp(460px, 72dvh, 760px);
    min-height: 460px;
    max-height: 760px;
    margin: 0 10px 10px;
    border-radius: 14px;
    background-size: 18px 18px;
  }

  .empty-state span {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .empty-state p {
    max-width: 220px;
    margin-inline: auto;
    line-height: 1.45;
  }

  .preview-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 14px 12px;
  }

  .preview-header .panel-title {
    align-items: flex-start;
  }

  .preview-tools {
    font-size: 15px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .preview-tools::-webkit-scrollbar {
    display: none;
  }

  .icon-btn,
  .zoom-chip {
    flex: 0 0 auto;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .zoom-chip {
    min-height: 44px;
    padding: 0 16px;
    font-size: 15px;
  }

  #patternCanvas {
    margin: 22px auto;
  }

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

  .metric-grid div {
    min-height: 86px;
    padding: 14px 12px;
    border-radius: 14px;
  }

  .metric-grid small {
    margin-bottom: 8px;
    font-size: 14px;
  }

  .metric-grid strong {
    font-size: 22px;
    line-height: 1.2;
    word-break: break-word;
  }

  .field label,
  .field > span,
  .toggle-row,
  .link-btn,
  .pay-note,
  .hint,
  .color-row small,
  .current-color small {
    font-size: 16px;
  }

  .field input,
  .field select {
    min-height: 56px;
    border-radius: 15px;
    font-size: 18px;
  }

  .toggle-row {
    gap: 10px;
  }

  .toggle-row input {
    width: 22px;
    height: 22px;
  }

  .primary-btn.tall {
    min-height: 58px;
    font-size: 18px;
  }

  .tool-grid {
    gap: 7px;
  }

  .tool-btn {
    min-height: 52px;
    font-size: 16px;
  }

  .current-color {
    min-height: 58px;
  }

  .edit-color-search {
    min-height: 52px;
    font-size: 16px;
  }

  .edit-color-chip {
    min-height: 54px;
  }

  .color-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 11px;
  }

  .swatch {
    width: 34px;
    height: 34px;
  }

  .color-row strong {
    font-size: 17px;
  }

  .edit-color-grid,
  .color-list {
    max-height: 240px;
  }

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

  .plan-list button {
    min-height: 96px;
    padding: 14px 12px;
  }

  .plan-list strong {
    font-size: 24px;
  }

  .plan-list span {
    font-size: 18px;
  }

  .plan-list small {
    font-size: 15px;
  }

  .modal {
    padding: 24px 18px;
  }

  .modal h2 {
    font-size: 26px;
  }

  .modal-plans {
    grid-template-columns: 1fr;
  }

  .purchase-plans,
  .payment-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 9px 10px;
  }

  .brand {
    gap: 8px;
  }

  .top-actions {
    gap: 6px;
  }

  .ghost-btn,
  .primary-btn.compact {
    min-height: 42px;
    padding: 0 12px;
    font-size: 15px;
  }

  .workspace {
    padding: 10px;
  }

  .panel {
    padding: 18px;
  }

  .panel-heading h1,
  .panel-title h2,
  .price-panel h2 {
    font-size: 23px;
  }

  .panel-heading p,
  .section-head p {
    font-size: 16px;
  }

  .field input,
  .field select {
    min-height: 54px;
    font-size: 17px;
  }

  .segmented button,
  .tool-btn,
  .primary-btn.tall {
    font-size: 17px;
  }

  .preview-panel {
    min-height: 0;
  }

  .canvas-stage {
    height: clamp(430px, 68vh, 680px);
    height: clamp(430px, 68dvh, 680px);
    min-height: 430px;
    max-height: 680px;
  }

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

  .plan-list {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - 20px);
  }
}
