:root {
    --bg: #f9f1d5;
    --panel: #fffdf2;
    --ink: #20201b;
    --muted: #605744;
    --line: #dfd19f;
    --brand: #214d20;
    --brand-soft: #deebcf;
    --accent: #de6432;
    --accent-soft: #ffe0d0;
    --warn: #9a6a1d;
    --error: #8d2f2f;
    --shadow: 0 18px 40px rgba(73, 63, 22, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(244, 197, 70, 0.25), transparent 28%),
        radial-gradient(circle at bottom right, rgba(128, 171, 61, 0.18), transparent 26%),
        linear-gradient(180deg, #fffbe7 0%, #f6edcc 100%);
    color: var(--ink);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

html {
    scroll-behavior: smooth;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: "Bitter", Georgia, serif;
    margin: 0 0 0.5rem;
    color: var(--brand);
}

p {
    margin: 0 0 1rem;
    line-height: 1.55;
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.2rem 3rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.8rem;
}

.detail-hero {
    margin-bottom: 2rem;
}

.hero-copy {
    padding: 0.8rem 0.2rem;
}

.hero-card,
.panel,
.day-card {
    background: var(--panel);
    border: 1px solid rgba(121, 105, 77, 0.16);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.hero-card,
.panel {
    padding: 1.4rem;
}

.eyebrow {
    margin-bottom: 0.6rem;
    color: var(--brand);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.hero h1,
.detail-hero h1 {
    font-size: clamp(2.6rem, 5vw, 4.3rem);
    line-height: 0.95;
    margin-bottom: 0.75rem;
}

.hero-script {
    margin-bottom: 0.85rem;
    color: var(--accent);
    font-family: "Brush Script MT", "Segoe Script", cursive;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    line-height: 1;
}

.lead {
    max-width: 60ch;
    color: var(--muted);
    font-size: 1.1rem;
}

.status {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    font-weight: 600;
}

.status.ok {
    background: var(--brand-soft);
    color: var(--brand);
}

.alert.success {
    background: var(--brand-soft);
    color: var(--brand);
}

.status.warn {
    background: #f8ebd2;
    color: var(--warn);
}

.panel-header {
    margin-bottom: 1rem;
}

.generate-form {
    display: grid;
    gap: 0.8rem;
}

label {
    font-weight: 700;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffefb;
    color: var(--ink);
    font: inherit;
    resize: vertical;
    min-height: 130px;
}

textarea.is-readonly {
    opacity: 0.8;
    cursor: wait;
}

button {
    justify-self: start;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    padding: 0.9rem 1.3rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.05);
}

button:disabled {
    cursor: wait;
    opacity: 0.8;
    filter: none;
}

button.is-loading::before {
    content: "";
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 0.6rem;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    vertical-align: -0.1rem;
    animation: spin 0.8s linear infinite;
}

.submit-status {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.field-error,
.alert.error {
    color: var(--error);
}

.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
}

.alert.error {
    background: #ffe4df;
}

.day-list {
    display: grid;
    gap: 1rem;
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.2rem;
}

.load-more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 0.9rem 1.3rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
    border: 1px solid rgba(33, 77, 32, 0.12);
    box-shadow: var(--shadow);
}

.load-more-button:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

.day-card {
    display: block;
    padding: 1.2rem;
    transition: transform 120ms ease, box-shadow 120ms ease;
    position: relative;
    overflow: hidden;
}

.day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 42px rgba(44, 41, 33, 0.12);
    text-decoration: none;
}

.day-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 26px;
}

.day-card-top-actions {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.day-card-delete-form {
    margin: 0;
}

.icon-delete-button {
    width: 2.3rem;
    height: 2.3rem;
    min-width: 2.3rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(185, 66, 47, 0.96);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    position: relative;
    z-index: 3;
}

.icon-delete-button span {
    transform: translateY(-1px);
}

.day-card .kcal {
    min-height: 2.3rem;
}

.danger-button {
    background: #b9422f;
}

.danger-button:hover {
    filter: brightness(1.02);
}

.hero-art {
    overflow: hidden;
    position: relative;
    padding: 0.6rem;
}

.hero-art img {
    display: block;
    width: 100%;
    height: auto;
}

.hero-art-compact {
    display: grid;
    gap: 0.8rem;
}

.hero-art-compact img {
    max-width: 280px;
    justify-self: center;
}

.day-card-head,
.meal-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.meal-title-group {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.meal-icon-wrap {
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,248,215,0.95));
    border: 1px solid rgba(121, 105, 77, 0.14);
}

.meal-icon {
    width: 56px;
    height: 56px;
    display: block;
}

.muted,
.summary,
.wish,
.meal-description,
.preparation,
.catalog-content {
    color: var(--muted);
}

.kcal {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: #edf4da;
    color: var(--brand);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-weight: 700;
}

.top-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.inline-form {
    margin: 0;
}

.meal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.meal-card h3 {
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

.ingredient-list {
    margin: 0;
    padding-left: 1.2rem;
}

.ingredient-list li {
    margin-bottom: 0.35rem;
}

.meal-card {
    position: relative;
    overflow: hidden;
}

.meal-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 138, 29, 0.18), rgba(244, 138, 29, 0));
    pointer-events: none;
}

.catalog-content h1,
.catalog-content h2,
.catalog-content h3 {
    margin-top: 1.4rem;
}

.catalog-content code {
    background: #efe7da;
    padding: 0.12rem 0.3rem;
    border-radius: 6px;
}

.catalog-content pre {
    overflow-x: auto;
    padding: 1rem;
    background: #201f1a;
    color: #f6f0e6;
    border-radius: 14px;
}

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

    .hero-copy {
        text-align: center;
    }

    .meal-icon-wrap {
        width: 60px;
        height: 60px;
    }

    .meal-icon {
        width: 50px;
        height: 50px;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
