:root {
  --blue: #b9e2f8;
  --button: #b9e2f8;
  --submit: #b9e2f8;
  --theme-soft: #eef8ff;
  --theme-soft-strong: #dff2fb;
  --theme-ink: #101820;
  --button-ink: #101820;
  --submit-ink: #101820;
  --ink: #101820;
  --muted: #6e7780;
  --line: #e7edf2;
  --danger: #e64646;
}

* { box-sizing: border-box; }
html, body {
  position: relative;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; }
img, canvas { max-width: 100%; }
button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.view {
  display: none;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  padding: calc(22px + env(safe-area-inset-top)) clamp(16px, 5vw, 24px) calc(92px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
.view.active { display: block; }
.top { padding-top: 16px; }
.top.compact { padding-top: 0; }
h1, h2, h3, p { margin: 0; }
h1 {
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.top p {
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.6;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.style-grid {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}
.home-product-layout {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 18px;
}
.home-product-layout.no-categories {
  display: block;
}
.home-product-layout .style-grid {
  margin-top: 0;
}
.style-grid:not(.has-categories),
.style-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 14px;
}
.style-grid.has-categories {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.style-grid.single-style {
  grid-template-columns: minmax(150px, 180px);
  justify-content: center;
}
.style-grid.has-categories.single-style {
  grid-template-columns: 1fr;
  justify-content: stretch;
}
.style-grid.has-categories.single-style .style-category-grid {
  grid-template-columns: minmax(150px, 180px);
  justify-content: center;
}
.style-category-section {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  scroll-margin-top: 58px;
}
.style-category-section h2 {
  margin: 4px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}
.login-entry {
  display: grid;
  gap: clamp(16px, 5vw, 22px);
  min-height: calc(100vh - 140px);
  align-content: center;
  width: min(calc(100vw - 48px), 420px);
  max-width: 100%;
  margin: 0 auto;
  min-width: 0;
  overflow-x: clip;
}
.login-entry h1 {
  text-align: center;
  font-size: clamp(28px, 9vw, 40px);
}
.entry-buttons {
  display: grid;
  gap: 20px;
  width: 100%;
  min-width: 0;
}
.entry-btn {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: clamp(54px, 14vw, 64px);
  border-radius: 999px;
  font-size: clamp(17px, 4.8vw, 20px);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-btn.taobao,
.entry-btn.pdd,
.entry-btn.xhs {
  background: var(--button);
  color: var(--button-ink);
}
.entry-btn.taobao {
  background: var(--entry-taobao, #f4ef2d);
  color: var(--entry-taobao-ink, #101820);
}
.entry-btn.pdd {
  background: var(--entry-pdd, #b9e2f8);
  color: var(--entry-pdd-ink, #101820);
}
.entry-btn.xhs {
  background: var(--entry-xhs, #ff5f73);
  color: var(--entry-xhs-ink, #ffffff);
}
.entry-btn.active {
  outline: 0;
  box-shadow: inset 0 0 0 3px #111;
}
.order-login-form {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 38, 54, .08);
}
.order-login-form h2 {
  font-size: 20px;
}
.order-login-form p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.order-login-form label {
  font-size: 14px;
  min-width: 0;
}
.order-login-form .primary {
  width: 100%;
  max-width: 100%;
}
.bound-order {
  margin-top: 18px;
  padding: 10px 12px;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  background: var(--theme-soft);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
  word-break: break-all;
}
.category-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 96px);
  padding: 0;
  overflow-y: auto;
  background: #fff;
  scrollbar-width: none;
}
.category-nav button {
  width: 100%;
  min-height: 38px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.category-nav button.active {
  border-color: var(--blue);
  background: var(--theme-soft);
  color: var(--ink);
}
.style-card {
  width: 100%;
  min-height: clamp(162px, 46vw, 184px);
  border-radius: 8px;
  background: #fff;
  border: 1px solid #f0f4f7;
  box-shadow: 0 10px 24px rgba(20, 38, 54, .08);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  padding: 12px;
}
.style-card-media {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
.style-card img {
  width: 100%;
  height: 100%;
  max-height: clamp(104px, 30vw, 126px);
  object-fit: contain;
  display: block;
}
.style-card-name {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}
.placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f2f7fb;
  color: #97a3ad;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-back {
  width: 42px;
  height: 42px;
  margin-left: -10px;
  font-size: 42px;
  line-height: 36px;
}
.page-title {
  text-align: center;
  font-size: 24px;
  margin: -40px 42px 32px;
}
.detail-cover-wrap {
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-cover {
  max-width: 82%;
  max-height: 190px;
  object-fit: contain;
}
.detail-cover.missing {
  display: none;
}
#detailTitle {
  text-align: center;
  font-size: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #1c1c1c;
}
.info-block {
  text-align: center;
  padding: 28px 12px;
  border-bottom: 1px solid #d8d8d8;
}
.info-block h3 {
  font-size: 18px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.info-block p {
  color: #343b44;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
}
.template-picker {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  min-width: 0;
}
.template-picker h3 {
  margin: 0;
  font-size: 16px;
  text-align: center;
}
.template-picker-grid {
  display: flex;
  gap: 8px;
  margin: 0 -2px;
  padding: 2px 2px 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.template-picker-grid button {
  display: grid;
  grid-template-rows: 112px auto;
  align-items: start;
  flex: 0 0 126px;
  gap: 6px;
  min-height: 0;
  padding: 7px;
  border: 1px solid #d9e5ef;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-weight: 800;
  scroll-snap-align: start;
}
.template-picker-grid button.active {
  border-width: 2px;
  border-color: var(--blue);
  background: var(--theme-soft);
  padding: 6px;
}
.template-picker-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 112px;
  aspect-ratio: auto;
  min-height: 0;
  border-radius: 6px;
  background: #fff;
  color: #7b8a97;
  overflow: hidden;
}
.template-picker-thumb.has-ratio {
  aspect-ratio: auto;
}
.template-picker-feature {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: var(--template-feature-focus, center 35%);
  display: block;
}
.template-picker-full {
  display: none;
}
.template-picker-thumb em {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-style: normal;
  font-size: 12px;
}
.template-picker-grid strong {
  min-width: 0;
  font-size: 11px;
  line-height: 1.3;
  min-height: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.primary, .outline {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 800;
  padding: 0 22px;
}
.primary {
  background: var(--button);
  color: var(--button-ink);
}
#submitOrderBtn {
  background: var(--submit);
  color: var(--submit-ink);
}
#submitOrderBtn.wide {
  margin-top: 18px;
}
.outline {
  border: 1px solid #ccd8e2;
  background: #fff;
}
.wide {
  width: 100%;
  margin-top: 34px;
}
.guide {
  font-size: 15px;
  line-height: 1.75;
  margin-bottom: 22px;
}
.guide strong {
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}
.red { color: var(--danger); }
.stage-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
.side-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.side-tabs button {
  min-height: 32px;
  padding: 6px 13px;
  border: 1px solid #d5e2ee;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}
.side-tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--theme-ink);
}
.stage {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .10);
  touch-action: pan-y;
}
.template-text-overlay {
  position: absolute;
  display: inline-block;
  pointer-events: auto;
  white-space: pre;
  overflow: visible;
  overflow-wrap: normal;
  word-break: keep-all;
  z-index: 18;
  cursor: move;
  outline: 0;
  user-select: text;
  touch-action: none;
}
.template-text-overlay.active,
.template-text-overlay:focus {
  background: transparent;
}
.template-text-selection-frame {
  position: absolute;
  pointer-events: none;
  border: 1.5px solid rgba(47, 109, 246, .9);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .86), 0 2px 8px rgba(15, 23, 42, .08);
}
.template-text-overlay.locked.active {
  box-shadow: 0 0 0 2px rgba(100, 116, 139, .92), 0 0 0 6px rgba(100, 116, 139, .10);
}
.template-text-delete {
  position: absolute;
  z-index: 25;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .22);
  touch-action: manipulation;
}
.template-asset {
  position: absolute;
  overflow: hidden;
  z-index: 1;
  cursor: move;
  touch-action: none;
}
.template-asset img {
  position: absolute;
  max-width: none;
  max-height: none;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.template-asset.locked {
  pointer-events: none;
  box-shadow: none;
}
.template-asset.active {
  box-shadow: 0 0 0 2px rgba(47, 109, 246, .75);
}
.user-asset {
  position: absolute;
  z-index: 18;
  cursor: move;
  touch-action: none;
}
.user-asset img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.user-asset.active {
  box-shadow: 0 0 0 2px rgba(47, 109, 246, .95), 0 0 0 6px rgba(47, 109, 246, .12);
}
.user-asset.locked.active {
  box-shadow: 0 0 0 2px rgba(100, 116, 139, .92), 0 0 0 6px rgba(100, 116, 139, .12);
}
.user-asset-delete {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 4;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .22);
  touch-action: manipulation;
}
.user-asset-handle {
  position: absolute;
  z-index: 24;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #2f9bff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .22);
  touch-action: none;
}
.user-asset-resize-nw { left: -11px; top: -11px; cursor: nwse-resize; }
.user-asset-resize-ne { right: -11px; top: -11px; cursor: nesw-resize; }
.user-asset-resize-sw { left: -11px; bottom: -11px; cursor: nesw-resize; }
.user-asset-resize-se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.user-asset-rotate-top {
  left: 50%;
  top: -42px;
  transform: translateX(-50%);
  background: #111827;
  cursor: grab;
}
.user-asset-rotate-top::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 20px;
  width: 2px;
  height: 20px;
  transform: translateX(-50%);
  background: rgba(47, 155, 255, .75);
}
.user-asset:not(.active) .user-asset-handle {
  display: none;
}
.fixed-asset {
  position: absolute;
  z-index: 8;
  padding: 0;
  border: 0;
  cursor: pointer;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  mask-position: center;
}
.fixed-asset.movable {
  z-index: 17;
  cursor: move;
  touch-action: none;
}
.fixed-asset.active {
  z-index: 17;
  outline: 2px solid rgba(47, 109, 246, .85);
  outline-offset: 2px;
}
.fixed-asset.knife-line {
  z-index: 96;
  pointer-events: none;
  outline: 0;
}
.fixed-asset.deleted {
  opacity: .18;
}
.fixed-asset-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 12px 0 8px;
  padding: 10px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
}
.fixed-asset-tools span {
  font-weight: 700;
}
.fixed-asset-tools input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 2px;
}
.fixed-asset-tools #fixedAssetDeleteBtn {
  border-color: #ef4444;
  color: #ef4444;
  font-weight: 800;
}
.text-size-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 520px);
  max-width: calc(100vw - 18px);
  margin: 8px auto 7px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid #dfe8f2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.text-tool-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.text-size-group,
.text-action-group,
.text-color-control {
  display: flex;
  align-items: center;
}
.text-size-group {
  display: grid;
  grid-template-columns: auto 28px minmax(100px, 1fr) 58px 28px;
  gap: 7px;
  width: 100%;
}
.text-action-group {
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid #edf1f5;
}
.text-color-control {
  gap: 7px;
  cursor: pointer;
}
.text-size-tools span {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1;
}
.text-size-tools button {
  width: auto;
  min-width: 0;
  height: 32px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border-color: #d8e2ec;
  background: #fff;
  box-shadow: none;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.text-size-tools #textSizeDownBtn,
.text-size-tools #textSizeUpBtn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1;
  color: #1f2937;
}
.text-size-tools input {
  width: 58px;
  height: 32px;
  min-height: 0;
  padding: 0 6px;
  text-align: center;
}
.text-size-tools #textSizeInput {
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}
.text-size-tools .tool-range {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 18px;
  padding: 0;
  accent-color: var(--blue);
}
.text-size-tools .tool-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b9e5f7, #ebedf0);
}
.text-size-tools .tool-range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
  -webkit-appearance: none;
  appearance: none;
}
.selected-tools .tool-range {
  flex: 1 1 120px;
  min-width: 110px;
  max-width: 190px;
  height: 22px;
  padding: 0;
  accent-color: var(--blue);
}
.selected-tools #lockUserAssetBtn {
  min-width: 58px;
}
#pngUploadTools {
  justify-content: center;
}
#pngUploadTools button {
  min-width: 82px;
}
.text-size-tools select {
  min-width: 0;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d7dee6;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}
.text-size-tools .text-color-input {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 2px;
  border: 1px solid #d8e2ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
}
.text-size-tools .text-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.text-size-tools .text-color-input::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}
.text-size-tools .text-center-btn {
  width: auto;
  min-width: 54px;
  height: 32px;
  min-height: 32px;
  padding-inline: 13px;
  border-radius: 999px;
  border-color: #dce5ed;
  color: #1f2937;
}
.text-size-tools .text-direction-btn {
  width: auto;
  min-width: 54px;
  height: 32px;
  min-height: 32px;
  padding-inline: 12px;
  border-radius: 999px;
  border-color: #b9e2f8;
  color: #0f6f99;
  background: #eef9ff;
}
.text-size-tools .text-delete-btn {
  width: auto;
  min-width: 54px;
  height: 32px;
  min-height: 32px;
  padding-inline: 13px;
  border-radius: 999px;
  border-color: #f2c8c8;
  background: #fff;
  color: #dc2626;
}
.text-editor-panel {
  display: grid;
  gap: 12px;
  margin: 18px 0 10px;
  padding: 14px;
  border: 1px solid #e5edf7;
  border-radius: 8px;
  background: #fff;
}
.text-editor-panel strong {
  font-size: 16px;
}
.text-editor-panel label {
  display: grid;
  gap: 6px;
}
.hole {
  position: absolute;
  overflow: hidden;
  background: #000;
  z-index: 70;
  touch-action: pan-y;
  box-shadow: none;
  transform: translateZ(0);
}
.hole.filled {
  background: transparent;
  box-shadow: none;
  touch-action: none;
}
.hole.empty {
  z-index: 71;
  opacity: 1;
  box-shadow: none;
  transform: none;
  background: #000;
  pointer-events: none;
}
.mirror-hole {
  pointer-events: none;
  background: #f8fbff;
}
.hole.active {
  z-index: 72;
}
.hole.swap-source {
  opacity: .78;
}
.hole.swap-target {
  z-index: 75;
  outline: 3px solid rgba(69, 142, 255, .9);
  outline-offset: 3px;
}
.hole.empty.active {
  z-index: 73;
}
.photo {
  position: absolute;
  max-width: none;
  max-height: none;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}
.plus {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .86);
  font-size: 42px;
  line-height: 1;
  font-weight: 300;
  transform: translateY(-2%);
}
.hole-upload-cue {
  position: absolute;
  z-index: 74;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}
.frame {
  position: absolute;
  inset: 0;
  z-index: 6;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fabric-editor-canvas,
.canvas-container {
  position: absolute !important;
  inset: 0;
  z-index: 26;
}
.canvas-container canvas {
  max-width: none;
  max-height: none;
}
.selection-ring {
  position: absolute;
  z-index: 75;
  pointer-events: none;
  border: 3px solid var(--blue);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .95);
}
.selected-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 4px 0 5px;
  padding: 4px 5px;
  border: 1px solid rgba(216, 226, 236, .92);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.selected-tools span {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 11px;
}
.selected-tools button {
  flex: 0 0 auto;
  min-width: 56px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 11px;
}
.selected-tools #userAssetScaleDownBtn,
.selected-tools #userAssetScaleUpBtn {
  min-width: 28px;
  width: 28px;
  padding: 0;
  touch-action: none;
}
.selected-tools #userAssetScaleInput {
  flex: 0 0 auto;
  width: 42px;
  min-height: 28px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid #d7dee6;
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-weight: 700;
}
.selected-tools #userAssetRotationInput {
  flex: 0 0 auto;
  width: 46px;
  min-height: 28px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid #d7dee6;
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-weight: 700;
}
#userAssetTools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  overflow-x: visible;
}
.asset-tool-row {
  display: grid;
  grid-template-columns: auto 30px minmax(70px, 1fr) 48px 30px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.asset-tool-rotate-row {
  grid-template-columns: auto minmax(70px, 1fr) 48px auto auto;
}
#userAssetTools .asset-tool-row > span {
  min-width: 26px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
#userAssetTools .asset-tool-row .tool-range {
  width: 100%;
  min-width: 0;
  max-width: none;
}
#userAssetTools .asset-tool-row button {
  min-width: 0;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}
#userAssetTools .asset-tool-row #userAssetScaleDownBtn,
#userAssetTools .asset-tool-row #userAssetScaleUpBtn {
  width: 30px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}
#userAssetTools .asset-tool-row input[type="number"] {
  width: 48px;
  height: 30px;
  min-height: 30px;
  padding: 0 3px;
  font-size: 12px;
}
.object-quick-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: min(100%, 680px);
  margin: 8px auto 8px;
  padding: 7px;
  border: 1px solid rgba(216, 226, 236, .95);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .10);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.object-quick-tools button {
  display: grid;
  flex: 0 0 56px;
  justify-items: center;
  gap: 3px;
  min-height: 46px;
  padding: 5px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2933;
  font-size: 11px;
  font-weight: 800;
}
.object-quick-tools button span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #f1f7fc;
  color: var(--blue);
  font-size: 12px;
  line-height: 1;
}
.object-quick-tools button.active {
  background: #eaf6ff;
  color: #0f66ac;
}
.object-quick-tools button.active span {
  background: var(--blue);
  color: #fff;
}
.object-quick-tools button:disabled {
  opacity: .38;
  cursor: not-allowed;
}
.object-quick-tools #objectDeleteBtn {
  color: #dc2626;
}
.object-quick-tools #objectDeleteBtn span {
  background: #fff1f1;
  color: #dc2626;
}
.unlimited-photo-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 12px;
}
.unlimited-photo-tools span {
  min-width: 64px;
  text-align: center;
  color: #1f2933;
  font-weight: 800;
}
.unlimited-photo-tools button {
  min-width: 96px;
}
.editor-toolbar {
  position: sticky;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 6px;
  margin: 8px -6px 6px;
  padding: 7px 6px;
  border-top: 1px solid rgba(223, 231, 238, .9);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}
.editor-toolbar button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 46px;
  border: 0;
  background: transparent;
  color: #1f2933;
  font-size: 12px;
  font-weight: 800;
}
.editor-toolbar button span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f2f7fb;
  color: var(--blue);
  font-size: 16px;
  line-height: 1;
}
.editor-history-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 6px;
}
.editor-history-tools button {
  min-height: 38px;
  padding: 0 10px;
  color: #475569;
  font-size: 14px;
}
.editor-history-tools button:disabled {
  opacity: .42;
}
.preset-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(248, 250, 252, .97);
  backdrop-filter: blur(3px);
}
.preset-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 901;
  max-height: min(64vh, 520px);
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -12px 32px rgba(15, 23, 42, .18);
}
.preset-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.preset-panel-head button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3f6f9;
  font-size: 22px;
}
.preset-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preset-panel-actions #uploadUserAssetBtn {
  width: auto;
  min-width: 74px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: #edf8ff;
  color: #1677a9;
  font-size: 12px;
  font-weight: 700;
}
.preset-asset-grid {
  overflow: auto;
  max-height: calc(min(64vh, 520px) - 58px);
}
.preset-category-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.preset-category-tabs button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 12px;
}
.preset-category-tabs button.active {
  border-color: var(--blue);
  background: #edf8ff;
  color: #0f6ea8;
  font-weight: 700;
}
.preset-asset-items {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}
.preset-asset-grid button {
  display: grid;
  gap: 4px;
  padding: 5px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
}
.preset-asset-grid .preset-category-tabs button {
  display: block;
  padding: 0 10px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
}
.preset-asset-grid .preset-category-tabs button.active {
  border-color: var(--blue);
  background: #edf8ff;
}
.preset-asset-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
}
.preset-upload-option {
  align-content: center;
  min-height: 66px;
  color: var(--blue);
  border-style: dashed !important;
  background: #f8fbff !important;
}
.preset-upload-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border-radius: 50%;
  background: #eef7ff;
  color: var(--blue);
  font-size: 22px;
  line-height: 1;
}
.preset-asset-grid span {
  min-width: 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.actions [data-action="detail"] {
  display: none;
}
.actions button {
  min-height: 44px;
  padding: 0 12px;
}
.actions .primary {
  grid-column: auto;
}
.confirm-layout {
  display: grid;
  gap: 22px;
}
.preview-image {
  width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.order-fields {
  display: grid;
  gap: 14px;
}
.order-fields h3 { font-size: 20px; }
.order-fields p { color: var(--muted); }
label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}
input, textarea {
  width: 100%;
  border: 1px solid #cfd9e4;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
  font-size: 16px;
}
textarea { resize: vertical; }
.notice {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #fff6f6;
  color: #a32929;
  line-height: 1.5;
}
.notice:not(.error) {
  background: #eef8ff;
  color: #176487;
}
.notice.error {
  background: #fff6f6;
  color: #a32929;
}
#submitStatus:not(.hidden) {
  margin: 14px 0 0;
  box-shadow: none;
}
.order-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}
.order-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.order-item img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  background: #f6f9fb;
}
.order-item h3 {
  font-size: 16px;
  margin-bottom: 8px;
}
.order-item p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}
.order-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.outline.small {
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  border-color: #cfd9e4;
  background: #fff;
}
.outline.danger {
  color: #b42318;
  border-color: #f2c3bc;
}
.order-detail {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}
.order-detail-preview {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #f6f9fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.order-detail-body {
  display: grid;
  gap: 14px;
}
.order-detail-body h3 {
  font-size: 22px;
}
.status-line {
  width: max-content;
  padding: 6px 12px;
  border-radius: 999px;
  color: #146c43;
  background: #eaf7ef;
  font-weight: 800;
}
.order-detail dl {
  display: grid;
  gap: 10px;
}
.order-detail dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.order-detail dt {
  color: var(--muted);
}
.order-detail dd {
  font-weight: 700;
}
.detail-actions {
  margin-top: 4px;
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid #edf1f4;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.bottom-nav button {
  font-size: 16px;
  color: #808894;
}
.bottom-nav .on { color: #000; font-weight: 800; }
.cropper {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: #050505;
  color: #fff;
  padding: calc(60px + env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cropper-title {
  text-align: center;
  font-size: 18px;
  margin-bottom: 70px;
}
.cropper-window {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  contain: paint;
  background: #3c3a3a;
  touch-action: none;
}
.cropper-window::before,
.cropper-window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cropper-window::before { border: 2px solid rgba(255,255,255,.45); }
.cropper-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: auto;
}
.cropper-actions .outline,
.cropper-actions .primary {
  color: #000;
}
.cropper-actions .primary { grid-column: span 2; }
.hidden { display: none !important; }

@media (min-width: 760px) {
  .view {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding-left: 34px;
    padding-right: 34px;
  }
  .style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .confirm-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .bottom-nav { max-width: 980px; left: 50%; transform: translateX(-50%); }
}

@media (max-width: 760px) {
  [data-view="editor"] {
    padding-top: 10px;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }
  [data-view="editor"] .page-title {
    margin: 0 0 8px;
    font-size: 22px;
    line-height: 1.2;
  }
  [data-view="editor"] .guide {
    margin: 0 0 10px;
    padding: 0;
    font-size: 13px;
    line-height: 1.45;
  }
  [data-view="editor"] .guide strong {
    display: none;
  }
  [data-view="editor"] .guide p {
    display: none;
  }
  [data-view="editor"] .guide p.red {
    display: block;
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
  }
  [data-view="editor"] .stage-shell {
    margin-top: 2px;
  }
  [data-view="editor"] .stage {
    box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
  }
  .text-size-tools {
    position: fixed;
    z-index: 160;
    width: 100%;
    max-width: calc(100vw - 18px);
    margin: 0;
    padding: 6px 8px;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    transform: translateX(-50%);
  }
  .text-tool-row {
    align-items: stretch;
    gap: 5px;
  }
  .text-size-group {
    grid-template-columns: auto 26px minmax(72px, 1fr) 50px 26px;
    gap: 5px;
    width: 100%;
  }
  .text-action-group {
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding-top: 5px;
  }
  .text-size-tools span {
    font-size: 12px;
    white-space: nowrap;
  }
  .text-size-tools button {
    width: auto;
    height: 28px;
    min-height: 0;
    padding: 0;
  }
  .text-size-tools #textSizeDownBtn,
  .text-size-tools #textSizeUpBtn {
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
  }
  .text-size-tools input {
    width: 50px;
    height: 28px;
    min-height: 0;
  }
  .text-size-tools select {
    width: 100%;
    height: 30px;
    font-size: 12px;
  }
  .text-size-tools .text-color-input {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 2px;
  }
  .text-size-tools .text-center-btn {
    min-width: 50px;
    height: 28px;
    min-height: 28px;
    padding-inline: 10px;
    font-size: 13px;
  }
  .text-size-tools .text-delete-btn {
    min-width: 50px;
    height: 28px;
    min-height: 28px;
    padding-inline: 10px;
    font-size: 13px;
  }
  .text-size-tools .tool-range {
    min-width: 0;
  }
  .selected-tools .tool-range {
    flex-basis: 96px;
    min-width: 92px;
    max-width: 140px;
  }
  .selected-tools {
    position: static;
    width: 100%;
    max-width: calc(100vw - 18px);
    margin: 4px auto 5px;
    padding: 4px 5px;
    gap: 4px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    transform: none;
  }
  .selected-tools span {
    flex: 0 0 auto;
    font-size: 11px;
  }
  .selected-tools button {
    min-width: 48px;
    height: 28px;
    min-height: 28px;
    padding: 4px 6px;
    font-size: 11px;
  }
  .selected-tools #userAssetScaleDownBtn,
  .selected-tools #userAssetScaleUpBtn {
    width: 28px;
    min-width: 28px;
  }
  .selected-tools #userAssetScaleInput {
    width: 42px;
    min-height: 28px;
    height: 28px;
    padding: 0 4px;
    font-size: 11px;
  }
  .selected-tools #userAssetRotationInput {
    width: 46px;
    min-height: 28px;
    height: 28px;
    padding: 0 4px;
    font-size: 11px;
  }
  .selected-tools #lockUserAssetBtn {
    min-width: 48px;
  }
  .object-quick-tools {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    position: fixed;
    left: 50%;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 150;
    width: 100%;
    max-width: calc(100vw - 18px);
    margin: 0;
    padding: 6px;
    gap: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .16);
    transform: translateX(-50%);
    overflow: visible;
  }
  .object-quick-tools.editing-open {
    display: none;
  }
  .object-quick-tools button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 4px 1px;
    font-size: 10px;
  }
  .object-quick-tools button span {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .editor-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-left: -8px;
    margin-right: -8px;
    padding: 8px;
  }
  .editor-toolbar button {
    min-height: 54px;
    font-size: 12px;
    gap: 4px;
  }
  .editor-toolbar button span {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .view {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  [data-view="login"] {
    padding-left: 0;
    padding-right: 0;
  }
  .login-entry {
    width: min(calc(100vw - 48px), 360px);
    max-width: calc(100vw - 48px);
    min-height: calc(100vh - 80px);
    margin-left: auto;
    margin-right: auto;
    align-content: center;
    justify-items: stretch;
  }
  .login-entry h1 {
    font-size: clamp(28px, 8vw, 36px);
  }
  .entry-btn {
    min-height: clamp(52px, 12vw, 62px);
    font-size: clamp(17px, 4.4vw, 20px);
  }
  [data-view="home"] .top {
    padding-top: 8px;
    text-align: left;
  }
  [data-view="home"] h1 {
    font-size: clamp(28px, 8vw, 34px);
  }
  [data-view="home"] .top p {
    margin-top: 12px;
    font-size: 16px;
  }
  .style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .style-grid.single-style {
    grid-template-columns: minmax(168px, 48vw);
    justify-content: center;
  }
  .style-grid.has-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .style-grid.has-categories.single-style {
    grid-template-columns: minmax(0, 1fr);
  }
  .style-grid.has-categories.single-style .style-category-grid {
    grid-template-columns: minmax(168px, 48vw);
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .view {
    width: 100%;
    overflow-x: hidden;
    padding-left: 18px;
    padding-right: 18px;
  }
  [data-view="login"] {
    padding-left: 0;
    padding-right: 0;
  }
  .login-entry {
    width: min(calc(100vw - 48px), 360px);
    max-width: calc(100vw - 48px);
  }
  [data-view="home"] .top {
    padding-top: 8px;
    text-align: left;
  }
  [data-view="home"] h1 {
    font-size: clamp(28px, 8vw, 34px);
  }
  [data-view="home"] .top p {
    margin-top: 12px;
    font-size: 16px;
  }
  .bound-order {
    margin-top: 14px;
    padding: 9px 10px;
  }
  .style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
  }
  .style-grid.single-style {
    grid-template-columns: minmax(168px, 48vw);
    justify-content: center;
  }
  .style-card {
    min-height: auto;
    padding: 12px;
  }
  .style-card img {
    max-height: none;
  }
  .template-picker {
    margin-top: 14px;
  }
  .template-picker-grid {
    gap: 7px;
    padding-bottom: 8px;
  }
  .template-picker-grid button {
    flex-basis: 108px;
    grid-template-rows: 96px auto;
    padding: 6px;
  }
  .template-picker-grid button.active {
    padding: 5px;
  }
  .template-picker-thumb {
    height: 96px;
  }
  .template-picker-grid strong {
    font-size: 10px;
    min-height: 26px;
  }
  .bottom-nav {
    height: calc(58px + env(safe-area-inset-bottom));
  }
  .confirm-layout {
    gap: 16px;
  }
  .preview-image {
    max-height: 58vh;
  }
  .side-tabs {
    gap: 6px;
    margin-bottom: 8px;
  }
  .side-tabs button {
    min-width: 70px;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 14px;
  }
  .selected-tools {
    margin: 8px 0 8px;
    gap: 6px;
  }
  .selected-tools button {
    min-width: min(108px, calc((100vw - 44px) / 3));
  }
  #pngUploadTools button {
    min-width: 82px;
  }
  .custom-create-tools button {
    min-width: 0;
  }
  .editor-toolbar button {
    min-width: 0;
  }
  .actions {
    gap: 8px;
    margin-top: 10px;
  }
  .actions button {
    min-height: 42px;
  }
  .preset-asset-items {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .text-size-group {
    grid-template-columns: auto 26px minmax(54px, 1fr) 46px 26px;
    gap: 5px;
  }
  .text-size-tools input {
    width: 46px;
    padding-inline: 4px;
  }
  .text-action-group {
    gap: 6px;
  }
  .text-size-tools .text-center-btn,
  .text-size-tools .text-delete-btn {
    min-width: 50px;
    padding-inline: 9px;
  }
  .style-grid {
    gap: 10px;
  }
  .style-card {
    padding: 12px;
  }
  .top p {
    font-size: 16px;
  }
  .bound-order {
    font-size: 14px;
  }
}
