.rng-generator,
.rng-generator * {
  box-sizing: border-box;
}

.rng-generator {
  --rng-blue: #385a78;
  --rng-blue-soft: #eaf1f6;
  --rng-border: #cbd9e3;
  --rng-orange: #c65a32;
  --rng-text: #263744;
  max-width: 1180px;
  margin: 24px auto;
  color: var(--rng-text);
  font-family: Arial, sans-serif;
}

.rng-generator__header {
  margin-bottom: 20px;
}

.rng-generator__header h2 {
  margin: 2px 0 6px;
  color: #243f57;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
}

.rng-generator__header p {
  margin: 0;
}

.rng-generator__eyebrow {
  color: var(--rng-blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rng-generator__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 28px;
  align-items: start;
}

.rng-controls {
  display: grid;
  gap: 16px;
}

.rng-fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--rng-border);
  border-radius: 10px;
  background: #fff;
}

.rng-fieldset legend {
  width: auto;
  margin: 0;
  padding: 0 7px;
  color: #294a65;
  font-size: 17px;
  font-weight: 700;
}

.rng-fieldset legend small {
  color: #607483;
  font-size: 13px;
  font-weight: 400;
}

.rng-fieldset label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  font-weight: 700;
}

.rng-fieldset label:last-child {
  margin-bottom: 0;
}

.rng-fieldset label small {
  font-weight: 400;
}

.rng-fieldset input,
.rng-fieldset select {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #aebfcb;
  border-radius: 6px;
  background: #fff;
  color: #1f303c;
  font-size: 16px;
  box-shadow: none;
}

.rng-color-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rng-fieldset input[type="color"] {
  width: 64px;
  height: 44px;
  padding: 4px;
  cursor: pointer;
}

.rng-color-value {
  color: #536875;
  font-family: Consolas, monospace;
  font-size: 14px;
}

.rng-fieldset input:focus,
.rng-fieldset select:focus,
.rng-generator button:focus-visible {
  outline: 3px solid rgba(56, 90, 120, .22);
  outline-offset: 2px;
  border-color: var(--rng-blue);
}

.rng-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rng-segmented button {
  min-height: 70px;
  padding: 11px;
  border: 2px solid var(--rng-border);
  border-radius: 8px;
  background: #fff;
  color: #294a65;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.rng-segmented button small {
  display: block;
  margin-top: 3px;
  color: #667986;
  font-size: 12px;
  font-weight: 400;
}

.rng-segmented button.is-active {
  border-color: var(--rng-blue);
  background: var(--rng-blue-soft);
}

.rng-image-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.rng-remove-image {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #b9c6ce;
  border-radius: 6px;
  background: #fff;
  color: #344d60;
  cursor: pointer;
}

.rng-upload-button {
  display: block !important;
  margin: 0 0 6px !important;
  padding: 11px 14px;
  border: 1px solid #7d96a8;
  border-radius: 6px;
  background: var(--rng-blue-soft);
  color: #294a65;
  text-align: center;
  cursor: pointer;
}

.rng-upload-button:hover {
  border-color: var(--rng-blue);
}

.rng-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.rng-upload-help,
.rng-image-quality {
  margin: 6px 0 12px;
  color: #607483;
  font-size: 12px;
  line-height: 1.4;
}

.rng-image-quality {
  padding: 8px 10px;
  border-radius: 5px;
  font-weight: 700;
}

.rng-image-quality.is-good {
  background: #e8f5eb;
  color: #246332;
}

.rng-image-quality.is-warning {
  background: #fff4d9;
  color: #7a5511;
}

.rng-image-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(52px, 1fr));
  gap: 8px;
  max-height: 250px;
  overflow: auto;
  padding: 3px;
  scrollbar-gutter: stable;
}

.rng-image-option {
  aspect-ratio: 1;
  min-width: 0;
  padding: 5px;
  border: 2px solid #dce4e9;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.rng-image-option:hover {
  border-color: #7892a5;
}

.rng-image-option.is-selected {
  border-color: var(--rng-orange);
  box-shadow: 0 0 0 2px rgba(198, 90, 50, .18);
}

.rng-image-option img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rng-image-layout {
  display: grid;
  gap: 10px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid #dce4e9;
}

.rng-image-layout[hidden] {
  display: none !important;
}

.rng-control-title,
.rng-image-layout label > span {
  font-weight: 700;
}

.rng-position-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rng-position-buttons button {
  min-height: 42px;
  border: 1px solid #aebfcb;
  border-radius: 6px;
  background: #fff;
  color: #294a65;
  cursor: pointer;
}

.rng-position-buttons button.is-active {
  border-color: var(--rng-blue);
  background: var(--rng-blue-soft);
  font-weight: 700;
}

.rng-reset-layout {
  min-height: 42px;
	margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #aebfcb;
  border-radius: 6px;
  background: #fff;
  color: #294a65;
  cursor: pointer;
}

.rng-fieldset input[type="range"] {
  height: 32px;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.rng-preview-sticky {
  position: sticky;
  top: 24px;
  padding: 22px;
  border: 1px solid var(--rng-border);
  border-radius: 12px;
  background: #f5f8fa;
}

.rng-preview-sticky h3 {
  margin: 0 0 2px;
  color: #294a65;
  font-size: 21px;
}

.rng-size-caption {
  min-height: 20px;
  margin: 0 0 15px;
  color: #627684;
  font-size: 13px;
}

.rng-drag-help {
  margin: -8px 0 12px;
  color: #536875;
  font-size: 12px;
}

.rng-preview-stage {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 34px 22px;
  border-radius: 9px;
  background-color: #cbd9e3;
  background-image: repeating-linear-gradient(35deg, rgba(255,255,255,.12) 0 2px, rgba(70,95,112,.035) 2px 4px);
}

.rng-preview {
  display: block;
  width: 100%;
  max-width: 600px;
  overflow: visible;
  filter: drop-shadow(0 5px 5px rgba(30, 50, 63, .2));
}

.rng-preview text {
  fill: #111;
}

.rng-draggable {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.rng-draggable.is-dragging {
  cursor: grabbing;
}

.rng-summary {
  margin: 16px 0;
  padding-left: 21px;
  color: #536875;
  font-size: 13px;
}

.rng-error {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #d89983;
  border-radius: 6px;
  background: #fff2ed;
  color: #8b3217;
  font-weight: 700;
}

.rng-add-to-cart {
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 7px;
  background: var(--rng-orange);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.rng-add-to-cart:hover {
  background: #a94725;
}

.rng-add-to-cart:disabled {
  cursor: wait;
  opacity: .65;
}

.rng-notice {
  margin: 10px 0 0;
  color: #607483;
}

@media (max-width: 900px) {
  .rng-generator__layout {
    grid-template-columns: 1fr;
  }

  .rng-preview-column {
	grid-row: auto;
  }

  .rng-preview-sticky {
    position: static;
  }

  .rng-preview-stage {
    min-height: 230px;
  }
}

@media (max-width: 520px) {
  .rng-generator {
    margin: 14px auto;
  }

  .rng-generator__header {
    padding: 0 2px;
  }

  .rng-fieldset,
  .rng-preview-sticky {
    padding: 14px;
  }

  .rng-segmented {
    grid-template-columns: 1fr;
  }

  .rng-image-grid {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
  }

  .rng-preview-stage {
    min-height: 185px;
    padding: 24px 14px;
  }

  .rng-summary {
    display: none;
  }
}
