.rj-body-parameter-tool {
  --rjbp-border: #d8dee4;
  --rjbp-soft: #f6f8fa;
  --rjbp-bg: #fff;
  --rjbp-text: #24292f;
  --rjbp-muted: #646970;
  --rjbp-accent: #2f6fdd;
  --rjbp-accent-soft: #eef4ff;
  --rjbp-error: #b42318;
  --rjbp-success: #166534;
  --rjbp-warning: #8a5a00;
  color: var(--rjbp-text);
  margin: 1.5rem 0;
  font-size: 15px;
  line-height: 1.65;
}

.rj-body-parameter-tool *,
.rj-body-parameter-tool *::before,
.rj-body-parameter-tool *::after {
  box-sizing: border-box;
}

.rjbp-guide,
.rjbp-section,
.rjbp-notes {
  margin: 16px 0;
  border: 1px solid var(--rjbp-border);
  border-radius: 12px;
  background: var(--rjbp-bg);
}

.rjbp-guide {
  padding: 0 18px 16px;
}

.rjbp-guide summary {
  padding: 16px 0;
  cursor: pointer;
  font-weight: 700;
}

.rjbp-guide ol {
  margin: 0 0 12px 1.4em;
}

.rjbp-guide p,
.rjbp-section-note,
.rjbp-field-note,
.rjbp-derived-card p,
.rjbp-candidate-box small {
  color: var(--rjbp-muted);
  font-size: 13px;
}

.rjbp-section {
  padding: 18px;
}


.rjbp-section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.rjbp-section-heading-row .rjbp-section-title {
  margin-bottom: 0;
}

.rjbp-section-title {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.4;
}

.rjbp-section-fixed-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--rjbp-soft);
}

.rjbp-section-action-label {
  margin-right: auto;
  color: var(--rjbp-muted);
  font-size: 12px;
  font-weight: 700;
}

.rjbp-section-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.rjbp-required-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 14px;
  align-items: end;
}

.rjbp-scale-help {
  padding: 12px 14px;
  border-radius: 9px;
  background: var(--rjbp-soft);
  color: var(--rjbp-muted);
  font-size: 13px;
}

.rjbp-field-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.rjbp-label,
.rjbp-mini-label {
  font-weight: 700;
}

.rjbp-mini-label {
  display: inline-block;
  margin-right: 8px;
  color: var(--rjbp-muted);
  font-size: 12px;
}

.rjbp-select,
.rjbp-number-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--rjbp-border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--rjbp-text);
  font: inherit;
}

.rjbp-select:focus,
.rjbp-number-input:focus,
.rjbp-button:focus,
.rjbp-step-button:focus {
  outline: 2px solid color-mix(in srgb, var(--rjbp-accent) 35%, transparent);
  outline-offset: 2px;
}

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

.rjbp-number-card {
  padding: 14px;
  border: 1px solid var(--rjbp-border);
  border-radius: 10px;
  background: #fff;
}

.rjbp-number-card.is-stale .rjbp-candidate-box {
  border-color: #d7a73d;
  background: #fff9e8;
}

.rjbp-number-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.rjbp-fixed-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--rjbp-muted);
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
}

.rjbp-fixed-label input {
  margin-top: 2px;
  flex: 0 0 auto;
}

.rjbp-current-value {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rjbp-value-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.rjbp-unit {
  color: var(--rjbp-muted);
  font-size: 13px;
}

.rjbp-step-buttons,
.rjbp-number-actions,
.rjbp-secondary-actions,
.rjbp-batch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rjbp-step-buttons {
  margin: 8px 0 12px;
}

.rjbp-step-button,
.rjbp-button {
  min-height: 40px;
  border: 1px solid var(--rjbp-border);
  border-radius: 8px;
  padding: 8px 13px;
  background: #fff;
  color: var(--rjbp-text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
}

.rjbp-step-button {
  min-width: 48px;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 12px;
}

.rjbp-button:hover,
.rjbp-step-button:hover {
  border-color: var(--rjbp-accent);
}

.rjbp-button-primary {
  border-color: var(--rjbp-accent);
  background: var(--rjbp-accent);
  color: #fff;
}

.rjbp-button-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.rjbp-button-quiet {
  color: var(--rjbp-muted);
}

.rjbp-button:disabled,
.rjbp-step-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.rjbp-candidate-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: baseline;
  min-height: 62px;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--rjbp-border);
  border-radius: 8px;
  background: var(--rjbp-soft);
}

.rjbp-candidate-box small {
  grid-column: 1 / -1;
  display: block;
}

.rjbp-derived-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--rjbp-border);
  border-radius: 10px;
  background: var(--rjbp-soft);
}

.rjbp-derived-card p {
  margin: 5px 0 0;
}

.rjbp-derived-card ul {
  margin: 8px 0 0 1.25em;
  color: var(--rjbp-muted);
  font-size: 13px;
}

.rjbp-cup-details {
  margin-top: 14px;
  border-top: 1px solid var(--rjbp-border);
  padding-top: 12px;
}

.rjbp-cup-details summary {
  cursor: pointer;
  font-weight: 700;
}

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

.rjbp-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .75fr);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--rjbp-border);
  border-radius: 10px;
}

.rjbp-field-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
}

.rjbp-field-note {
  margin: 4px 0 0;
}

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

.rjbp-batch-grid .rjbp-button {
  width: 100%;
}

.rjbp-secondary-actions {
  margin-top: 12px;
}

.rjbp-notes {
  padding: 16px 18px;
  background: var(--rjbp-soft);
}

.rjbp-notes p {
  margin: 8px 0;
  color: var(--rjbp-muted);
  font-size: 13px;
}

.rjbp-status {
  min-height: 1.6em;
  margin: 10px 0;
  font-size: 13px;
  font-weight: 700;
}

.rjbp-status[data-status="error"] { color: var(--rjbp-error); }
.rjbp-status[data-status="success"] { color: var(--rjbp-success); }
.rjbp-status[data-status="warning"] { color: var(--rjbp-warning); }


.rjbp-preset-panel {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--rjbp-border);
  border-radius: 10px;
  background: var(--rjbp-accent-soft);
}

.rjbp-preset-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr);
  gap: 14px;
  align-items: start;
}

.rjbp-preset-mode {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rjbp-preset-mode label {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13px;
}

.rjbp-preset-mode input {
  margin-top: 4px;
}

.rjbp-preset-actions {
  margin: 12px 0 6px;
}

@media (max-width: 900px) {
  .rjbp-number-grid,
  .rjbp-select-grid,
  .rjbp-batch-grid,
  .rjbp-required-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .rjbp-section,
  .rjbp-guide,
  .rjbp-notes {
    border-radius: 9px;
  }

  .rjbp-section {
    padding: 14px;
  }

  .rjbp-select-row {
    grid-template-columns: 1fr;
  }

  .rjbp-section-heading-row,
  .rjbp-number-head,
  .rjbp-current-value {
    align-items: stretch;
    flex-direction: column;
  }

  .rjbp-section-fixed-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rjbp-section-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .rjbp-section-heading-row .rjbp-button,
  .rjbp-section-action-buttons .rjbp-button,
  .rjbp-number-actions .rjbp-button,
  .rjbp-secondary-actions .rjbp-button,
  .rjbp-batch-grid .rjbp-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .rjbp-preset-grid {
    grid-template-columns: 1fr;
  }
}

.rjbp-subsection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rjbp-border);
}

.rjbp-subsection:first-of-type {
  margin-top: 8px;
}

.rjbp-subsection-title {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
}

.rjbp-composite-field {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--rjbp-border);
  border-radius: 10px;
  background: var(--rjbp-soft);
}

.rjbp-composite-field-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rjbp-composite-field-head .rjbp-field-note {
  margin-bottom: 0;
}

.rjbp-hair-style-list {
  display: grid;
  gap: 8px;
}

.rjbp-hair-style-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--rjbp-border);
  border-radius: 9px;
  background: var(--rjbp-bg);
}

.rjbp-hair-style-number {
  min-width: 48px;
  color: var(--rjbp-muted);
  font-size: 12px;
  font-weight: 700;
}

.rjbp-hair-fixed-label {
  align-items: center;
  white-space: nowrap;
}

.rjbp-hair-fixed-label input {
  margin-top: 0;
}

.rjbp-textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--rjbp-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--rjbp-text);
  font: inherit;
  line-height: 1.6;
}

.rjbp-textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--rjbp-accent) 35%, transparent);
  outline-offset: 2px;
}

.rjbp-character-count {
  align-self: flex-end;
  color: var(--rjbp-muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .rjbp-hair-style-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .rjbp-hair-style-number {
    grid-column: 1 / -1;
  }

  .rjbp-hair-style-row .rjbp-select {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .rjbp-composite-field-head {
    flex-direction: column;
  }

  .rjbp-composite-field-head .rjbp-button {
    width: 100%;
  }

  .rjbp-hair-style-row {
    grid-template-columns: 1fr 1fr;
  }

  .rjbp-hair-style-number,
  .rjbp-hair-style-row .rjbp-select {
    grid-column: 1 / -1;
  }

  .rjbp-hair-style-row .rjbp-fixed-label {
    justify-self: start;
  }

  .rjbp-hair-style-row [data-rjbp-reroll-hair-style],
  .rjbp-hair-style-row [data-rjbp-remove-hair-style] {
    width: 100%;
  }
}
