/* =================================== */
/* 1. 全体的なスタイル設定
/* =================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
header {
    background: linear-gradient(135deg, #4a90e2, #50e3c2);
    color: white;
    padding: 30px;
    text-align: center;
    border-radius: 8px 8px 0 0;
}
header h1 {
    margin: 0;
}
main {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
}

/* =================================== */
/* 2. サービス紹介アコーディオン
/* =================================== */
.service-accordion {
    max-width: 900px;         /* ページ全体のコンテナと同じ最大幅に設定 */
    margin-left: auto;        /* この2行で水平方向の中央揃えを実現 */
    margin-right: auto;
    padding: 0 30px;          /* 内側の余白を維持 */
    box-sizing: border-box;   /* paddingを含めて幅を計算するようにする */
    margin-bottom: 20px;
    margin-top: 40px;
}

.service-accordion summary {
    display: flex;
    justify-content: center; /* ← ここを center に変更 */
    align-items: center;
    gap: 10px; /* ← テキストとアイコンの間に余白を追加 */
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.service-accordion summary::-webkit-details-marker {
    display: none; /* Chrome/Safariのデフォルトの三角を消す */
}

.service-accordion summary:hover {
    background-color: #f1f3f5;
}

.service-accordion .accordion-title {
    font-weight: bold;
    color: #4a90e2;
}

.service-accordion .accordion-icon {
    font-size: 1.5em;
    font-weight: bold;
    color: #4a90e2;
    transition: transform 0.3s;
}

.service-accordion[open] > summary .accordion-icon {
    transform: rotate(45deg); /* 開いたときにアイコンを「×」に回転 */
}

.service-accordion .accordion-content {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.service-accordion .accordion-content h3 {
    margin-top: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.service-accordion .accordion-content ul {
    list-style: none;
    padding-left: 0;
}

.service-accordion .accordion-content li {
    margin-bottom: 8px;
}

.service-accordion .accordion-content li s {
    color: #888;
    margin-right: 8px;
}

/* =================================== */
/* 3. 入力フォーム（カードデザイン適用）
/* =================================== */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 30px; /* カード間の余白を調整 */
}
fieldset {
    border: none; /* 元の枠線を削除 */
    border-radius: 12px; /* カードの角を丸める */
    padding: 25px;
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* 柔らかい影を追加 */
    transition: all 0.2s ease-in-out;
}
fieldset:hover {
    transform: translateY(-5px); /* ホバー時に浮き上がる効果 */
    box-shadow: 0 8px A20px rgba(0, 0, 0, 0.08);
}
legend {
    font-weight: bold;
    font-size: 1.2em;
    color: #fff;
    background: linear-gradient(135deg, #4a90e2, #50e3c2); /* ヘッダーと統一感のあるデザイン */
    padding: 8px 20px;
    border-radius: 9999px; /* ピル型（カプセル型）に */
    margin-left: -5px; /* カードの端に合わせる微調整 */
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
}
input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
}
textarea {
    resize: vertical;
}
button#calculate-btn {
    margin-top: 10px;
}
button {
    padding: 15px;
    background-color: #6a67ea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:hover {
    background-color: #5a57d1;
}
.description {
    font-size: 0.9em;
    color: #666;
    margin-top: -5px;
    margin-bottom: 15px;
}

/* =================================== */
/* 4. 計算結果表示エリア
/* =================================== */
.result-section h2 {
    color: #4a90e2;
    margin-top: 0;
}
.card {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 5px solid #50e3c2;
}
.card h3 {
    margin-top: 0;
    color: #333;
}
.card p, .card li {
    line-height: 1.6;
}
.highlight-card {
    background-color: #4a90e2;
    color: white;
    border-left: 5px solid #2a6dbf;
}
.highlight-card h3, .highlight-card strong {
    color: white;
}
.main-calorie {
    font-size: 2.5em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
}
.pfc-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
}
.pfc-grid strong {
    font-size: 1.5em;
    display: block;
}
.loading-text {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-style: italic;
}

/* =================================== */
/* 5. ペイウォールと決済ボタン
/* =================================== */
.paywall {
    background-color: #fefce8;
    border-left-color: #facc15;
    text-align: center;
}
.paywall-title {
    color: #ca8a04;
    font-size: 1.5em;
    line-height: 1.4;
    margin-bottom: 15px;
}
.paywall-description {
    font-size: 0.95em;
    max-width: 600px;
    margin: 0 auto 30px;
    line-height: 1.7;
}
#open-sample-btn {
    box-sizing: border-box;
    width: 100%;
    max-width: 280px;
    padding-top: 15px;
    padding-bottom: 15px;
    font-size: 1.1em;
    font-weight: bold;
    background-color: #6a67ea;
    color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    margin-top: 0;
}
#open-sample-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.payment-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
.payment-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 280px;
}
.payment-option.recommended {
    transform: scale(1.02);
}
.limited-offer-tag {
    position: relative;
    display: inline-block;
    background-color: #ef4444;
    color: white;
    font-size: 0.9em;
    font-weight: bold;
    padding: 8px 16px;
    margin-bottom: 12px;
    z-index: 1;
}
.limited-offer-tag::before, .limited-offer-tag::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ef4444;
    z-index: -1;
}
.limited-offer-tag::before {
    transform: rotate(4deg);
}
.limited-offer-tag::after {
    transform: rotate(-4deg);
}
.plan-catchphrase {
    font-size: 1em;
    color: #854d0e;
    font-weight: 500;
    margin-bottom: 12px;
    text-align: center;
    line-height: 1.5;
    min-height: 3em;
}
.plan-catchphrase strong {
    font-weight: bold;
    color: #c2410c;
}
.payment-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 8px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-width: auto;
    margin-top: 0;
}
.payment-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.payment-btn .plan-name {
    display: block;
    margin-bottom: 5px;
    font-size: 1.05em;
}
.payment-btn .price-wrapper {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-top: 5px;
}
.payment-btn .original-price {
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}
.payment-btn .final-price {
    font-size: 1.7em;
    font-weight: 900;
    color: #fff;
}
.payment-btn .final-price::before {
    content: '→';
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    margin-right: 8px;
}

/* =================================== */
/* 6. 注意書きとサポート情報
/* =================================== */
.disclaimer-card {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
    font-size: 0.9em;
}
.disclaimer-card p {
    margin: 0;
}
.support-info-box {
    margin: 20px auto;
    padding: 15px;
    max-width: 500px;
    border: 1px solid #f59e0b;
    background-color: #fffbeb;
    border-radius: 8px;
    font-size: 0.9em;
    text-align: center;
}
.support-info-box p {
    margin: 5px 0;
}
.support-info-box .support-email {
    font-weight: bold;
    color: #d97706;
}

/* =================================== */
/* 7. モーダルウィンドウ
/* =================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100;
}
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 101;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
}
.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover {
    color: #333;
}
.modal-content h3 {
    text-align: center;
    margin-top: 0;
    color: #4a90e2;
}
.modal-content .sample-user-info {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    background-color: #f0f4f8;
    padding: 8px;
    border-radius: 4px;
    overflow-wrap: break-word;
    word-break: break-all;
}
.modal-content img {
    width: 100%;
    margin-top: 15px;
}
.modal-content .modal-note {
    text-align: center;
    font-size: 0.8em;
    color: #888;
    margin-top: 15px;
}
.hidden-content {
    display: none;
}
#legal-modal .legal-content {
    display: block;
    padding: 0;
    text-align: left;
}
#legal-modal .legal-content h2 {
    margin-top: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5em;
    font-size: 1.2em;
}
#legal-modal .legal-content p, #legal-modal .legal-content li {
    font-size: 0.9em;
}

/* =================================== */
/* 8. AIプラン表示エリア
/* =================================== */
#ai-plan-section .day-title {
    text-align: center;
    font-weight: bold;
    font-size: 1.4em;
    color: #4a90e2;
    padding-bottom: 10px;
    margin-top: 40px;
    border-bottom: 2px solid #4a90e2;
}
#ai-plan-section .advice-main-title {
    font-size: 1.6em;
    text-align: center;
    color: #4a90e2;
    border-top: 2px solid #f0f4f8;
    border-bottom: 2px solid #4a90e2;
    padding: 15px 0;
    margin-top: 40px;
    margin-bottom: 30px;
}
#ai-plan-section .meal-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 15px;
}
#ai-plan-section .advice-subtitle {
    text-align: center;
    font-size: 1.2em;
    color: #4a90e2;
    font-weight: bold;
    margin-top: 25px;
}
#ai-plan-section .day-total {
    text-align: center;
    margin-top: 25px;
    margin-bottom: 5px;
    font-size: 1.1em;
}
#ai-plan-section .day-total-value {
    text-align: center;
    margin-top: 0;
    padding-bottom: 25px;
    font-size: 1.1em;
}
#ai-plan-section strong {
    font-weight: bold;
    color: #333;
    font-size: 1em;
}
#ai-plan-section .day-total strong {
    color: #059669;
}
#ai-plan-section li {
    padding-left: 1.2em;
    text-indent: -1.2em;
    margin-bottom: 5px;
    list-style-type: none;
}
#ai-plan-section li::before {
    content: "";
}

/* =================================== */
/* 9. 画像保存ボタン
/* =================================== */
#download-btn {
    display: block;
    margin: 30px auto 10px auto;
    width: 100%;
    max-width: 280px;
    background-color: #6a67ea;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}
#download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    background-color: #5a57d1;
}
.download-note {
    text-align: center;
    font-size: 0.9em;
    color: #666;
}

/* =================================== */
/* 10. フッター
/* =================================== */
.site-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
}
.site-footer nav a {
    color: #666;
    text-decoration: none;
    margin: 0 10px;
    cursor: pointer;
}
.site-footer nav a:hover {
    text-decoration: underline;
}

/* =================================== */
/* 11. レスポンシブ対応
/* =================================== */

/* --- タブレットサイズまでの共通調整 --- */
@media (max-width: 820px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* --- スマートフォンサイズ（480px以下）の調整 --- */
@media (max-width: 480px) {

    /* フォームの縦ズレを修正 */
    .form-grid {
        /* 各グリッドアイテムを上端揃えにすることで、ラベルの高さ違いによるズレを防ぐ */
        align-items: start;
    }

    /* アコーディオンの文字を1行に */
    .service-accordion .accordion-title {
        white-space: nowrap; /* テキストの折り返しを禁止 */
    }

    /* 決済ボタンのテキストを1行に */
    .payment-btn .plan-name {
        white-space: nowrap; /* テキストの折り返しを禁止 */
    }
    
    /* 価格の矢印を独立させる */
    .payment-btn .price-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }
    .payment-btn .final-price::before {
        content: '↓';
        display: block;      /* 矢印をブロック要素にして独立させる */
        text-align: center;  /* 中央揃え */
        margin-right: 0;
        margin: 2px 0;
    }
}