:root {
    --page-bg: #f4f7fb;
    --surface: #ffffff;
    --surface-muted: #eef3f8;
    --border: #cfd8e3;
    --text: #1f2933;
    --text-soft: #52606d;
    --accent: #1d6fa5;
    --accent-dark: #15567f;
    --shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
    --radius: 14px;
    --content-width: 700px;
}

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

body {
    margin: 0;
    padding: 1.5rem 0 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    background: var(--page-bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    line-height: 1.55;
}

body > * {
    width: min(var(--content-width), calc(100% - 2rem));
}

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

a:hover,
a:focus-visible {
    color: var(--accent-dark);
    text-decoration: underline;
}

h1,
h2,
h3 {
    margin: 0;
    color: var(--text);
    line-height: 1.2;
}

h1 {
    font-size: clamp(2rem, 5vw, 2.6rem);
    text-align: center;
}

h2 {
    font-size: 1.4rem;
}

p,
li,
label,
span,
strong {
    font-size: 1rem;
}

p,
ul,
ol {
    margin: 0;
}

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

img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

button,
input,
label,
.button-link {
    font: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

button {
    border: 0;
    border-radius: 10px;
    padding: 0.75rem 1.1rem;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

button:hover,
button:focus-visible,
.button-link:hover,
.button-link:focus-visible {
    background: var(--accent-dark);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0.75rem 1.1rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.button-link:hover,
.button-link:focus-visible {
    color: #fff;
    text-decoration: none;
}

.top,
.nav,
.nav-row,
.search-block,
.recipes,
.recipes-list,
.cards-area,
.profile-intro,
.recipe-info,
.recipe-columns,
.login-form,
body > h1,
body > h2,
body > p {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.top,
.nav,
.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.95rem 1.2rem;
    flex-wrap: wrap;
}

.top {
    margin-top: 0.25rem;
}

.top a:first-child {
    font-size: 1.3rem;
    font-weight: 700;
}

.nav,
.nav-row {
    justify-content: center;
}

.nav a,
.nav-row a {
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
}

body > h1,
body > h2,
body > p {
    padding: 1rem 1.25rem;
}

body > p {
    color: var(--text-soft);
}

.recipes,
.recipes-list,
.cards-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.card,
.recipe-box {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.card ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-left: 0;
    list-style: none;
}

.card li a,
.tag-row span,
body > p.tag-row span {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #ddeaf4;
    color: var(--accent-dark);
    margin: 0.2rem 0.3rem 0 0;
}

.recipe-box-header,
.review-summary-header,
.page-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.recipe-box-header h2 {
    flex: 1 1 240px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.star-rating-display {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-soft);
}

.star-rating-display--compact {
    align-self: flex-start;
}

.star-icons {
    display: inline-flex;
    gap: 0.1rem;
}

.star-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.star-icon.is-filled {
    color: #f3b33d;
}

.star-icon.is-empty {
    color: #c5ced8;
}

.star-rating-text {
    font-size: 0.95rem;
}

.profile-intro,
.recipe-columns {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.profile-intro > div,
.recipe-columns > div {
    flex: 1 1 280px;
    min-width: 0;
}

.recipe-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
}

.recipe-info p {
    flex: 1 1 220px;
    padding: 0.75rem 0.9rem;
    background: var(--surface-muted);
    border-radius: 10px;
}

.search-block {
    padding: 1rem;
}

.search-block form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    width: 100%;
}

.search-block label {
    width: 100%;
    font-weight: 700;
    color: var(--text);
}

.search-block input {
    flex: 1 1 280px;
    min-width: 0;
}

.search-block button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.rating-filter,
.search-empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.rating-filter {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
}

.rating-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.rating-filter-clear {
    padding: 0.55rem 0.85rem;
}

.rating-filter-stars {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.rating-filter-star {
    padding: 0.25rem;
    border: 0;
    background: transparent;
    color: #c5ced8;
    font-size: 2rem;
    line-height: 1;
}

.rating-filter-star:hover,
.rating-filter-star:focus-visible {
    background: transparent;
    color: #f3b33d;
}

.rating-filter-star.is-active {
    color: #f3b33d;
}

.rating-filter-status,
.search-empty-state {
    color: var(--text-soft);
}

.search-empty-state {
    padding: 1rem 1.25rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    padding: 1.25rem;
}

.login-form p {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: var(--text);
}

.login-form button {
    align-self: flex-start;
}

.review-page,
.review-summary,
.review-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.review-form {
    align-items: flex-start;
}

.form-error {
    color: #9b2c2c;
}

.star-rating-input {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 0.2rem;
}

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

.star-rating-input label {
    cursor: pointer;
    color: #c5ced8;
    font-size: 2rem;
    line-height: 1;
}

.star-rating-input label:hover,
.star-rating-input label:hover ~ label,
.star-rating-input input:checked + label,
.star-rating-input input:checked + label ~ label {
    color: #f3b33d;
}

@media (max-width: 640px) {
    body {
        padding-top: 1rem;
        gap: 1rem;
    }

    body > * {
        width: min(var(--content-width), calc(100% - 1rem));
    }

    .top,
    .nav,
    .nav-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-block {
        padding: 0.7rem 0.85rem;
    }

    .search-block form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.45rem;
    }

    .search-block label {
        grid-column: 1 / -1;
        width: auto;
        margin-bottom: 0.1rem;
        font-size: 0.8rem;
    }

    .search-block input[type="search"] {
        width: 100%;
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .search-block button {
        width: auto;
        padding: 0.55rem 0.8rem;
        font-size: 0.95rem;
    }

    .nav a,
    .nav-row a,
    .top a {
        text-align: center;
    }

    .recipe-box-header,
    .review-summary-header,
    .page-actions,
    .rating-filter-header {
        flex-direction: column;
        align-items: stretch;
    }

    .login-form button,
    .search-block button {
        width: 100%;
    }
}
