:root {
  --bg: #17110b;
  --bg-soft: #21170f;
  --panel: rgba(255, 248, 234, 0.08);
  --panel-strong: rgba(255, 248, 234, 0.13);
  --text: #fff8ea;
  --muted: #cdbfa8;
  --accent: #e44e2d;
  --accent-2: #f3b34c;
  --green: #6fa45b;
  --danger: #c94b3f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(228, 78, 45, 0.24), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(111, 164, 91, 0.18), transparent 28rem),
    linear-gradient(135deg, #17110b 0%, #21170f 54%, #120d08 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 8vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.subtitle {
  max-width: 700px;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  line-height: 1.55;
  margin-bottom: 0;
}

.hero-badge {
  min-width: 160px;
  padding: 24px;
  border: 1px solid rgba(255, 248, 234, 0.16);
  border-radius: 50%;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  text-align: center;
  background: linear-gradient(145deg, rgba(228, 78, 45, 0.25), rgba(255, 248, 234, 0.08));
  box-shadow: var(--shadow);
}

.hero-badge span {
  display: block;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.hero-badge small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.panel,
.result-card {
  border: 1px solid rgba(255, 248, 234, 0.13);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.controls-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 16px;
  padding: 16px;
  margin-bottom: 18px;
}

.control-card {
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 248, 234, 0.07);
}

.control-card label,
.control-card > span {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 850;
}

.stepper {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 10px;
  align-items: center;
}

.stepper button,
.secondary-button,
.primary-button,
.danger-button,
.editor-toggle {
  border: 0;
  color: var(--text);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.stepper button {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 248, 234, 0.12);
  font-size: 1.6rem;
  line-height: 1;
}

.stepper button:hover,
.secondary-button:hover,
.primary-button:hover,
.danger-button:hover,
.editor-toggle:hover {
  transform: translateY(-1px);
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 248, 234, 0.16);
  border-radius: 16px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  outline: none;
  padding: 13px 14px;
}

input:focus {
  border-color: rgba(243, 179, 76, 0.8);
  box-shadow: 0 0 0 4px rgba(243, 179, 76, 0.13);
}

.input-with-unit,
.field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.input-with-unit span,
.field span {
  color: var(--muted);
  font-weight: 800;
}

.total-card strong {
  display: block;
  font-size: 2.2rem;
  letter-spacing: -0.05em;
}

.total-card small {
  color: var(--muted);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.result-card {
  padding: 22px;
  min-height: 300px;
}

.result-card.accent {
  background: linear-gradient(160deg, rgba(228, 78, 45, 0.2), rgba(255, 248, 234, 0.07));
}

.result-card.totals {
  background: linear-gradient(160deg, rgba(111, 164, 91, 0.18), rgba(255, 248, 234, 0.07));
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.card-title-row h2 {
  margin-bottom: 0;
  letter-spacing: -0.04em;
  font-size: 1.7rem;
}

.card-title-row span {
  color: var(--accent-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-weight: 900;
  white-space: nowrap;
}

.ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.ingredients li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 248, 234, 0.12);
  color: var(--muted);
}

.ingredients li:last-child {
  border-bottom: 0;
}

.ingredients strong {
  color: var(--text);
  font-size: 1.16rem;
}

.notes-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.notes-panel h2 {
  margin-bottom: 6px;
}

.notes-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.secondary-button,
.primary-button,
.danger-button {
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 900;
  white-space: nowrap;
}

.secondary-button {
  border: 1px solid rgba(255, 248, 234, 0.18);
  background: rgba(255, 248, 234, 0.1);
}

.primary-button {
  background: var(--green);
}

.danger-button {
  background: rgba(201, 75, 63, 0.86);
}

.editor {
  overflow: hidden;
}

.editor-toggle {
  width: 100%;
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background: transparent;
}

.editor-toggle span {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.editor-toggle small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 900;
}

.editor-body {
  border-top: 1px solid rgba(255, 248, 234, 0.12);
  padding: 22px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.editor-grid label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-weight: 800;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  background: #fff8ea;
  color: #17110b;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .hero,
  .controls-panel,
  .results-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .hero-badge {
    width: 150px;
    min-width: unset;
    justify-self: start;
    border-radius: 28px;
    aspect-ratio: auto;
  }

  .result-card {
    min-height: unset;
  }
}

@media (max-width: 540px) {
  .shell {
    width: min(100% - 22px, 1120px);
    padding-top: 18px;
  }

  .controls-panel,
  .result-card,
  .notes-panel,
  .editor-body,
  .editor-toggle {
    padding: 16px;
  }

  .notes-panel,
  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button,
  .primary-button,
  .danger-button {
    width: 100%;
  }

  .card-title-row {
    align-items: baseline;
  }
}
