:root {
    --red: #e30613;
    --red-dark: #b8050f;
    --red-soft: #fdecee;
    --text: #1d1f24;
    --muted: #6b7280;
    --bg: #f4f5f7;
    --card: #ffffff;
    --border: #e5e7eb;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

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

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ---------- Header ---------- */
.hero {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: #fff;
    padding: 3rem 0 5rem;
}

.hero__badge {
    display: inline-block;
    padding: .2rem .7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.hero__title {
    margin: .6rem 0 .4rem;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    line-height: 1.15;
}

.hero__lead {
    margin: 0;
    max-width: 38rem;
    opacity: .9;
}

/* ---------- Formular ---------- */
.order-form {
    margin-top: -3rem;
    display: grid;
    gap: 1rem;
}

.section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section__header { margin: 0; }

.section__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.section__toggle:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: -3px;
    border-radius: var(--radius);
}

.section__title {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 700;
}

.section__count {
    padding: .15rem .65rem;
    border-radius: 999px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

.section__chevron {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .3s var(--ease);
}

.section.is-open .section__chevron { transform: rotate(180deg); }

/* Auf-/Zuklappen mit animierter Höhe */
.section__body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s var(--ease);
}

.section.is-open .section__body { grid-template-rows: 1fr; }

.section__inner {
    overflow: hidden;
    padding: 0 1.25rem;
}

.section.is-open .section__inner { padding-bottom: 1rem; }

/* ---------- Zeilen (3 Spalten) ---------- */
.row {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: .85rem 0;
    border-top: 1px solid var(--border);
}

.row--head {
    padding: .5rem 0;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.row--head span:last-child { text-align: center; }

.row__image {
    position: relative;
    width: 96px;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    cursor: zoom-in;
}

.row__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s var(--ease);
}

.row__image:hover img,
.row__image:focus-visible img { transform: scale(1.08); }

.row__image:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 2px;
}

.row__name {
    font-weight: 600;
    font-size: 1.02rem;
    cursor: pointer;
}

/* ---------- Unterkategorie (eingerückt) ---------- */
.subgroup {
    margin: 0 0 .5rem 2rem;
    padding-left: 1rem;
    border-left: 3px solid var(--red-soft);
}

.subgroup__title {
    padding: .2rem 0 .5rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--red-dark);
}

.subgroup .row { grid-template-columns: 72px 1fr auto; }
.subgroup .row__image { width: 72px; }
.subgroup .row__name { font-weight: 500; font-size: .97rem; }

/* ---------- Mengen-Eingabe mit "/12" ---------- */
.qty {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.qty__btn {
    width: 40px;
    height: 40px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.qty__btn:hover { border-color: var(--red); color: var(--red); }
.qty__btn:active { background: var(--red-soft); }
.qty__btn:disabled { opacity: .35; cursor: not-allowed; border-color: var(--border); color: var(--text); }

.qty__field {
    position: relative;
    width: 92px;
}

.qty__field input {
    width: 100%;
    height: 40px;
    padding: 0 2.6rem 0 .75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: right;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty__field input::-webkit-outer-spin-button,
.qty__field input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty__field input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, .15);
}

.qty__field input:invalid { border-color: var(--red); }

.qty__suffix {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 500;
    pointer-events: none;
}

/* ---------- Aktionen ---------- */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: .5rem 0 2rem;
}

.btn {
    padding: .85rem 1.5rem;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
}

.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--red);
    color: #fff;
    box-shadow: 0 6px 16px rgba(227, 6, 19, .25);
}

.btn--primary:hover { background: var(--red-dark); }

.btn--ghost {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
}

.btn--ghost:hover { border-color: var(--muted); }

.btn--small {
    padding: .5rem 1rem;
    border-radius: 10px;
    font-size: .9rem;
}

.toolbar {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.footer {
    padding: 1.5rem 0 2rem;
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
}

/* ---------- Lightbox ---------- */
.lightbox {
    max-width: min(92vw, 900px);
    max-height: 92vh;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    overflow: visible;
}

.lightbox[open] { animation: zoom-in .25s var(--ease); }

.lightbox::backdrop {
    background: rgba(15, 17, 21, .7);
    backdrop-filter: blur(4px);
    animation: fade-in .25s ease;
}

.lightbox__figure { margin: 0; }

.lightbox__figure img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 3.5rem);
    margin: 0 auto;
    border-radius: var(--radius) var(--radius) 0 0;
    object-fit: contain;
}

.lightbox__figure figcaption {
    padding: .9rem 1.25rem;
    font-weight: 600;
    text-align: center;
}

.lightbox__close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

@keyframes zoom-in { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
    .hero { padding: 2rem 0 4.5rem; }

    .section__toggle { padding: 1rem; }
    .section__inner { padding: 0 1rem; }

    .row {
        grid-template-columns: 64px 1fr;
        grid-template-areas:
            "img name"
            "img qty";
        gap: .4rem .85rem;
    }

    .row--head { display: none; }
    .row--head + .row { border-top: 0; }

    .row__image { grid-area: img; width: 64px; align-self: start; }
    .row__name { grid-area: name; }
    .qty { grid-area: qty; }

    .subgroup { margin-left: .75rem; padding-left: .75rem; }
    .subgroup .row { grid-template-columns: 52px 1fr; }
    .subgroup .row__image { width: 52px; }

    .actions { flex-direction: column-reverse; }
    .btn { width: 100%; }
    .toolbar .btn { width: auto; flex: 1; }

    .lightbox__close { top: 8px; right: 8px; }
}

/* ---------- Startseite (Name eingeben) ---------- */
body.is-locked { overflow: hidden; }

.welcome {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 90, 100, .55) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(120, 0, 8, .5) 0%, transparent 50%),
        linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    clip-path: circle(150% at 50% 50%);
    transition: clip-path .85s cubic-bezier(.7, 0, .3, 1);
}

.welcome[hidden] { display: none; }
.welcome.is-done { clip-path: circle(0% at 50% 50%); }

.welcome__blobs span {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    animation: float 14s ease-in-out infinite;
}

.welcome__blobs span:nth-child(1) { width: 420px; height: 420px; top: -140px; left: -120px; }
.welcome__blobs span:nth-child(2) { width: 260px; height: 260px; bottom: -80px; right: -60px; animation-delay: -5s; }
.welcome__blobs span:nth-child(3) { width: 140px; height: 140px; top: 18%; right: 14%; animation-delay: -9s; }

.welcome__card {
    position: relative;
    width: min(100%, 420px);
    padding: 2.25rem 2rem 2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 30px 80px rgba(80, 0, 5, .35);
    text-align: center;
    /* backwards statt both, sonst blockiert die Animation die Ausblend-Transition */
    animation: card-in .7s var(--ease) backwards;
    transition: opacity .35s ease, transform .45s var(--ease);
}

.welcome__card.is-shaking { animation: shake .4s ease; }

.welcome.is-leaving .welcome__card {
    opacity: 0;
    transform: scale(.9) translateY(24px);
    pointer-events: none;
}

.welcome__logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.1rem;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--red);
    box-shadow: 0 10px 24px rgba(227, 6, 19, .35);
    animation: pulse 2.4s ease-in-out infinite;
}

.welcome__logo svg { width: 34px; height: 34px; fill: #fff; }

.welcome__badge {
    display: inline-block;
    padding: .2rem .75rem;
    border-radius: 999px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
}

.welcome__title { margin: .7rem 0 .4rem; font-size: 1.9rem; line-height: 1.15; }
.welcome__text { margin: 0 0 1.5rem; color: var(--muted); }

/* Eingabefeld mit schwebendem Label */
.field { position: relative; text-align: left; }

.field input {
    width: 100%;
    padding: 1.35rem 1rem .55rem;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: #fff;
    font: inherit;
    font-size: 1.05rem;
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}

.field input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(227, 6, 19, .12);
}

.field label {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    transition: top .2s var(--ease), font-size .2s var(--ease), color .2s;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: .95rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--red-dark);
}

.field__error {
    min-height: 1.4rem;
    margin: .35rem 0 .6rem;
    color: var(--red);
    font-size: .85rem;
    font-weight: 600;
    text-align: left;
}

.btn--block {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.btn__arrow {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s var(--ease);
}

.btn:hover .btn__arrow { transform: translateX(4px); }

/* Begrüßung nach Namenseingabe */
.welcome__greeting {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .4rem;
    padding: 1.5rem;
    color: #fff;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.welcome.is-greeting .welcome__greeting { opacity: 1; }
.welcome.is-done .welcome__greeting { opacity: 0; transform: scale(.95); transition: opacity .4s, transform .6s var(--ease); }

.welcome__check,
.done__check {
    display: grid;
    place-items: center;
    border-radius: 50%;
}

.welcome__check {
    width: 104px;
    height: 104px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, .18);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .4);
}

.welcome__check svg,
.done__check svg {
    width: 56%;
    fill: none;
    stroke: #fff;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.welcome__check path,
.done__check path { stroke-dasharray: 24; stroke-dashoffset: 24; }

.welcome.is-greeting .welcome__check { animation: pop .55s var(--ease) both, ring 1.2s .3s ease-out; }
.welcome.is-greeting .welcome__check path { animation: draw .45s .3s ease forwards; }

.welcome__hello { margin: 0; font-size: clamp(1.8rem, 7vw, 2.8rem); font-weight: 800; line-height: 1.15; }
.welcome__sub { margin: 0; opacity: .85; }

.welcome.is-greeting .welcome__hello { animation: rise .6s .25s var(--ease) both; }
.welcome.is-greeting .welcome__sub { animation: rise .6s .4s var(--ease) both; }

/* Formular baut sich nach der Startseite gestaffelt auf */
body.is-revealed .hero .container > * { animation: rise .7s var(--ease) both; }
body.is-revealed .hero .container > :nth-child(2) { animation-delay: .08s; }
body.is-revealed .hero .container > :nth-child(3) { animation-delay: .16s; }
body.is-revealed .hero .container > :nth-child(4) { animation-delay: .24s; }
body.is-revealed .section { animation: rise .7s var(--ease) both; animation-delay: calc(.2s + var(--i, 0) * .06s); }

/* Name im Kopfbereich */
.hero__user {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1.1rem;
    padding: .3rem .35rem .3rem .75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    font-size: .9rem;
    font-weight: 600;
}

.hero__user svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.hero__user button {
    padding: .25rem .75rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--red-dark);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Senden-Button mit Ladeanzeige */
.btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 22px;
    height: 22px;
    margin: auto;
    border: 3px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ---------- Bestellung erfolgreich ---------- */
.done {
    width: min(92vw, 420px);
    padding: 2.25rem 2rem 2rem;
    border: 0;
    border-radius: 24px;
    background: var(--card);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
    text-align: center;
}

.done[open] { animation: zoom-in .35s var(--ease); }

.done::backdrop {
    background: rgba(15, 17, 21, .65);
    backdrop-filter: blur(4px);
    animation: fade-in .25s ease;
}

.done__check {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.1rem;
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    box-shadow: 0 12px 28px rgba(22, 163, 74, .35);
}

.done[open] .done__check { animation: pop .55s .1s var(--ease) both; }
.done[open] .done__check path { animation: draw .45s .4s ease forwards; }

.done__title { margin: 0 0 .4rem; font-size: 1.5rem; }
.done__text { margin: 0 0 1.5rem; color: var(--muted); }

.done__warning {
    margin: -.75rem 0 1.25rem;
    padding: .6rem .8rem;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: .9rem;
}

/* ---------- Hinweis (Toast) ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    z-index: 60;
    max-width: calc(100% - 2rem);
    padding: .85rem 1.25rem;
    border-radius: 14px;
    background: #1d1f24;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
    transition: opacity .25s ease, transform .35s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--red-dark); }

/* ---------- Fehlerseiten ---------- */
.error__code {
    margin: .5rem 0 0;
    font-size: clamp(4.5rem, 22vw, 7rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.04em;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rise .7s .15s var(--ease) both;
}

.error .welcome__title { margin-top: .25rem; }

.error__actions {
    display: flex;
    gap: .6rem;
}

.error__actions .btn {
    flex: 1;
    text-decoration: none;
    text-align: center;
}

.error__footer {
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 0;
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
    text-align: center;
}

/* ---------- Footer-Links ---------- */
.footer a,
.error__footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer a:hover { color: var(--red); }
.error__footer a:hover { color: #fff; }

/* ---------- Impressum / Datenschutz ---------- */
.hero__back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: 1.1rem;
    padding: .35rem .9rem .35rem .65rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.hero__back:hover { background: rgba(255, 255, 255, .26); }

.hero__back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.legal {
    margin: -3rem 0 1rem;
    padding: 2rem 2.25rem;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    animation: rise .6s var(--ease) both;
}

.legal h2 {
    margin: 1.75rem 0 .5rem;
    font-size: 1.1rem;
    color: var(--red-dark);
}

.legal h2:first-child { margin-top: 0; }
.legal p, .legal ul, .legal address { margin: 0 0 .75rem; font-style: normal; }
.legal ul { padding-left: 1.25rem; }
.legal li { margin-bottom: .3rem; }
.legal a { color: var(--red); }

@media (max-width: 600px) {
    .legal { padding: 1.5rem 1.25rem; }
}

@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.3); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ring { to { box-shadow: 0 0 0 40px rgba(255, 255, 255, 0); } }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 14px 32px rgba(227, 6, 19, .45); } }
@keyframes float { 50% { transform: translate(30px, 40px) scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
    .welcome__card { padding: 1.75rem 1.25rem 1.5rem; }
    .welcome__title { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .welcome__check path, .done__check path { stroke-dashoffset: 0; }
}
