*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #282c34;
  color: #fff;
  font-size: 22px;
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
  min-height: 100vh;
}

h1 {
  font-size: 2.6rem;
  color: #d4f1c6;
  text-align: center;
  margin-bottom: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.4rem;
  color: #d4f1c6;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

a {
  color: #61dafb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.recipe-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recipe-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.recipe-card-name {
  font-size: 1.2rem;
  font-weight: 500;
}

.recipe-card-arrow {
  opacity: 0.4;
  font-size: 1.1rem;
}

.btn {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: #d4f1c6;
  color: #282c34;
  border-color: #d4f1c6;
  font-weight: 600;
}

.btn-primary:hover {
  background: #c2e8b0;
  border-color: #c2e8b0;
}

.btn-danger {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.15);
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.back-link {
  font-size: 0.95rem;
  cursor: pointer;
  color: #61dafb;
  user-select: none;
}

.back-link:hover {
  text-decoration: underline;
}

.count-section {
  margin-bottom: 1.5rem;
}

.count-display {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.ingredient-line {
  padding: 0.15rem 0;
  font-size: 1.05rem;
}

.recipe-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.85rem;
  padding: 1.2rem 1rem;
  color: rgba(255, 255, 255, 0.6);
}

.recipe-footer a {
  color: #61dafb;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #d4f1c6;
  margin-bottom: 0.3rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: #fff;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: #d4f1c6;
}

.form-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.form-input-sm {
  width: auto;
  max-width: 100px;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
}

.form-row .form-group {
  flex: 1;
}

.form-row .form-group-sm {
  flex: 0 0 90px;
}

.ingredients-section h2 {
  margin-bottom: 1rem;
}

.ing-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  position: relative;
}

.ing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.ing-card-num {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ing-delete-btn {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0 0.3rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.ing-delete-btn:hover {
  opacity: 1;
}

.ing-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.ing-amount-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ing-amount-row .form-input {
  width: 80px;
  flex-shrink: 0;
}

.ing-amount-row .unit-input {
  width: 70px;
  flex-shrink: 0;
}

.ing-amount-row .per-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.ing-note-row {
  margin-top: 0.4rem;
}

.ing-note-row .form-input {
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.add-ingredient-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: rgba(212, 241, 198, 0.08);
  border: 2px dashed rgba(212, 241, 198, 0.25);
  border-radius: 8px;
  color: #d4f1c6;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 0.5rem;
}

.add-ingredient-btn:hover {
  background: rgba(212, 241, 198, 0.14);
  border-color: rgba(212, 241, 198, 0.4);
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.edit-actions .spacer {
  flex: 1;
}

.section-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1.5rem 0;
}

#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #444;
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
}

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

.loading {
  text-align: center;
  padding-top: 4rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.1rem;
}

@media (max-width: 480px) {
  body {
    font-size: 20px;
  }

  #app {
    padding: 1.5rem 1rem 5rem;
  }

  h1 {
    font-size: 2.1rem;
    margin-bottom: 2rem;
  }

  .ing-amount-row {
    flex-wrap: wrap;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-row .form-group-sm {
    flex: 1;
  }
}