:root {
  color-scheme: light;
  font-family: 'Poppins', system-ui, sans-serif;
  background-color: #fff6f8;
  color: #402627;
  line-height: 1.65;
  --background: #fff6f8;
  --background-soft: #ffedf2;
  --surface: #ffffff;
  --surface-soft: #fff9f6;
  --accent: #d87f8d;
  --accent-strong: #b15c69;
  --accent-soft: #f6cdd4;
  --accent-mint: #8bf4c6;
  --accent-mint-soft: #c8ffe5;
  --neon-glow: rgba(139, 244, 198, 0.45);
  --text: #402627;
  --text-soft: #725051;
  --highlight: #ffe3eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top left, rgba(248, 221, 230, 0.7), transparent 58%),
    radial-gradient(circle at 80% 18%, rgba(139, 244, 198, 0.22), transparent 55%),
    radial-gradient(circle at bottom right, rgba(255, 228, 228, 0.7), transparent 55%),
    var(--background);
}

main {
  width: min(1100px, 94vw);
  margin: 0 auto 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}

.app-header {
  position: relative;
  margin: clamp(1.5rem, 4vw, 3rem) auto;
  width: min(1100px, 94vw);
  padding: clamp(2rem, 6vw, 3.8rem);
  border-radius: 36px;
  overflow: hidden;
  background: linear-gradient(130deg, rgba(255, 236, 242, 0.95), rgba(252, 213, 222, 0.85) 55%, rgba(139, 244, 198, 0.3));
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  text-align: center;
  box-shadow: 0 30px 60px -45px rgba(124, 70, 81, 0.45);
}

.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 25%, rgba(139, 244, 198, 0.45), transparent 48%),
    repeating-radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.55) 0 6px, transparent 8px 18px);
  opacity: 0.25;
  mix-blend-mode: screen;
  pointer-events: none;
}

.app-header::after {
  content: '';
  position: absolute;
  top: -120px;
  right: -140px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(216, 127, 141, 0.32), transparent 55%),
    radial-gradient(circle at 35% 60%, rgba(139, 244, 198, 0.32), transparent 70%);
  pointer-events: none;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 1.9rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.78), rgba(139, 244, 198, 0.45));
  color: var(--accent-strong);
  font-family: 'Parisienne', cursive;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  letter-spacing: 0.08em;
  box-shadow: 0 10px 24px -18px rgba(139, 244, 198, 0.85);
}

h1 {
  margin: 0;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

h2,
h3 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  color: var(--text);
}

.tagline {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  color: var(--text-soft);
  max-width: 36ch;
}

.header-note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent-strong);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.7), rgba(139, 244, 198, 0.35));
  padding: 0.5rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 24px -18px rgba(139, 244, 198, 0.65);
}

.header-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.7), rgba(139, 244, 198, 0.38));
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 30px -26px rgba(139, 244, 198, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  flex-wrap: wrap;
  justify-content: center;
}

.app-footer {
  margin-top: auto;
  background: transparent;
  text-align: center;
  font-size: 0.95rem;
  padding: 2rem 1rem 3rem;
  color: var(--text-soft);
}

.app-footer span {
  font-family: 'Parisienne', cursive;
  font-size: 1.05rem;
}

.card {
  background: var(--surface);
  border-radius: 28px;
  box-shadow: 0 22px 40px -34px rgba(105, 53, 66, 0.55);
  padding: clamp(1.8rem, 4vw, 2.8rem);
  border: 1px solid rgba(216, 127, 141, 0.12);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(139, 244, 198, 0.35), transparent 55%);
  pointer-events: none;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 247, 249, 0.75), transparent 50%);
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-header {
  margin-bottom: 1.25rem;
}

.card-header h2 {
  margin: 0 0 0.4rem;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  color: var(--text);
}

.card-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 1rem;
}

.grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.form-column,
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--text);
}

input,
select,
button,
textarea {
  font-family: inherit;
}

input,
select,
textarea {
  padding: 0.7rem 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(177, 92, 105, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 230, 237, 0.58));
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: inset 0 0 12px -10px rgba(139, 244, 198, 0.6);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(177, 92, 105, 0.45);
  box-shadow: 0 0 0 3px rgba(216, 127, 141, 0.25), 0 0 0 6px rgba(139, 244, 198, 0.12);
  transform: translateY(-1px);
}

button {
  border: none;
  padding: 0.7rem 1.45rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button.primary {
  background: linear-gradient(130deg, #d87f8d, #c9687a 52%, rgba(139, 244, 198, 0.9));
  color: #331d21;
  box-shadow: 0 18px 32px -20px rgba(216, 127, 141, 0.9), 0 0 22px -12px var(--neon-glow);
}

button.secondary {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(139, 244, 198, 0.42));
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.3), 0 10px 20px -16px rgba(139, 244, 198, 0.9);
}

button.ghost {
  background: rgba(255, 255, 255, 0.65);
  color: var(--accent-strong);
  border: 1px dashed rgba(216, 127, 141, 0.6);
  box-shadow: inset 0 0 0 1px rgba(139, 244, 198, 0.25);
}

button.danger {
  background: linear-gradient(135deg, #ff7f86, #e45a63);
  color: white;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 26px -18px rgba(115, 54, 65, 0.35), 0 0 18px -10px var(--neon-glow);
}

button:active {
  transform: translateY(0);
}

.serving-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.serving-inputs {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 0.8rem;
}

#serving-slider {
  accent-color: var(--accent);
}

.ingredients-editor {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.65fr) minmax(90px, 0.6fr) 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.ingredient-row button {
  padding: 0.45rem 0.8rem;
  background: linear-gradient(135deg, rgba(216, 127, 141, 0.12), rgba(139, 244, 198, 0.35));
  color: var(--accent-strong);
}

.saved-recipes ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.saved-recipes li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(120deg, rgba(255, 226, 235, 0.85), rgba(139, 244, 198, 0.28), rgba(255, 255, 255, 0.85));
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  gap: 0.5rem;
  box-shadow: 0 10px 20px -18px rgba(139, 244, 198, 0.85);
}

.saved-recipes button {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.recipe-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 226, 235, 0.58), rgba(139, 244, 198, 0.28));
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.18), 0 14px 26px -24px rgba(105, 53, 66, 0.35),
    0 0 20px -14px var(--neon-glow);
}

.recipe-card header {
  margin-bottom: 1rem;
}

.recipe-card h3 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-family: 'Playfair Display', 'Times New Roman', serif;
}

.recipe-card .servings {
  margin: 0.25rem 0 0;
  color: var(--accent-strong);
}

.scaled-ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scaled-ingredients li {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.94), rgba(139, 244, 198, 0.18));
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.1);
}

.scaled-ingredients li span.tooltip {
  position: absolute;
  left: 1rem;
  bottom: calc(100% + 0.4rem);
  background: var(--accent-strong);
  color: white;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  transform: translateY(4px);
}

.scaled-ingredients li:hover span.tooltip {
  opacity: 1;
  transform: translateY(0);
}

.note {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.converter {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.4rem 0;
}

.input-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-buttons button {
  background: linear-gradient(135deg, rgba(216, 127, 141, 0.15), rgba(139, 244, 198, 0.35));
  color: var(--accent-strong);
  font-size: 0.85rem;
  border-radius: 12px;
}

.conversion-output {
  display: grid;
  gap: 0.6rem;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.92), rgba(139, 244, 198, 0.2));
  border-radius: 12px;
  padding: 1rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.12), 0 0 18px -14px var(--neon-glow);
}

.references {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.reference-card {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(255, 236, 242, 0.85), rgba(139, 244, 198, 0.24));
  border-radius: 14px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.14);
}

.reference-card h3 {
  margin: 0;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  color: var(--text);
}

.reference-card ul {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.reference-card li {
  font-size: 0.96rem;
  color: var(--text-soft);
}

.bakers-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.bakers-table {
  display: grid;
  gap: 0.75rem;
}

.bakers-row {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  align-items: end;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.92), rgba(139, 244, 198, 0.18));
  padding: 0.85rem;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(216, 127, 141, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(216, 127, 141, 0.18);
  color: var(--accent-strong);
}

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle .slider {
  position: relative;
  width: 70px;
  height: 34px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(139, 244, 198, 0.32));
  border-radius: 999px;
  border: 1px solid rgba(216, 127, 141, 0.35);
  box-shadow: inset 0 0 8px rgba(216, 127, 141, 0.15), 0 0 12px -8px var(--neon-glow);
}

.toggle .slider::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #ffe5ec 55%, rgba(139, 244, 198, 0.6));
  transition: transform 0.2s ease;
  box-shadow: 0 6px 14px -6px rgba(177, 92, 105, 0.45), 0 0 12px -6px var(--neon-glow);
}

.toggle input:checked + .slider::after {
  transform: translateX(36px);
}

.toggle .labels {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.75rem;
  color: var(--accent-strong);
  font-weight: 600;
}

@media (max-width: 720px) {
  .app-header {
    padding: clamp(1.6rem, 8vw, 2.4rem);
    border-radius: 26px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .header-note {
    font-size: 0.85rem;
  }

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

  .ingredient-row {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
    grid-template-rows: auto auto;
  }

  .ingredient-row input:nth-child(1),
  .ingredient-row input:nth-child(2) {
    grid-column: span 1;
  }

  .ingredient-row input:nth-child(3) {
    grid-column: span 2;
  }

  .ingredient-row button {
    grid-column: span 2;
    justify-self: flex-start;
  }

  .serving-inputs {
    grid-template-columns: 1fr;
  }

  .bakers-row {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
  }

  .bakers-row input {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }
  .app-header,
  .app-footer,
  #unit-converter,
  #equivalents,
  #bakers-percentage,
  #fraction-note,
  .saved-recipes,
  .form-actions,
  #recipe-form {
    display: none !important;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .card {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .recipe-card {
    background: white;
    box-shadow: none;
    padding: 0;
  }
}
