.diy-v3-shell {
  height: calc(100vh - 58px);
  min-height: 640px;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  overflow: hidden;
  background: #eef2f5;
}

.diy-v3-studio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.diy-v3-studio-bar > div:first-child {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.diy-v3-studio-bar h1 {
  margin: 0;
  font-size: 18px;
}

.diy-v3-studio-bar span {
  color: var(--muted);
  font-size: 13px;
}

.diy-v3-studio-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.diy-v3-studio-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diy-v3-studio-summary i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.diy-v3-studio-summary b { font-size: 17px; }

.diy-v3-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 170px minmax(500px, 1fr) minmax(320px, 372px);
  grid-template-areas: "taxonomy stage library";
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.diy-v3-taxonomy,
.diy-v3-stage-column,
.diy-v3-library { min-width: 0; min-height: 0; background: #fff; }

.diy-v3-taxonomy {
  grid-area: taxonomy;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.diy-group-list {
  display: grid;
  padding: 8px;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: #f4f7f9;
}

.diy-group-button,
.diy-category-button {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 10px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 750;
}

.diy-group-button small,
.diy-category-button small {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 9px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.diy-group-button.active {
  border-left-color: #6e4db6;
  background: linear-gradient(90deg, #e9e0ff 0, #f7f3ff 88%);
  color: #5d3da3;
}

.diy-category-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.diy-category-head span {
  color: var(--muted);
  font-size: 12px;
}

.diy-category-list {
  min-height: 0;
  overflow-y: auto;
  padding: 5px 7px 16px;
}

.diy-category-button {
  width: 100%;
  min-height: 42px;
  margin-bottom: 2px;
  font-weight: 650;
}

.diy-category-button.active {
  border-left-color: var(--blue);
  background: var(--blue-soft);
  color: #1e5ca9;
}

.diy-v3-stage-column {
  grid-area: stage;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.diy-stage-toolbar {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.diy-guide-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-weight: 750;
}

.diy-guide-button b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
}

.diy-stage-metrics {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.diy-stage-metrics span {
  min-width: 116px;
  padding: 5px 9px;
  border-left: 3px solid var(--blue);
  background: #f4f8fd;
}

.diy-stage-metrics span:nth-child(2) { border-color: var(--green); background: #f0f8f4; }
.diy-stage-metrics span:nth-child(3) { border-color: var(--orange); background: #fff7ef; }
.diy-stage-metrics small { display: block; color: var(--muted); font-size: 11px; }
.diy-stage-metrics strong { display: block; margin-top: 1px; font-size: 14px; }

.diy-stage-tools { display: flex; align-items: center; gap: 4px; }
.diy-stage-tools button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 18px;
}
.diy-stage-tools button.active { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.diy-stage-tools button:disabled { cursor: not-allowed; opacity: .35; }

.diy-stage-viewport {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px;
  background: #f1f3f4;
  touch-action: none;
  user-select: none;
}

.diy-stage-plate {
  --plate-outer: #a8654d;
  --plate-inner: #c9d9d5;
  --plate-center: #e8efec;
  --plate-image: none;
  width: min(100%, 66vh);
  max-width: 720px;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  background-image: var(--plate-image), radial-gradient(circle at 50% 47%, var(--plate-center) 0 58%, var(--plate-inner) 69%, var(--plate-outer) 70% 78%, #f4f4f1 79% 100%);
  background-position: center;
  background-size: cover;
  box-shadow: 0 4px 14px rgba(32,41,45,.12);
}

.diy-stage-logo {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  color: rgba(31,44,40,.18);
  text-align: center;
  pointer-events: none;
}
.diy-stage-logo strong { font-size: clamp(24px, 4vw, 48px); }
.diy-stage-logo span { font-size: 10px; letter-spacing: 2px; }

.diy-bracelet-camera {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  transform-origin: center;
  will-change: transform;
}

.diy-elastic-ring {
  position: absolute;
  left: 0;
  top: 0;
  border: 3px solid rgba(126,137,135,.58);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1px rgba(255,255,255,.28);
}

.diy-bracelet-items { position: absolute; left: 0; top: 0; }
.diy-bracelet-item {
  --item-rotation: 0deg;
  --item-offset: 0px;
  --item-shadow-x: 7px;
  --item-shadow-y: 10px;
  --item-shadow-blur: 8px;
  --item-shadow-color: rgba(28,31,30,.36);
  --hole-x: 50%;
  --hole-y: 50%;
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  transform: rotate(var(--item-rotation)) translateY(var(--item-offset));
  touch-action: none;
  z-index: 3;
}

.diy-bracelet-item img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  filter: drop-shadow(var(--item-shadow-x) var(--item-shadow-y) var(--item-shadow-blur) var(--item-shadow-color));
  -webkit-user-drag: none;
}

.diy-bracelet-item.dragging {
  left: 50%;
  top: 50%;
  margin: 0 !important;
  z-index: 12;
  opacity: .92;
  transform: translate(calc(var(--drag-x) - 50%), calc(var(--drag-y) - 50%));
}

.diy-delete-zone {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 14px;
  padding: 7px 12px;
  border-radius: 5px;
  background: rgba(155,44,44,.9);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: .15s ease;
  pointer-events: none;
}
.diy-delete-zone.visible { opacity: 1; transform: translate(-50%, 0); }

.diy-stage-helper {
  min-height: 31px;
  margin: 0;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  background: #f2f8f5;
  color: #37604f;
  text-align: center;
  font-size: 12px;
}
.diy-stage-helper.warning { background: var(--orange-soft); color: #9d5d21; }
.diy-stage-helper.danger { background: var(--red-soft); color: var(--red); }

.diy-stage-actions {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.diy-stage-actions > div { display: flex; align-items: center; gap: 6px; }
.diy-stage-actions button {
  min-height: 39px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-weight: 750;
}
.diy-stage-actions button:disabled { cursor: not-allowed; opacity: .4; }
.diy-stage-actions .diy-primary-action { border-color: var(--brand); background: var(--brand); color: #fff; }
.diy-stage-actions > span { color: var(--muted); font-size: 12px; text-align: right; }

.diy-v3-library {
  grid-area: library;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.diy-library-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.diy-library-head h2 { margin: 0; font-size: 17px; }
.diy-library-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.diy-library-head > b { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--blue-soft); color: var(--blue); }

.diy-material-search {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: 7px 8px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}
.diy-material-search input { min-width: 0; height: 38px; border: 0; outline: 0; }
.diy-material-search button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.diy-mobile-search { display: none; }

.diy-material-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.diy-material-card {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-rows: 102px auto auto;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.diy-material-card:hover { border-color: #9eb4cd; box-shadow: 0 5px 14px rgba(39,57,73,.09); }
.diy-material-photo { min-width: 0; min-height: 0; width: 100%; height: 102px; align-self: stretch; display: grid; place-items: center; overflow: hidden; background: #f7f8f8; }
.diy-material-photo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; justify-self: center; align-self: center; }
.diy-material-photo img.is-missing { opacity: .18; }
.diy-material-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.diy-material-card > span:last-of-type { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--muted); font-size: 12px; }
.diy-material-card em { color: var(--text); font-style: normal; font-weight: 800; }
.diy-material-card small { position: absolute; inset: 8px 8px auto auto; padding: 3px 5px; border-radius: 4px; background: var(--red); color: #fff; }
.diy-material-card.is-disabled { cursor: not-allowed; opacity: .48; filter: grayscale(.7); }

.diy-selected-panel {
  min-height: 64px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  background: #f5f7f9;
}
.diy-selected-panel > span { grid-column: 1 / -1; color: var(--muted); text-align: center; }
.diy-selected-panel img { width: 48px; height: 48px; object-fit: contain; background: #fff; }
.diy-selected-panel div { min-width: 0; }
.diy-selected-panel small, .diy-selected-panel strong, .diy-selected-panel span { display: block; }
.diy-selected-panel strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diy-selected-panel small, .diy-selected-panel div span { color: var(--muted); font-size: 11px; }

.diy-empty-materials {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.diy-flying-material {
  position: fixed;
  z-index: 200;
  object-fit: contain;
  pointer-events: none;
  transition: left .4s cubic-bezier(.2,.8,.2,1), top .4s cubic-bezier(.2,.8,.2,1), width .4s ease, height .4s ease, opacity .4s ease, transform .4s ease;
  filter: drop-shadow(6px 8px 7px rgba(25,28,27,.32));
}

.diy-guide-list { display: grid; gap: 9px; margin: 0; padding-left: 22px; }
.diy-guide-list li { padding: 8px; background: var(--surface-soft); }
.diy-guide-list strong, .diy-guide-list span { display: block; }
.diy-guide-list span { margin-top: 3px; color: var(--muted); }

.diy-background-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.diy-background-options button { padding: 8px; border: 2px solid transparent; border-radius: 6px; background: #fff; }
.diy-background-options button.active { border-color: var(--blue); }
.diy-background-options span { display: block; aspect-ratio: 1; border: 0; border-radius: 4px; background-image: var(--image), radial-gradient(circle, var(--center) 0 55%, var(--inner) 55% 59%, var(--outer) 59% 63.5%, #f2f4f3 63.7%); background-position: center; background-size: 100% 100%; }
.diy-background-options strong { display: block; margin-top: 6px; }

.diy-cart-success { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: center; }
.diy-cart-success img { width: 210px; aspect-ratio: 1; object-fit: contain; background: #f3f5f5; }
.diy-cart-success > div > div { display: flex; gap: 7px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .diy-v3-workspace { grid-template-columns: 146px minmax(430px, 1fr) minmax(290px, 330px); }
  .diy-stage-metrics span { min-width: 102px; }
  .diy-stage-actions > span { display: none; }
}

@media (max-width: 900px) {
  .diy-v3-shell {
    height: calc(100dvh - 56px);
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  .diy-v3-studio-bar { display: none; }
  .diy-v3-workspace {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    grid-template-rows: clamp(364px, calc(100vw + 46px), 524px) 44px minmax(0, 1fr);
    grid-template-areas: none;
    gap: 1px;
  }
  .diy-v3-stage-column {
    position: relative;
    grid-area: auto;
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-rows: minmax(0, 1fr) 42px;
  }
  .diy-stage-toolbar {
    position: absolute;
    z-index: 20;
    inset: 0 0 auto;
    min-height: 46px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 3px 6px;
    border-bottom: 1px solid rgba(214,221,226,.82);
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(5px);
  }
  .diy-guide-button { min-height: 32px; padding: 3px 6px; }
  .diy-guide-button b { width: 18px; height: 18px; }
  .diy-stage-metrics { gap: 4px; }
  .diy-stage-metrics span { min-width: 0; flex: 1; padding: 3px 5px; }
  .diy-stage-metrics small { min-height: 20px; display: flex; align-items: center; font-size: 9px; line-height: 10px; }
  .diy-stage-metrics strong { font-size: 12px; line-height: 14px; white-space: nowrap; }
  .diy-stage-tools { gap: 2px; }
  .diy-stage-tools button { width: 27px; height: 30px; }
  .diy-stage-viewport { grid-row: 1; padding: 0; }
  .diy-stage-plate { width: auto; height: 100%; max-width: 100%; max-height: 100%; box-shadow: 0 3px 12px rgba(32,41,45,.11); }
  .diy-stage-helper {
    position: absolute;
    z-index: 18;
    left: 0;
    right: 0;
    bottom: 42px;
    display: none;
    min-height: 22px;
    padding: 3px 7px;
    border-top: 0;
    background: rgba(255,247,239,.9);
    font-size: 10px;
    line-height: 16px;
  }
  .diy-stage-helper.warning, .diy-stage-helper.danger { display: block; }
  .diy-stage-actions { grid-row: 2; min-height: 42px; padding: 3px 6px; }
  .diy-stage-actions > div { width: 100%; display: grid; grid-template-columns: minmax(125px, 1.25fr) minmax(70px, .7fr) minmax(96px, .95fr); }
  .diy-stage-actions button { min-width: 0; min-height: 34px; padding: 4px 7px; font-size: 12px; }
  .diy-v3-taxonomy,
  .diy-v3-library { display: contents; }
  .diy-group-list {
    position: relative;
    z-index: 3;
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 5px;
    border-bottom: 0;
    background: #f7f9fa;
  }
  .diy-group-button { flex: 0 0 auto; min-width: 70px; min-height: 40px; justify-content: center; border-left: 0; border-bottom: 3px solid transparent; padding: 4px 8px; font-size: 12px; line-height: 1.12; text-align: center; white-space: nowrap; }
  .diy-group-button.active { border-bottom-color: var(--purple); background: var(--purple-soft); }
  .diy-group-button small, .diy-category-button small { display: none; }
  .diy-category-head { display: none; }
  .diy-category-list {
    grid-column: 1;
    grid-row: 3;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 0 max(72px, env(safe-area-inset-bottom));
    border-top: 0;
    border-right: 1px solid var(--line);
    background: #f7f8f8;
  }
  .diy-category-button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    justify-content: flex-start;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #edf0f1;
    border-radius: 0;
    padding: 7px 7px;
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .diy-category-button.active { border-left-color: var(--blue); border-bottom-color: #edf0f1; background: #fff; }
  .diy-library-head, .diy-selected-panel { display: none; }
  .diy-material-search { display: none; }
  .diy-mobile-search {
    flex: 0 0 38px;
    min-width: 0;
    min-height: 36px;
    display: grid;
    grid-template-columns: 36px 0 0;
    align-items: center;
    justify-self: end;
    align-self: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
  }
  .diy-mobile-search > span { width: 36px; display: grid; place-items: center; font-size: 20px; }
  .diy-mobile-search input { width: 0; min-width: 0; height: 34px; padding: 0; border: 0; outline: 0; opacity: 0; }
  .diy-mobile-search button { width: 0; height: 34px; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 19px; }
  .diy-mobile-search:focus-within,
  .diy-mobile-search.has-value {
    position: absolute;
    inset: 3px 5px;
    grid-template-columns: 36px minmax(0, 1fr) 32px;
    z-index: 5;
  }
  .diy-mobile-search:focus-within input,
  .diy-mobile-search.has-value input { width: 100%; padding: 0 4px; opacity: 1; }
  .diy-mobile-search:focus-within button,
  .diy-mobile-search.has-value button { width: 32px; }
  .diy-material-grid {
    grid-column: 2;
    grid-row: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 5px 5px max(72px, env(safe-area-inset-bottom));
    scroll-padding-bottom: max(72px, env(safe-area-inset-bottom));
    background: #fff;
  }
  .diy-material-card { height: 112px; min-height: 112px; grid-template-rows: 66px 16px 16px; gap: 2px; overflow: hidden; padding: 4px; }
  .diy-material-card strong { min-width: 0; font-size: 12px; line-height: 16px; }
  .diy-material-card > span:last-of-type { min-width: 0; gap: 2px; font-size: 9.5px; line-height: 16px; }
  .diy-material-card > span:last-of-type b,
  .diy-material-card > span:last-of-type em { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 520px) {
  .diy-stage-toolbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .diy-stage-metrics span:nth-child(3) { display: none; }
  .diy-stage-tools button[data-diy-action="reset"] { display: grid; }
  .diy-stage-plate { width: auto; height: 100%; }
  .diy-stage-logo strong { font-size: 24px; }
  .diy-stage-logo span { letter-spacing: 1px; }
  .diy-stage-actions button { white-space: normal; line-height: 1.15; }
}

@media (max-width: 900px) and (max-height: 720px) {
  .diy-stage-toolbar { min-height: 44px; }
}

@media (max-width: 360px) {
  .diy-group-button { min-width: 66px; padding-inline: 6px; font-size: 10.5px; }
  .diy-stage-actions > div { grid-template-columns: minmax(112px, 1.2fr) 58px 86px; }
}

/* Final V3 workspace: left material browser, fixed stage, right design details. */
.diy-desktop-primary { min-width: 0; display: flex; align-items: center; gap: 4px; }
.diy-primary-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 5px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-weight: 750;
  white-space: nowrap;
}
.diy-primary-button small { min-width: 22px; padding: 1px 5px; border-radius: 9px; background: #eef1f4; color: var(--muted); font-size: 11px; }
.diy-primary-button.active { border-bottom-color: var(--purple); background: var(--purple-soft); color: var(--purple); }
.diy-mobile-guide, .diy-mobile-actions, .diy-mobile-search-panel { display: none; }

.diy-stage-plate {
  border-radius: 0;
  background-image: var(--plate-image), radial-gradient(circle at 50% 50%, var(--plate-center) 0 55%, var(--plate-inner) 55% 59%, var(--plate-outer) 59% 63.5%, #f2f4f3 63.7% 100%);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.diy-stage-safe-clip {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  clip-path: circle(40% at 50% 50%);
}

.diy-placement-track {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  border: 18px solid rgba(52,120,212,.09);
  border-radius: 50%;
  outline: 2px dashed rgba(52,120,212,.58);
  outline-offset: -10px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.diy-stage-plate.is-dragging .diy-placement-track { display: block; }
.diy-drop-anchor {
  position: absolute;
  z-index: 14;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  display: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(29,143,102,.25), 0 3px 8px rgba(0,0,0,.24);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.diy-stage-plate.is-dragging .diy-drop-anchor { display: block; }
.diy-stage-plate.is-delete-target .diy-drop-anchor { background: var(--red); box-shadow: 0 0 0 3px rgba(196,73,73,.24), 0 3px 8px rgba(0,0,0,.24); }
.diy-bracelet-item.arriving { opacity: 0; }
.diy-bracelet-item.arrived { animation: diy-arrive-on-string .3s cubic-bezier(.2,.9,.25,1.2); }
@keyframes diy-arrive-on-string { from { opacity: .35; scale: .72; } to { opacity: 1; scale: 1; } }

.diy-bracelet-item.dragging {
  left: var(--drag-x);
  top: var(--drag-y);
  margin: 0 !important;
  z-index: 12;
  opacity: .96;
  transform: translate(-50%, -50%);
}

.diy-v3-design-panel { grid-area: design; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; background: #fff; }
.diy-v3-design-panel > header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.diy-v3-design-panel h2 { margin: 0; font-size: 17px; }
.diy-v3-design-panel p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.diy-v3-design-panel > header > b { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--green-soft); color: var(--green); }
.diy-design-list { min-height: 0; overflow-y: auto; padding: 5px; }
.diy-design-row { width: 100%; min-width: 0; display: grid; grid-template-columns: 25px 46px minmax(0,1fr) auto; gap: 7px; align-items: center; padding: 6px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.diy-design-row:hover, .diy-design-row.active { background: var(--blue-soft); }
.diy-design-row > span { width: 23px; height: 23px; display: grid; place-items: center; color: #fff; background: var(--green); font-size: 11px; font-weight: 800; }
.diy-design-row img { width: 46px; height: 46px; object-fit: contain; background: #f4f6f6; }
.diy-design-row div { min-width: 0; }
.diy-design-row strong, .diy-design-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diy-design-row small { margin-top: 2px; color: var(--muted); }
.diy-design-row > b { white-space: nowrap; }
.diy-design-empty { min-height: 170px; display: grid; place-content: center; gap: 4px; color: var(--muted); text-align: center; }
.diy-v3-design-panel > footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px; border-top: 1px solid var(--line); background: #f5f7f6; }
.diy-v3-design-panel > footer span { min-width: 0; }
.diy-v3-design-panel > footer small, .diy-v3-design-panel > footer strong { display: block; }
.diy-v3-design-panel > footer small { color: var(--muted); }
.diy-v3-design-panel > footer strong { margin-top: 2px; }

@media (min-width: 901px) {
  .diy-v3-shell { height: calc(100dvh - 58px); grid-template-rows: 46px minmax(0,1fr); }
  .diy-v3-studio-bar { padding: 4px 10px; }
  .diy-v3-workspace { grid-template-columns: 136px 286px minmax(430px,1fr) 276px; grid-template-areas: "taxonomy library stage design"; }
  .diy-v3-taxonomy { grid-template-rows: auto minmax(0,1fr); }
  .diy-group-list { display: none; }
  .diy-category-head { min-height: 44px; }
  .diy-category-button { min-height: 40px; }
  .diy-v3-library { grid-template-rows: auto auto minmax(0,1fr); }
  .diy-selected-panel { display: none; }
  .diy-library-head { min-height: 44px; padding-block: 5px; }
  .diy-library-head p { display: none; }
  .diy-material-search { min-height: 40px; margin: 5px 6px; }
  .diy-material-search input { height: 34px; }
  .diy-material-grid { gap: 5px; padding: 0 6px 10px; }
  .diy-material-card { grid-template-rows: 86px auto auto; padding: 5px; }
  .diy-material-photo { height: 86px; }
  .diy-material-photo img { width: 86px; height: 86px; }
  .diy-v3-stage-column { grid-template-rows: 46px minmax(0,1fr) auto 48px; }
  .diy-stage-toolbar { min-height: 46px; grid-template-columns: minmax(0,1fr) auto; padding: 4px 8px; }
  .diy-mobile-guide { display: none; }
  .diy-stage-metrics { justify-content: flex-start; }
  .diy-stage-metrics span { min-width: 132px; }
  .diy-stage-viewport { padding: 10px; }
  .diy-stage-plate { width: min(100%, 72vh); max-width: 760px; }
  .diy-stage-actions { min-height: 48px; justify-content: flex-end; padding: 4px 8px; }
  .diy-stage-actions .diy-desktop-actions { width: auto; display: flex; justify-content: flex-end; gap: 5px; }
  .diy-stage-actions button { min-height: 36px; white-space: nowrap; }
  .diy-mobile-actions { display: none !important; }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .diy-v3-workspace { grid-template-columns: 118px 236px minmax(370px,1fr) 240px; }
  .diy-primary-button { padding-inline: 7px; }
  .diy-v3-studio-summary span { display: none; }
}

@media (max-width: 900px) {
  .diy-v3-shell { height: calc(100dvh - 46px); min-height: 0; grid-template-rows: minmax(0,1fr); }
  .diy-v3-workspace {
    grid-template-columns: 86px minmax(0,1fr);
    grid-template-rows: calc(min(100vw, 480px) + 40px) 36px minmax(0,1fr);
  }
  .diy-v3-stage-column { grid-template-rows: 0 minmax(0,1fr) 0 40px; }
  .diy-stage-toolbar {
    position: absolute;
    z-index: 20;
    inset: 0 0 auto;
    min-height: 34px;
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    gap: 2px;
    padding: 1px 5px;
    border: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .diy-mobile-guide { min-height: 30px; display: inline-flex; padding: 1px 4px; border: 0; background: transparent; }
  .diy-mobile-guide b { width: 18px; height: 18px; }
  .diy-stage-metrics { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .diy-stage-metrics span { min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 3px; padding: 1px 4px; border: 0; border-left: 1px solid var(--line); background: transparent !important; }
  .diy-stage-metrics small { min-height: 0; display: inline; font-size: 9px; line-height: 1; white-space: nowrap; }
  .diy-stage-metrics strong { display: inline; margin: 0; font-size: 12px; line-height: 1; white-space: nowrap; }
  .diy-desktop-stage-tools { display: none; }
  .diy-stage-viewport { grid-row: 2; padding: 6px; background: #eef1f1; }
  .diy-stage-plate { width: 100%; height: auto; max-width: 480px; max-height: 100%; aspect-ratio: 1; box-shadow: 0 2px 10px rgba(32,41,45,.1); }
  .diy-stage-helper { display: none !important; }
  .diy-stage-actions { grid-row: 4; min-height: 40px; padding: 3px 4px; }
  .diy-desktop-actions { display: none !important; }
  .diy-stage-actions .diy-mobile-actions { width: 100%; min-width: 0; display: flex; align-items: stretch; gap: 3px; }
  .diy-mobile-actions button { min-width: 0; min-height: 34px; flex: 0 1 auto; padding: 3px 6px; font-size: 12px; line-height: 1; white-space: nowrap; }
  .diy-mobile-actions .diy-mobile-icon-action { width: 34px; flex: 0 0 34px; display: grid; place-items: center; padding: 0; font-size: 17px; }
  .diy-mobile-actions button[data-diy-action="clear"] { flex: .7 1 auto; }
  .diy-mobile-actions button[data-diy-action="remove"] { flex: 1 1 auto; }
  .diy-mobile-actions .diy-primary-action { flex: 1.35 1 auto; }
  .diy-group-list { grid-template-columns: repeat(5,minmax(0,1fr)); display: grid; gap: 0; padding: 0; overflow: hidden; }
  .diy-group-button { width: 100%; min-width: 0; min-height: 36px; padding: 2px; font-size: 12px; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .diy-group-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .diy-mobile-search-panel { display: none; }
  .mobile-search-open .diy-mobile-search-panel { position: absolute; z-index: 8; inset: 1px 3px; display: grid; grid-template-columns: 32px minmax(0,1fr) 32px; align-items: center; border: 1px solid var(--blue); background: #fff; }
  .diy-mobile-search-panel > span { display: grid; place-items: center; font-size: 18px; }
  .diy-mobile-search-panel input { min-width: 0; height: 32px; padding: 0 4px; border: 0; outline: 0; }
  .diy-mobile-search-panel button { height: 32px; border: 0; background: transparent; font-size: 18px; }
  .diy-category-list { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .diy-material-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4px; padding-bottom: max(8px, env(safe-area-inset-bottom)); scroll-padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .diy-material-card { height: 118px; min-height: 118px; grid-template-rows: 72px 18px 16px; gap: 2px; padding: 4px; }
  .diy-material-photo { height: 72px; }
  .diy-material-photo img { width: 72px; height: 72px; }
  .diy-material-card strong { font-size: 12px; line-height: 18px; }
  .diy-material-card > span:last-of-type { font-size: 9.5px; line-height: 16px; }
  .diy-v3-design-panel { display: none; }
}

@media (max-width: 520px) {
  .diy-v3-shell { height: calc(100dvh - 36px); }
}

@media (max-width: 360px) {
  .diy-group-button { min-width: 0; padding-inline: 1px; font-size: 12px; }
  .diy-mobile-actions button { padding-inline: 4px; }
  .diy-mobile-actions .diy-mobile-icon-action { width: 31px; flex-basis: 31px; }
}

/* Desktop workspace lock: fixed side regions, stable stage, independent scrolling. */
@media (min-width: 901px) {
  .diy-v3-shell {
    --diy-taxonomy-width: clamp(112px, 9.4vw, 136px);
    --diy-library-width: clamp(230px, 18.8vw, 286px);
    --diy-design-width: clamp(240px, 19vw, 288px);
    width: 100%;
    max-width: 1600px;
    margin-inline: auto;
    overflow: hidden;
  }

  .diy-v3-workspace {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(118px, 9.5fr) minmax(236px, 19.5fr) minmax(300px, 52fr) minmax(240px, 19fr);
    grid-template-areas: "taxonomy library stage design";
    align-items: stretch;
    overflow: hidden;
  }

  .diy-v3-taxonomy,
  .diy-v3-library,
  .diy-v3-stage-column,
  .diy-v3-design-panel {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .diy-category-list,
  .diy-material-grid,
  .diy-design-list { overscroll-behavior: contain; }

  .diy-stage-viewport {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    container-type: size;
    contain: layout paint;
  }

  .diy-v3-stage-column > .diy-stage-toolbar,
  .diy-v3-stage-column > .diy-stage-helper,
  .diy-v3-stage-column > .diy-stage-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .diy-stage-plate {
    width: min(760px, calc(100% - 20px), calc(100dvh - 190px));
    max-width: none;
    max-height: none;
    flex: 0 0 auto;
    contain: layout paint;
  }

  @supports (width: 1cqw) {
    .diy-stage-plate { width: min(760px, calc(100cqw - 20px), calc(100cqh - 20px)); }
  }
}

@media (min-width: 901px) and (max-width: 1279px) {
  .diy-stage-metrics span { min-width: 102px; }
}

@media (min-width: 901px) and (max-width: 1050px) {
  .diy-stage-metrics { min-width: 0; display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 3px; }
  .diy-stage-metrics span { min-width: 0; padding-inline: 5px; }
  .diy-desktop-stage-tools { display: none; }
  .diy-stage-actions .diy-desktop-actions { width: 100%; display: grid; grid-template-columns: 1fr .7fr 1.15fr 1fr; gap: 3px; }
  .diy-stage-actions .diy-desktop-actions button { min-width: 0; min-height: 34px; padding: 4px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
}
