/* Index page specific CSS variables (base.html already includes common variables) */
:root {
  --gradient-success: linear-gradient(135deg,
      var(--primary-color) 0%,
      var(--primary-dark) 100%);
}

/* Index page specific body styles (base.html handles common styles) */
body {
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.01em;
  position: relative;
}

html,
body {
  height: 100%;
}






.token-badge {
  white-space: nowrap;
}

@media (max-width: 991.98px) {


  .token-badge {
    margin-top: 1rem;
    text-align: center;
    justify-content: center;
  }

  header {
    background: rgba(255, 255, 255, 0.95) !important;
  }
}

@media (max-width: 768px) {
  [data-bs-theme="dark"] header {
    background: rgba(33, 37, 41, 0.95) !important;
  }
}

/* Dimension controls styling */
#dimension-row .form-label.small {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--gray-700);
}

/* Compact selected-thread swatches in Step 3 */
#step-3 #color-swatches {
  margin-bottom: 0.2rem !important;
}


#step-3 .selected-thread-colors-grid {
  row-gap: 0.35rem !important;
  column-gap: 0.35rem !important;
}

#step-3 .compact-color-card {
  min-height: 0;
  border-width: 2px;
  border-radius: 9px;
}

#step-3 .compact-color-card .color-preview {
  height: 34px;
  min-height: 34px;
  border-radius: 7px;
}

#step-3 .compact-color-card .btn-close {
  width: 12px;
  height: 12px;
  font-size: 7px;
  border-width: 1px;
}

@media (max-width: 767.98px) {
  #step-3 .compact-color-card .color-preview {
    height: 30px;
    min-height: 30px;
  }
}

/* Step 3 bottom options: compact layout */
#step-3 #dimension-row {
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#step-3 #dimension-row .form-label.fw-semibold {
  font-size: 0.9rem;
}

#step-3 .dimension-single-line {
  gap: 16px;
}

#step-3 .dimension-inline-title {
  white-space: nowrap;
  margin-right: 4px;
}

#step-3 .dimension-input-group {
  width: auto;
  flex: 0 0 auto;
}

#step-3 .dimension-unit-wrap {
  flex: 0 0 auto;
}

#step-3 #unit-select {
  width: auto;
  min-width: 3.2rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}

#step-3 #dimension-row .input-group .btn,
#step-3 #dimension-row .input-group .form-control,
#step-3 #dimension-row .input-group-text,
#step-3 #dimension-row .form-select {
  min-height: 30px;
}

#step-3 .dimension-inline-row .input-group-text {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
}

#step-3 #width-input,
#step-3 #height-input {
  min-height: 26px;
  height: 26px;
  min-width: 4.2rem;
  max-width: 4.2rem;
  flex: 0 0 4.2rem;
}

#step-3 .dimension-inline-row .input-group .btn {
  min-height: 26px;
  height: 26px;
  padding: 0.1rem 0.32rem;
}

/* Compact vertical up/down stepper on the side of each size input */
#step-3 .dimension-stepper {
  display: flex;
  flex-direction: column;
  width: 1.55rem;
  height: 26px;
  margin-left: -1px;
  border: 1px solid var(--bs-border-color, #ced4da);
  border-top-right-radius: 0.2rem;
  border-bottom-right-radius: 0.2rem;
  overflow: hidden;
}

#step-3 .dimension-stepper-btn {
  flex: 1 1 0;
  min-height: 0;
  border: 0;
  padding: 0;
  background: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-secondary-color, #6c757d);
  font-size: 0.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#step-3 .dimension-stepper-btn:first-child {
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

#step-3 .dimension-stepper-btn:hover {
  background: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-body-color, #212529);
}

#step-3 .dimension-stepper-btn:active {
  background: var(--bs-border-color, #dee2e6);
}

#step-3 .step3-dimension-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
  margin-left: 4px;
}

#step-3 #step3-advanced-settings {
  margin-top: 0.5rem !important;
}

/* Step 4: make design preview pane 25% wider than 50/50 split */
@media (min-width: 768px) {
  .stitch-settings-layout-row .stitch-preview-col {
    flex: 0 0 62.5%;
    max-width: 62.5%;
  }

  .stitch-settings-layout-row .stitch-settings-col {
    flex: 0 0 37.5%;
    max-width: 37.5%;
  }
}

@media (max-width: 991.98px) {
  #step-3 .dimension-single-line {
    gap: 8px;
  }

  #step-3 .dimension-inline-title {
    width: 100%;
    margin-right: 0;
  }
}

#step-3 .step3-advanced-summary {
  font-size: 0.85rem;
  line-height: 1.2;
}

#step-3 #min-fill-size-row .form-label.fw-semibold {
  font-size: 0.82rem;
}

[aria-expanded="true"] #step3-advanced-chevron,
[aria-expanded="true"] #step4-advanced-chevron {
  transform: rotate(180deg);
}

#step-3 .step3-help-text {
  font-size: 0.72rem;
  line-height: 1.3;
  margin-top: 4px;
}

@media (max-width: 767.98px) {
  #step-3 #dimension-row {
    padding: 7px 8px;
  }

  /* Must live *after* the base `#step-3 .step3-dimension-note` rule above:
     an equal-specificity override written earlier in the file loses on source
     order, which is how the nowrap note (up to ~640px wide once digitize.js
     swaps in the Quick Convert size-limit copy) used to stretch the whole
     phone layout to a sideways-scrolling 694px. */
  #step-3 .step3-dimension-note {
    display: flex;
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
    margin-left: 0;
  }

  /* The Wizard adopts #dimension-row out of #step-3 into its own panel, where
     no #step-3 rule reaches — keep the note wrapping there too. */
  .step3-dimension-note {
    white-space: normal;
    min-width: 0;
  }
}



/* Enhanced cards */
.card:not(.color-card) {
  border: none;
  border-radius: var(--border-radius-lg);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.card:not(.color-card)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.4),
      transparent);
}

.card:not(.color-card):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(13, 110, 253, 0.1);
}

[data-bs-theme="dark"] .card:not(.color-card) {
  background: rgba(33, 37, 41, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .card:not(.color-card)::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

[data-bs-theme="dark"] .card:not(.color-card):hover {
  border-color: rgba(13, 110, 253, 0.2);
}

/* Checkerboard transparency background */
.checkerboard-bg {
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #fff;
}

/* Images inside checkerboard containers fill the full area */
.checkerboard-bg>img,
.checkerboard-bg>.img-fluid {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Color picker images fill container width when not zoomed */
.checkerboard-bg .color-picker-container:not(.zoomed) img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Placeholder/text content inside preview containers gets padding */
.checkerboard-bg>.text-muted,
.checkerboard-bg>div.text-muted,
.checkerboard-bg>div.d-flex {
  padding: 1rem;
}

/* Step 2's two preview images. Was an inline max-height on each <img> written
   by digitize.js, which outranked the phone clamp in the 767.98px block below;
   as a class it loses to that rule's id selector, as it should. */
.step2-pane-img {
  max-height: 300px;
}

/* The background-removal method chooser sits on the checkerboard, which makes
   its explanatory text hard to read — give it a readable panel behind it. */
#bg-removal-placeholder {
  background-color: rgba(255, 255, 255, 0.88);
}

[data-bs-theme="dark"] #bg-removal-placeholder {
  background-color: rgba(33, 37, 41, 0.88);
}

/* Step 3 color selection preview panes */
#current-image-container,
#color-preview-container {
  height: 420px;
}

@media (max-width: 767.98px) {

  #current-image-container,
  #color-preview-container {
    height: 320px;
  }
}

[data-bs-theme="dark"] .checkerboard-bg {
  background-image:
    linear-gradient(45deg, #3a3a3a 25%, transparent 25%),
    linear-gradient(-45deg, #3a3a3a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #3a3a3a 75%),
    linear-gradient(-45deg, transparent 75%, #3a3a3a 75%);
  background-color: #2b2b2b;
}

/* Color swatch specific styles */
.color-card {
  border: 3px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 60px;
}

.color-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px) scale(1.02);
}

.color-card.selected {
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.25);
  transform: scale(1.05);
}

.color-card .color-preview {
  position: relative;
  border-radius: 8px 8px 0 0;
  min-height: 60px;
}

.color-card .btn-close {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

/* ── Stitch Color Order panel ── */
.stitch-order-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stitch-order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  cursor: grab;
  user-select: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.stitch-order-item:active { cursor: grabbing; }

.stitch-order-item.dragging {
  opacity: 0.4;
  box-shadow: none;
}

.stitch-order-item.drag-over {
  border-color: var(--primary-color);
  background: rgba(13, 110, 253, 0.06);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.2);
}

.stitch-order-handle {
  color: var(--gray-400);
  font-size: 14px;
  flex-shrink: 0;
  cursor: grab;
}


.stitch-order-swatch {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.stitch-order-label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stitch-order-hint {
  font-size: 10px;
  color: var(--gray-400);
  flex-shrink: 0;
}

.stitch-order-layer-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.stitch-order-layer-tag.top-tag {
  background: rgba(13,110,253,0.10);
  color: #0d6efd;
  border: 1px solid rgba(13,110,253,0.25);
}
.stitch-order-layer-tag.bot-tag {
  background: rgba(108,117,125,0.10);
  color: var(--gray-500);
  border: 1px solid rgba(108,117,125,0.25);
}

[data-bs-theme="dark"] .stitch-order-item {
  background: var(--gray-800);
  border-color: var(--gray-600);
}
[data-bs-theme="dark"] .stitch-order-item.drag-over {
  background: rgba(13, 110, 253, 0.15);
}
[data-bs-theme="dark"] .stitch-order-badge {
  background: var(--gray-700);
  border-color: var(--gray-500);
  color: var(--gray-200);
}
[data-bs-theme="dark"] .stitch-order-label { color: var(--gray-200); }

.color-card .btn-close:hover {
  background-color: #dc3545;
  transform: scale(1.1);
}

.color-card .color-preview {
  width: 100%;
  height: 35px;
  border: none;
  border-radius: calc(var(--border-radius) - 2px) calc(var(--border-radius) - 2px) 0 0;
  margin: 0;
  padding: 0;
  background: var(--white);
  position: relative;
  overflow: hidden;
}

.color-card .btn-close {
  background: rgba(108, 117, 125, 0.9);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  opacity: 0.8;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
}

.color-card .btn-close:hover {
  opacity: 1;
  background: rgba(108, 117, 125, 1);
  transform: scale(1.2);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 1);
}

.color-card .btn-close::before {
  content: "✕";
  font-weight: bold;
  font-size: 10px;
}

.card:not(.color-card) .card-header {
  background: var(--gradient-primary);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
  position: relative;
  overflow: hidden;
}

.card:not(.color-card) .card-header h5,
.card:not(.color-card) .card-header h6 {
  color: #ffffff;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  font-size: 0.95rem;
}

.card:not(.color-card) .card-header h6 {
  font-size: 0.9rem;
}

.card:not(.color-card) .card-header.success {
  background: var(--gradient-success);
}

.card:not(.color-card) .card-body {
  padding: 2rem;
  background: var(--white);
  position: relative;
}

.card:not(.color-card) .card-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 2rem;
  right: 2rem;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      var(--gray-200),
      transparent);
}

/* Enhanced buttons */
.btn {
  border-radius: var(--border-radius);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--gradient-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* Enhanced form controls */
.form-control {
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg,
      var(--gray-50) 0%,
      var(--white) 100%);
  box-shadow: var(--shadow-sm);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-primary), 0 0 0 3px rgba(13, 110, 253, 0.1);
  background: var(--white);
  transform: translateY(-1px);
}

.form-control:hover:not(:focus) {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
}

/* Bootstrap's .form-control-sm modifier carries the same specificity as the
   .form-control rule above, which loads later — so every small input in the app
   silently inherited its roomy 12px/16px padding. On a phone (where base.html
   pins form controls to 16px to stop iOS zooming) 32px of horizontal padding
   leaves ~23px of a ~59px field, clipping values like "3.00" to "3.0(" in the
   Lettering Designer's Design Size boxes. Restore the compact sizing the -sm
   markup asks for, and keep the shrunken control tappable on touch (matching
   the .btn-sm min-height in base.html). */
.form-control-sm {
  padding: 0.25rem 0.5rem;
}

@media (pointer: coarse) {

  .form-control-sm,
  .form-select-sm {
    min-height: 38px;
  }
}

/* Enhanced alerts */
.alert {
  border: none;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Enhanced step cards */
.step-card {
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

.step-card.active {
  animation-delay: 0.1s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced drop area */
#drop-area {
  border: 2px dashed var(--gray-300) !important;
  border-radius: var(--border-radius-lg) !important;
  background: linear-gradient(135deg,
      var(--gray-50) 0%,
      var(--white) 100%) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#drop-area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
      transparent,
      rgba(13, 110, 253, 0.02),
      transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#drop-area:hover::before {
  opacity: 1;
}

#drop-area.dragover {
  border-color: var(--primary-color) !important;
  background: linear-gradient(135deg,
      rgba(13, 110, 253, 0.05) 0%,
      var(--white) 100%) !important;
  box-shadow: var(--shadow-primary);
  transform: scale(1.02);
}

/* Enhanced color palette */
.color-option {
  border: 3px solid var(--gray-200);
  border-radius: var(--border-radius);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.color-option::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.color-option:hover::before {
  opacity: 1;
}

.color-option:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.color-option.selected {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-primary);
  transform: scale(1.05);
}

.color-option.selected::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Color swatches for stitch settings */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
  border-color: var(--primary-color);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-swatch:active {
  transform: scale(0.95);
}

/* Rainbow "Custom" swatch */
.color-swatch-custom {
  width: 28px;
  height: 28px;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: conic-gradient(from 0deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.color-swatch-custom::after {
  content: '+';
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.color-swatch-custom:hover {
  border-color: var(--primary-color);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-swatch-custom:active {
  transform: scale(0.95);
}

/* User-picked custom color swatch (slightly different indicator) */
.color-swatch-user {
  width: 28px;
  height: 28px;
  border: 2px solid var(--gray-300);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.color-swatch-user:hover {
  border-color: var(--primary-color);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-swatch-user:active {
  transform: scale(0.95);
}

/* Small diamond badge to distinguish user picks */
.color-swatch-user::before {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  background: var(--primary-color, #0d6efd);
  border-radius: 50%;
  border: 1.5px solid var(--white, #fff);
}

/* Selected color bar (replaces lone color swatch) */
.selected-color-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 8px;
  margin-top: 2px;
}

.selected-color-bar .form-control-color {
  width: 48px !important;
  height: 40px !important;
  min-width: 48px !important;
  border: 3px solid var(--gray-400) !important;
  border-radius: 8px !important;
  padding: 1px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  flex-shrink: 0;
  pointer-events: none !important;
  cursor: default !important;
  transition: none !important;
}

/* Hide redundant descriptions and labels inside the bar */
.selected-color-bar .color-input-description,
.selected-color-bar .color-input-label,
.selected-color-bar .color-preview-swatch {
  display: none;
}

.selected-color-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-400);
  white-space: nowrap;
}

.selected-color-bar-hex {
  display: none;
}

.selected-color-bar-hint {
  display: none;
}

.color-swatch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  background-color: rgba(255, 255, 255, 0.9);
}

.color-swatch:hover::after {
  opacity: 1;
}

.color-swatches-container {
  margin-bottom: 8px;
  padding: 8px;
  background-color: var(--gray-50);
  border-radius: 6px;
  border: 1px solid var(--gray-100);
  transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
  transform: translateY(0);
}

.color-swatches-container.fade-out {
  opacity: 0;
  transform: translateY(-5px);
}

.color-swatches-label {
  font-size: 0.8rem;
  color: var(--gray-700);
  margin-bottom: 4px;
  font-weight: 600;
}

/* Enhanced color input styling */
.form-control-color {
  width: 60px !important;
  height: 40px !important;
  border: 3px solid var(--gray-200) !important;
  border-radius: 8px !important;
  padding: 2px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.form-control-color:hover {
  border-color: var(--primary-color) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.form-control-color:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25), 0 4px 8px rgba(0, 0, 0, 0.15) !important;
  transform: translateY(-1px) !important;
}

/* Color input container styling */
.color-input-container {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.color-input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.color-preview-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--white);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-left: 6px;
}

/* Color input group styling */
.color-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background-color: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-100);
  width: 100%;
  min-width: 200px;
}

.color-input-group:hover {
  background-color: var(--gray-100);
  border-color: var(--primary-color);
}

.stitch-color-layout {
  display: grid;
  grid-template-columns: minmax(130px, 170px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.stitch-color-selector {
  min-width: 0;
}

.compact-color-input-group {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.compact-color-input-group .color-input-description {
  margin-top: 0;
  line-height: 1.2;
}

.stitch-color-palette {
  min-width: 0;
}

.stitch-color-palette .color-swatches-container {
  margin-bottom: 0;
  height: 100%;
}

.stitch-color-palette .color-swatches {
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 0;
}

@media (max-width: 768px) {
  .stitch-color-layout {
    grid-template-columns: 1fr;
  }
}

.color-input-description {
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-top: 4px;
  font-style: italic;
}

/* Disabled stitch settings styles - simple pointer blocking */
.stitch-settings-disabled,
.output-format-disabled,
.dimensions-disabled,
.global-satin-disabled {
  pointer-events: none;
  opacity: 0.6;
}

/* Full screen preview loading overlay */
.preview-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.preview-loading-content {
  background: var(--white);
  padding: 2rem 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
}

.preview-loading-spinner {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
}

/* Enhanced progress indicators */
.progress {
  height: 8px;
  border-radius: var(--border-radius);
  background: var(--gray-200);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  background: var(--gradient-primary);
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
}

.progress-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.4),
      transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

/* Enhanced modal */
.modal-content {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-2xl);
  backdrop-filter: blur(20px);
  background: var(--gradient-card);
}

.modal-header {
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  padding: 1.5rem;
}

.modal-header h5 {
  color: #ffffff;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 2rem;
}

.modal-footer {
  border: none;
  padding: 1.5rem 2rem;
  background: var(--gray-50);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* Enhanced loading states */
.spinner-border {
  animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Enhanced tooltips */
.tooltip {
  font-size: 0.875rem;
  background: var(--accent-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

/* Enhanced image preview */
.image-preview {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-preview:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .card-body {
    padding: 1.5rem;
  }

  .card-header {
    padding: 0.5rem 1rem;
  }

  .btn {
    padding: 0.75rem 1.5rem;
  }

  header nav {
    flex-direction: column;
    gap: 2rem !important;
  }

  header nav .d-flex {
    flex-wrap: wrap;
    gap: 1rem !important;
  }
}

@media (max-width: 576px) {
  .card-body {
    padding: 1rem;
  }

  .card-header {
    padding: 0.4rem 0.8rem;
  }

  .card-header h5,
  .card-header h6 {
    font-size: 0.85rem;
  }
}

/* Responsive: Shape settings mobile layout */
@media (max-width: 768px) {
  /* Tall enough to edit comfortably, short enough to keep the
     selection tools reachable right below the preview */
  #svg-preview {
    height: 52vh !important;
    height: 52svh !important;
    min-height: 300px;
  }

  #shape-settings-content {
    min-height: auto !important;
    max-height: 400px;
    overflow-y: auto;
  }

  .angle-dial-container svg {
    width: 80px !important;
    height: 80px !important;
  }
}



/* Border type illustrated cards */
.border-type-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.border-type-card {
  flex: 1;
  min-width: 80px;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--white);
}

.border-type-card:hover {
  border-color: var(--primary-color);
  background: rgba(13, 110, 253, 0.04);
}

.border-type-card.active {
  border-color: var(--primary-color);
  background: rgba(13, 110, 253, 0.08);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.border-type-card .card-icon {
  font-size: 18px;
  margin-bottom: 4px;
  display: block;
}

.border-type-card .card-label {
  font-size: 11px;
  font-weight: 600;
  display: block;
}

.border-type-card .card-desc {
  font-size: 9px;
  color: var(--gray-500);
  display: block;
  line-height: 1.2;
}

/* Discoverability pulse hint */
@keyframes pulseHint {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.shape-hint-pulse {
  animation: pulseHint 2.5s ease-in-out 3;
}



/* Tooltip info icons */
.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* Action sections separator */
.action-divider {
  border-top: 1px solid var(--gray-200);
  margin: 12px 0 8px 0;
  padding-top: 8px;
}

.action-divider-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

/* Interactive SVG Preview Container */
#svg-preview {
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
}

#svg-preview.dragging {
  cursor: grabbing;
}

#svg-preview svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transform-origin: 0 0;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  shape-rendering: geometricPrecision;
  /* transition managed via JS: enabled for button zoom, disabled for wheel/pan */
}

/* Workflow mode choice card hover effects */
.workflow-choice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Clickable shapes styling */
#svg-preview path[id],
#svg-preview g.satin-text-wrapper[id] {
  cursor: pointer;
  transition: stroke 0.2s ease;
}

#svg-preview path[id]:hover,
#svg-preview g.satin-text-wrapper[id]:hover {
  filter: drop-shadow(0 0 3px rgba(0, 123, 255, 0.5));
}

#svg-preview path[id].selected,
#svg-preview g.satin-text-wrapper[id].selected {
  stroke: #dc3545 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 5px rgba(220, 53, 69, 0.7));
}

/* Zoom and pan controls */
.svg-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.svg-control-btn {
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .svg-control-btn {
  background: rgba(50, 55, 60, 0.9);
  color: #dee2e6;
}

.svg-control-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

/* Scale indicator */
.scale-indicator {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* Checkerboard pattern for transparency visualization */
.checker-background {
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: var(--white);
}

/* Fix for SVG alignment */
.svg-container {
  width: 100%;
  height: 300px;
  /* Fixed height container */
  position: relative;
  display: flex;
  justify-content: flex-start;
  /* Align to left */
  align-items: flex-start;
  /* Align to top */
  overflow: hidden;
}

/* Embroidery preview styles */
#embroidery-preview-container {
  transition: all 0.3s ease;
  cursor: zoom-in;
  position: relative;
}

[data-bs-theme="dark"] #embroidery-preview-container {
  background-color: var(--bs-dark, #212529) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

#embroidery-preview-container:hover {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  transform: scale(1.02);
}

#embroidery-preview-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
  pointer-events: none;
}

#embroidery-preview-container:hover::after {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Zoom icon overlay on hover */
#embroidery-preview-container::before {
  content: "\f00e";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.8);
  background-color: rgba(0, 0, 0, 0.5);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  opacity: 0;
  transition: all 0.3s ease;
}

#embroidery-preview-container:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

#embroidery-preview.fade-in {
  animation: fadeInScale 0.4s ease-out forwards;
}

/* Crosshair cursor for color selection */
.color-picker-image {
  cursor: crosshair !important;
}

/* Zoom and pan container for color selection */
.color-picker-container {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: transparent;
  height: 100%;
  max-height: none;
  user-select: none;
  outline: none;
  /* Remove focus outline */
}

/* Remove inner border when nested inside a checkerboard container */
.checkerboard-bg .color-picker-container {
  border: none;
  border-radius: 0;
}

.color-picker-container:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.color-picker-container.zoomed {
  overflow: auto;
  cursor: grab;
}

.color-picker-container.zoomed:active {
  cursor: grabbing;
}

.color-picker-container .color-picker-image {
  transition: transform 0.15s ease-out;
  transform-origin: center center;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Ensure image fits container when not zoomed */
.color-picker-container:not(.zoomed) .color-picker-image {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
}

/* Color preview images (zoom/pan only, no color selection) */
#color-preview-image {
  cursor: grab !important;
}

#color-preview-image:active,
.color-picker-container.zoomed #color-preview-image {
  cursor: grab;
}

.zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.zoom-btn {
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .zoom-btn {
  background: rgba(50, 55, 60, 0.9);
  color: #dee2e6;
}

.zoom-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

.zoom-btn:disabled {
  background: rgba(108, 117, 125, 0.6);
  cursor: not-allowed;
  opacity: 0.6;
}

.zoom-indicator {
  font-size: 11px;
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 35px;
  text-align: center;
  font-weight: 500;
  margin: 2px 0;
}

/* Magnifying bubble for precise color selection */
.magnification-bubble {
  position: fixed;
  width: 120px;
  height: 120px;
  border: 3px solid #007bff;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 9999;
  display: none;
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.magnification-bubble.active {
  display: block;
}

.magnification-canvas {
  /* block, not the inline default: an inline canvas sits on the text baseline
     and leaves ~8px of descender space, which pushed the magnified pixels up
     inside the round bubble and clipped the bottom of the view. */
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.magnification-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: #ff0000;
  border: 1px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* Feedback form styling */
.feedback-star {
  border: none !important;
  padding: 8px 12px;
  transition: all 0.2s ease;
  font-size: 1.1em;
}

.feedback-star:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.feedback-star.btn-warning {
  background-color: #ffc107 !important;
  border-color: #ffc107 !important;
  color: var(--gray-800) !important;
}

.feedback-star.btn-outline-warning:hover {
  background-color: rgba(255, 193, 7, 0.1) !important;
  border-color: #ffc107 !important;
  color: #ffc107 !important;
}

#feedback-form {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.border-warning {
  border: 2px solid #ffc107 !important;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

.card.border-warning .card-header.bg-warning {
  background-color: #ffc107 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Output Format Selection Styling - matches other cards */

.output-format-inline-card {
  border-radius: 10px;
}

/* Step 4 right-rail tools: make Text/Global sections read as one compact stack */
#step-4 #text-tools-section {
  margin-top: 0.85rem !important;
  padding-top: 0.65rem !important;
  border-top-color: var(--gray-200, #e9ecef) !important;
}

#step-4 #border-patch-tools-section {
  margin-top: 0.4rem !important;
  padding-top: 0.35rem !important;
  border-top: 0 !important;
}

#step-4 #text-tools-section h6,
#step-4 #border-patch-tools-section h6 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem !important;
  color: var(--gray-600, #6c757d) !important;
}

.output-format-inline-label {
  font-size: 0.9rem;
  white-space: nowrap;
}

.output-format-inline-select {
  min-width: 230px;
  max-width: 360px;
  width: auto;
  flex: 1 1 260px;
}

#filetype-select {
  border: 2px solid var(--gray-100);
  transition: all 0.3s ease;
  font-weight: 500;
}

#filetype-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

#filetype-select option {
  padding: 8px 12px;
  font-weight: 500;
}

@media (max-width: 767.98px) {
  .output-format-inline-select {
    min-width: 0;
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
}

/* Angle Dial Styles */
.angle-dial-container {
  position: relative;
  display: inline-block;
  user-select: none;
  cursor: pointer;
}

.angle-dial:hover {
  filter: brightness(1.1);
}

.angle-hand {
  transform-origin: 30px 30px;
  transition: transform 0.2s ease;
  cursor: grab;
}

.angle-hand:active {
  cursor: grabbing;
}

.angle-dial-container:hover .angle-hand {
  stroke: #0a58ca;
  stroke-width: 3;
}

/* Shape Selection Styles */
.shape-selected {
  stroke: var(--selection-stroke-color, #007bff) !important;
  stroke-width: var(--selection-border-width, 3) !important;
  stroke-dasharray: var(--selection-dash-array, 5, 5) !important;
  /* fill will be set dynamically per shape using its original color */
  animation: selection-pulse 2s infinite;
}

/* Boost satin text path visibility — font paths are very thin at preview scale.
         Use non-scaling-stroke so the width is in screen pixels, not font units.
         pointer-events:none ensures clicks pass through to the hit-area / group.
         The stitch preview is excluded: its widths are real thread widths in
         font units and must scale with the design. */
g.satin-text-wrapper path:not(.satin-hit-area):not(.satin-stitch-preview) {
  vector-effect: non-scaling-stroke;
  stroke-width: 1.8px !important;
  pointer-events: none;
}

/* Stitch preview: decoration drawn from the satin rails (satin-preview.js).
         Clicks belong to the group's hit area, never to the preview. */
.satin-stitch-preview {
  pointer-events: none;
}

/* The rails/rungs the preview was built from stay in the DOM — they are the
         geometry the converter digitizes — but they no longer need drawing. */
.satin-src-hidden {
  stroke: none !important;
  fill: none !important;
}

/* Satin text groups: use glow instead of stroke (stroke cascades to children) */
g.satin-text-wrapper.shape-selected {
  stroke: none !important;
  stroke-width: 0 !important;
  stroke-dasharray: none !important;
  filter: drop-shadow(0 0 4px rgba(0, 123, 255, 0.85)) drop-shadow(0 0 10px rgba(0, 123, 255, 0.45));
  animation: satin-selection-pulse 2s infinite !important;
}

/* Prevent selection stroke from leaking into satin text child paths */
g.satin-text-wrapper.shape-selected path {
  stroke-dasharray: none !important;
  stroke-opacity: 1 !important;
  animation: none !important;
}

@keyframes selection-pulse {

  0%,
  100% {
    stroke-opacity: 1;
  }

  50% {
    stroke-opacity: 0.6;
  }
}

@keyframes satin-selection-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(0, 123, 255, 0.85)) drop-shadow(0 0 10px rgba(0, 123, 255, 0.45));
  }

  50% {
    filter: drop-shadow(0 0 6px rgba(0, 123, 255, 0.4)) drop-shadow(0 0 4px rgba(0, 123, 255, 0.2));
  }
}

/* Text shape visual indicator */
.text-shape {
  cursor: move;
}

/* Text transform handles */
.text-transform-group {
  pointer-events: all;
}

.text-transform-handle {
  fill: white;
  stroke: #0d6efd;
  stroke-width: 1.5;
  cursor: nwse-resize;
}

.text-transform-handle:hover {
  fill: #e8f0fe;
}

.text-rotate-handle {
  fill: white;
  stroke: #0d6efd;
  stroke-width: 1.5;
  cursor: grab;
}

.text-rotate-handle:hover {
  fill: #e8f0fe;
}

.text-rotate-line {
  stroke: #0d6efd;
  stroke-width: 1;
  stroke-dasharray: 3, 3;
}

.text-bounding-box {
  fill: none;
  stroke: #0d6efd;
  stroke-width: 1;
  stroke-dasharray: 4, 3;
  cursor: move;
}

/* Patch resize handles */
.patch-handle-group {
  pointer-events: all;
}

.patch-resize-handle {
  fill: white;
  stroke: #198754;
  stroke-width: 1.5;
  transition: fill 0.1s;
}

.patch-resize-handle:hover {
  fill: #d1e7dd;
}

.patch-bounding-box {
  fill: none;
  stroke: #198754;
  stroke-width: 1;
  stroke-dasharray: 5, 3;
  pointer-events: none;
}

/* Design boundary outline - shows original design area (orange) */
.design-boundary-rect {
  fill: none;
  stroke: #e67e22;
  stroke-width: 1.5;
  stroke-dasharray: 6, 4;
  opacity: 0.6;
  pointer-events: none;
}

/* Total content boundary outline - shows total area including text (blue) */
.total-boundary-rect {
  fill: none;
  stroke: #0d6efd;
  stroke-width: 1.5;
  stroke-dasharray: 6, 4;
  opacity: 0.6;
  pointer-events: none;
}

/* Hoop frame overlay: a sibling <svg> of the design, not a child of it.
   The frame is usually LARGER than the design (that gap is the head-room the
   user is checking), so keeping it out of the design tree is what stops every
   bbox/measure/export path from treating it as artwork. Its geometry props
   must mirror `#svg-preview svg` exactly — same size, same origin, same
   transform (kept in sync by syncHoopOverlayTransform) — or the frame drifts
   away from the design under zoom. */
svg.hoop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 1;
}

/* Solid-ish dashes rather than the thin dotted guides, so it reads as a
   physical hoop edge and not a third measurement box. */
.hoop-boundary-rect {
  fill: none;
  stroke: #6c757d;
  stroke-width: 2;
  stroke-dasharray: 10, 5;
  opacity: 0.75;
  pointer-events: none;
}

.hoop-boundary-rect.is-over {
  stroke: #dc3545;
  stroke-dasharray: none;
  opacity: 0.9;
}

/* ── Hoop guide ────────────────────────────────────────────────────────── */

.hoop-row {
  gap: 0.5rem;
  /* Aligns with the width/height controls above it in #dimension-row. */
  padding-top: 0.25rem;
}

.hoop-inline-title {
  font-size: 0.875rem;
  white-space: nowrap;
  min-width: 128px;
}

/* Two numbers, a unit and a clear button. Narrow on purpose: this is a guide,
   not a design setting, and it sits under the width/height controls that are
   the real ones. */
.hoop-size-group {
  max-width: 360px;
}

.hoop-size-group input {
  max-width: 72px;
}

/* Wide enough to show the unit next to the chevron. Bootstrap reserves 2.25rem
   of right padding for that arrow, so a select sized to its text alone renders
   as a bare chevron with the word pushed out of view. */
.hoop-size-group .hoop-unit {
  flex: 0 0 auto;
  width: auto;
  min-width: 4.75rem;
}

.hoop-fit-note {
  font-size: 0.78rem;
  color: var(--gray-600, #6c757d);
  flex: 1 1 100%;
}

.hoop-fit-note.is-ok { color: #198754; }
.hoop-fit-note.is-over { color: #dc3545; font-weight: 500; }

.canvas-hoop-readout {
  color: var(--gray-600, #6c757d);
}
.canvas-hoop-readout.is-ok { color: #198754; }
.canvas-hoop-readout.is-over { color: #dc3545; font-weight: 500; }

@media (max-width: 575.98px) {
  .hoop-inline-title { min-width: 0; }
  .hoop-size-group { max-width: 100%; flex: 1 1 auto; }
}

/* ── Garment mockup modal ──────────────────────────────────────────────── */

.garment-mockup-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}

.garment-mockup-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.garment-mockup-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--gray-600, #6c757d);
}

.garment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.garment-chip {
  border: 1px solid var(--gray-300, #dee2e6);
  background: #fff;
  color: var(--gray-700, #495057);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.garment-chip:hover {
  border-color: var(--gray-500, #adb5bd);
  background: var(--gray-100, #f8f9fa);
}

.garment-chip.active {
  background: #1452cc;
  border-color: #1452cc;
  color: #fff;
}

.garment-mockup-stage {
  background: var(--gray-100, #f8f9fa);
  border: 1px solid var(--gray-200, #e9ecef);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
}

.garment-mockup-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
  max-height: 52vh;
}

/* Garment silhouettes are line art on purpose: a filled shirt would compete
   with the design sitting on top of it, which is the thing being judged. */
.garment-body {
  fill: #fff;
  stroke: var(--gray-500, #adb5bd);
  stroke-width: 0.22;
  stroke-linejoin: round;
}

.garment-detail {
  fill: none;
  stroke: var(--gray-400, #ced4da);
  stroke-width: 0.16;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.garment-mockup-note {
  font-size: 0.82rem;
  color: var(--gray-600, #6c757d);
  margin-top: 0.75rem;
  min-height: 2.2em;
}

.garment-mockup-note.is-over {
  color: #b02a37;
}

/* Add Text button styling in preview controls */
#add-text-btn {
  font-family: serif !important;
  letter-spacing: -1px;
}

/* Text font preview in modal */
#text-font-preview {
  transition: all 0.2s ease;
}

#text-font-preview svg {
  max-width: 100%;
  height: auto;
}

.batch-settings-panel .badge {
  font-size: 0.75rem;
}

.batch-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.batch-header-left {
  flex: 0 0 auto;
  min-width: 160px;
}

.batch-header-right {
  flex: 1 1 auto;
  text-align: right;
  padding-top: 2px;
}

.batch-header-right small {
  line-height: 1.3;
}

@media (max-width: 768px) {
  .batch-header {
    flex-direction: column;
    gap: 8px;
  }

  .batch-header-left {
    min-width: 0;
  }

  .batch-header-right {
    text-align: left;
    padding-top: 0;
  }
}

/* Combine-tool interactive cards */
.combine-tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--white);
  margin-bottom: 6px;
}

.combine-tool-card:hover {
  border-color: var(--primary, #0d6efd);
  background: color-mix(in srgb, var(--primary, #0d6efd) 6%, var(--white));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.combine-tool-card:active {
  transform: scale(0.98);
}

.combine-tool-card[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.combine-tool-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #fff;
}

.combine-tool-icon.merge-icon {
  background: linear-gradient(135deg, #198754, #20c997);
}

.combine-tool-icon.outline-icon {
  background: linear-gradient(135deg, #0d6efd, #6ea8fe);
}

.combine-tool-body {
  flex: 1;
  min-width: 0;
}

.combine-tool-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.2;
}

.combine-tool-desc {
  font-size: 0.7rem;
  color: var(--gray-500);
  line-height: 1.3;
  margin-top: 1px;
}

.combine-tool-arrow {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--gray-400);
  transition: transform 0.15s ease;
}

.combine-tool-card:hover .combine-tool-arrow {
  transform: translateX(2px);
  color: var(--primary, #0d6efd);
}

/* Dark mode tweaks for combine-tool cards */
[data-bs-theme="dark"] .combine-tool-card:hover {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .combine-tool-icon.merge-icon {
  background: linear-gradient(135deg, #20c997, #3dd5a8);
}

[data-bs-theme="dark"] .combine-tool-icon.outline-icon {
  background: linear-gradient(135deg, #3d8bfd, #8bb9fe);
}

/* Lasso Selection Box */
.lasso-selection {
  position: absolute;
  border: 2px dashed #007bff;
  background-color: rgba(0, 123, 255, 0.1);
  pointer-events: none;
  z-index: 1000;
  display: none;
}

/* Hide number input spinner arrows completely for custom control */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}

/* ── Embroidery Font Picker ── */
.font-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  min-height: 34px;
  transition: border-color .15s;
}

.font-picker-trigger:hover {
  border-color: var(--primary-color, #0d6efd);
}

.font-picker-trigger .fp-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-picker-trigger .fp-caret {
  margin-left: auto;
  font-size: 10px;
  opacity: .5;
}

/* Font navigation row with prev/next arrows */
.fp-nav-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fp-nav-row .font-picker-trigger {
  flex: 1;
  min-width: 0;
}

.fp-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 34px;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 6px;
  background: #fff;
  color: var(--gray-500, #adb5bd);
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  transition: all .15s;
  padding: 0;
}

.fp-nav-btn:hover {
  border-color: var(--primary-color, #0d6efd);
  color: var(--primary-color, #0d6efd);
  background: #f0f4ff;
}

.fp-nav-btn:active {
  transform: scale(.92);
}

.font-picker-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1060;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  max-height: 370px;
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.font-picker-dropdown.open {
  display: flex;
}

.fp-search-wrap {
  padding: 8px 10px 4px;
  border-bottom: 1px solid #eee;
}

.fp-search-wrap input {
  width: 100%;
  padding: 5px 10px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

.fp-search-wrap input:focus {
  border-color: var(--primary-color, #0d6efd);
}

.fp-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
}

.fp-cat-pill {
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid #dee2e6;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  color: #555;
}

.fp-cat-pill:hover {
  border-color: var(--primary-color, #0d6efd);
  color: var(--primary-color, #0d6efd);
}

.fp-cat-pill.active {
  background: var(--primary-color, #0d6efd);
  border-color: var(--primary-color, #0d6efd);
  color: #fff;
}

.fp-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}

.fp-item {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #333;
  transition: background .1s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fp-item:hover {
  background: #f0f4ff;
}

.fp-item.selected {
  background: #e8f0fe;
  font-weight: 600;
}

.fp-item .fp-item-meta {
  font-size: 10px;
  color: #999;
  margin-left: 8px;
  flex-shrink: 0;
}

.fp-no-results {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 12px;
}

/* ── Font picker dark-mode ── */
[data-bs-theme="dark"] .font-picker-trigger {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-bs-theme="dark"] .fp-nav-btn {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-500);
}

[data-bs-theme="dark"] .fp-nav-btn:hover {
  border-color: var(--primary-light, #3d8bfd);
  color: var(--primary-light, #3d8bfd);
  background: rgba(13, 110, 253, 0.1);
}

[data-bs-theme="dark"] .font-picker-dropdown {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

[data-bs-theme="dark"] .fp-search-wrap {
  border-bottom-color: var(--gray-300);
}

[data-bs-theme="dark"] .fp-search-wrap input {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-bs-theme="dark"] .fp-cats {
  border-bottom-color: var(--gray-300);
}

[data-bs-theme="dark"] .fp-cat-pill {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-600);
}

[data-bs-theme="dark"] .fp-cat-pill:hover {
  border-color: var(--primary-light, #3d8bfd);
  color: var(--primary-light, #3d8bfd);
}

[data-bs-theme="dark"] .fp-cat-pill.active {
  background: var(--primary-color, #0d6efd);
  border-color: var(--primary-color, #0d6efd);
  color: #fff;
}

[data-bs-theme="dark"] .fp-item {
  color: var(--gray-700);
}

[data-bs-theme="dark"] .fp-item:hover {
  background: var(--gray-50);
}

[data-bs-theme="dark"] .fp-item.selected {
  background: rgba(13, 110, 253, 0.15);
}

[data-bs-theme="dark"] .fp-item .fp-item-meta {
  color: var(--gray-500);
}

[data-bs-theme="dark"] .fp-no-results {
  color: var(--gray-500);
}
/* ============================================================
   Mobile & touch experience
   ------------------------------------------------------------
   Goal: an app-like flow on phones — each step fits the screen,
   primary actions stay visible (sticky card footers), and every
   canvas interaction (color picking, shape selection, zoom/pan)
   works with touch. Desktop is unaffected.
   ============================================================ */

/* --- Touch interaction surfaces (all pointer types) --- */

/* The SVG editor canvas handles its own gestures (pan/pinch/tap) */
#svg-preview {
  touch-action: none;
}

/* The color picker scrolls with the page until zoomed in;
   JS switches touch-action to none while zoomed for free panning */
.color-picker-container {
  touch-action: pan-y;
}

.color-picker-container.zoomed {
  touch-action: none;
}

/* Multi-select toggle: only relevant where Shift+Click doesn't exist */
.svg-control-btn-touch {
  display: none;
}

@media (pointer: coarse) {
  .svg-control-btn-touch {
    display: flex;
  }
}

.svg-control-btn.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.35);
}

/* Stitch-order arrow buttons: touch-friendly alternative to HTML5
   drag & drop (which doesn't fire on touch devices) */
.stitch-order-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

.stitch-order-arrow {
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-600);
  border-radius: 5px;
  width: 26px;
  height: 20px;
  line-height: 1;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.stitch-order-arrow:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.stitch-order-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

[data-bs-theme="dark"] .stitch-order-arrow {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-600);
}

@media (pointer: coarse) {
  .stitch-order-arrow {
    width: 34px;
    height: 26px;
    font-size: 0.7rem;
  }

  /* Bigger canvas controls under a finger */
  .svg-control-btn,
  .zoom-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .zoom-indicator {
    min-width: 44px;
  }

  /* Bigger dimension steppers */
  #step-3 .dimension-stepper {
    width: 2rem;
    height: 38px;
  }

  #step-3 #width-input,
  #step-3 #height-input {
    min-height: 38px;
    height: 38px;
    min-width: 4.6rem;
    max-width: 4.6rem;
    flex: 0 0 4.6rem;
  }

  #step-3 #dimension-row .input-group .btn,
  #step-3 #dimension-row .input-group .form-control,
  #step-3 #dimension-row .input-group-text,
  #step-3 #dimension-row .form-select {
    min-height: 38px;
  }

  #step-3 .dimension-stepper-btn {
    font-size: 0.65rem;
  }

  /* Compact color cards need a reachable remove button */
  #step-3 .compact-color-card .btn-close {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
}

/* Neutralize hover-lift effects on devices without hover — they
   otherwise "stick" after a tap and make the UI feel glitchy */
@media (hover: none) {

  .card:not(.color-card):hover,
  .color-card:hover,
  .image-preview:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }

  .svg-control-btn:hover,
  .zoom-btn:hover:not(:disabled) {
    transform: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-700);
  }

  [data-bs-theme="dark"] .svg-control-btn:hover,
  [data-bs-theme="dark"] .zoom-btn:hover:not(:disabled) {
    background: rgba(50, 55, 60, 0.9);
    color: #dee2e6;
  }

  .svg-control-btn.active,
  .svg-control-btn.active:hover {
    background: var(--primary-color);
    color: #fff;
  }

  .workflow-choice-card:hover {
    transform: none !important;
  }
}

/* --- Phone layout (max-width 767.98px) --- */
@media (max-width: 767.98px) {

  /* Tighter page gutters so content uses the full width */
  .main-content>.container,
  .main-content .container.pb-4 {
    padding-left: 10px;
    padding-right: 10px;
  }

  #steps-container .step-card {
    margin-bottom: 0.75rem !important;
  }

  /* Sticky footers need visible overflow on the card
     (id selector outranks the base .card:not(.color-card) rule) */
  #steps-container .step-card.card {
    overflow: visible;
  }

  /* Keep Back / Next always reachable, iOS-toolbar style */
  .step-card>.card-footer {
    position: sticky;
    bottom: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }

  [data-bs-theme="dark"] .step-card>.card-footer {
    background: rgba(33, 37, 41, 0.92);
    border-top-color: var(--gray-200);
  }

  /* Footer buttons (e.g. "Back" + "Make Changes (Free)" / "Start New
     Design") share the row equally and truncate instead of wrapping their
     label across 2-3 lines, which used to balloon the sticky footer's
     height and cram/split the text. */
  .step-card>.card-footer .btn {
    min-height: 44px;
    flex: 1 1 0;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 0.86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .step-card>.card-footer .btn i.me-2 {
    margin-right: 4px !important;
  }

  /* Hero (guest view): compact */
  .display-4 {
    font-size: 1.6rem;
  }

  .lead {
    font-size: 1rem;
  }

  /* Step 1: compact drop area */
  #drop-area h5 {
    font-size: 1rem;
  }

  #drop-area .fa-3x {
    font-size: 2em;
  }

  /* Step 2: keep both image panes visible without a huge scroll.

     The clamp belongs on the image, NOT on the pane. #bg-removed-image-container
     also hosts the background-removal method chooser (#bg-removal-placeholder,
     re-rendered by bgRemovalPlaceholderMarkup() in digitize.js), which is taller
     than 36svh on a phone — a clamped pane with overflow:hidden decapitated the
     second method button and the recommendation hint. Clamping the image also
     *scales* a tall preview down instead of cropping its bottom off, which is
     what the old pane clamp did on any viewport shorter than ~830px. */
  #original-image-container img,
  #bg-removed-image-container img {
    max-height: 36vh;
    max-height: 36svh;
    object-fit: contain;
  }

  #step2-transform-controls .btn {
    min-height: 40px;
  }

  /* Step 3: image + preview panes sized so the swatches stay close */
  #current-image-container,
  #color-preview-container {
    height: 40vh;
    height: 40svh;
    max-height: 380px;
  }

  /* Workflow choice cards: compact, single-screen-ish */
  .workflow-choice-card .card-body {
    padding: 1rem !important;
  }

  .workflow-choice-card .fa-3x {
    font-size: 1.6em;
    margin-bottom: 0.5rem !important;
  }

  .workflow-choice-card p.text-muted {
    margin-bottom: 0.5rem !important;
    font-size: 0.85rem;
  }

  /* Feature bullet lists are desktop marketing detail; the description
     covers it on phones */
  .workflow-choice-card ul {
    display: none;
  }

  #step-mode-select .row.g-4 {
    --bs-gutter-y: 0.75rem;
  }

  /* Simple mode preview + final preview: viewport-relative heights */
  #simple-svg-preview {
    height: 45vh !important;
    height: 45svh !important;
  }

  #embroidery-preview-container {
    height: 45vh !important;
    height: 45svh !important;
  }

  /* Selection action buttons under the preview */
  #selection-actions-bar .btn {
    min-height: 44px;
  }

  /* Modals: near-full-width sheets with compact padding */
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-body {
    padding: 1.25rem;
  }

  .modal-header {
    padding: 1rem 1.25rem;
  }

  .modal-footer {
    padding: 0.75rem 1.25rem;
  }

  /* Shape settings panel sits below the preview — give it room but
     keep the page from ballooning */
  #shape-settings-content {
    max-height: none;
    overflow-y: visible;
  }

  /* Scale indicator can collide with sticky footer edge — nudge it */
  .scale-indicator {
    bottom: 8px;
    left: 8px;
    font-size: 11px;
  }

  /* In-canvas overlays (zoom buttons, scale badge) must stay beneath
     the sticky footer (z-index 40) or they steal its taps */
  .zoom-controls,
  .svg-controls,
  .scale-indicator,
  .lasso-selection {
    z-index: 30;
  }
}

/* ── Canvas shape tools (static/js/shape-tools.js) ─────────────────────── */

.shape-tools-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.shape-tools-bar[hidden] {
  display: none;
}

.shape-tool-group {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--gray-300, #dee2e6);
  border-radius: 8px;
  background: var(--gray-100, #f8f9fa);
}

[data-bs-theme="dark"] .shape-tool-group {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.shape-tool-btn {
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--gray-700, #495057);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

[data-bs-theme="dark"] .shape-tool-btn {
  color: #dee2e6;
}

.shape-tool-btn:hover {
  background: rgba(13, 110, 253, 0.12);
  color: var(--primary-color, #0d6efd);
}

.shape-tool-btn.active {
  background: var(--primary-color, #0d6efd);
  color: #fff;
}

/* Undo/redo dim out rather than disappearing: the bar sits directly above
   #svg-preview, so its height must not change while the user is editing. */
.shape-tool-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.shape-tool-btn:disabled:hover {
  background: transparent;
  color: var(--gray-700, #495057);
}

[data-bs-theme="dark"] .shape-tool-btn:disabled:hover {
  color: #dee2e6;
}

/* Hidden by visibility, not display: the toolbar row must keep its height. */
.shape-tool-color.is-hidden {
  visibility: hidden;
}

.shape-tool-color .form-control-color {
  width: 34px;
  height: 30px;
  padding: 2px;
}

.shape-size-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--gray-700, #495057);
}

[data-bs-theme="dark"] .shape-size-wrap {
  color: #dee2e6;
}

.shape-size-wrap.is-empty .shape-size-input,
.shape-size-wrap.is-empty .shape-size-label,
.shape-size-wrap.is-empty .shape-size-unit,
.shape-size-wrap.is-empty .shape-lock-btn {
  opacity: 0.45;
}

.shape-size-label {
  font-weight: 600;
  margin: 0;
}

.shape-size-input {
  width: 68px;
  padding: 2px 6px;
  height: 28px;
  font-size: 0.78rem;
}

/* Hide the spin buttons — they step by too much to be useful here */
.shape-size-input::-webkit-outer-spin-button,
.shape-size-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.shape-size-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.shape-lock-btn {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.shape-size-unit {
  min-width: 18px;
}

.shape-size-count {
  color: var(--gray-600, #6c757d);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Fixed height and single line on purpose — this sits directly above
   #svg-preview, so any change in its height would move the canvas (and every
   click-to-user-space mapping with it) mid-interaction. */
.shape-tool-hint {
  font-size: 0.74rem;
  color: var(--gray-600, #6c757d);
  margin-bottom: 6px;
  height: 1.15rem;
  line-height: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shape-tool-hint.is-warning {
  color: #b45309;
  font-weight: 600;
}

.shape-tool-hint.is-empty {
  visibility: hidden;
}

/* Crosshair while a drawing or cutting tool is armed */
#svg-preview.shape-tool-drawing,
#svg-preview.shape-tool-cutting {
  cursor: crosshair;
}

/* On-canvas overlay: selection box, size labels, transform handles */
.shape-tools-overlay {
  pointer-events: none;
}

.st-bbox {
  fill: none;
  stroke: #0d6efd;
}

.st-handle {
  fill: #fff;
  stroke: #0d6efd;
  pointer-events: all;
}

.st-handle:hover {
  fill: #e8f0fe;
}

.st-rotate-line {
  stroke: #0d6efd;
  stroke-dasharray: 2 2;
}

.st-dim-label {
  fill: #0d6efd;
  stroke: #fff;
  paint-order: stroke;
  stroke-linejoin: round;
  font-weight: 700;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  dominant-baseline: middle;
}

[data-bs-theme="dark"] .st-dim-label {
  fill: #8ab4f8;
  stroke: #1b1e21;
}

.st-move-area {
  pointer-events: stroke;
}

.st-draw-preview {
  stroke: #0d6efd;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

.st-cut-line {
  stroke: #dc3545;
  stroke-linecap: round;
}

.st-cut-point {
  fill: #fff;
  stroke: #dc3545;
}

@media (max-width: 767.98px) {
  .shape-size-count {
    display: none;
  }

  .shape-tool-btn {
    width: 38px;
    height: 36px;
    font-size: 15px;
  }

  .shape-lock-btn {
    width: 30px;
    height: 30px;
  }
}

/* Narrow phones (~320-360px): the W/H selection-size group is 231px wide and
   wraps onto its own line inside a ~200px toolbar, so the trailing unit label
   spilled past the card. Trim the two inputs rather than let the group wrap —
   this row sits directly above #svg-preview and must keep a constant height
   (see .shape-size-count's note above). */
@media (max-width: 400px) {
  .shape-size-input {
    width: 52px;
  }

  .shape-size-wrap {
    gap: 4px;
  }
}

/* Small print that explains a control ("Keeps jump threads instead of
   cutting…", the Design Size limit note, the satin-font hint). 11px is legible
   on a desktop monitor but genuinely hard to read at arm's length on a phone,
   and these lines carry the reason a setting exists — so give them a floor.
   Was an inline font-size on each element; the class keeps them in step. */
.setting-note {
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 767.98px) {
  .setting-note {
    font-size: 12.5px;
  }
}

/* ==========================================================================
   Text Designer (/text) — blank canvas with the text tools only.
   Controller: static/js/text-mode.js
   ========================================================================== */

/* Design-area outline on the blank canvas. Registered as editor chrome in the
   export/selection strip lists, so it never reaches a stitch file. */
.text-canvas-frame {
  fill: none;
  stroke: #e67e22;
  stroke-width: 1.5;
  stroke-dasharray: 6, 4;
  opacity: 0.55;
  pointer-events: none;
}

/* The drawing tools have no place here — select is the only canvas tool. */
body.text-mode-active #shape-tools-bar [data-tool="rect"],
body.text-mode-active #shape-tools-bar [data-tool="circle"],
body.text-mode-active #shape-tools-bar [data-tool="triangle"],
body.text-mode-active #shape-tools-bar [data-tool="cut"],
body.text-mode-active #shape-draw-color-wrap {
  display: none !important;
}

/* Nor do the shape-composition and patch tools. */
body.text-mode-active #border-patch-tools-section,
body.text-mode-active #action-merge-shapes,
body.text-mode-active #action-undo-merge,
body.text-mode-active #action-create-outline,
body.text-mode-active #action-stitch-on-top {
  display: none !important;
}

/* There is no step 3 to go back to, and the "use the Wizard instead" note
   is about digitizing an image, not typing a line of text. */
body.text-mode-active #back-to-step-3,
body.text-mode-active #editor-mobile-notice {
  display: none !important;
}

/* Design Size row: three controls plus a separator on one line leaves each
   number box ~27px of content on a 320px phone, clipping "3.00" to a single
   digit. Let the unit select drop to its own line and give the boxes a floor. */
@media (max-width: 400px) {
  .text-canvas-size-row {
    flex-wrap: wrap;
  }

  #text-canvas-width,
  #text-canvas-height {
    flex: 1 1 4.5rem;
    min-width: 4.5rem;
  }
}

/* The single Add Text button, moved into #text-mode-panel by text-mode.js. */
body.text-mode-active #text-tools-section #add-text-btn {
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
}

/* ---------------------------------------------------------------------------
   Download-page "detail got lost?" pill (#detail-rescue-body, step 5)
   Shrink-to-fit strip between the stitch preview and the download button. The
   tint comes from Bootstrap's -subtle utilities so dark mode follows
   data-bs-theme; this only handles the things utilities can't express.
   --------------------------------------------------------------------------- */
.detail-rescue-pill {
  /* Long enough to read, short enough to stay a strip rather than a paragraph. */
  max-width: min(100%, 40rem);
}

@media (max-width: 575.98px) {
  /* Once the button wraps onto its own line the pill shape reads as a blob —
     square it off and let it use the full width instead. */
  .detail-rescue-pill {
    border-radius: var(--bs-border-radius-lg) !important;
    width: 100%;
  }
}

/* Paddle price placeholders. The amount is fetched from Paddle after load, so
   the slot is dimmed until a real, already-formatted total replaces it —
   never a hardcoded figure, which would be wrong in the buyer's currency. */
.paddle-price-loading {
  display: inline-block;
  min-width: 4ch;
  opacity: 0.35;
  border-radius: 0.25rem;
  background: currentColor;
  animation: paddle-price-pulse 1.2s ease-in-out infinite;
}

@keyframes paddle-price-pulse {
  0%, 100% { opacity: 0.18; }
  50%      { opacity: 0.38; }
}
