:root {
  --ink: #0c0b09;
  --paper: #fffaf0;
  --paper-2: #f8efd9;
  --paper-deep: #efe2cb;
  --kraft: #c9a66d;
  --kraft-dark: #a98245;
  --gold: #c99a24;
  --gold-bright: #d7ad36;
  --muted: #6b6254;
  --shadow: 0 14px 28px rgba(45, 31, 12, .16);
  --line: 3px solid var(--ink);
  --radius: 22px;
  --tear: polygon(1% 2%, 10% 0, 21% 2%, 34% .5%, 49% 2.5%, 63% .3%, 79% 2%, 98% 1%, 100% 14%, 98.5% 31%, 100% 48%, 98% 64%, 100% 82%, 98% 99%, 83% 98%, 67% 100%, 51% 98.5%, 36% 100%, 21% 98%, 2% 99%, 0 84%, 1.5% 67%, 0 51%, 1% 35%, 0 18%);
  --ui-page-bg: var(--paper);
  --ui-card-bg: #fffdf7;
  --ui-kraft-bg: #ead9ba;
  --ui-text-primary: var(--ink);
  --ui-text-secondary: var(--muted);
  --ui-text-subtle: #928776;
  --ui-black: var(--ink);
  --ui-gold: var(--gold);
  --ui-success: #2f8f5b;
  --ui-warning: #b7791f;
  --ui-error: #b42318;
  --ui-border: rgba(12, 11, 9, .16);
  --ui-shadow: 0 10px 22px rgba(45, 31, 12, .13);
  --ui-page-gutter: 18px;
  --ui-page-top-gap: 104px;
  --ui-card-radius: 18px;
  --ui-card-radius-sm: 14px;
  --ui-button-primary-height: 50px;
  --ui-button-secondary-height: 42px;
  --ui-icon-button-size: 44px;
  --ui-card-gap: 14px;
  --ui-bottom-nav-height: 72px;
  --ui-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ui-font-title-1: clamp(30px, 7.2vw, 38px);
  --ui-font-title-2: clamp(22px, 5.4vw, 26px);
  --ui-font-card-title: 18px;
  --ui-font-body: 15px;
  --ui-font-caption: 12px;
  --ui-font-button: 16px;
  --ui-font-tag: 12px;
}

/* 2026-06-27 sticker selection, safe-area tray, and exact-preview corrections */
.design-layer.selected {
  outline: 1.5px solid #111 !important;
  outline-offset: 4px !important;
}

.layer-quick-tools {
  pointer-events: auto !important;
}

.layer-quick-tools button {
  pointer-events: auto !important;
}

body.designer-mode .material-panel {
  padding-left: max(78px, calc(env(safe-area-inset-left) + 78px)) !important;
}

.material-card img {
  filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 1 !important;
}

.design-layer {
  pointer-events: auto;
}

.design-layer.selected {
  outline: 1.5px solid #111;
  outline-offset: 4px;
}

.layer-quick-tools {
  position: absolute;
  z-index: 8;
  right: -18px;
  top: -18px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.layer-quick-tools button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1.5px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #050505;
  font-size: 17px;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.layer-quick-tools button[data-layer-op="delete"] {
  background: #050505;
  color: #fff;
}

body.designer-mode .material-panel {
  padding-left: max(78px, calc(env(safe-area-inset-left) + 78px));
}

.material-card img {
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

.designer-tool-panel input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.designer-tool-panel input[type="number"]::-webkit-outer-spin-button,
.designer-tool-panel input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 900px) {
  body.designer-mode .material-panel {
    padding-left: max(54px, calc(env(safe-area-inset-left) + 54px));
  }

  .layer-quick-tools {
    right: -15px;
    top: -15px;
  }

  .layer-quick-tools button {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 15px;
  }
}

/* HBuilderX approved home, scoped so mature customer screens keep their existing UI. */
.wantutu-bottom-nav-art {
  display: none;
}

body.wantutu-home-mode {
  overflow-x: hidden;
  background: #ffffff;
}

body.wantutu-home-mode .mini-app {
  width: min(100vw, 460px);
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
  overflow-y: visible;
  background: #ffffff;
  box-shadow: none;
}

body.wantutu-home-mode .mini-app::before,
body.wantutu-home-mode .paper-header {
  display: none;
}

body.wantutu-home-mode #homeScreen,
.wantutu-home {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: #ffffff;
}

.wantutu-home-top {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 59px;
  padding: 0 14px;
  background: transparent;
}

.wantutu-home-top > img {
  display: block;
  width: 110px;
  height: 42px;
  object-fit: contain;
  background: transparent;
}

.wantutu-home-capsule {
  position: absolute;
  top: 15px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 29px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
  border-radius: 15px;
  color: #111111;
  background: #ffffff;
}

.wantutu-home-capsule b {
  width: 33px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 29px;
  letter-spacing: 0;
}

.wantutu-home-capsule i {
  width: 1px;
  height: 17px;
  background: #eeeeee;
}

.wantutu-home-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #f8f7f4;
}

.wantutu-home-slide {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: transparent;
  transition: opacity 450ms ease;
}

.wantutu-home-slide.active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wantutu-home-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wantutu-home-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 23px;
  background: #ffffff;
}

.wantutu-home-dot {
  width: 5px;
  height: 5px;
  min-width: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d7d7d7;
}

.wantutu-home-dot.active {
  background: #111111;
}

.wantutu-home-showcase {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #ffffff;
}

.wantutu-home-showcase > img {
  display: block;
  width: 100%;
  height: auto;
}

.wantutu-home-select-design {
  position: absolute;
  top: 14.467%;
  left: 50%;
  width: 45.333%;
  height: 8.645%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.wantutu-home-bottom-safe {
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
}

.wantutu-home-service {
  position: fixed;
  z-index: 80;
  top: 47vh;
  right: max(0px, calc((100vw - 460px) / 2));
  width: min(13.733vw, 63.17px);
  height: min(13.733vw, 63.17px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .16);
}

.wantutu-home-service img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.wantutu-home-mode .icp-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  margin: 12px 12px calc(78px + env(safe-area-inset-bottom, 0px));
  color: #777777;
  background: #ffffff;
}

body.wantutu-home-mode .bottom-tabs {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  width: min(100vw, 460px);
  min-height: 0;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  outline: 0;
  transform: translateX(-50%);
  background: #ffffff;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .04);
}

body.wantutu-home-mode .wantutu-bottom-nav-art {
  position: absolute;
  z-index: 0;
  top: max(-92px, -20vw);
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

body.wantutu-home-mode .bottom-tabs button {
  z-index: 1;
  min-width: 0;
  min-height: 70px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
}

body.wantutu-home-mode .bottom-tabs button i,
body.wantutu-home-mode .bottom-tabs button span {
  opacity: 0;
}

body.wantutu-home-mode .bottom-tabs button.active,
body.wantutu-home-mode .bottom-tabs button[data-tab="piece"] {
  color: transparent;
  background: transparent;
  transform: none;
}

body.wantutu-home-mode .bottom-tabs button.active::after {
  display: none;
}

body.designer-mode .wantutu-home-service {
  display: none;
}

/* 2026-06 strict production designer fixes: compact landscape editor, clipped strip, dense sticker tray. */
.ring-designer-shell {
  width: 100vw;
  height: 100dvh;
  transform: none;
  grid-template-rows: 62px minmax(0, 1fr) 104px;
  padding: 0 46px 16px;
}

.designer-topbar {
  grid-template-columns: 132px minmax(0, 1fr) 150px;
  align-items: center;
  padding: 8px 0 0;
}

.designer-brand-title strong {
  font-size: 20px;
}

.designer-brand-title span {
  display: none;
}

.designer-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  min-height: 0;
}

.designer-canvas-panel {
  width: 100%;
  display: grid;
  place-items: center;
  gap: 0;
}

.ring-stage {
  width: 100%;
  display: grid;
  place-items: center;
  overflow: visible;
}

.ring-design-surface {
  width: min(91vw, 1840px);
  height: auto;
  min-height: 56px;
  max-height: 24vh;
  aspect-ratio: var(--ring-aspect, 18) / 1;
  border: 1.5px solid #8a8a8a;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.2);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
}

.ring-guide-svg,
.reference-image {
  display: none;
}

.designer-size-line,
.designer-hint,
.designer-size-tools {
  display: none;
}

.designer-toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding: 0;
  overflow: visible;
}

.designer-tool-strip {
  display: flex;
  align-items: end;
  gap: 18px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.designer-toolbar button,
.upload-tool {
  min-width: 52px;
  min-height: 66px;
  padding: 2px 4px;
  font-size: 12px;
}

.designer-toolbar svg {
  width: 27px;
  height: 27px;
}

.designer-footer-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.designer-footer-actions .designer-main-btn {
  min-width: 118px;
  min-height: 50px;
  padding: 0 20px;
  border: 1.5px solid #111;
  border-radius: 0;
  font-size: 16px;
  box-shadow: none;
}

.designer-tool-panel {
  position: absolute;
  left: 60px;
  bottom: 82px;
  z-index: 4;
  display: grid;
  gap: 9px;
  min-width: 250px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
}

.designer-tool-panel label {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 8px;
  color: #565656;
  font-weight: 900;
  font-size: 13px;
}

.designer-tool-panel input[type="range"] {
  accent-color: #050505;
}

.designer-tool-panel input[type="number"] {
  width: 92px;
  min-height: 34px;
  border: 1.5px solid #111;
  border-radius: 0;
  padding: 0 8px;
  background: #fff;
}

.canvas-panel label {
  grid-template-columns: 86px 100px;
}

.design-layer {
  touch-action: none;
  will-change: transform, left, top, width, height;
}

.design-layer.selected {
  outline: 1.5px solid #111;
  outline-offset: 5px;
}

.layer-handle {
  position: absolute;
  z-index: 3;
  width: 24px;
  height: 24px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #fff;
  pointer-events: auto;
  touch-action: none;
}

.layer-handle::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  background: #111;
}

.layer-handle-scale {
  right: -18px;
  bottom: -18px;
  cursor: nwse-resize;
}

.layer-handle-rotate {
  right: -18px;
  top: -18px;
  cursor: grab;
}

body.designer-mode .material-panel {
  top: 0;
  right: 0;
  left: 0;
  width: 100vw;
  height: 80dvh;
  max-height: 80dvh;
  padding: 22px 46px 28px;
  border-radius: 0 0 18px 18px;
}

.material-layout {
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 24px;
}

.material-primary-cats {
  gap: 12px;
  padding-top: 52px;
}

.material-primary-cats button,
.material-sub-cats button {
  font-size: 16px;
  line-height: 1.15;
}

.material-head {
  margin-bottom: 10px;
}

.material-head strong {
  font-size: 20px;
}

.material-head span {
  font-size: 13px;
}

.material-sub-cats {
  gap: 20px;
  margin-bottom: 14px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 10px 14px;
}

.material-card {
  min-height: 88px;
  gap: 4px;
  padding: 0;
}

.material-card img {
  width: 78px;
  height: 62px;
  object-fit: contain;
  filter: grayscale(1) contrast(190%);
  opacity: 1;
}

.material-card span {
  max-width: 78px;
  font-size: 9px;
  line-height: 1.1;
  color: #454545;
}

@media (orientation: portrait) and (max-width: 900px) {
  .ring-designer-shell {
    width: 100vw;
    height: 100dvh;
    transform: none;
    transform-origin: center;
    grid-template-rows: 58px minmax(0, 1fr) 104px;
    padding: 0 18px 14px;
  }

  .designer-workbench {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .ring-design-surface {
    width: 92vw;
    height: auto;
    aspect-ratio: var(--ring-aspect, 18) / 1;
    min-height: 44px;
    max-height: 18vh;
  }

  .designer-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .designer-tool-strip {
    gap: 12px;
  }

  .designer-footer-actions .designer-main-btn {
    min-width: 88px;
    min-height: 46px;
    font-size: 14px;
    padding-inline: 12px;
  }

  .designer-tool-panel {
    left: 16px;
    bottom: 84px;
  }

  body.designer-mode .material-panel {
    height: 80dvh;
    max-height: 80dvh;
    padding: 18px 22px 24px;
  }

  .material-layout {
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 14px;
  }

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

/* 2026-06-27 interaction corrections */
.ring-designer-shell {
  grid-template-rows: 62px minmax(0, 1fr) 104px;
  padding: 0 28px 12px;
}

.designer-workbench {
  position: relative;
  z-index: 1;
  overflow: visible;
}

.designer-toolbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(176px, 21vw);
  align-items: end;
  gap: 10px;
  padding: 0;
  overflow: visible;
}

.designer-tool-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: clamp(1px, .35vw, 7px);
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.designer-toolbar button,
.upload-tool {
  min-width: 0;
  min-height: 64px;
  padding: 3px 1px;
  gap: 3px;
  white-space: nowrap;
  font-size: clamp(9px, .82vw, 12px);
}

.designer-toolbar svg {
  width: clamp(20px, 1.75vw, 27px);
  height: clamp(20px, 1.75vw, 27px);
}

.designer-footer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.designer-footer-actions .designer-main-btn {
  min-width: 0;
  min-height: 52px;
  padding: 0 8px;
  font-size: clamp(12px, 1.05vw, 16px);
}

.designer-tool-panel {
  position: absolute;
  z-index: 60;
  left: clamp(8px, 13vw, 220px);
  bottom: calc(100% + 8px);
  min-width: min(310px, 58vw);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  overflow: visible;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

.design-layer.selected {
  outline: none;
}

.layer-handle {
  display: none;
}

body.designer-mode .material-panel {
  height: 80dvh;
  max-height: 80dvh;
  padding: 18px 30px 20px;
  overflow: hidden;
}

.material-layout {
  grid-template-columns: clamp(112px, 11vw, 168px) minmax(0, 1fr);
  gap: clamp(12px, 1.5vw, 26px);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.material-primary-cats {
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 54px 4px 8px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.material-primary-cats button,
.material-sub-cats button {
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.2;
}

.material-main {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.material-head {
  min-height: 42px;
  margin: 0 0 6px;
}

.material-head strong {
  font-size: 18px;
}

.material-head span {
  font-size: 11px;
}

.material-sub-cats {
  gap: 16px;
  min-height: 34px;
  margin: 0 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-content: start;
  gap: 8px 10px;
  min-height: 0;
  padding: 4px 8px 18px 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.material-card {
  min-width: 0;
  min-height: 72px;
  gap: 2px;
  padding: 0;
  overflow: hidden;
}

.material-card img {
  width: 100%;
  height: clamp(48px, 8.5vh, 72px);
  object-fit: contain;
  filter: grayscale(1) contrast(300%) drop-shadow(.35px 0 #000) drop-shadow(-.35px 0 #000) drop-shadow(0 .35px #000);
  mix-blend-mode: multiply;
  background: #fff;
}

.material-card span {
  display: none;
}

@media (max-width: 900px) {
  .ring-designer-shell {
    grid-template-rows: 54px minmax(0, 1fr) 94px;
    padding: 0 12px 8px;
  }

  .designer-toolbar {
    grid-template-columns: minmax(0, 1fr) 176px;
    gap: 6px;
  }

  .designer-toolbar button,
  .upload-tool {
    min-height: 56px;
    font-size: 8px;
  }

  .designer-toolbar svg {
    width: 19px;
    height: 19px;
  }

  .designer-footer-actions .designer-main-btn {
    min-height: 46px;
    font-size: 12px;
  }

  .designer-tool-panel {
    left: 8px;
    bottom: calc(100% + 6px);
    min-width: min(286px, 62vw);
  }

  body.designer-mode .material-panel {
    padding: 12px 16px 14px;
  }

  .material-layout {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
  }

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

  .material-card img {
    height: clamp(42px, 8vh, 58px);
  }
}

/* 2026-06-27 export-and-touch corrections */
.ring-stage {
  position: relative !important;
  width: min(90vw, 1820px) !important;
  overflow: visible !important;
}

.ring-design-surface {
  width: 100% !important;
  overflow: hidden !important;
  touch-action: none !important;
}

.design-layer.selected {
  outline: 1.5px solid #111 !important;
  outline-offset: 0 !important;
}

.layer-quick-tools-stage {
  position: absolute !important;
  z-index: 70 !important;
  right: auto !important;
  top: auto !important;
  display: flex !important;
  gap: 6px !important;
  transform: translate(-100%, -130%) !important;
  pointer-events: auto !important;
}

.layer-quick-tools-stage.is-hidden {
  display: none !important;
}

.layer-quick-tools-stage button {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  border: 1.5px solid #111 !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #050505 !important;
  font-size: 17px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.16) !important;
}

.layer-quick-tools-stage button[data-layer-op="delete"] {
  background: #050505 !important;
  color: #fff !important;
}

@media (max-width: 900px) {
  .ring-stage {
    width: min(88vw, 980px) !important;
  }

  .layer-quick-tools-stage button {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    font-size: 15px !important;
  }
}

/* Final override: sticker selection, safe-area tray, and exact-preview corrections. */
.design-layer {
  pointer-events: auto;
}

.design-layer.selected {
  outline: 1.5px solid #111;
  outline-offset: 4px;
}

.layer-quick-tools {
  position: absolute;
  z-index: 8;
  right: -18px;
  top: -18px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.layer-quick-tools button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1.5px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #050505;
  font-size: 17px;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.layer-quick-tools button[data-layer-op="delete"] {
  background: #050505;
  color: #fff;
}

body.designer-mode .material-panel {
  padding-left: max(78px, calc(env(safe-area-inset-left) + 78px));
}

.material-card img {
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

.designer-tool-panel input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.designer-tool-panel input[type="number"]::-webkit-outer-spin-button,
.designer-tool-panel input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 900px) {
  body.designer-mode .material-panel {
    padding-left: max(54px, calc(env(safe-area-inset-left) + 54px));
  }

  .layer-quick-tools {
    right: -15px;
    top: -15px;
  }

  .layer-quick-tools button {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 15px;
  }
}

/* Final override: sticker selection, safe-area tray, and exact-preview corrections. */
.design-layer {
  pointer-events: auto;
}

.design-layer.selected {
  outline: 1.5px solid #111;
  outline-offset: 4px;
}

.layer-quick-tools {
  position: absolute;
  z-index: 8;
  right: -18px;
  top: -18px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.layer-quick-tools button {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1.5px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #050505;
  font-size: 17px;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.layer-quick-tools button[data-layer-op="delete"] {
  background: #050505;
  color: #fff;
}

body.designer-mode .material-panel {
  padding-left: max(78px, calc(env(safe-area-inset-left) + 78px));
}

.material-card img {
  filter: none;
  mix-blend-mode: normal;
  opacity: 1;
}

.designer-tool-panel input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.designer-tool-panel input[type="number"]::-webkit-outer-spin-button,
.designer-tool-panel input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 900px) {
  body.designer-mode .material-panel {
    padding-left: max(54px, calc(env(safe-area-inset-left) + 54px));
  }

  .layer-quick-tools {
    right: -15px;
    top: -15px;
  }

  .layer-quick-tools button {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 15px;
  }
}

.material-card span {
  display: none;
}

* {
  box-sizing: border-box;
}

html {
  background: #14110c;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "KaiTi", "STKaiti", "Arial Rounded MT Bold", Arial, sans-serif;
  background:
    radial-gradient(circle at 36% 34%, rgba(12,11,9,.035) 0 1px, transparent 1.4px),
    radial-gradient(circle at 24% 18%, rgba(201,154,36,.12) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 12%, rgba(12,11,9,.07) 0 1px, transparent 2px),
    linear-gradient(120deg, #f7f2e8, #fffaf0 52%, #efe2ca);
  background-size: 31px 31px, auto, auto, auto;
}

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

button {
  color: inherit;
  cursor: pointer;
}

.mini-app {
  position: relative;
  width: min(100vw, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 104px 18px calc(112px + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 3%, rgba(201,154,36,.15) 0 2px, transparent 3px),
    radial-gradient(circle at 12% 28%, rgba(12,11,9,.04) 0 1px, transparent 1.8px),
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.45)),
    repeating-linear-gradient(45deg, rgba(0,0,0,.023) 0 1px, transparent 1px 10px),
    var(--paper);
  box-shadow: 0 0 0 1px rgba(255,255,255,.4), 0 36px 90px rgba(0,0,0,.38);
}

.icp-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  margin: 28px 0 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.icp-footer a {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  text-decoration: none;
}

.icp-footer a:hover,
.icp-footer a:focus-visible {
  color: var(--kraft-dark);
  text-decoration: underline;
}

.public-security-filing {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 4px;
}

.public-security-filing img {
  display: block;
  width: auto;
  height: 18px;
  flex: 0 0 auto;
}

.public-security-filing span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mini-app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image:
    radial-gradient(circle, rgba(0,0,0,.12) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(255,255,255,.8) 0 1px, transparent 1.6px);
  background-size: 22px 22px, 31px 31px;
  mix-blend-mode: multiply;
}

.paper-header {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 50%;
  width: min(100vw, 460px);
  height: 94px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 48px 1fr 108px;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 10px;
  background: linear-gradient(180deg, rgba(255,250,240,.96), rgba(255,250,240,.82));
  backdrop-filter: blur(10px);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.brand-lockup strong {
  font-size: 29px;
  font-weight: 1000;
  letter-spacing: 0;
  transform: rotate(-3deg);
  text-shadow: 1px 1px 0 #fff, 2px 2px 0 rgba(201,154,36,.45);
}

.brand-lockup span {
  margin-top: 4px;
  font-family: "Comic Sans MS", "Microsoft YaHei", cursive;
  font-weight: 900;
  font-size: 17px;
}

.brand-lockup em {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  font-style: normal;
  color: #fff;
  background: var(--ink);
  box-shadow: 4px 4px 0 rgba(201,154,36,.8);
  transform: rotate(-1.5deg);
  clip-path: polygon(2% 8%, 98% 0, 96% 88%, 4% 100%);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.round-icon {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 5px 14px rgba(40,26,8,.22);
  font-size: 22px;
  font-weight: 1000;
}

.ghost-back {
  visibility: hidden;
}

.ghost-back.show {
  visibility: visible;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.paper,
.hero-paper,
.paper-card,
.strip-panel,
.mine-card,
.draw-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255,255,255,.75), rgba(255,250,240,.5)),
    var(--paper);
  border: 2px solid rgba(12,11,9,.11);
  border-radius: 16px;
  clip-path: var(--tear);
  box-shadow: var(--shadow);
}

.paper::after,
.hero-paper::after,
.paper-card::after,
.strip-panel::after,
.mine-card::after,
.draw-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 0, transparent 0 9px, rgba(0,0,0,.08) 10px 11px, transparent 12px),
    radial-gradient(circle at 70% 100%, transparent 0 12px, rgba(0,0,0,.07) 13px 14px, transparent 15px);
  opacity: .5;
}

.hero-paper {
  margin: 8px 0 22px;
  padding: 30px 23px 26px;
  min-height: 318px;
  transform: rotate(-1deg);
  border: 0;
}

.hero-paper::before,
.paper-card::before,
.strip-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 18px -8px -10px 14px;
  border-radius: inherit;
  background: rgba(156,111,52,.34);
  transform: rotate(2.5deg);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
  font-weight: 1000;
  box-shadow: 4px 4px 0 var(--gold);
  transform: rotate(-1.6deg);
  clip-path: polygon(0 12%, 98% 0, 100% 86%, 5% 100%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hero-paper h1,
.page-title {
  font-size: clamp(32px, 8vw, 44px);
  line-height: 1.12;
  font-weight: 1000;
  letter-spacing: 0;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", sans-serif;
  text-shadow: .7px .7px 0 rgba(12,11,9,.18);
}

.page-title {
  margin: 10px 0 16px;
  text-align: center;
  position: relative;
}

.page-title::before,
.page-title::after {
  content: "✦";
  display: inline-block;
  margin: 0 10px;
  color: var(--gold);
  font-size: .62em;
  transform: rotate(-12deg);
}

.page-title::after {
  transform: rotate(14deg);
}

.gold-underline {
  display: inline-block;
  border-bottom: 5px solid var(--gold);
  line-height: .9;
}

.hero-paper p {
  margin-top: 16px;
  color: #27231b;
  font-weight: 800;
  line-height: 1.7;
}

.tag-row,
.filter-row,
.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-row {
  margin: 18px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: #e9dcc2;
  color: #271e13;
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(120,80,20,.12);
  border: 1px solid rgba(12,11,9,.08);
}

.pill.active,
.brush-btn,
.black-btn {
  color: #fff;
  background: var(--ink);
  border: 0;
  box-shadow: 4px 5px 0 var(--gold);
}

.brush-btn,
.black-btn,
.outline-btn {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 1000;
}

.brush-btn,
.black-btn,
.black-mini {
  position: relative;
  border: 2px solid var(--ink);
  outline: 2px dashed rgba(255,255,255,.85);
  outline-offset: -7px;
  clip-path: polygon(2% 8%, 97% 0, 100% 18%, 98% 88%, 6% 100%, 0 83%);
}

.outline-btn {
  background: #fffdf7;
  border: var(--line);
  box-shadow: 3px 4px 0 rgba(201,154,36,.42);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.restore-banner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin: 2px 0 18px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,250,240,.58)),
    var(--paper-deep);
  box-shadow: var(--shadow);
  clip-path: var(--tear);
}

.restore-banner strong,
.restore-banner span {
  display: block;
}

.restore-banner strong {
  font-size: 17px;
  font-weight: 1000;
}

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

.restore-banner .brush-btn,
.restore-banner .outline-btn {
  min-height: 38px;
  padding: 7px 11px;
  font-size: 14px;
}

.hero-ring {
  position: absolute;
  right: 12px;
  bottom: 16px;
  width: 138px;
  transform: rotate(-7deg);
}

.hero-ring svg,
.sample-card svg,
.ring-preview svg,
.final-preview svg {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.doodle {
  color: var(--gold);
  font-size: 28px;
  font-weight: 1000;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.quick-card {
  min-height: 134px;
  padding: 18px 16px;
  text-align: left;
  border: 0;
  transform: rotate(var(--tilt, -1deg));
  overflow: visible;
}

.quick-card:nth-child(even) {
  --tilt: 1.4deg;
}

.quick-card svg,
.bottom-tabs svg,
.paper-icon svg,
.service-grid svg,
.mini-symbol svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-card svg {
  width: 46px;
  height: 46px;
}

.quick-card strong,
.paper-card h3,
.mine-card h3 {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  font-weight: 1000;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", sans-serif;
}

.quick-card span,
.paper-card p,
.meta,
.help-text {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

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

.section-head h2 {
  font-size: 26px;
  font-weight: 1000;
}

.section-head button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 1000;
}

.inspiration-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.inspiration-chip {
  min-height: 92px;
  padding: 10px 6px;
  border: 0;
  border-radius: 18px;
  background: #d3b27c;
  color: #1c160d;
  font-weight: 1000;
  clip-path: polygon(4% 6%, 95% 0, 100% 88%, 10% 100%, 0 78%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 6px 12px rgba(80,52,17,.16);
}

.inspiration-chip svg {
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
}

.search-card {
  padding: 16px;
  margin-bottom: 15px;
}

.search-box {
  height: 54px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  border: var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: #fffdf7;
  box-shadow: inset 0 -3px 0 rgba(201,154,36,.1);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 800;
}

.catalog-tabs,
.template-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.catalog-tabs button,
.template-tabs button,
.filter-row button,
.tool-row button {
  border: 0;
  border-radius: 999px;
  background: #e8dcc7;
  padding: 9px 8px;
  font-weight: 1000;
  box-shadow: inset 0 -3px 0 rgba(120,80,20,.1);
}

.catalog-tabs button.active,
.template-tabs button.active,
.filter-row button.active,
.tool-row button.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 3px 4px 0 var(--gold);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.paper-card {
  padding: 16px 15px;
  border: 0;
  text-align: left;
  overflow: hidden;
  transform: rotate(var(--paper-tilt, -.6deg));
}

.paper-card:nth-child(even) {
  --paper-tilt: .7deg;
}

.product-card,
.template-card {
  min-height: 246px;
}

.piece-card {
  min-height: 232px;
}

.card-art {
  min-height: 104px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 20%, rgba(201,154,36,.28), transparent 19%),
    repeating-linear-gradient(35deg, rgba(255,255,255,.12) 0 2px, transparent 2px 7px),
    rgba(201,166,109,.48);
  clip-path: polygon(4% 8%, 91% 0, 100% 18%, 96% 91%, 12% 100%, 0 79%);
}

.card-art svg {
  width: 104px;
  height: 84px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 3px 3px 0 rgba(201,154,36,.65);
  clip-path: polygon(0 15%, 94% 0, 100% 78%, 5% 100%);
}

.feedback {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 2px dashed rgba(12,11,9,.22);
  color: #4c412f;
  font-size: 12px;
  font-weight: 800;
}

.black-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  width: 100%;
  min-height: 38px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
  box-shadow: 3px 4px 0 var(--gold);
}

.strip-panel {
  margin: 22px 0;
  padding: 16px;
}

.template-guide {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.draw-card {
  padding: 16px;
  margin-bottom: 14px;
  overflow: visible;
}

.canvas-wrap {
  position: relative;
  height: 268px;
  border: var(--line);
  border-radius: 20px;
  background:
    linear-gradient(rgba(12,11,9,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12,11,9,.06) 1px, transparent 1px),
    #fffdf7;
  background-size: 20px 20px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.55);
}

#sketchCanvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.sample-card {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 122px;
  padding: 10px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 6px 16px rgba(0,0,0,.16);
  transform: rotate(-3deg);
  font-weight: 1000;
  text-align: center;
}

.sample-card svg {
  width: 88px;
  height: 42px;
}

.tool-row {
  margin: 14px 0;
}

.inline-field {
  display: block;
  margin: 12px 0;
}

.stroke-row {
  display: grid;
  grid-template-columns: 72px 1fr 34px;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  font-weight: 1000;
}

.stroke-row input {
  accent-color: var(--gold);
}

.symbol-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.symbol-row button {
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: #fffdf7;
  box-shadow: inset 0 0 0 2px rgba(12,11,9,.13);
  font-size: 26px;
}

.preview-band {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  gap: 8px;
}

.ring-preview,
.final-preview {
  min-height: 82px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #eee5d5;
}

.draw-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin-top: 14px;
}

.profile-strip {
  display: grid;
  grid-template-columns: 82px 1fr 110px;
  align-items: center;
  gap: 14px;
  min-height: 154px;
  padding: 18px;
  clip-path: var(--tear);
}

.avatar-paper {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 40%, #fff 0 22px, transparent 23px),
    linear-gradient(90deg, #d4c2a2 0 50%, #f0c334 51%);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.service-grid button {
  min-height: 118px;
  padding: 12px 6px;
  border: 0;
  text-align: center;
}

.service-grid svg {
  width: 44px;
  height: 44px;
}

.list-card {
  padding: 16px;
  margin-top: 12px;
}

.as-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 2px dashed rgba(12,11,9,.18);
  align-items: center;
}

.list-item:last-child {
  border-bottom: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e8dcc7;
  color: #1d160d;
  font-weight: 1000;
  font-size: 12px;
}

.draft-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.outline-btn.danger {
  color: #a33622;
  border-color: #a33622;
  box-shadow: 3px 4px 0 rgba(163,54,34,.18);
}

.profile-form,
.submit-form {
  display: grid;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-weight: 1000;
}

input,
textarea,
select {
  width: 100%;
  border: var(--line);
  border-radius: 16px;
  padding: 12px 13px;
  background: #fffdf7;
  color: var(--ink);
  outline: 0;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 4px rgba(201,154,36,.25);
}

.modal-mask {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.48);
}

.modal-mask[hidden] {
  display: none !important;
}

.modal-card {
  width: min(100%, 420px);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0,0,0,.34);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(20px);
  min-width: 180px;
  max-width: min(88vw, 380px);
  opacity: 0;
  padding: 12px 16px;
  border-radius: 18px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
  text-align: center;
  font-weight: 1000;
  pointer-events: none;
  transition: .2s ease;
}

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

.bottom-tabs {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 12px;
  width: min(calc(100vw - 28px), 432px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  min-height: 76px;
  padding: 8px 10px;
  border: var(--line);
  border-radius: 999px;
  background: rgba(255,253,247,.94);
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  outline: 2px solid rgba(255,255,255,.9);
  outline-offset: -7px;
}

.bottom-tabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-weight: 1000;
  position: relative;
}

.bottom-tabs svg {
  width: 29px;
  height: 29px;
}

.bottom-tabs button.active {
  color: var(--gold);
}

.bottom-tabs button.active::after {
  content: "✦";
  position: absolute;
  top: 2px;
  right: 14px;
  color: var(--gold);
  font-size: 12px;
}

.bottom-tabs button[data-tab="piece"] {
  transform: translateY(-3px);
}

.bottom-tabs button[data-tab="piece"] svg {
  width: 35px;
  height: 35px;
}

.empty {
  grid-column: 1 / -1;
  padding: 18px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

@media (max-width: 380px) {
  .mini-app {
    padding-inline: 12px;
  }

  .paper-header {
    grid-template-columns: 40px 1fr 92px;
    padding-inline: 12px;
  }

  .brand-lockup strong {
    font-size: 22px;
  }

  .card-grid,
  .quick-grid {
    gap: 10px;
  }

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

/* UI-1A: global visual tokens, home hero, shared cards/buttons, and bottom navigation. */
.mini-app {
  padding-inline: var(--ui-page-gutter);
  padding-bottom: calc(var(--ui-bottom-nav-height) + 34px + var(--ui-safe-bottom));
}

.paper,
.hero-paper,
.paper-card,
.strip-panel,
.mine-card,
.draw-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-card-radius);
  box-shadow: var(--ui-shadow);
}

.paper-card,
.strip-panel {
  background:
    linear-gradient(135deg, rgba(255,255,255,.74), rgba(255,250,240,.46)),
    var(--ui-card-bg);
}

.paper-card {
  padding: 16px;
  transform: rotate(var(--paper-tilt, -.35deg));
}

.paper-card:nth-child(even) {
  --paper-tilt: .35deg;
}

.paper-card:active,
.quick-card:active,
.strip-panel button:active,
.brush-btn:active,
.black-btn:active,
.outline-btn:active,
.black-mini:active,
.bottom-tabs button:active {
  transform: translateY(1px) scale(.99);
}

.brush-btn,
.black-btn,
.outline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ui-button-primary-height);
  padding: 10px 18px;
  border-radius: var(--ui-card-radius-sm);
  font-size: var(--ui-font-button);
  line-height: 1;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.brush-btn,
.black-btn,
.black-mini {
  color: #fff;
  background: var(--ui-black);
  box-shadow: 2px 3px 0 var(--ui-gold);
}

.outline-btn {
  min-height: var(--ui-button-secondary-height);
  color: var(--ui-text-primary);
  background: rgba(255,253,247,.78);
  border: 1.5px solid var(--ui-black);
  box-shadow: 2px 3px 0 rgba(201,154,36,.24);
}

.round-icon {
  width: var(--ui-icon-button-size);
  height: var(--ui-icon-button-size);
  border: 1px solid rgba(12,11,9,.06);
  box-shadow: 0 6px 16px rgba(40,26,8,.15);
}

.hero-paper {
  min-height: 292px;
  margin: 4px 0 18px;
  padding: 26px 22px 24px;
  transform: rotate(-.45deg);
  background:
    radial-gradient(circle at 72% 80%, rgba(201,154,36,.12) 0 18px, transparent 19px),
    linear-gradient(135deg, rgba(255,255,255,.72), rgba(255,250,240,.42)),
    var(--ui-kraft-bg);
}

.hero-paper h1,
.page-title {
  font-size: var(--ui-font-title-1);
}

.hero-paper p {
  max-width: 78%;
  margin-top: 12px;
  color: var(--ui-text-primary);
  font-size: var(--ui-font-body);
  font-weight: 750;
  line-height: 1.58;
}

.eyebrow {
  margin-bottom: 11px;
  padding: 5px 11px;
  font-size: var(--ui-font-tag);
  box-shadow: 2px 3px 0 rgba(201,154,36,.72);
}

.home-hero-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  max-width: 74%;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.home-hero-flow li {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 7px 3px;
  border: 1px dashed rgba(12,11,9,.22);
  border-radius: 999px;
  background: rgba(255,253,247,.5);
  color: var(--ui-text-secondary);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.home-hero-flow li span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--ui-black);
  color: #fff;
  font-size: 10px;
}

.hero-actions {
  margin-top: 18px;
}

.home-primary-cta {
  min-width: 148px;
}

.hero-ring {
  right: 10px;
  bottom: 20px;
  width: 126px;
  opacity: .96;
}

.quick-grid {
  gap: var(--ui-card-gap);
  margin: 18px 0 20px;
}

.quick-card {
  display: grid;
  align-content: start;
  min-height: 126px;
  padding: 16px 14px;
  transform: rotate(var(--tilt, -.35deg));
}

.quick-card:nth-child(even) {
  --tilt: .35deg;
}

.home-quick-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255,253,247,.7);
  box-shadow: inset 0 0 0 1px rgba(12,11,9,.08);
}

.home-quick-icon svg,
.quick-card svg {
  width: 28px;
  height: 28px;
}

.quick-card strong,
.paper-card h3,
.mine-card h3 {
  margin-top: 10px;
  font-size: var(--ui-font-card-title);
  line-height: 1.22;
}

.quick-card span:not(.home-quick-icon),
.paper-card p,
.meta,
.help-text {
  color: var(--ui-text-secondary);
  font-size: var(--ui-font-body);
  font-weight: 650;
  line-height: 1.52;
}

.strip-panel {
  margin: 20px 0;
  padding: 18px 16px;
  transform: rotate(-.2deg);
}

.section-head {
  margin: 0 0 12px;
}

.section-head h2 {
  font-size: var(--ui-font-title-2);
}

.section-head button {
  min-height: var(--ui-button-secondary-height);
  padding-inline: 10px;
  border-radius: 999px;
  background: rgba(255,253,247,.64);
  box-shadow: inset 0 0 0 1px rgba(12,11,9,.1);
}

.inspiration-chip {
  min-height: 82px;
  padding: 10px 6px;
  border-radius: var(--ui-card-radius-sm);
  background: #d9bd85;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 4px 10px rgba(80,52,17,.12);
}

.bottom-tabs {
  bottom: max(10px, var(--ui-safe-bottom));
  width: min(calc(100vw - 28px), 424px);
  min-height: var(--ui-bottom-nav-height);
  padding: 7px 10px;
  border: 2px solid var(--ui-black);
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
}

.bottom-tabs button {
  min-width: 0;
  min-height: 54px;
  gap: 2px;
  font-size: 14px;
  line-height: 1.05;
}

.bottom-tabs svg {
  width: 27px;
  height: 27px;
}

.bottom-tabs button.active {
  color: var(--ui-gold);
  background: rgba(201,154,36,.08);
}

.bottom-tabs button.active::after {
  top: 3px;
  right: 13px;
  font-size: 10px;
}

.bottom-tabs button[data-tab="piece"] {
  transform: translateY(-1px);
}

.bottom-tabs button[data-tab="piece"] svg {
  width: 31px;
  height: 31px;
}

@media (max-width: 380px) {
  .hero-paper {
    padding-inline: 18px;
  }

  .hero-paper p {
    max-width: 76%;
  }

  .home-hero-flow {
    max-width: 78%;
    gap: 5px;
  }

  .home-hero-flow li {
    font-size: 10px;
    padding-inline: 2px;
  }

  .hero-ring {
    width: 112px;
  }
}

body.designer-mode {
  overflow: hidden;
  background: #fffdf7;
}

body.designer-mode .paper-header,
body.designer-mode .bottom-tabs,
body.designer-mode .icp-footer {
  display: none;
}

body.designer-mode .mini-app {
  width: 100vw;
  max-width: none;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fffdf7;
  box-shadow: none;
}

body.designer-mode .mini-app::before {
  opacity: .16;
}

.ring-designer-shell {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) 92px;
  gap: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 16%, rgba(201,154,36,.16) 0 2px, transparent 3px),
    radial-gradient(circle at 86% 8%, rgba(12,11,9,.06) 0 1px, transparent 2px),
    linear-gradient(120deg, #fffdf7, #f7f1e7);
}

.designer-topbar,
.designer-canvas-panel,
.designer-actions,
.designer-toolbar,
.material-panel,
.effect-card {
  border: 2px solid rgba(12,11,9,.12);
  background: rgba(255,253,247,.92);
  box-shadow: 0 10px 24px rgba(40,28,8,.12);
}

.designer-topbar {
  display: grid;
  grid-template-columns: 96px 1fr 118px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 22px;
}

.designer-topbar strong {
  display: block;
  font-size: 20px;
  font-weight: 1000;
  letter-spacing: 0;
}

.designer-topbar span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.designer-back,
.designer-plain,
.designer-side-btn,
.designer-main-btn,
.layer-controls button,
.material-head button {
  min-height: 40px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fffdf7;
  font-weight: 1000;
}

.designer-plain {
  border-color: rgba(12,11,9,.3);
}

.designer-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  min-height: 0;
}

.designer-canvas-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border-radius: 24px;
}

.designer-size-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.ring-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  border-radius: 22px;
  background:
    linear-gradient(rgba(255,255,255,.78), rgba(255,255,255,.78)),
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(12,11,9,.045) 18px 19px),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(12,11,9,.045) 18px 19px);
}

.ring-design-surface {
  position: relative;
  width: min(92vw, 920px);
  height: clamp(150px, 30vh, 226px);
  min-width: 620px;
  transform: scale(var(--designer-zoom, 1));
  transform-origin: center;
  overflow: hidden;
  touch-action: none;
  border: 2px solid #d9d2c7;
  border-radius: 28px;
  background: #fff;
  box-shadow: inset 0 0 0 8px rgba(201,154,36,.05), 0 18px 34px rgba(42,28,10,.13);
}

.ring-design-surface.show-boundary {
  border-color: var(--ink);
}

.reference-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .24;
  filter: grayscale(1);
  pointer-events: none;
}

.ring-guide-svg,
.ring-draw-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.safe-area {
  fill: rgba(201,154,36,.08);
  stroke: rgba(201,154,36,.55);
  stroke-width: .05;
  stroke-dasharray: .45 .35;
}

.center-line {
  stroke: rgba(12,11,9,.22);
  stroke-width: .035;
  stroke-dasharray: .35 .28;
}

.design-layer {
  position: absolute;
  display: grid;
  place-items: center;
  color: #0c0b09;
  touch-action: none;
  cursor: move;
}

.design-layer svg,
.design-layer img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.design-layer svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.design-layer.selected {
  outline: 2px dashed var(--gold);
  outline-offset: 6px;
}

.designer-hint {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(201,154,36,.12);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.layer-controls {
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding-bottom: 2px;
  overflow-x: auto;
}

.layer-controls button {
  flex: 0 0 auto;
  padding: 0 14px;
  border-color: rgba(12,11,9,.25);
}

.layer-controls .danger {
  color: #a33622;
  border-color: #a33622;
}

.designer-actions {
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 10px;
  border-radius: 24px;
}

.designer-main-btn {
  min-height: 58px;
  border-radius: 18px;
  background: #fffdf7;
  box-shadow: 4px 5px 0 rgba(201,154,36,.35);
}

.designer-main-btn.dark {
  color: #fff;
  background: var(--ink);
  box-shadow: 4px 5px 0 var(--gold);
}

.designer-side-btn {
  color: var(--gold);
  border-color: rgba(201,154,36,.8);
}

.designer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  overflow-x: auto;
  border-radius: 26px;
}

.designer-toolbar button,
.upload-tool {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 66px;
  min-height: 54px;
  padding: 6px 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  font-weight: 1000;
}

.designer-toolbar svg {
  width: 23px;
  height: 23px;
}

.designer-toolbar button.active,
.upload-tool:active {
  background: rgba(201,154,36,.28);
  box-shadow: inset 0 0 0 2px rgba(12,11,9,.12);
}

.designer-size-tools {
  flex: 0 0 260px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-left: 2px dashed rgba(12,11,9,.15);
}

.designer-size-tools label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.designer-size-tools input {
  padding: 0;
  border: 0;
  accent-color: var(--gold);
}

.material-panel {
  position: fixed;
  z-index: 105;
  right: 14px;
  bottom: 112px;
  width: min(420px, 42vw);
  max-height: calc(100dvh - 190px);
  overflow: auto;
  padding: 14px;
  border-radius: 24px;
}

.material-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.material-head strong {
  font-size: 20px;
  font-weight: 1000;
}

.material-head > div {
  display: grid;
  gap: 2px;
}

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

.material-head button {
  width: 38px;
  min-height: 38px;
}

.material-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.material-search input,
.material-search button {
  min-height: 42px;
  border: 1px solid rgba(12,11,9,.22);
  border-radius: 12px;
}

.material-search input {
  min-width: 0;
  padding: 0 12px;
  background: #fff;
}

.material-search button {
  padding: 0 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
}

.material-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.material-tabs button {
  border: 1px solid rgba(12,11,9,.22);
  border-radius: 999px;
  padding: 7px 10px;
  background: #f3ead9;
  font-weight: 900;
  margin-left: calc(var(--category-level, 0) * 8px);
}

.material-tabs button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.material-tabs small {
  opacity: .65;
}

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

.material-card {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 98px;
  border: 2px solid rgba(12,11,9,.16);
  border-radius: 18px;
  background: #fffaf0;
  font-weight: 1000;
  overflow: hidden;
  cursor: grab;
}

.material-card img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: #fff;
}

.material-card small {
  color: var(--muted);
  font-size: 10px;
}

.material-card svg {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
}

.material-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed rgba(12,11,9,.22);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.material-empty.error {
  color: #9a3028;
  border-color: rgba(154,48,40,.35);
}

.ring-design-surface.sticker-drop-active {
  outline: 4px solid rgba(198,148,28,.45);
  outline-offset: 6px;
  background: #fff7dc;
}

.material-panel p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.effect-panel {
  position: fixed;
  z-index: 112;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12,11,9,.42);
}

.effect-card {
  position: relative;
  width: min(780px, 92vw);
  padding: 20px;
  border-radius: 28px;
}

.effect-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  font-weight: 1000;
}

.effect-card strong {
  display: block;
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 1000;
}

.effect-export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.effect-export-row button {
  min-height: 40px;
  padding: 7px 14px;
  border: 2px solid rgba(12,11,9,.25);
  border-radius: 999px;
  background: #fffdf7;
  font-weight: 1000;
}

.effect-ring {
  padding: 38px 34px;
  border-radius: 26px;
  background: linear-gradient(180deg, #f2f2f0, #dad8d2);
  box-shadow: inset 0 0 26px rgba(0,0,0,.16);
}

.effect-strip {
  position: relative;
  height: 86px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9f8f3, #cfcac0 50%, #f8f8f5);
  border: 2px solid rgba(12,11,9,.18);
}

.effect-strip svg,
.effect-strip .design-layer {
  position: absolute;
  inset: 12% 5%;
  width: 90%;
  height: 76%;
}

.ring-designer-shell.is-inverted .ring-design-surface {
  background: #0f0e0c;
}

.ring-designer-shell.is-inverted .ring-draw-svg,
.ring-designer-shell.is-inverted .design-layer {
  filter: invert(1);
}

@media (max-height: 500px) and (orientation: landscape) {
  .ring-designer-shell {
    grid-template-rows: 52px minmax(0, 1fr) 72px;
    gap: 6px;
    padding: 6px 8px;
  }

  .designer-topbar {
    padding-block: 5px;
  }

  .designer-canvas-panel,
  .designer-actions {
    gap: 6px;
    padding: 7px;
  }

  .ring-design-surface {
    height: 116px;
  }

  .designer-hint {
    display: none;
  }

  .designer-main-btn {
    min-height: 46px;
  }

  .designer-side-btn {
    min-height: 34px;
  }

  .designer-toolbar {
    padding: 6px;
  }

  .designer-toolbar button,
  .upload-tool {
    min-height: 46px;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .ring-designer-shell {
    width: 100vw;
    height: 100dvh;
    transform: none;
    transform-origin: center;
    grid-template-rows: 52px minmax(0, 1fr) 82px;
  }

  .designer-topbar {
    grid-template-columns: 84px 1fr 100px;
  }

  .designer-topbar strong {
    font-size: 17px;
  }

  .designer-workbench {
    grid-template-columns: minmax(0, 1fr) 128px;
  }

  .ring-design-surface {
    width: 620px;
    height: 162px;
  }

  .designer-toolbar button,
  .upload-tool {
    min-height: 48px;
    min-width: 58px;
    font-size: 13px;
  }

  .material-panel {
    width: min(360px, 50vw);
    bottom: 96px;
  }
}

/* Clean customer-facing ring designer, aligned to the simple white drawing reference. */
body.designer-mode {
  overflow: hidden;
  background: #fff;
}

body.designer-mode .mini-app {
  background: #fff;
  color: #050505;
}

body.designer-mode .mini-app::before {
  display: none;
}

.ring-designer-shell {
  grid-template-rows: 76px minmax(0, 1fr) 104px;
  gap: 0;
  padding: 0 34px 22px;
  background: #fff;
  color: #050505;
}

.ring-designer-shell.material-open .designer-workbench,
.ring-designer-shell.material-open .designer-toolbar {
  filter: blur(5px);
  opacity: .32;
  pointer-events: none;
}

.designer-topbar,
.designer-canvas-panel,
.designer-actions,
.designer-toolbar,
.effect-card {
  border: 0;
  background: #fff;
  box-shadow: none;
}

.designer-topbar {
  grid-template-columns: 132px minmax(0, 1fr) 150px;
  padding: 14px 0 4px;
  border-radius: 0;
}

.designer-back,
.designer-plain {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: #050505;
  font-size: 18px;
}

.designer-brand-title {
  justify-self: center;
  text-align: center;
}

.designer-brand-title strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 1000;
}

.designer-brand-title strong:not(:first-child),
.designer-brand-title span {
  display: none;
}

.designer-meta-line {
  display: block;
  margin-top: 6px;
  color: #737373;
  font-size: 12px;
  font-weight: 800;
}

.designer-workbench {
  grid-template-columns: minmax(0, 1fr) 214px;
  align-items: center;
  gap: 28px;
  min-height: 0;
}

.designer-canvas-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 0;
  border-radius: 0;
  background: #fff;
}

.designer-size-line {
  display: none;
}

.ring-stage {
  overflow: visible;
  border-radius: 0;
  background: #fff;
}

.ring-design-surface {
  width: min(91vw, 1680px);
  min-width: 0;
  aspect-ratio: var(--ring-aspect, 10) / 1;
  height: auto;
  min-height: clamp(94px, 22vh, 220px);
  max-height: 30vh;
  transform: scale(var(--designer-zoom, 1));
  transform-origin: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: contain;
  border: 1.5px solid #8a8a8a;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.18);
}

.ring-design-surface.show-boundary {
  border-color: #7c7c7c;
}

.safe-area {
  fill: transparent;
  stroke: rgba(184,145,42,.4);
  stroke-width: .035;
  stroke-dasharray: none;
}

.center-line {
  stroke: rgba(0,0,0,.2);
  stroke-width: .025;
  stroke-dasharray: .3 .3;
}

.design-layer.selected {
  outline: 1.5px dashed #c79a24;
  outline-offset: 5px;
}

.designer-hint {
  min-height: 22px;
  padding: 0;
  background: transparent;
  color: #8a8a8a;
  text-align: center;
  font-size: 12px;
}

.layer-controls {
  justify-content: center;
  min-height: 36px;
}

.layer-controls button {
  min-height: 34px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
}

.designer-actions {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 0;
  border-radius: 0;
}

.designer-main-btn,
.designer-side-btn {
  min-height: 56px;
  border: 1.5px solid #111;
  border-radius: 0;
  background: #fff;
  color: #050505;
  box-shadow: none;
  font-size: 18px;
}

.designer-main-btn.dark {
  color: #fff;
  background: #050505;
  box-shadow: none;
}

.designer-side-btn {
  color: #050505;
  border-color: #111;
}

.designer-toolbar {
  align-items: center;
  gap: 16px;
  padding: 12px 0 0;
  overflow-x: auto;
  border-radius: 0;
  background: #fff;
}

.designer-toolbar button,
.upload-tool {
  flex-direction: column;
  gap: 4px;
  min-width: 58px;
  min-height: 72px;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #050505;
  box-shadow: none;
  font-size: 13px;
}

.designer-toolbar button.active,
.upload-tool:active {
  background: transparent;
  box-shadow: inset 0 -3px 0 #050505;
}

.designer-toolbar svg {
  width: 28px;
  height: 28px;
  stroke: #050505;
  fill: none;
}

.designer-size-tools {
  display: none;
}

.material-backdrop {
  position: fixed;
  z-index: 104;
  inset: 0;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(5px);
}

body.designer-mode .material-panel {
  position: fixed;
  z-index: 106;
  top: 0;
  right: 0;
  bottom: auto;
  left: 0;
  width: 100vw;
  height: 80dvh;
  max-height: 80dvh;
  padding: 30px 54px 34px;
  overflow: auto;
  border: 0;
  border-radius: 0 0 24px 24px;
  background: #fff;
  color: #050505;
  box-shadow: 0 24px 42px rgba(0,0,0,.35);
}

.material-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 34px;
}

.material-primary-cats {
  display: grid;
  align-content: start;
  gap: 18px;
  padding-top: 62px;
}

.material-primary-cats button,
.material-sub-cats button {
  border: 0;
  background: transparent;
  color: #9a9a9a;
  text-align: left;
  font-size: 20px;
  font-weight: 900;
}

.material-primary-cats button.active,
.material-sub-cats button.active {
  color: #050505;
}

.material-main {
  min-width: 0;
}

.material-head {
  margin: 0 0 18px;
}

.material-head strong {
  font-size: 22px;
}

.material-head button {
  width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 50%;
  background: #f4f4f4;
}

.material-search {
  max-width: 460px;
  margin-bottom: 18px;
}

.material-search input,
.material-search button {
  min-height: 40px;
  border: 1px solid #111;
  border-radius: 0;
  background: #fff;
}

.material-search button {
  background: #050505;
  color: #fff;
}

.material-sub-cats {
  display: flex;
  gap: 28px;
  margin-bottom: 22px;
  overflow-x: auto;
}

.material-sub-cats small {
  color: #999;
  font-size: 12px;
}

.material-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 22px 28px;
}

.material-card {
  min-height: 96px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  cursor: grab;
}

.material-card img {
  width: 118px;
  height: 90px;
  object-fit: contain;
  background: transparent;
}

.material-card span {
  max-width: 110px;
  color: #050505;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card small,
.material-panel p {
  display: none;
}

.ring-design-surface.sticker-drop-active {
  outline: 2px solid #050505;
  outline-offset: 8px;
  background: #fff;
}

@media (orientation: portrait) and (max-width: 900px) {
  .ring-designer-shell {
    grid-template-rows: 64px minmax(0, 1fr) 86px;
    padding: 0 22px 16px;
  }

  .designer-workbench {
    grid-template-columns: minmax(0, 1fr) 164px;
    gap: 18px;
  }

  .ring-design-surface {
    width: min(72vw, 760px);
    height: auto;
    aspect-ratio: var(--ring-aspect, 10) / 1;
  }

  body.designer-mode .material-panel {
    max-height: 64dvh;
    padding: 22px 34px 28px;
  }
}

/* Final DRAWNTO-like customer designer corrections */
.ring-designer-shell {
  grid-template-rows: 96px minmax(0, 1fr) 118px;
  padding: 0 52px 22px;
  width: 100vw;
  height: 100dvh;
  transform: none;
  transform-origin: center;
}

.designer-workbench {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 0;
}

.designer-canvas-panel {
  width: 100%;
  align-content: center;
  justify-items: center;
  gap: 0;
}

.ring-stage {
  width: 100%;
  overflow: visible;
}

.ring-design-surface {
  width: min(90vw, 1820px);
  height: auto;
  min-height: 0;
  max-height: 24vh;
  aspect-ratio: var(--ring-aspect, 18.333) / 1;
  border: 1.5px solid #777;
  border-radius: 0;
  box-shadow: 0 1px 5px rgba(0,0,0,.24);
  overflow: hidden;
  touch-action: none;
}

.designer-size-line,
.designer-hint,
.designer-size-tools {
  display: none;
}

.designer-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 0;
  overflow: hidden;
}

.designer-tool-strip {
  display: flex;
  align-items: center;
  gap: 26px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
}

.designer-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.designer-footer-actions .designer-main-btn {
  min-width: 184px;
  min-height: 56px;
  border: 1.5px solid #111;
  border-radius: 0;
  background: #fff;
  color: #050505;
  box-shadow: none;
  font-size: 17px;
}

.designer-footer-actions .designer-main-btn.dark {
  background: #050505;
  color: #fff;
}

.ring-guide-svg,
.ring-draw-svg,
.design-layer svg,
.design-layer img {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

body.designer-mode .material-panel {
  height: 80dvh;
  max-height: 80dvh;
  overflow-y: auto;
}

@media (orientation: portrait) and (max-width: 900px) {
  .ring-designer-shell {
    grid-template-rows: 76px minmax(0, 1fr) 108px;
    padding: 0 22px 18px;
    width: 100vw;
    height: 100dvh;
    transform: none;
    transform-origin: center;
  }

  .designer-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .ring-design-surface {
    width: min(88vw, 980px);
    height: auto;
    max-height: 23vh;
    aspect-ratio: var(--ring-aspect, 18.333) / 1;
  }

  .designer-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
  }

  .designer-tool-strip {
    gap: 18px;
  }

  .designer-footer-actions .designer-main-btn {
    min-width: 132px;
    min-height: 52px;
    font-size: 15px;
  }

  body.designer-mode .material-panel {
    height: 80dvh;
    max-height: 80dvh;
    overflow-y: auto;
  }
}

/* 2026-06-27 interaction corrections */
.ring-designer-shell {
  grid-template-rows: 62px minmax(0, 1fr) 104px;
  padding: 0 28px 12px;
}

.designer-workbench {
  position: relative;
  z-index: 1;
  overflow: visible;
}

.designer-toolbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(176px, 21vw);
  align-items: end;
  gap: 10px;
  padding: 0;
  overflow: visible;
}

.designer-tool-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: clamp(1px, .35vw, 7px);
  width: 100%;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.designer-toolbar button,
.upload-tool {
  min-width: 0;
  min-height: 64px;
  padding: 3px 1px;
  gap: 3px;
  white-space: nowrap;
  font-size: clamp(9px, .82vw, 12px);
}

.designer-toolbar svg {
  width: clamp(20px, 1.75vw, 27px);
  height: clamp(20px, 1.75vw, 27px);
}

.designer-footer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.designer-footer-actions .designer-main-btn {
  min-width: 0;
  min-height: 52px;
  padding: 0 8px;
  font-size: clamp(12px, 1.05vw, 16px);
}

.designer-tool-panel {
  position: absolute;
  z-index: 60;
  left: clamp(8px, 13vw, 220px);
  bottom: calc(100% + 8px);
  min-width: min(310px, 58vw);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  overflow: visible;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
}

.design-layer.selected {
  outline: none;
}

.layer-handle {
  display: none;
}

body.designer-mode .material-panel {
  height: 80dvh;
  max-height: 80dvh;
  padding: 18px 30px 20px;
  overflow: hidden;
}

.material-layout {
  grid-template-columns: clamp(112px, 11vw, 168px) minmax(0, 1fr);
  gap: clamp(12px, 1.5vw, 26px);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.material-primary-cats {
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 54px 4px 8px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.material-primary-cats button,
.material-sub-cats button {
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.2;
}

.material-main {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.material-head {
  min-height: 42px;
  margin: 0 0 6px;
}

.material-head strong {
  font-size: 18px;
}

.material-head span {
  font-size: 11px;
}

.material-sub-cats {
  gap: 16px;
  min-height: 34px;
  margin: 0 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  align-content: start;
  gap: 8px 10px;
  min-height: 0;
  padding: 4px 8px 18px 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.material-card {
  min-width: 0;
  min-height: 72px;
  gap: 2px;
  padding: 0;
  overflow: hidden;
}

.material-card img {
  width: 100%;
  height: clamp(48px, 8.5vh, 72px);
  object-fit: contain;
  filter: grayscale(1) contrast(300%) drop-shadow(.35px 0 #000) drop-shadow(-.35px 0 #000) drop-shadow(0 .35px #000);
  mix-blend-mode: multiply;
  background: #fff;
}

.material-card span {
  display: none;
}

@media (max-width: 900px) {
  .ring-designer-shell {
    grid-template-rows: 54px minmax(0, 1fr) 94px;
    padding: 0 12px 8px;
  }

  .designer-toolbar {
    grid-template-columns: minmax(0, 1fr) 176px;
    gap: 6px;
  }

  .designer-toolbar button,
  .upload-tool {
    min-height: 56px;
    font-size: 8px;
  }

  .designer-toolbar svg {
    width: 19px;
    height: 19px;
  }

  .designer-footer-actions .designer-main-btn {
    min-height: 46px;
    font-size: 12px;
  }

  .designer-tool-panel {
    left: 8px;
    bottom: calc(100% + 6px);
    min-width: min(286px, 62vw);
  }

  body.designer-mode .material-panel {
    padding: 12px 16px 14px;
  }

  .material-layout {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
  }

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

  .material-card img {
    height: clamp(42px, 8vh, 58px);
  }
}

/* Asset-center customer sticker pagination and metadata. */
.material-card {
  min-height: 96px;
}

.material-card span,
.material-card .material-card-category {
  display: block;
  width: 100%;
  overflow: hidden;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card span {
  color: #202020;
  font-size: 9px;
}

.material-card .material-card-category {
  color: #777;
  font-size: 8px;
}

.material-empty,
.material-load-status,
.material-load-more {
  grid-column: 1 / -1;
}

.material-load-status {
  padding: 10px 0;
  color: #777;
  font-size: 12px;
  text-align: center;
}

.material-load-more {
  min-height: 36px;
  border: 1px solid rgba(12, 11, 9, .16);
  border-radius: 999px;
  background: #fff;
  color: #333;
  cursor: pointer;
}

/* Server-configured sections keep the customer layout responsive. */
.configured-section {
  min-width: 0;
}

.configured-section + .configured-section {
  margin-top: var(--section-gap, 0);
}

.configured-section .configured-grid {
  grid-template-columns: repeat(var(--section-columns, 2), minmax(0, 1fr));
  gap: var(--section-gap, 12px);
}

.section-poster,
.section-text,
.section-image,
.section-button_group,
.section-card_group,
.section-grid,
.section-divider,
.section-spacer,
.section-bottom_nav {
  min-height: var(--section-min-height, 0);
  padding: var(--section-padding, 16px);
  overflow: hidden;
  color: var(--section-text, #111);
  background: var(--section-bg, #fff);
  border-radius: var(--section-radius, 0);
}

.visual-poster {
  position: relative;
  display: grid;
  align-items: end;
  min-height: max(180px, var(--section-min-height, 0px));
  overflow: hidden;
}

.visual-poster > .visual-section-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.designer-export-workflow {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(4px);
}

.designer-export-workflow.is-success {
  inset: auto 12px calc(76px + env(safe-area-inset-bottom, 0px));
  display: block;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.designer-export-workflow.is-success .designer-export-card {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 14px 18px;
  gap: 6px;
  pointer-events: none;
}

.designer-export-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(430px, calc(100vw - 40px));
  padding: 28px 30px;
  border: 1.5px solid #111;
  border-radius: 6px;
  background: #fff;
  color: #111;
  box-shadow: 0 18px 52px rgba(0, 0, 0, .15);
  text-align: center;
}

.designer-export-card strong {
  font-size: clamp(18px, 2vw, 24px);
}

.designer-export-card p {
  margin: 0;
  color: #626262;
  font-size: 14px;
}

.designer-export-card ul {
  width: 100%;
  margin: 2px 0 0;
  padding: 12px 14px;
  list-style: none;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  color: #333;
  text-align: left;
}

.designer-export-card li + li {
  margin-top: 6px;
}

.designer-export-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #ddd;
  border-top-color: #111;
  border-radius: 50%;
  animation: designer-export-spin .8s linear infinite;
}

.designer-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.designer-export-actions button {
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-weight: 800;
}

.designer-export-actions button.dark {
  background: #111;
  color: #fff;
}

.designer-export-actions button:only-child {
  grid-column: 1 / -1;
}

@keyframes designer-export-spin {
  to { transform: rotate(360deg); }
}

.visual-poster-copy {
  position: relative;
  z-index: 1;
  padding: 22px;
  color: inherit;
  background: linear-gradient(0deg, color-mix(in srgb, var(--section-bg, #fff) 92%, transparent), transparent);
}

.visual-poster h2,
.visual-text-block h2,
.visual-button-block h2,
.visual-card-block h2 {
  margin: 0 0 8px;
  letter-spacing: 0;
}

.visual-poster p,
.visual-text-block p,
.visual-text-block h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

.visual-section-image {
  display: block;
  width: 100%;
  max-height: 420px;
}

.visual-image-block,
.visual-image-block figcaption {
  margin: 0;
}

.visual-image-block figcaption {
  padding-top: 8px;
}

.visual-button-row,
.visual-bottom-nav {
  display: grid;
  grid-template-columns: repeat(var(--section-columns, 1), minmax(0, 1fr));
  gap: var(--section-gap, 10px);
}

.visual-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--section-accent, #c89b32);
  border-radius: min(var(--section-radius, 0px), 8px);
  color: var(--section-text, #111);
  background: transparent;
}

.visual-button-solid {
  color: #fff;
  background: var(--section-accent, #c89b32);
}

.visual-button-text {
  border-color: transparent;
}

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

.visual-card {
  min-height: 84px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--section-text, #111) 18%, transparent);
  border-radius: min(var(--section-radius, 0px), 8px);
  color: inherit;
  background: color-mix(in srgb, var(--section-bg, #fff) 94%, var(--section-accent, #c89b32));
}

.visual-divider {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--section-accent, #c89b32);
}

.visual-spacer {
  min-height: max(12px, var(--section-min-height, 32px));
}

body.admin-page-preview .bottom-tabs {
  display: none;
}

body.admin-page-preview .customer-main {
  padding-bottom: 24px;
}

@media (max-width: 620px) {
  .configured-section .configured-grid {
    grid-template-columns: repeat(min(var(--section-columns, 2), 2), minmax(0, 1fr));
  }
}

/* 17-3 unified sticker, image and drawing object controls */
.designer-canvas-panel,
.ring-stage {
  position: relative;
}

.ring-draw-svg {
  pointer-events: none !important;
}

.design-layer,
.design-layer.selected,
.design-layer:focus,
.design-layer:focus-visible,
.design-layer > img,
.design-layer > svg {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.designer-drawing-hit-target {
  position: absolute;
  z-index: 8;
  display: block;
  min-width: 2px;
  min-height: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: move;
  touch-action: none;
}

.designer-edit-overlay {
  position: absolute;
  z-index: 25;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.designer-edit-overlay.is-hidden {
  display: none;
}

.designer-object-selection {
  position: absolute;
  box-sizing: border-box;
  min-width: 2px;
  min-height: 2px;
  cursor: move;
  pointer-events: auto;
  touch-action: none;
  transform-origin: center;
}

.designer-object-selection.is-locked {
  cursor: default;
}

.designer-selection-frame {
  position: absolute;
  inset: -5px;
  border: 1px dashed #000;
  box-shadow: none;
  pointer-events: none;
}

.designer-object-selection.is-locked .designer-selection-frame {
  border-color: #000;
  border-style: dashed;
  opacity: .65;
}

.designer-rotate-handle {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: -94px;
  display: grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #000;
  cursor: grab;
  touch-action: none;
  transform: translateX(-50%);
}

.designer-rotate-handle:active {
  cursor: grabbing;
}

.designer-rotate-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 30px;
  width: 1px;
  height: 54px;
  background: #000;
  transform: translateX(-50%);
  pointer-events: none;
}

.designer-rotate-handle i {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #000;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-style: normal;
  line-height: 1;
  pointer-events: none;
}

.designer-scale-handle {
  position: absolute;
  right: -17px;
  bottom: -17px;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
}

.designer-scale-handle i {
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #111;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  pointer-events: none;
}

.designer-selection-actions {
  position: absolute;
  right: -18px;
  top: -48px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.designer-selection-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #111;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}

.designer-lock-badge {
  position: absolute;
  right: -8px;
  top: -34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #555;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.designer-layers-panel {
  position: absolute;
  z-index: 16;
  top: 50%;
  right: 12px;
  width: min(190px, 24vw);
  max-height: min(46vh, 300px);
  padding: 9px;
  overflow-y: auto;
  border: 1px solid rgba(17, 17, 17, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .1);
  transform: translateY(-50%);
}

.designer-layers-panel > strong {
  display: block;
  margin: 0 4px 6px;
  color: #666;
  font-size: 11px;
}

.designer-layer-list {
  display: grid;
  gap: 4px;
}

.designer-layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px 28px;
  align-items: center;
  min-height: 34px;
  border: 1px solid transparent;
  background: #fafafa;
}

.designer-layer-row.selected {
  border-color: #c89a24;
  background: #fff8e5;
}

.designer-layer-row.is-hidden .designer-layer-select {
  opacity: .5;
}

.designer-layer-row.is-locked {
  background: #f0f0f0;
}

.designer-layer-row button {
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #222;
}

.designer-layer-row .designer-layer-select {
  display: grid;
  min-width: 0;
  padding: 3px 7px;
  text-align: left;
}

.designer-layer-select span,
.designer-layer-select small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.designer-layer-select span {
  font-size: 11px;
  font-weight: 800;
}

.designer-layer-select small {
  color: #888;
  font-size: 9px;
}

@media (max-width: 760px) {
  .designer-layers-panel {
    right: 2px;
    width: 142px;
    max-height: 38vh;
    padding: 5px;
  }

  .designer-layer-row {
    grid-template-columns: minmax(0, 1fr) 26px 26px 26px;
  }
}

/* Local-font text tool: editing UI only; generated glyph paths remain in the design layer. */
.designer-text-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(150px, .8fr) minmax(110px, .45fr) auto;
  align-items: end;
  gap: 8px 10px;
  width: min(820px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(58vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
}

.designer-text-panel label {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: #555;
  font-size: 11px;
}

.designer-text-panel textarea,
.designer-text-panel select,
.designer-text-panel input[type="number"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid rgba(12, 11, 9, .24);
  border-radius: 7px;
  background: #fff;
  color: #0c0b09;
  font: inherit;
}

.designer-text-panel textarea {
  resize: vertical;
}

.designer-text-input {
  position: relative;
}

.designer-text-input > small {
  position: absolute;
  right: 7px;
  bottom: 4px;
  color: #888;
  font-size: 9px;
  pointer-events: none;
}

.designer-text-status,
.designer-text-note {
  grid-column: 1 / -1;
  margin: 0;
  color: #666;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.designer-text-status.is-error {
  color: #a2251d;
  font-weight: 700;
}

.designer-text-panel > button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: #111;
  color: #fff;
  cursor: pointer;
}

.designer-text-panel > button:disabled {
  cursor: wait;
  opacity: .55;
}

.design-layer.text-layer,
.design-layer.text-layer svg,
.design-layer.text-layer path {
  fill: #0c0b09;
  stroke: none;
}

@media (max-width: 760px) {
  .designer-text-panel {
    left: 4px;
    grid-template-columns: minmax(0, 1fr) minmax(108px, .65fr);
    width: calc(100vw - 20px);
    max-height: min(66vh, 430px);
    padding: 10px;
  }

  .designer-text-panel .designer-text-input,
  .designer-text-panel > button,
  .designer-text-status,
  .designer-text-note {
    grid-column: 1 / -1;
  }
}

/* 17-7 mobile toolbar release fix: one row, scrollable tools, fixed actions. */
.designer-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.designer-tool-strip {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  width: auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.designer-tool-strip > button,
.designer-tool-strip > .upload-tool {
  flex: 0 0 clamp(52px, 5.6vw, 72px);
}

.designer-toolbar button,
.designer-toolbar .upload-tool,
.designer-footer-actions .designer-main-btn {
  box-sizing: border-box;
  min-height: 64px;
  height: 64px;
}

.designer-footer-actions {
  display: grid;
  flex: 0 0 clamp(176px, 21vw, 400px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  width: auto;
}

@media (max-width: 900px) {
  .designer-footer-actions {
    flex-basis: 176px;
  }

  .designer-toolbar button,
  .designer-toolbar .upload-tool,
  .designer-footer-actions .designer-main-btn {
    min-height: 56px;
    height: 56px;
  }
}
