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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    color: #2c1a0e;
    background: #f5f0eb;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px 32px;
}

#top-bar {
    display: flex;
    align-items: center;
    height: 56px;
    margin-bottom: 16px;
    border-bottom: 1px solid #d6cbc0;
}

#nav-back {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    color: #2c1a0e;
    font-size: 22px;
}

#nav-back::before {
    content: "\2190";
}

#nav-back.hidden {
    visibility: hidden;
}

#nav-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
    cursor: pointer;
}

#nav-action {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 15px;
    min-height: 40px;
}

#nav-action.hidden {
    visibility: hidden;
}

h2 {
    font-size: 20px;
    font-weight: 700;
}

.btn {
    display: inline-block;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    min-height: 48px;
    line-height: 1.2;
}

.btn-primary {
    background: #FFD700;
    color: #2c1a0e;
}

.btn-primary:active {
    background: #e6c200;
}

.btn-secondary {
    background: #e8e0d8;
    color: #2c1a0e;
}

.btn-danger {
    background: #f5e6e6;
    color: #c00;
}


.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 12px;
    font-size: 18px;
    border: 1px solid #c4b5a5;
    border-radius: 6px;
    min-height: 48px;
    background: #fff;
    color: #2c1a0e;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: #fff;
    border: none;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(44, 26, 14, 0.1);
}

.card:active {
    background: #f9f9f9;
}

.card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card p {
    font-size: 16px;
    color: #5a3e2b;
    margin-bottom: 4px;
}

.card .meta {
    font-size: 14px;
    color: #8c7161;
}

.card .card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    color: #8c7161;
    padding: 40px 16px;
    font-size: 18px;
}

.substitution-box {
    background: #FFD700;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.substitution-box h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.substitution-box ul {
    list-style: disc;
    padding-left: 20px;
}

.substitution-box li {
    font-size: 16px;
    margin-bottom: 4px;
}

.recipe-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.recipe-desc {
    font-size: 16px;
    color: #5a3e2b;
    margin-bottom: 12px;
}

.recipe-meta {
    font-size: 14px;
    color: #8c7161;
    margin-bottom: 20px;
}

.recipe-section {
    margin-bottom: 24px;
}

.recipe-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #d6cbc0;
}

.servings-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.servings-control select {
    font-size: 18px;
    padding: 8px 12px;
    border: 1px solid #c4b5a5;
    border-radius: 6px;
    min-height: 48px;
    background: #fff;
    color: #2c1a0e;
}

.ingredient-list {
    list-style: none;
}

.ingredient-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e2d9d0;
    font-size: 18px;
}

.ingredient-list .amount {
    font-weight: 600;
}

.instruction-list {
    list-style: none;
    counter-reset: steps;
}

.instruction-list li {
    counter-increment: steps;
    padding: 10px 0;
    border-bottom: 1px solid #e2d9d0;
    font-size: 17px;
}

.instruction-list li::before {
    content: counter(steps) ".";
    font-weight: 700;
    margin-right: 8px;
}

.equipment-list {
    list-style: disc;
    padding-left: 20px;
}

.equipment-list li {
    font-size: 16px;
    padding: 4px 0;
}

.notes-area {
    margin-bottom: 24px;
}

.notes-area textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid #c4b5a5;
    border-radius: 6px;
    resize: vertical;
    margin-bottom: 8px;
    background: #fff;
    color: #2c1a0e;
}

.recipe-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

#shopping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

#shopping-title {
    font-size: 18px;
    font-weight: 600;
}

#shopping-header select {
    font-size: 18px;
    padding: 8px 12px;
    border: 1px solid #c4b5a5;
    border-radius: 6px;
    min-height: 48px;
    background: #fff;
    color: #2c1a0e;
}

.dept-group {
    margin-bottom: 20px;
}

.dept-group h3 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b4f3a;
    padding-bottom: 6px;
    border-bottom: 2px solid #2c1a0e;
    margin-bottom: 4px;
}

.shop-item {
    display: flex;
    align-items: center;
    padding: 14px 12px;
    font-size: 20px;
    min-height: 52px;
    border-bottom: 1px solid #e2d9d0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.2s, color 0.2s;
}

.shop-item.unchecked {
    background: #FFD700;
    font-weight: 500;
}

.shop-item.checked {
    background: #e2d9d0;
    color: #a08c7a;
    text-decoration: line-through;
}

.shop-item .check-mark {
    width: 28px;
    height: 28px;
    border: 2px solid #5a3e2b;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.shop-item.checked .check-mark {
    background: #a08c7a;
    border-color: #a08c7a;
    color: #fff;
}

#clear-checks {
    margin-top: 20px;
    width: 100%;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #d6cbc0;
    border-top-color: #2c1a0e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

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

#search-status {
    text-align: center;
    padding: 20px;
    color: #6b4f3a;
}

.candidate-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2d9d0;
    display: none;
}

.candidate-detail.open {
    display: block;
}

.candidate-toggle {
    font-size: 14px;
    color: #6b4f3a;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
    font-family: inherit;
}

#diet-filters {
    margin-bottom: 16px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-btn {
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid #c4b5a5;
    border-radius: 20px;
    background: #fff;
    color: #5a3e2b;
    cursor: pointer;
    min-height: 40px;
    transition: background 0.15s, color 0.15s;
}

.filter-btn.active {
    background: #2c1a0e;
    color: #fff;
    border-color: #2c1a0e;
}

.custom-filter-row {
    display: flex;
    gap: 8px;
}

.custom-filter-row input {
    flex: 1;
    padding: 8px 12px;
    font-size: 15px;
    border: 1px solid #c4b5a5;
    border-radius: 20px;
    background: #fff;
    color: #2c1a0e;
    min-height: 40px;
    font-family: inherit;
}

.saved-notes {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.6;
    color: #2c1a0e;
    white-space: pre-wrap;
    box-shadow: 0 1px 3px rgba(44, 26, 14, 0.1);
}
