:root {
  color-scheme: light;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  --ctw-blue: #0878f9;
  --ctw-blue-deep: #0069e8;
  --ctw-purple: #5b4ff2;
  --ctw-line: #d9dee6;
  --ctw-muted: #7c8490;
  --ctw-text: #111318;
  --ctw-stage: #f0f1f3;
}

@font-face {
  font-family: "CraftyWand Renderer Icons";
  src: url("/craftywand-dieline-generator-assets/vendor/ctw-renderer-icons.woff2") format("woff2");
  font-display: block;
}

@font-face {
  font-family: "CraftyWand Editor Icons";
  src: url("/craftywand-dieline-generator-assets/vendor/ctw-editor-icons.woff2") format("woff2");
  font-display: block;
}

@font-face {
  font-family: "CraftyWand Sites Icons";
  src: url("/craftywand-dieline-generator-assets/vendor/ctw-sites-icons.woff2") format("woff2");
  font-display: block;
}

.ctw-source-icon {
  display: inline-grid;
  width: 1em;
  height: 1em;
  place-items: center;
  flex: 0 0 auto;
  font-size: 21px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  speak: never;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ctw-source-icon--renderer { font-family: "CraftyWand Renderer Icons"; }
.ctw-source-icon--editor { font-family: "CraftyWand Editor Icons"; }
.ctw-source-icon--sites { font-family: "CraftyWand Sites Icons"; }

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 1080px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ctw-stage);
  color: var(--ctw-text);
}

button,
input { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(8, 120, 249, .28);
  outline-offset: 2px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctw-dg-app {
  --ctw-preview-size: 272px;
  height: 100vh;
  display: grid;
  grid-template-rows: 86px minmax(0, 1fr);
}

.ctw-beta-banner {
  z-index: 35;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  background: linear-gradient(90deg, var(--ctw-purple) 0%, #6857f7 48%, var(--ctw-blue) 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(35, 24, 113, .12);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .005em;
  text-align: center;
}

.ctw-beta-banner__badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.ctw-dg-header {
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 20px;
  border-bottom: 1px solid #e6e8ec;
  background: #fff;
}

.ctw-dg-brand,
.ctw-dg-header-actions {
  display: flex;
  align-items: center;
}

.ctw-dg-brand { gap: 14px; }

.ctw-dg-brand > img {
  width: 158px;
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.ctw-dg-brand > strong {
  font-size: 19px;
  font-weight: 650;
  white-space: nowrap;
}

.ctw-dg-module-chip,
.ctw-local-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eaf4ff;
  color: #006bdc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.ctw-icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.ctw-icon-button:hover { background: #f2f4f7; }

.ctw-dg-header-actions { gap: 16px; }

/* Cloud save indicator. Each customer change is saved to the cloud, so the
   header shows a cloud that lifts an upload arrow while the save is in flight
   and settles into a check when the revision lands. */
.ctw-box-sync-status {
  display: inline-flex;
  max-width: 190px;
  align-items: center;
  color: #596273;
  font-size: 11px;
  font-weight: 650;
  gap: 6px;
  white-space: nowrap;
}

.ctw-box-sync-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctw-box-sync-cloud {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.ctw-box-sync-cloud-arrow,
.ctw-box-sync-cloud-check { opacity: 0; }

/* Pending/saving: the cloud breathes and the arrow rises out of it. */
.ctw-box-sync-status[data-state="pending"] .ctw-box-sync-cloud-arrow,
.ctw-box-sync-status[data-state="saving"] .ctw-box-sync-cloud-arrow { opacity: 1; }

.ctw-box-sync-status[data-state="saving"] .ctw-box-sync-cloud-body {
  animation: ctw-cloud-breathe 1.4s ease-in-out infinite;
}

.ctw-box-sync-status[data-state="saving"] .ctw-box-sync-cloud-arrow {
  animation: ctw-cloud-upload 1.4s ease-in-out infinite;
}

/* Saved: the check draws itself once, then stays. */
.ctw-box-sync-status[data-state="saved"] .ctw-box-sync-cloud-check {
  opacity: 1;
  stroke-dasharray: 12;
  animation: ctw-cloud-check 0.42s ease-out both;
}

.ctw-box-sync-status[data-state="pending"] { color: #596273; }
.ctw-box-sync-status[data-state="saving"] { color: #0878f9; }
.ctw-box-sync-status[data-state="saved"] { color: #16843b; }
.ctw-box-sync-status[data-state="error"],
.ctw-box-sync-status[data-state="conflict"] { color: #b42318; }

@keyframes ctw-cloud-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes ctw-cloud-upload {
  0% { opacity: 0; transform: translateY(2.5px); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-3px); }
}

@keyframes ctw-cloud-check {
  from { stroke-dashoffset: 12; }
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ctw-box-sync-status[data-state="saving"] .ctw-box-sync-cloud-body,
  .ctw-box-sync-status[data-state="saving"] .ctw-box-sync-cloud-arrow,
  .ctw-box-sync-status[data-state="saved"] .ctw-box-sync-cloud-check {
    animation: none;
  }
}

.ctw-design-button,
.ctw-download-button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.ctw-design-button {
  border: 1px solid #20242a;
  background: #fff;
}

.ctw-download-button {
  border: 1px solid var(--ctw-blue);
  background: var(--ctw-blue);
  color: #fff;
  box-shadow: 0 5px 14px rgba(8, 120, 249, .18);
}

.ctw-download-button:hover { background: var(--ctw-blue-deep); }

/* The download control is a plain CraftyWand button with no icon at all: the
   glyph it used to carry came from the module's own icon font, which nothing
   else in the site header uses, so it read as a foreign control. */
.ctw-upgrade-card .ctw-source-icon { font-size: 12px; }

.ctw-design-button .ctw-source-icon {
  margin-left: 3px;
  font-size: 14px;
}

.ctw-dg-workspace {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 82px 240px minmax(520px, 1fr);
  gap: 0;
}

.ctw-dg-rail {
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 19px 10px 16px;
  border-right: 1px solid #e7e9ed;
  background: #fff;
  box-shadow: 4px 0 18px rgba(25, 35, 48, .035);
}

.ctw-dg-rail > button {
  display: grid;
  width: 64px;
  min-height: 72px;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 7px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.ctw-dg-rail > button:hover { background: #f6f8fa; }

.ctw-dg-rail > button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.ctw-dg-rail > button:disabled:hover { background: transparent; }

.ctw-dg-rail > button.is-active { color: var(--ctw-blue); }

.ctw-dg-rail > button .ctw-source-icon { font-size: 23px; }

.ctw-dg-rail > button:nth-of-type(4) {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #e2e5e9;
  border-radius: 0;
}

.ctw-rail-info {
  display: grid;
  width: 24px;
  height: 24px;
  margin-top: auto;
  place-items: center;
  border: 2px solid #0d1117;
  border-radius: 50%;
  color: #0d1117;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.ctw-control-panel {
  z-index: 15;
  min-height: 0;
  overflow: auto;
  padding: 22px 13px 28px;
  border-right: 1px solid #e2e5e9;
  background: #fff;
  box-shadow: 4px 0 18px rgba(25, 35, 48, .025);
  scrollbar-width: thin;
}

.ctw-panel-section[hidden] { display: none !important; }

.ctw-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ctw-panel-title-row h2,
.ctw-panel-section > h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.ctw-help {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #737b85;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: help;
  vertical-align: 2px;
}

.ctw-unit-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid #d8dce2;
  border-radius: 9px;
}

.ctw-unit-toggle button {
  width: 37px;
  height: 25px;
  padding: 0;
  border: 0;
  background: #f5f6f8;
  color: #9aa0a9;
  font-size: 12px;
  cursor: pointer;
}

.ctw-unit-toggle button.is-active {
  background: #e8f3ff;
  color: var(--ctw-blue);
}

.ctw-size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 8px;
  margin-top: 19px;
}

.ctw-size-grid label:last-child { grid-column: 1; }

.ctw-size-grid label > span,
.ctw-advanced-grid label > span {
  display: block;
  margin: 0 0 8px 4px;
  font-size: 12px;
}

.ctw-size-grid label > span {
  color: #111318;
  font-weight: 700;
}

.ctw-advanced-grid label > span { color: #7e858f; }

.ctw-size-grid label > div {
  position: relative;
}

.ctw-size-grid input,
.ctw-stepper input,
.ctw-advanced-grid input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #cfd4db;
  border-radius: 9px;
  background: #fff;
  color: #20242a;
  font-size: 13px;
}

.ctw-size-grid input {
  padding: 0 28px 0 10px;
}

.ctw-size-grid b {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: #505762;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.ctw-spaced-title { margin-top: 26px; }

.ctw-material-select { position: relative; margin-top: 12px; }

#material-button {
  display: grid;
  width: 100%;
  min-height: 40px;
  grid-template-columns: 20px 1fr 20px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #cfd4db;
  border-radius: 9px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

#material-button i,
.ctw-material-option i {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  background: var(--swatch, #caa46f) var(--texture, none) center/cover;
}

#material-button span {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#material-button > .ctw-source-icon {
  margin-left: auto;
  font-size: 14px;
  color: #4e5560;
}

#material-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  left: 0;
  width: 210px;
  padding: 6px;
  border: 1px solid #d8dce2;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(22, 32, 45, .16);
}

#material-menu[hidden] { display: none; }

.ctw-material-option {
  display: grid;
  width: 100%;
  grid-template-columns: 22px 1fr 16px;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.ctw-material-category-list {
  display: grid;
  gap: 2px;
}

.ctw-material-category {
  display: grid;
  width: 100%;
  min-height: 42px;
  grid-template-columns: 1fr 18px;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #222b35;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ctw-material-category .ctw-source-icon {
  color: #737b86;
  font-size: 13px;
  transform: rotate(-90deg);
}

.ctw-material-category.is-active { background: #f0f1f3; }
.ctw-material-category.has-selection { color: #111923; font-weight: 650; }

.ctw-material-submenu {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  width: 276px;
  max-height: 300px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid #d8dce2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(22, 32, 45, .16);
}

.ctw-material-option .ctw-source-icon {
  margin-left: auto;
  color: var(--ctw-blue);
  font-size: 14px;
}

.ctw-material-option:hover,
.ctw-material-option.is-active { background: #edf5ff; }

.ctw-field-heading {
  margin: 24px 0 2px;
  font-size: 15px;
  font-weight: 650;
}

.ctw-field-range {
  margin: 0 0 10px;
  color: #8a919b;
  font-size: 12px;
}

.ctw-stepper {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 0;
  padding: 4px;
  border: 1px solid #cfd4db;
  border-radius: 9px;
}

.ctw-stepper button {
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: #eef0f3;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.ctw-stepper input {
  height: 30px;
  padding: 0 5px;
  border: 0;
  text-align: center;
}

.ctw-size-mode-title { margin-top: 25px; }

.ctw-size-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.ctw-size-modes button {
  min-height: 54px;
  padding: 5px 7px;
  border: 1px solid #cfd4db;
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  line-height: 1.15;
  cursor: pointer;
}

.ctw-size-modes button.is-active {
  border: 2px solid var(--ctw-blue);
  color: #18212c;
}

.ctw-upgrade-card {
  margin-bottom: 21px;
  padding: 12px 10px;
  border: 1px solid #7ab8ff;
  border-radius: 8px;
  background: #edf5ff;
}

.ctw-upgrade-card[hidden] { display: none; }

.ctw-upgrade-card p {
  margin: 0 0 9px;
  color: #4c5663;
  font-size: 13px;
  line-height: 1.45;
}

.ctw-upgrade-card button {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--ctw-blue);
  border-radius: 7px;
  background: #fff;
  color: #006fe9;
  font-size: 12px;
  cursor: pointer;
}

.ctw-upgrade-card button span { color: #ffbe0b; }

.ctw-advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 8px;
  margin-top: 18px;
}

.ctw-advanced-grid input {
  padding: 0 8px;
  background: #fafafa;
}

.ctw-advanced-grid input:disabled {
  border-color: #ebedf0;
  color: #a9afb7;
}

.ctw-advanced-grid label > div { position: relative; }

.ctw-advanced-grid label b {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #a2a8af;
  font-size: 10px;
  font-weight: 500;
  pointer-events: none;
}

.ctw-panel-copy {
  color: #6c7480;
  font-size: 12px;
  line-height: 1.55;
}

.ctw-model-card {
  display: grid;
  width: 100%;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
  padding: 8px;
  border: 2px solid var(--ctw-blue);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.ctw-model-card img {
  width: 54px;
  height: 48px;
  border-radius: 7px;
  object-fit: cover;
}

.ctw-model-card strong,
.ctw-model-card small { display: block; }

.ctw-model-card strong { font-size: 12px; }
.ctw-model-card small { margin-top: 4px; color: #7c8490; font-size: 10px; }

.ctw-contract-list {
  display: grid;
  gap: 0;
  margin: 16px 0;
  border: 1px solid #e2e5e9;
  border-radius: 10px;
}

.ctw-contract-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #e8ebef;
  font-size: 12px;
}

.ctw-contract-list div:last-child { border: 0; }
.ctw-contract-list dt { color: #7c8490; }
.ctw-contract-list dd { margin: 0; font-weight: 650; }

.ctw-wide-button {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 1px solid #cfd4db;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.ctw-dieline-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ctw-stage);
}

.ctw-stage-information {
  position: absolute;
  z-index: 5;
  top: 28px;
  left: 24px;
  pointer-events: none;
}

.ctw-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 9px;
  font-size: 12px;
}

.ctw-legend span { display: flex; align-items: center; gap: 5px; }
.ctw-legend i { display: inline-block; width: 28px; height: 0; border-top: 2px solid; }
.ctw-legend .bleed { border-color: #20ba27; border-top-style: dashed; }
.ctw-legend .trim { border-color: #171bd8; }
.ctw-legend .crease { border-color: #f12c31; border-top-style: solid; }

.ctw-dimension-summary p {
  margin: 0 0 8px;
  font-size: 11px;
}

.ctw-dimension-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 650;
}

.ctw-dieline-viewport {
  position: absolute;
  inset: 0 calc(var(--ctw-preview-size) + 26px) 0 0;
  overflow: visible;
  cursor: grab;
  touch-action: none;
}

.ctw-dieline-viewport.is-panning { cursor: grabbing; }

.ctw-dieline-canvas {
  position: absolute;
  inset: 178px 0 76px 18px;
  transform-origin: 50% 50%;
  transition: opacity .18s ease;
}

.ctw-dieline-canvas > p {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #76808b;
  font-size: 13px;
}

.ctw-dieline-canvas.is-loading { opacity: .55; }

.ctw-dieline-canvas > svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ctw-dieline-canvas .dieline-measurement-dimensions text {
  fill: #0878f9;
  stroke: #fff;
  stroke-width: 2.4px;
  stroke-linejoin: round;
  paint-order: stroke fill;
  font-weight: 400;
}

.ctw-dieline-canvas .dieline-measurement-overlay { filter: none !important; }

.ctw-watermark-layer { pointer-events: none; }

.ctw-canvas-toolbar {
  position: absolute;
  z-index: 8;
  bottom: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid #e3e6eb;
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 7px 24px rgba(23, 32, 44, .08);
}

.ctw-canvas-toolbar button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.ctw-canvas-toolbar button.is-active { background: #edf1f5; }
.ctw-canvas-toolbar button:hover { background: #f0f3f6; }
.ctw-canvas-toolbar .ctw-source-icon { font-size: 18px; }
.ctw-canvas-toolbar > i { width: 1px; height: 25px; margin: 0 5px; background: #dce0e5; }

/* The canvas no longer carries a build/runtime marker. It printed the local
   dev port ("CraftyWand native engine - runtime :3398") onto a customer-facing
   page, which would have shipped to production verbatim. */

.ctw-output-panel {
  position: absolute;
  z-index: 24;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--ctw-preview-size);
  min-height: 0;
  overflow: auto;
  padding: 20px 14px;
  background: #f6f6f7;
}

.ctw-preview-card,
.ctw-format-card {
  overflow: hidden;
  border: 1px solid #e1e4e8;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(26, 36, 49, .07);
}

.ctw-preview-card {
  position: relative;
  height: calc(var(--ctw-preview-size) - 28px);
  background: linear-gradient(#e8eaed, #d9dcdf);
}

.ctw-preview-card > #open-3d {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  width: 35px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.ctw-preview-card iframe {
  width: 100%;
  height: calc(100% - 45px);
  border: 0;
  background: transparent;
}

/* Small update spinner. The customer stays on the model they are looking at
   while a change is applied — this is deliberately not the Studio's full-page
   loading animation, which is what a whole boot would show. */
.ctw-preview-card.is-updating::after {
  position: absolute;
  z-index: 4;
  top: 11px;
  left: 11px;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(8, 120, 249, .25);
  border-top-color: #0878f9;
  border-radius: 50%;
  animation: ctw-preview-spin .7s linear infinite;
  content: "";
}

@keyframes ctw-preview-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ctw-preview-card.is-updating::after { animation-duration: 2.4s; }
}

.ctw-fold-control {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 42px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 0 10px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .95);
  font-size: 12px;
}

.ctw-fold-control input { width: 100%; accent-color: #111; }
.ctw-fold-control span:last-child { color: #a4a8ae; }

.ctw-preview-resize-handle {
  appearance: none;
  position: absolute;
  z-index: 6;
  bottom: 0;
  left: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0 10px 0 15px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .76) 0 2px, rgba(255, 255, 255, 0) 2px 6px),
    linear-gradient(45deg, #bfc3cc 0 50%, transparent 50%);
  cursor: nwse-resize;
  touch-action: none;
}

.ctw-preview-resize-handle::after {
  content: "Drag to resize window";
  position: absolute;
  right: calc(100% + 10px);
  bottom: 0;
  padding: 6px 8px;
  border-radius: 4px;
  background: #111;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  font: 600 11px/1 "Segoe UI", Inter, sans-serif;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(2px);
  pointer-events: none;
  transition: opacity .12s, transform .12s;
}

.ctw-preview-resize-handle:hover::after,
.ctw-preview-resize-handle:focus-visible::after,
.ctw-preview-card.is-resizing .ctw-preview-resize-handle::after {
  opacity: 1;
  transform: translateY(0);
}

.ctw-format-card {
  margin-top: 18px;
  padding: 18px 14px;
}

.ctw-format-card h2 {
  margin: 0 0 15px;
  font-size: 16px;
  font-weight: 500;
}

.ctw-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ctw-format-grid button {
  display: flex;
  min-width: 0;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid #cfd4db;
  border-radius: 9px;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}

.ctw-format-grid button.is-active {
  border: 2px solid var(--ctw-blue);
  background: #f9fcff;
}

.ctw-format-grid img { width: 21px; height: 21px; object-fit: contain; }

.ctw-format-card h3 {
  margin: 23px 0 10px;
  font-size: 14px;
  font-weight: 500;
}

.ctw-format-card ul {
  margin: 0;
  padding-left: 18px;
  color: #6d7480;
  font-size: 11px;
  line-height: 1.45;
}

.ctw-format-card li { margin-bottom: 9px; }

.ctw-watermark-notice {
  margin: 10px 0 0;
  padding: 8px;
  border-radius: 7px;
  background: #fff8e4;
  color: #7a5b05;
  font-size: 10px;
  line-height: 1.4;
}

.ctw-watermark-notice.is-premium {
  background: #eaf8ee;
  color: #25713c;
}

.ctw-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
}

.ctw-modal[hidden] { display: none; }

.ctw-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 24, 39, .55);
}

.ctw-modal > section {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 48px));
  max-height: 80vh;
  overflow: auto;
  padding: 25px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}

.ctw-modal > section h2 { margin: 0 0 20px; }

.ctw-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f5;
  font-size: 20px;
  cursor: pointer;
}

.ctw-model-browser-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.ctw-model-catalog-modal {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: grid;
  place-items: center;
}

.ctw-model-catalog-modal[hidden] { display: none; }

.ctw-model-catalog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 24, 39, .58);
}

.ctw-model-catalog-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1080px, calc(100vw - 40px));
  height: min(780px, calc(100vh - 52px));
  overflow: hidden;
  border-radius: 18px;
  background: #f5f6f8;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .3);
}

.ctw-model-catalog-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px);
  gap: 28px;
  align-items: center;
  padding: 22px 62px 18px 24px;
  border-bottom: 1px solid #e0e3e8;
  background: #fff;
}

.ctw-model-catalog-header h2 { margin: 5px 0 2px; font-size: 22px; }
.ctw-model-catalog-header p { margin: 0; color: #717986; font-size: 12px; }

.ctw-model-catalog-search {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d9dde3;
  border-radius: 10px;
  background: #f8f9fa;
  color: #657080;
}

.ctw-model-catalog-search input {
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #17202b;
  font: inherit;
}

.ctw-model-catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 236px;
  gap: 16px;
  align-content: start;
  overflow: auto;
  padding: 22px 24px;
}

.ctw-model-catalog-card {
  min-width: 0;
  min-height: 236px;
  overflow: hidden;
  padding: 0;
  border: 1px solid #e0e3e8;
  border-radius: 13px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ctw-model-catalog-card:hover,
.ctw-model-catalog-card:focus-visible {
  border-color: #0878f9;
  outline: 0;
  box-shadow: 0 8px 22px rgba(8, 120, 249, .14);
  transform: translateY(-1px);
}

.ctw-model-catalog-thumb {
  display: block;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(145deg, #f8f9fa, #e9ebee);
}

.ctw-model-catalog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ctw-model-catalog-card > strong,
.ctw-model-catalog-card > small,
.ctw-model-catalog-card > em { display: block; margin-right: 13px; margin-left: 13px; }
.ctw-model-catalog-card > strong { margin-top: 11px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ctw-model-catalog-card > small { min-height: 28px; margin-top: 4px; color: #747d89; font-size: 10px; line-height: 1.35; }
.ctw-model-catalog-card > em { width: max-content; margin-top: 8px; margin-bottom: 12px; padding: 4px 7px; border-radius: 999px; background: #eaf4ff; color: #0878f9; font-size: 9px; font-style: normal; font-weight: 700; }

.ctw-model-catalog-empty {
  grid-column: 1 / -1;
  margin: 70px 0;
  color: #747d89;
  text-align: center;
}

.ctw-model-catalog-footer {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  gap: 18px;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid #e0e3e8;
  background: #fff;
}

.ctw-model-catalog-footer span { color: #69727f; font-size: 11px; text-align: center; }
.ctw-model-catalog-footer button { height: 36px; border: 1px solid #d9dde3; border-radius: 8px; background: #fff; color: #25303d; cursor: pointer; }
.ctw-model-catalog-footer button:disabled { opacity: .45; cursor: default; }

.ctw-material-guide-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid #e4e7eb;
}

.ctw-material-guide-row img {
  width: 100px;
  height: 72px;
  border-radius: 9px;
  object-fit: cover;
}

.ctw-material-guide-row h3 { margin: 0 0 5px; font-size: 14px; }
.ctw-material-guide-row p { margin: 0; color: #6d7480; font-size: 12px; line-height: 1.45; }

.ctw-toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: 28px;
  padding: 10px 15px;
  transform: translateX(-50%);
  border-radius: 9px;
  background: #17202b;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}

.ctw-toast[hidden] { display: none; }

/* Account chrome and the sign-in prompt.
   ---------------------------------------------------------------------------
   `account-app.js` is the SAME component the 3D Studio and the 2D editor mount,
   and it renders the branded sign-in artwork — `cw-account-visual`,
   `cw-account-logo` and `cw-account-showcase`. This stylesheet previously
   styled NONE of those three selectors, so on the generator the sign-in prompt
   rendered that art markup completely unstyled while every other CraftyWand
   surface showed the branded modal. The account rules below are therefore
   copied verbatim from the Studio shell (`runtime/template.html`) so the
   generator's sign-in is the site's sign-in, not a look-alike.
   If the Studio shell's account styling changes, change it here too. */
.cw-account-root { display: flex; align-items: center; }
.cw-account-shell { display: flex; align-items: center; }
.cw-account-pill {
  min-height: 42px; max-width: 184px; padding: 6px 13px;
  display: flex; align-items: center; gap: 8px;
  background: #fff; color: #111; border: 1px solid rgba(0,0,0,0.1);
  border-radius: 999px; font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.cw-account-pill:disabled { opacity: 0.6; cursor: wait; }
.cw-account-pill--signed-in { cursor: default; padding: 5px 6px 5px 8px; }
.cw-account-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #111827; color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto;
}
.cw-account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92px; }
.cw-account-plan {
  border-radius: 999px; background: rgba(15, 23, 42, 0.08); color: #111827;
  padding: 3px 7px; font-size: 11px; line-height: 1; font-weight: 700;
}
.cw-account-plan--premium { background: #111827; color: #fff; }
.cw-account-upgrade {
  border: 0; border-radius: 999px; padding: 6px 11px; background: #6655f6;
  color: #fff; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.cw-account-upgrade:hover { background: #5146e5; }
.cw-account-signout {
  border: none; border-radius: 999px; background: rgba(15, 23, 42, 0.08); color: #111;
  padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer;
}
.cw-account-signout:hover { background: rgba(15, 23, 42, 0.14); }
.cw-account-backdrop {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 24px; background: rgba(15, 23, 42, 0.42); backdrop-filter: blur(8px);
}
.cw-account-modal {
  width: min(760px, calc(100vw - 32px)); background: #fff; border-radius: 12px;
  box-shadow: 0 28px 80px rgba(0,0,0,0.24); overflow: hidden;
}
.cw-account-visual {
  min-height: 252px; padding: 24px 26px 28px; display: grid; gap: 12px;
  box-sizing: border-box; text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(109, 61, 240, 0.11), transparent 58%),
    linear-gradient(180deg, #f7f5ff 0%, #fff 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.cw-account-visual > p { margin: 0; color: #5146e5; font-size: 13px; font-weight: 800; letter-spacing: 0.01em; }
.cw-account-logo { width: 230px; max-width: 54vw; height: 72px; margin: 0 auto; display: block; object-fit: contain; }
.cw-account-showcase { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.cw-account-showcase span {
  height: 96px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fff; border: 1.5px solid #6655f6;
  border-radius: 11px; box-shadow: 0 8px 20px rgba(79, 70, 229, 0.08);
}
.cw-account-showcase img { width: 100%; height: 100%; display: block; object-fit: contain; }
.cw-account-modal-head {
  height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.cw-account-modal-head h2 { margin: 0; font-size: 19px; line-height: 1.2; }
.cw-account-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff; color: #111; font: inherit; cursor: pointer;
}
.cw-account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 12px 16px 0; }
.cw-account-tabs button {
  border: 1px solid rgba(15, 23, 42, 0.1); border-radius: 8px; background: #fff;
  padding: 9px 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.cw-account-tabs button.is-active { background: #111827; color: #fff; border-color: #111827; }
.cw-account-form { padding: 16px; display: grid; gap: 12px; }
.cw-account-field { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: #334155; }
.cw-account-field input {
  width: 100%; box-sizing: border-box; border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px; padding: 10px 11px; font: inherit; color: #111; background: #fff;
}
.cw-account-field input:focus { outline: 2px solid rgba(139, 92, 246, 0.26); border-color: #8b5cf6; }
.cw-account-message { margin: 0; color: #b91c1c; font-size: 13px; line-height: 1.35; }
.cw-account-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.cw-account-actions button { border-radius: 999px; padding: 9px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.cw-account-secondary { background: #fff; color: #111; border: 1px solid rgba(15, 23, 42, 0.12); }
.cw-account-primary { background: #8b5cf6; color: #fff; border: 1px solid #8b5cf6; }
.cw-account-actions button:disabled { opacity: 0.6; cursor: wait; }

/* The paid-entitlement prompt is this module's own and keeps its own styling.
   It no longer shares declarations with the account rules above, so the
   sign-in modal can follow the site without dragging this dialog with it. */
.cw-entitlement-modal { position: fixed; z-index: 200; inset: 0; }
.cw-entitlement-dialog {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 40px));
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
.cw-entitlement-close { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.cw-entitlement-actions button { min-height: 38px; padding: 0 14px; border: 1px solid #0878f9; border-radius: 8px; cursor: pointer; }
.cw-entitlement-primary { background: #0878f9; color: #fff; }
.cw-entitlement-secondary { background: #fff; color: #0878f9; }
.cw-entitlement-modal[hidden] { display: none; }
.cw-entitlement-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .6); }
.cw-entitlement-visual { display: none; }
.cw-entitlement-kicker { color: #0878f9; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.cw-entitlement-content h2 { margin: 0 0 10px; }
.cw-entitlement-content > p { color: #606975; }
.cw-entitlement-actions { display: flex; gap: 8px; margin-top: 20px; }

@media (max-width: 1260px) {
  .ctw-dg-app { --ctw-preview-size: 244px; }
  .ctw-dg-workspace { grid-template-columns: 74px 220px minmax(480px, 1fr); }
  .ctw-dg-header-actions { gap: 8px; }
  .ctw-dg-module-chip { display: none; }
  .ctw-output-panel { padding-right: 9px; padding-left: 9px; }
  .ctw-model-catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .ctw-model-catalog-header { grid-template-columns: 1fr; gap: 12px; }
  .ctw-model-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 760px) {
  .ctw-dg-app { grid-template-rows: 68px minmax(0, 1fr); }
  .ctw-beta-banner { gap: 8px; padding: 0 18px; font-size: 12px; }
  .ctw-beta-banner__badge { min-height: 21px; padding: 0 7px; font-size: 10px; }
  .ctw-dg-rail { padding-top: 8px; }
  .ctw-dg-rail > button { min-height: 62px; }
  .ctw-preview-card iframe { height: calc(100% - 42px); }
  .ctw-format-card { margin-top: 10px; padding-top: 13px; }
  .ctw-format-card h3 { margin-top: 14px; }
}

/* Custom size is offered only where the derived box type proves every axis
   drives the envelope. The notice explains a disabled Custom size block. */
.ctw-custom-size-notice {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff8e6;
  color: #7a5b17;
  font-size: 12px;
  line-height: 1.45;
}

/* Model-library cards show the catalogue's own flat + rendered dieline
   thumbnails, matching the public Dieline Generator library. */
.ctw-model-catalog-thumb--pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #f4f6f9;
}
.ctw-model-catalog-thumb--pair img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ctw-model-catalog-card.is-pending {
  opacity: .55;
  cursor: not-allowed;
}

/* Generator display options do not mutate physical knife geometry. */
.ctw-canvas-view { position: relative; font-size: 12px; }
.ctw-canvas-view summary { cursor: pointer; padding: 10px; list-style: none; }
.ctw-canvas-view > div { position: absolute; bottom: 48px; right: 0; width: 220px; background: white; padding: 14px; border: 1px solid #dce0e5; border-radius: 12px; box-shadow: 0 5px 18px #0002; }
.ctw-canvas-view label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.ctw-canvas-view input[type=color] { width: 38px; height: 26px; border: 0; padding: 0; }
