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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #d4a574 100%);
    min-height: 100vh;
    padding: 20px;
    color: #3d2817;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: #fff8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(61, 40, 23, 0.15);
    border: 2px solid #d4a574;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.header-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.header-text {
    text-align: left;
}

h1 {
    font-size: 2.5rem;
    color: #5d3a1a;
    margin-bottom: 10px;
}

.subtitle {
    color: #8b6f47;
    font-size: 1.1rem;
}

.calculator {
    background: #fff8f0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(61, 40, 23, 0.15);
    margin-bottom: 20px;
    border: 2px solid #d4a574;
}

.section {
    margin-bottom: 35px;
}

.section:last-child {
    margin-bottom: 0;
}

h2 {
    font-size: 1.5rem;
    color: #5d3a1a;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #c89666;
}

.help-text {
    color: #8b6f47;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.ingredient-list {
    margin-bottom: 15px;
}

.ingredient-row {
    display: grid;
    grid-template-columns: 1fr 100px 30px auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.ingredient-name {
    padding: 10px;
    border: 2px solid #d4a574;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
}

.ingredient-name:focus {
    outline: none;
    border-color: #b8860b;
}

.ingredient-percentage {
    padding: 10px;
    border: 2px solid #d4a574;
    border-radius: 6px;
    font-size: 1rem;
    text-align: right;
    transition: border-color 0.3s;
    background: white;
}

.ingredient-percentage:focus {
    outline: none;
    border-color: #b8860b;
}

.ingredient-percentage:read-only {
    background-color: #faf6f1;
    color: #8b6f47;
}

.percentage-symbol {
    color: #8b6f47;
    font-weight: 500;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-remove:hover {
    background: #c0392b;
}

.btn-add {
    background: #8b6f47;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.btn-add:hover {
    background: #6d5636;
}

.output-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.input-group {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 10px;
}

.input-group input,
.input-group select {
    padding: 12px;
    border: 2px solid #d4a574;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #b8860b;
}

.form-row {
    display: grid;
    grid-template-columns: 140px minmax(200px, 400px);
    gap: 15px;
    align-items: center;
    margin-bottom: 10px;
}

.form-label {
    font-size: 1rem;
    color: #5d3a1a;
    font-weight: 500;
    text-align: left;
}

.form-input {
    padding: 12px;
    border: 2px solid #d4a574;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: white;
    width: 100%;
    max-width: 400px;
}

.form-input:focus {
    outline: none;
    border-color: #b8860b;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit .form-input {
    padding-right: 35px;
}

.unit-symbol {
    position: absolute;
    right: 12px;
    color: #8b6f47;
    font-weight: 600;
    font-size: 1rem;
    pointer-events: none;
}

.recipe-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recipe-link {
    display: inline-block;
    padding: 10px 16px;
    background: white;
    color: #5d3a1a;
    text-decoration: none;
    border: 2px solid #d4a574;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
}

.recipe-link:hover {
    background: #8b6f47;
    color: white;
    border-color: #8b6f47;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(61, 40, 23, 0.2);
}

.recipe-link:active {
    transform: translateY(0);
}

.saved-recipe-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-delete-recipe {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.btn-delete-recipe:hover {
    background: #c0392b;
}

.save-recipe-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-save {
    background: #8b6f47;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 500;
}

.btn-save:hover {
    background: #6d5636;
}

.results {
    background: #faf6f1;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e8d4b8;
}

#resultsList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #8b6f47;
}

.result-item.flour {
    border-left-color: #b8860b;
    font-weight: 600;
}

.result-name {
    font-size: 1.1rem;
    color: #5d3a1a;
}

.result-amount {
    font-size: 1.2rem;
    font-weight: 600;
    color: #8b6f47;
}

.result-item.flour .result-amount {
    color: #b8860b;
}

footer {
    text-align: center;
    padding: 20px;
    color: #8b6f47;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        margin-bottom: 20px;
        padding: 20px 15px;
    }

    .header-content {
        gap: 15px;
    }

    .header-icon {
        width: 60px;
        height: 60px;
    }

    .calculator {
        padding: 20px 15px;
    }

    .section {
        margin-bottom: 25px;
    }

    h2 {
        font-size: 1.3rem;
    }

    .form-row {
        grid-template-columns: 110px 1fr;
        gap: 10px;
    }

    .form-label {
        font-size: 0.95rem;
    }

    .form-input {
        padding: 10px;
        font-size: 16px;
    }

    .ingredient-row {
        grid-template-columns: 1fr 80px 20px auto;
        gap: 8px;
    }

    .input-group {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .recipe-links {
        gap: 8px;
    }

    .recipe-link {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .header-icon {
        width: 50px;
        height: 50px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }

    .calculator {
        padding: 15px 10px;
    }
}
