:root {
    --primary: #2d7a3e;
    --primary-dark: #1e5229;
    --accent: #ff6b35;
    --accent-light: #ff8558;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

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

body {
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
}

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

/* Header */
.app-header {
    background-color: var(--primary);
    color: white;
    padding: 40px 0;
    text-align: center;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    margin-bottom: 24px;
}

.app-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease;
}

.shadow {
    box-shadow: var(--shadow);
}

/* Form Styles */
.grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: #fafafa;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.btn {
    display: inline-block;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-light);
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 16px;
}

.btn-sm {
    padding: 6px 12px;
}

.history-controls {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Results */
.hidden {
    display: none;
}

.result-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.gradient-bg {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.text-white {
    color: white;
}

.main-result h3 {
    opacity: 0.9;
    font-size: 1rem;
}

.total-calories {
    font-size: 3rem;
    font-weight: 800;
    margin: 10px 0;
}

.total-calories small {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.8;
}

.rec-item {
    margin-bottom: 16px;
}

.rec-item:last-child {
    margin-bottom: 0;
}

.rec-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.rec-item .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.tips-box h4 {
    margin-bottom: 12px;
    color: var(--primary);
}

.tips-box ul {
    list-style: none;
}

.tips-box li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.tips-box li::before {
    content: "✔️";
    position: absolute;
    left: 0;
}

/* Logic Accordion */
.logic-section {
    margin-bottom: 24px;
}

.logic-accordion {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background: white;
    overflow: hidden;
    transition: all 0.3s ease;
}

.logic-accordion[open] {
    box-shadow: var(--shadow);
}

.logic-summary {
    list-style: none;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--text-main);
    user-select: none;
    transition: background 0.2s ease;
}

.logic-summary:hover {
    background: #fcfcfc;
    color: var(--primary);
}

.logic-summary::-webkit-details-marker {
    display: none;
}

.summary-icon::after {
    content: '⊕';
    font-size: 1.2rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    display: inline-block;
}

.logic-accordion[open] .summary-icon::after {
    content: '⊖';
    transform: rotate(180deg);
}

.logic-content {
    padding: 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.logic-item {
    margin-bottom: 20px;
}

.logic-item:last-child {
    margin-bottom: 0;
}

.logic-item h5 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logic-item p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
}

.logic-item ul {
    margin-top: 8px;
    padding-left: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.logic-item ul li {
    margin-bottom: 4px;
}

.logic-item strong {
    color: var(--accent);
}

/* Tabs */
.section-header {
    margin-bottom: 20px;
}

.scroll-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scrollbar-width: none;
    /* Firefox */
}

.scroll-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.tab-btn {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* Status Messages */
.status-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: #f8fafc;
    border-radius: 12px;
    color: #64748b;
    font-size: 1.1rem;
}

.status-msg.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

.mt-1 {
    margin-top: 1rem;
}

.product-img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #f9f9f9;
    padding: 10px;
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-weight: 700;
    font-size: 1rem;
    height: 3rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
}

.product-price {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.product-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.efficiency-tag {
    display: inline-block;
    background: #e9f5ec;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 4px;
}

.amazon-btn {
    margin-top: auto;
    background: #ff9900;
    color: #111;
    text-decoration: none;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-weight: 700;
}

/* Footer */
.app-footer {
    padding: 40px 0;
    border-top: 1px solid #ddd;
    margin-top: 40px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.disclaimer,
.amazon-disclaimer {
    margin-bottom: 16px;
}

.social-share {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.share-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.share-btn.twitter {
    background: #000;
}

.share-btn.line {
    background: #00b900;
}

/* Responsive */
@media (max-width: 600px) {
    .grid-form {
        grid-template-columns: 1fr;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .total-calories {
        font-size: 2.5rem;
    }
}