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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4faf6;
    color: #1b2a22;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Header ─────────────────────────────────────────── */

header {
    text-align: center;
    padding: 2rem 0 1.75rem;
}

.logo-link {
    text-decoration: none;
}

.logo-img {
    display: block;
    margin: 0 auto 0.6rem;
    height: 72px;
    width: auto;
}

.logo {
    font-size: 2.25rem;
    font-weight: 800;
    color: #2d6a4f;
    letter-spacing: -1px;
    line-height: 1;
}

.tagline {
    font-size: 0.9rem;
    color: #6b7c74;
    margin-top: 0.35rem;
}

/* ── Converter card ──────────────────────────────────── */

.converter {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.75rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

/* ── Form elements ───────────────────────────────────── */

.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #4a6456;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.autocomplete-wrap {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #d8e8df;
    border-radius: 8px;
    font-size: 1rem;
    color: #1b2a22;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

input[type="text"]:focus {
    border-color: #2d6a4f;
}

input[type="text"]::placeholder {
    color: #aabab3;
}

/* ── Autocomplete dropdown ───────────────────────────── */

.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #d8e8df;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.suggestion {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.3;
}

.suggestion:hover,
.suggestion.active {
    background: #f0f7f3;
}

.suggestion small {
    display: block;
    color: #7a9e8b;
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

/* ── Volume row (quantity + unit side by side) ───────── */

.volume-row {
    display: flex;
    gap: 0.5rem;
}

.volume-row #qty-select {
    width: 68px;
    flex-shrink: 0;
    text-align: center;
    padding-right: 0.5rem;
    background-position: right 0.4rem center;
}

.volume-row #unit-select {
    flex: 1;
}

/* ── Unit select ─────────────────────────────────────── */

select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1.5px solid #d8e8df;
    border-radius: 8px;
    font-size: 1rem;
    color: #1b2a22;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a6456' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

select:focus {
    border-color: #2d6a4f;
}

/* ── Result ──────────────────────────────────────────── */

.result {
    text-align: center;
    margin-top: 1.25rem;
    padding: 1.5rem 1rem;
    background: #f0f7f3;
    border-radius: 10px;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-empty {
    color: #a0b8ac;
    font-size: 0.95rem;
}

.result-value {
    font-size: 4.5rem;
    font-weight: 800;
    color: #2d6a4f;
    line-height: 1;
    letter-spacing: -2px;
}

.result-unit {
    font-size: 1.1rem;
    font-weight: 600;
    color: #52b788;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-label {
    font-size: 0.85rem;
    color: #6b7c74;
    margin-top: 0.4rem;
}

/* ── Noscript fallback (ingredient pages) ────────────── */

.noscript-result {
    background: #f0f7f3;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    color: #2d3f35;
    text-align: center;
}

.noscript-result strong {
    color: #2d6a4f;
}

/* ── Ads ─────────────────────────────────────────────── */

.ad-slot {
    margin: 1.5rem 0 0;
    text-align: center;
}

/* ── Footer ──────────────────────────────────────────── */

main {
    flex: 1;
}

footer {
    text-align: center;
    padding: 2rem 0 1.5rem;
    font-size: 0.82rem;
    color: #a0b8ac;
}

footer a {
    color: #52b788;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ── Mobile ──────────────────────────────────────────── */

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0 1.25rem;
    }

    .logo {
        font-size: 1.9rem;
    }

    .converter {
        padding: 1.25rem;
    }

    .result-value {
        font-size: 3.5rem;
    }
}
