.recipe-scaler {
  max-width: 1000px;
  margin: 0 auto;
}

/* Header */

.recipe-scaler .tool-header {
  margin-bottom: 2rem;
}

.recipe-scaler .tool-header h1 {
  margin: 0.25rem 0 0.75rem;
}

.recipe-scaler .tool-header > p:last-child {
  max-width: 760px;
  color: var(--text-muted);
  line-height: 1.6;
}

.tool-category,
.result-label {
  color: var(--main);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Main panel */

.recipe-scaler-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Settings */

.recipe-settings {
  padding: 1.5rem;
  background: var(--panel-background);
  border: 1px solid var(--border);
}

.field-group {
  min-width: 0;
}

.field-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.field-group input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-background);
  color: var(--text-dark);
  font: inherit;
}

.field-group input:focus,
.recipe-input:focus {
  outline: 2px solid var(--main);
  outline-offset: 1px;
}

.yield-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
  max-width: 600px;
  margin-top: 1.25rem;
}

.yield-arrow {
  padding-bottom: 0.7rem;
  color: var(--main);
  font-weight: 900;
  font-size: 1.2rem;
}

.scale-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.preset-button {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--main);
  background: transparent;
  color: var(--main);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.preset-button:hover,
.preset-button.active {
  background: var(--main);
  color: var(--page-background);
}

.preset-button:focus-visible {
  outline: 2px solid var(--main);
  outline-offset: 2px;
}

/* Editors */

.recipe-editor {
  padding: 1.5rem;
  background: var(--panel-background);
  border: 1px solid var(--border);
}

.recipe-editor-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.recipe-editor-header h2 {
  margin: 0;
}

.recipe-editor-header p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.recipe-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-background);
  color: var(--text-dark);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.recipe-input::placeholder {
  color: var(--text-muted-dark);
  opacity: 0.8;
}

.ingredient-help {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-top: 0.75rem;
  color: var(--text-muted-dark);
  font-size: 0.85rem;
}

.ingredient-help strong {
  color: var(--text);
}

.ingredient-help span {
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  background: var(--surface-background);
}

/* Instructions */

.instructions-editor {
  margin-top: 0;
}

.instructions-editor h2 span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Result */

.recipe-result {
  padding: 1.5rem;
  background: var(--panel-background);
  border: 1px solid var(--border);
}

.recipe-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.recipe-result-header h2 {
  margin: 0.25rem 0;
}

.result-yield {
  margin: 0;
  color: var(--text-muted);
}

.tool-button,
.secondary-button {
  flex-shrink: 0;
}

/* Scaled ingredients */

.scaled-ingredients {
  display: flex;
  flex-direction: column;
}

.scaled-ingredient {
  display: grid;
  grid-template-columns: 90px 80px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.scaled-quantity {
  font-weight: 700;
  text-align: right;
}

.scaled-unit {
  color: var(--text-muted);
}

.scaled-ingredient-text {
  min-width: 0;
}

.scaled-ingredient.unparsed {
  display: block;
  color: var(--text-muted);
}

.unparsed-indicator {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--main);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ingredient-spacer {
  height: 0.5rem;
}

/* Instructions output */

.scaled-instructions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.scaled-instructions h3 {
  margin: 0 0 0.75rem;
}

#instructions-output {
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Messages */

.recipe-message {
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--panel-background);
}

.recipe-message.error {
  color: var(--error);
}

/* SEO content */

.recipe-scaler .tool-info {
  max-width: 850px;
  margin-top: 3rem;
}

.recipe-scaler .tool-info h2 {
  margin-top: 2.5rem;
}

.recipe-scaler .tool-info h2:first-child {
  margin-top: 0;
}

.recipe-scaler .tool-info h3 {
  margin-top: 1.5rem;
}

.recipe-scaler .tool-info p {
  color: var(--text-muted);
  line-height: 1.7;
}

/* Responsive */

@media (max-width: 700px) {
  .recipe-settings,
  .recipe-editor,
  .recipe-result {
    padding: 1rem;
  }

  .yield-fields {
    grid-template-columns: 1fr;
    max-width: none;
    gap: 0.75rem;
  }

  .yield-arrow {
    display: none;
  }

  .recipe-editor-header,
  .recipe-result-header {
    flex-direction: column;
    align-items: stretch;
  }

  .recipe-result-header .tool-button,
  .recipe-editor-header .secondary-button {
    width: 100%;
  }

  .scaled-ingredient {
    grid-template-columns: 70px 65px minmax(0, 1fr);
    gap: 0.5rem;
  }

  .ingredient-help {
    display: block;
  }

  .ingredient-help strong,
  .ingredient-help span {
    display: inline-block;
    margin: 0.2rem 0.2rem 0 0;
  }
}