:root {
    --border: #e5e7eb;
    --muted: #6b7280;
    --text: #111827;
    --background: #f9fafb;
    --card: #ffffff;
    --accent: #2563eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0;
}

.hero {
    margin-bottom: 24px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.04em;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 1.1rem;
}

.search-panel,
.empty-state-card,
.recipe-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgb(15 23 42 / 6%);
}

.search-panel {
    position: relative;
    padding: 20px;
    margin-bottom: 28px;
}

.label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.ingredient-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
}

.suggestions {
    position: absolute;
    z-index: 10;
    display: block;
    width: calc(100% - 40px);
    margin-top: 6px;
}

.suggestion-list {
    margin: 0;
    padding: 8px;
    list-style: none;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgb(15 23 42 / 12%);
}

.suggestion,
.selected-chip {
    cursor: pointer;
}

.suggestion {
    display: block;
    width: 100%;
    padding: 10px 12px;
    color: var(--text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.suggestion:hover {
    background: #f3f4f6;
}

.selected-ingredients {
    margin-top: 20px;
}

.selected-ingredients h2,
.section-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.selected-chip {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    color: #1d4ed8;
    background: #dbeafe;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-header p,
.empty-state,
.empty-state-card {
    color: var(--muted);
}

.empty-state-card {
    padding: 28px;
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.recipe-card {
    overflow: visible;
}

.recipe-image-wrapper {
    position: relative;
}

.recipe-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #e5e7eb;
}

.recipe-ingredients-tooltip {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    display: none;
    width: min(320px, calc(100% - 24px));
    max-height: 360px;
    overflow-y: auto;
    padding: 12px 14px;
    color: var(--text);
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgb(15 23 42 / 24%);
    font-size: 0.9rem;
}

.recipe-image-wrapper:hover .recipe-ingredients-tooltip,
.recipe-image-wrapper:focus-within .recipe-ingredients-tooltip {
    display: block;
}

.recipe-ingredients-tooltip strong {
    display: block;
    margin-bottom: 8px;
}

.recipe-ingredients-tooltip ul {
    margin: 0;
    padding-left: 18px;
}

.recipe-ingredients-tooltip li + li {
    margin-top: 4px;
}

.recipe-card-body {
    padding: 16px;
}

.recipe-card h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    line-height: 1.3;
}

.match-summary {
    margin: 0 0 12px;
    color: var(--muted);
}

.recipe-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.recipe-meta dt {
    color: var(--muted);
    font-size: 0.75rem;
}

.recipe-meta dd {
    margin: 0;
    font-weight: 700;
}

.recipe-link {
    color: var(--accent);
    font-weight: 700;
}