:root {
  color-scheme: light;

  --color-bg: #f5f0e2;
  --color-surface: #ffffff;
  --color-header-bg: #445429;
  --color-header-text: #f5f0e2;
  --color-header-sub: #ecd3a4;
  --color-primary: #445429;
  --color-primary-hover: #333f1f;
  --color-on-primary: #f5f0e2;
  --color-accent: #bf4f2b;
  --color-accent-hover: #9c3e20;
  --color-on-accent: #ffffff;
  --color-tile-bg: #ecd3a4;
  --color-tile-hover: #e2c088;
  --color-text: #2b2a1f;
  --color-muted: #6d6b5a;
  --color-border: #d8cdb0;

  --color-paper: #fffdf6;
  --color-paper-line: rgba(68, 84, 41, 0.09);
  --color-tape: rgba(236, 211, 164, 0.85);
  --color-photo-frame: #ffffff;
  --color-shadow: rgba(60, 50, 20, 0.28);
  --color-shadow-soft: rgba(60, 50, 20, 0.1);

  --font-notiz: 'Caveat', 'Segoe Print', cursive;
  --radius: 0.75rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #1c1d16;
  --color-surface: #26281f;
  --color-header-bg: #2c3619;
  --color-header-text: #f0ead8;
  --color-header-sub: #d9c08f;
  --color-primary: #a3bb6e;
  --color-primary-hover: #b6cc84;
  --color-on-primary: #1c1d16;
  --color-accent: #e27a52;
  --color-accent-hover: #ec916d;
  --color-on-accent: #1c1d16;
  --color-tile-bg: #3a3424;
  --color-tile-hover: #4a4230;
  --color-text: #ece6d3;
  --color-muted: #a8a48e;
  --color-border: #45473a;

  --color-paper: #2b2a22;
  --color-paper-line: rgba(236, 230, 211, 0.06);
  --color-tape: rgba(217, 192, 143, 0.35);
  --color-photo-frame: #3a3a30;
  --color-shadow: rgba(0, 0, 0, 0.55);
  --color-shadow-soft: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, sans-serif;
  line-height: 1.4;
}

a {
  color: var(--color-accent);
}

.icon {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


header {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
}

.header-gruppe {
  display: flex;
  gap: 0.25rem;
}

.header-links {
  grid-column: 1;
  justify-self: start;
}

.header-titel {
  grid-column: 2;
  text-align: center;
}

.header-rechts {
  grid-column: 3;
  justify-self: end;
}

.header-gruppe[hidden],
.header-button[hidden] {
  display: none;
}

:root[data-theme="dark"] .icon-mond,
:root:not([data-theme="dark"]) .icon-sonne {
  display: none;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.1rem, 4.6vw, 1.5rem);
}

header p {
  margin: 0;
  color: var(--color-header-sub);
  font-size: 0.9rem;
}

button.header-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--color-header-text);
}

button.header-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 380px) {
  header {
    gap: 0.25rem;
    padding-inline: 0.5rem;
  }

  .header-gruppe {
    gap: 0;
  }

  header h1 {
    font-size: 1.05rem;
  }

  header p {
    font-size: 0.78rem;
  }
}


main {
  max-width: 30rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  min-height: calc(100dvh - 6rem);
  display: flex;
  flex-direction: column;
}

main > section {
  display: none;
}

main > section.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

h2 {
  margin: 0 0 0.5rem;
}

.hinweis {
  color: var(--color-muted);
}


#fortschritt {
  list-style: none;
  display: flex;
  margin: 0 0 1.5rem;
  padding: 0;
  counter-reset: schritt;
}

#fortschritt[hidden] {
  display: none;
}

#fortschritt li {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  counter-increment: schritt;
}

#fortschritt li::before {
  content: counter(schritt);
  position: relative;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 700;
}

#fortschritt li + li::after {
  content: '';
  position: absolute;
  top: 1rem;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  transform: translateY(-50%);
}

#fortschritt li.aktiv {
  color: var(--color-text);
  font-weight: 600;
}

#fortschritt li.aktiv::before {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

#fortschritt li.erledigt::before {
  content: '✓';
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

#fortschritt li.aktiv::after,
#fortschritt li.erledigt::after {
  background: var(--color-primary);
}


#login label {
  font-weight: 600;
  margin-top: 0.5rem;
}

input[type="text"],
input[type="password"] {
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

#login-error {
  color: var(--color-accent);
  min-height: 1.2rem;
  margin: 0;
}


button {
  min-height: 44px;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 0 1rem;
}

button:hover {
  background: var(--color-primary-hover);
}

button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#login-button,
#lust-weiter {
  margin-top: 0.5rem;
}

#hauptzutat-zurueck,
#jahreszeit-zurueck,
#von-vorn,
#vorheriges-rezept {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

#hauptzutat-zurueck:hover,
#jahreszeit-zurueck:hover,
#von-vorn:hover,
#vorheriges-rezept:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-on-primary);
}


#hauptzutat.is-active,
#jahreszeit.is-active {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-content: start;
  gap: 0.75rem;
}

#hauptzutat.is-active h2,
#jahreszeit.is-active h2,
#hauptzutat-zurueck,
#jahreszeit-zurueck {
  grid-column: 1 / -1;
}

#hauptzutat button[data-value],
#jahreszeit button[data-value] {
  min-height: 56px;
  background: var(--color-tile-bg);
  color: var(--color-text);
  border: 2px solid transparent;
}

#hauptzutat button[data-value]:hover,
#jahreszeit button[data-value]:hover {
  background: var(--color-tile-hover);
  border-color: var(--color-accent);
}


#lust-range {
  width: 100%;
  height: 44px;
  padding: 0;
  touch-action: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

#lust-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: var(--color-tile-bg);
}

#lust-range::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: var(--color-tile-bg);
}

#lust-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-border);
  cursor: pointer;
}

#lust-range::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-border);
  cursor: pointer;
}

#lust-value {
  display: block;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
}


#rezept-container {
  flex: 1;
  position: relative;
  margin-top: 0.75rem;
  padding: 1.75rem 1.25rem 1.5rem;
  background-color: var(--color-paper);
  background-image:
    linear-gradient(var(--color-paper-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-paper-line) 1px, transparent 1px);
  background-size: 1.25rem 1.25rem;
  border-radius: 3px;
  box-shadow:
    0 1px 2px var(--color-shadow-soft),
    0 12px 24px -12px var(--color-shadow);
}

#rezept-container::before {
  content: '';
  position: absolute;
  top: -0.75rem;
  left: 50%;
  width: 6.5rem;
  height: 1.5rem;
  background: var(--color-tape);
  transform: translateX(-50%) rotate(-2deg);
  box-shadow: 0 1px 2px var(--color-shadow-soft);
}

.notiz-titel {
  margin: 0;
  font-family: var(--font-notiz);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.05;
}

.rezept-bild {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 1.25rem;
  border: 0.4rem solid var(--color-photo-frame);
  border-radius: 2px;
  box-shadow: 0 4px 12px -4px var(--color-shadow);
  transform: rotate(-1deg);
}

.rezept-kopf {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.rezept-aktionen {
  display: flex;
  flex-shrink: 0;
  margin-top: -0.25rem;
}

button.icon-button {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary);
}

button.icon-button:hover:not(:disabled) {
  background: var(--color-tile-bg);
}

#favorit-button[aria-pressed="true"] {
  color: var(--color-accent);
}

#favorit-button[aria-pressed="true"] .icon {
  fill: currentColor;
}

.rezept-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
}

.meta-chip,
button.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.meta-chip {
  background: var(--color-tile-bg);
}

.meta-chip .icon,
.chip-button .icon {
  width: 1.1rem;
  height: 1.1rem;
}

button.chip-button {
  background: transparent;
  color: var(--color-text);
  border: 1.5px dashed var(--color-muted);
}

button.chip-button:hover {
  background: var(--color-tile-bg);
}

button.chip-button[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: 1.5px solid var(--color-primary);
}

.aufwand-punkte {
  display: inline-flex;
  gap: 3px;
}

.aufwand-punkte i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}

.aufwand-punkte i.voll {
  background: currentColor;
}

.rezept-abschnitt {
  margin-top: 1.5rem;
}

.rezept-abschnitt h4 {
  margin: 0 0 0.5rem;
  font-family: var(--font-notiz);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-accent);
}

.abschnitt-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.abschnitt-kopf h4 {
  margin: 0;
}

.portionen {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.portionen span {
  min-width: 6.5rem;
  text-align: center;
  font-weight: 600;
}

button.icon-button.rund {
  width: 40px;
  min-height: 40px;
  border: 1.5px solid var(--color-border);
  background: var(--color-paper);
}

.zutaten-liste {
  list-style: none;
  margin: 0;
  padding: 0;
}

.zutaten-liste label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.4rem 0;
  cursor: pointer;
}

.zutaten-liste input {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.1rem 0 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--color-primary);
  border-radius: 4px;
  background: var(--color-paper);
  cursor: pointer;
}

.zutaten-liste input:checked {
  background: var(--color-primary);
}

.zutaten-liste input:checked::after {
  content: '';
  width: 0.3rem;
  height: 0.6rem;
  border: solid var(--color-on-primary);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.zutaten-liste input:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.zutaten-liste input:checked + span {
  color: var(--color-muted);
  text-decoration: line-through;
}

.zubereitung ol,
.zubereitung ul {
  padding-left: 1.25rem;
}

.zubereitung p {
  margin: 0 0 0.75rem;
}


.lade {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

.spinner {
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: drehen 0.8s linear infinite;
}

@keyframes drehen {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.5s;
  }
}


.button-leiste {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0;
  background: linear-gradient(to top, var(--color-bg) 70%, transparent);
}

.button-leiste button {
  flex: 1;
  padding: 0 0.75rem;
}

#vorheriges-rezept {
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.nur-gross {
  display: none;
}

.button-leiste button[hidden] {
  display: none;
}

#anderes-rezept {
  flex: 1.5;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

#anderes-rezept:hover {
  background: var(--color-accent-hover);
}


.favoriten-liste {
  list-style: none;
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.favorit-eintrag {
  position: relative;
}

button.favorit-karte {
  width: 100%;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 3.75rem 0.5rem 0.75rem;
  text-align: left;
  font-weight: 400;
  background: var(--color-paper);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  box-shadow: 0 6px 14px -10px var(--color-shadow);
}

button.favorit-karte:hover {
  background: var(--color-paper);
  border-color: var(--color-accent);
}

button.favorit-entfernen {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  color: var(--color-accent);
}

button.favorit-entfernen .icon {
  fill: currentColor;
}

.favorit-karte img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border: 0.2rem solid var(--color-photo-frame);
  border-radius: 2px;
}

.favorit-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.favorit-text strong {
  font-family: var(--font-notiz);
  font-size: 1.5rem;
  line-height: 1.05;
}

.favorit-text span {
  font-size: 0.85rem;
  color: var(--color-muted);
}


#toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  z-index: 10;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.5rem);
  transition: opacity 0.2s, transform 0.2s;
}

#toast.sichtbar {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 768px) {
  header {
    padding: 1rem max(2rem, calc((100% - 64rem) / 2 + 2rem));
  }

  .header-titel {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  header h1 {
    margin: 0;
  }

  button.header-button {
    width: 44px;
    min-height: 44px;
  }

  header p {
    padding-left: 1rem;
    border-left: 1px solid var(--color-header-sub);
  }

  main {
    max-width: 64rem;
    padding: 2.5rem 2rem 3rem;
    min-height: calc(100dvh - 4.5rem);
  }

  h2 {
    font-size: 1.75rem;
    text-align: center;
  }

  #fortschritt {
    width: 100%;
    max-width: 30rem;
    margin: 0 auto 2rem;
  }

  #login.is-active,
  #lust.is-active {
    flex: 0 0 auto;
    width: 100%;
    max-width: 28rem;
    margin: 2rem auto 0;
    padding: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
  }

  #lust.is-active {
    max-width: 36rem;
    margin-top: 0;
  }

  #login-button,
  #lust-weiter {
    align-self: center;
    padding: 0 2rem;
  }

  #hauptzutat.is-active {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }

  #jahreszeit.is-active {
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
  }

  #hauptzutat button[data-value],
  #jahreszeit button[data-value] {
    min-height: 8rem;
    font-size: 1.15rem;
  }

  #hauptzutat-zurueck,
  #jahreszeit-zurueck {
    justify-self: center;
    padding: 0 2rem;
    margin-top: 0.5rem;
  }

  #rezept-container {
    width: 100%;
    max-width: 48rem;
    margin-inline: auto;
    padding: 2.5rem 2.5rem 2rem;
  }

  #rezept-container:has(.rezept-bild) {
    max-width: none;
  }

  .notiz-titel {
    font-size: 2.75rem;
  }

  .rezept:has(.rezept-bild) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: 2.5rem;
    align-content: start;
  }

  .rezept:has(.rezept-bild) > .rezept-bild {
    grid-column: 1;
    grid-row: 1 / span 20;
    align-self: start;
    position: sticky;
    top: 1.5rem;
    margin-bottom: 0;
  }

  .rezept:has(.rezept-bild) > :not(.rezept-bild) {
    grid-column: 2;
  }

  .button-leiste {
    justify-content: center;
  }

  .button-leiste button,
  #anderes-rezept {
    flex: 0 0 auto;
    min-width: 12rem;
    padding: 0 1.25rem;
  }

  #vorheriges-rezept {
    width: auto;
    min-width: 0;
    padding: 0 1.25rem 0 0.75rem;
  }

  .nur-gross {
    display: inline;
  }

  .favoriten-liste {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
