.main {
    &.product {
        margin: 0 auto 48px;

        @media (width < 768px) {
            padding: 0;
            margin: 0 auto 24px;
        }

        .container {
            .back-button {
                font-size: 12px;
                line-height: 150%;
                letter-spacing: 0.014em;
                border: 1px solid #EDE6E0;
                border-radius: 2px;
                position: relative;
                display: inline-block;
                margin: 24px 0 16px;

                @media (width < 768px) {
                    margin: 8px 12px;
                }

                &:before {
                    content: "";
                    background: url("../img/favors_back_icon.svg") no-repeat center;
                    background-size: contain;
                    width: 16px;
                    height: 16px;
                    position: absolute;
                    top: 50%;
                    left: 8px;
                    transform: translate(0, -50%);
                }

                & a {
                    padding: 6px 12px 6px 28px;
                    display: block;
                    cursor: pointer;
                }
            }

            .flex-wrap {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: clamp(5px, calc(10vw / 768* 100), 32px);
                margin-top: 72px;
                margin-bottom: 72px;

                @media (width < 768px) {
                    flex-flow: column;
                    gap:16px;
                    margin-top: 16px;
                    margin-bottom: 16px;
                }

                .slider-section {
                    width: clamp(390px, calc(390vw / 768* 100), 524px);
                    max-width: 524px;
                    background: #fff;
                    padding: 32px;
                    border: 1px solid #EDE6E0;

                    @media (width < 1130px) {
                        width: clamp(350px, calc(350vw / 768* 100), 524px);
                    }

                    @media (width < 768px) {
                        width: 100%;
                        max-width: 100%;
                        padding: 16px 0;
                    }

                    .swiper {
                        width: 100%;
                    }

                    /* メインスライダー */
                    .main-slider {
                        .swiper-slide {
                            @media (width < 768px) {
                                width: 100%;
                                padding: 0 12px;
                            }

                            & img {
                                width: 100%;
                                height: auto;
                                display: block;
                            }
                        }
                    }

                    /* サムネイルスライダー */
                    .thumbnail-slider {
                        margin-top: 16px;

                        @media (width < 768px) {
                            padding-left: 12px;
                            overflow: hidden;
                        }

                        .swiper-wrapper {
                            @media (width >= 768px) {
                                display: flex;
                                flex-wrap: wrap;
                                transform: unset !important;
                            }

                            .swiper-slide {
                                width: clamp(64px, calc(64vw / 768* 100), 107px) !important;
                                height: clamp(64px, calc(64vw / 768* 100), 107px);
                                cursor: pointer;

                                @media (width >= 768px) {
                                    &:nth-child(4n) {
                                        margin-right: 0 !important;
                                    }

                                    &:nth-child(n+5) {
                                        margin-top: 16px;
                                    }
                                }

                                &.swiper-slide-thumb-active {
                                    border: 3px solid #D5C1B8;
                                }

                                & img {
                                    width: 100%;
                                    height: 100%;
                                    object-fit: cover;
                                    display: block;
                                }
                            }
                        }
                    }
                }

                .detail-section {
                    max-width: 724px;
                    width: 100%;
                    background: #fff;
                    border: 1px solid #EDE6E0;

                    @media (width < 768px) {
                        width: auto;
                        margin: 0 12px;
                    }

                    .detail-section__unit {
                        padding: 32px;
                        width: clamp(420px, calc(420vw / 768* 100), 724px);
                        border-bottom: 2px solid #EDE6E0;

                        @media (width < 1300px) {
                            width: 100%;
                        }

                        @media (width < 768px) {
                            padding: 16px 12px;
                        }

                        &:last-child {
                            border-bottom: none;
                        }

                        & p {
                            line-height: 150%;
                            letter-spacing: 0.014em;
                        }

                        &.detail-section__unit--desc {
                            @media (width < 768px) {
                                padding: 24px 12px;
                            }
                        }

                        /* 商品情報とオプションを1枠にまとめたぶん、オプション以降にだけ間隔を持たせる。
                           このクラスが付くのは商品詳細だけなので、同じCSSを読む引菓子・縁起物の
                           商品詳細（gifts/celebratory-product.blade.php）には影響しない。
                           値は同じ枠内の .option-buttons と揃える */
                        &.detail-section__unit--product {
                            .item-color {
                                margin-top: 32px;
                            }

                            /* バリアントが1件かつ Default Title のときは見出しが出ず、
                               サムネイルが価格の直後に来る */
                            .price + .stock-list {
                                margin-top: 32px;
                            }

                            @media (width < 768px) {
                                .item-color,
                                .price + .stock-list {
                                    margin-top: 24px;
                                }
                            }
                        }

                        .creator-name {
                            font-weight: 500;
                            font-size: 18px;
                            margin-bottom: 4px;

                            @media (width < 768px) {
                                font-size: 16px;
                            }
                        }

                        .item-name {
                            font-weight: 700;
                            font-size: 26px;
                            margin-bottom: 12px;

                            @media (width < 768px) {
                                font-size: 20px;
                            }
                        }

                        .price {
                            font-size: 20px;

                            @media (width < 768px) {
                                font-size: 16px;
                            }
                        }

                        .desc {
                            font-weight: 500;
                            font-size: 14px;
                            margin-bottom: 32px;
                            letter-spacing: 0.011em;
                            line-height: 1.6;

                            /* 下のボタンとの間隔なので、ボタンが無いとき（ログイン時の商品詳細）は不要 */
                            &:last-child {
                                margin-bottom: 0;
                            }

                            @media (width < 768px) {
                                margin-bottom: 24px;
                            }

                            & strong {
                                margin-top: 10px;
                                margin-bottom: 5px;
                                display: block;

                                & + br {
                                    display: none;
                                }
                            }
                        }

                        .button {
                            width: 320px;
                            margin-top: 32px;

                            @media (width < 768px) {
                                width: 100%;
                                margin-top: 24px;
                            }
                        }

                        /* カンプ実測: ボタン列は右寄せ（コンテナ 468px = 228px × 2 + gap 12px）。
                           上下・右の32pxは .detail-section__unit の padding がそのまま効く。
                           ボタンは2つとも 228×48px / Radius 2px だが、padding は種別で異なる
                           （Secondary=6px 12px / Primary=12px 24px）ため個別に指定する。
                           高さはラベル1行なら padding だけで 48px になるが、折り返し時もカンプの箱を保つため
                           height で固定し、ラベルは flex で天地中央に置く。 */
                        .option-buttons {
                            display: flex;
                            flex-wrap: wrap;
                            justify-content: flex-end;
                            /* 横並び時のボタン間は12px、縦積み時（折り返し・スマホとも）は8px */
                            row-gap: 8px;
                            column-gap: 12px;
                            margin-top: 32px;

                            /* スマホは縦積みで「引き出物として設定する」が上（カンプ準拠）。
                               PCは左=AI／右=引き出物 なので、DOM順はPCに合わせたまま column-reverse で逆に積む */
                            @media (width < 768px) {
                                flex-direction: column-reverse;
                                margin-top: 24px;
                            }

                            .button {
                                width: 228px;
                                height: 48px;
                                margin-top: 0;
                                display: flex;
                                align-items: center;
                                justify-content: center;
                                gap: 8px;
                                border-radius: 2px;

                                @media (width < 768px) {
                                    width: 100%;
                                }
                            }

                            /* AIにメッセージを相談する（Secondary。Fill=white・Border=1px primary/tint #EDE6E0）。
                               カンプにドロップシャドウの指定が無いため、共通 .default-button の影は打ち消す
                               （影が付くのは Primary=引き出物として設定する だけ） */
                            .button.default-button {
                                padding: 6px 12px;
                                box-shadow: none;

                                /* 非活性の見た目を隣の「引き出物として設定する」に揃える。
                                   共通CSSの .default-button:disabled は灰色（#ccc）に塗り替えるため、
                                   淡くなるだけの .active-button:disabled と並ぶと片方だけ重く見える。
                                   同じく「元の色のまま opacity で淡くする」形にする */
                                &:disabled {
                                    background-color: #fff;
                                    color: #6E767D;
                                    opacity: 0.3;
                                }
                            }

                            /* 引き出物として設定する（Primary。Fill=primary/base #D5C1B8・影は共通 .button の 4dp 2枚と一致） */
                            .button.active-button {
                                padding: 12px 24px;
                            }
                        }

                        .item-color {
                            font-weight: 500;
                            font-size: 22px;
                            display: flex;
                            align-items: center;
                            margin-bottom: 16px;

                            @media (width < 768px) {
                                font-size: 16px;
                            }

                            & span {
                                margin: 0 8px;
                                font-weight: 500;
                                font-size: 16px;

                                &.item-color__name, &.item-option__name {
                                    margin: 0;
                                }
                            }
                        }

                        .stock-list {
                            display: flex;
                            flex-wrap: wrap;
                            align-items: center;
                            gap: 12px;
                            margin-bottom: 16px;

                            /* 下にボタン列が続くとき（商品詳細のオプション欄）は、間隔を
                               .option-buttons の margin-top だけで決めるため打ち消す。
                               引菓子の選択画面では stock-list が末尾に来るので 16px を残す。 */
                            &:has(+ .option-buttons) {
                                margin-bottom: 0;
                            }

                            .stock-item {
                                border: 1px solid #fff;
                                box-sizing: content-box;
                                width: 70px;
                                cursor: pointer;

                                @media (width < 768px) {
                                    width: calc((100% / 4) - 11px);
                                }

                                &.active {
                                    border-color: #D5C1B8;

                                    .stock-item__image {
                                        border-color: #D5C1B8;
                                    }
                                }

                                .stock-item__image {
                                    display: block;
                                    border-bottom: 1px solid #fff;
                                    object-fit: cover;

                                    @media (width >= 768px) {
                                        height: 100%;
                                        aspect-ratio: 1;
                                    }

                                    @media (width < 768px) {
                                        height: 76px;
                                    }
                                }

                                & p {
                                    font-weight: 500;
                                    font-size: 10px;
                                    text-align: center;
                                    display: flex;
                                    align-items: center;
                                    justify-content: space-between;
                                    padding: 0 6px;
                                    margin: 4px 0 8px;

                                    & span {
                                        font-size: 12px;
                                    }
                                }

                                &:hover, &:has(input:checked) {
                                    border-color: #D5C1B8;

                                    .stock-item__image {
                                        border-color: #D5C1B8;
                                    }
                                }
                            }
                        }

                        .stock-info {
                            position: relative;
                            display: inline-block;

                            .stock-info__text {
                                font-weight: 500;
                                font-size: 12px;
                                padding-left: 22px;
                                position: relative;
                                cursor: pointer;

                                &:before {
                                    content: "";
                                    background: url("../img/info_icon.svg") no-repeat center;
                                    background-size: contain;
                                    width: 18px;
                                    height: 18px;
                                    position: absolute;
                                    top: 50%;
                                    left: 0;
                                    transform: translate(0, -50%);
                                }
                            }

                            .stock-info__tooltip {
                                opacity: 0;
                                visibility: hidden;
                                position: absolute;
                                top: 0;
                                left: -28px;
                                background-color: #fff;
                                border: 1px solid #EDE6E0;
                                border-radius: 6px;
                                font-size: 12px;
                                box-shadow: 0 2px 12px 0 #0000001A, 0 5px 8px 0 #00000005, 0 2px 4px 0 #00000003;
                                z-index: 10;
                                /*transform: translateY(-40px);*/
                                transition: all 0.25s ease-in-out;
                                padding: 12px 16px;
                                line-height: 150%;
                                letter-spacing: 0.011em;
                                white-space: nowrap;

                                @media (width < 1130px) {
                                    white-space: initial;
                                    width: 320px;
                                }

                                @media (width < 768px) {
                                    top: -45px;
                                    left: 0;
                                    width: 340px;
                                    white-space: initial;
                                    transform: translateY(46px);
                                    padding: 10px 12px;
                                }



                                &::before {
                                    content: "";
                                    position: absolute;
                                    bottom: 100%;
                                    left: 36px;
                                    transform: translateX(-50%);
                                    border-width: 7px;
                                    border-style: solid;
                                    border-color: transparent transparent #EDE6E0 transparent; /* ↓ 色が下側にくるよう変更 */
                                    z-index: 1;

                                    @media (width < 768px) {
                                        left: 54px;
                                    }
                                }

                                &::after {
                                    content: "";
                                    position: absolute;
                                    bottom: 100%;
                                    left: 36px;
                                    transform: translateX(-50%) translateY(1px); /* マイナスからプラスに変更 */
                                    border-width: 6px;
                                    border-style: solid;
                                    border-color: transparent transparent #fff transparent; /* ↓ 色が下側にくるよう変更 */
                                    z-index: 2;

                                    @media (width < 768px) {
                                        left: 54px;
                                    }
                                }

                                &.is-visible {
                                    opacity: 1;
                                    visibility: visible;
                                    transform: translateY(75px);
                                }
                            }

                            &:hover {
                                .stock-info__tooltip {
                                    @media (width >= 768px) {
                                        opacity: 1;
                                        visibility: visible;
                                        transform: translateY(30px);
                                    }
                                }
                            }
                        }

                        .story {
                            display: flex;
                            gap: 10px;

                            .story__image {
                                width: 173px;
                                object-fit: contain;
                                object-position: top;

                                @media (width < 768px) {
                                    width: 82px;
                                }
                            }

                            .story__text {
                                .catch {
                                    font-weight: 700;
                                    font-size: 18px;
                                    margin-bottom: 12px;

                                    @media (width < 768px) {
                                        font-size: 16px;
                                    }
                                }

                                .creator-name {
                                    font-size: 16px;
                                    margin-bottom: 12px;

                                    @media (width < 768px) {
                                        font-size: 12px;
                                    }
                                }

                                .link-text {
                                    font-weight: 500;
                                    font-size: 14px;
                                    position: relative;
                                    padding-right: 20px;
                                    display: inline-block;

                                    &:before {
                                        position: absolute;
                                        top: 50%;
                                        right: 0;
                                        content: "";
                                        background: url("../img/recommend_result_story-icon.svg");
                                        width: 16px;
                                        height: 16px;
                                        transform: translate(0, -50%);
                                        background-size: contain;
                                    }

                                    & a {
                                        cursor: pointer;
                                        color: #D5C1B8;
                                    }
                                }
                            }
                        }

                        .specification {
                            .specification__title {
                                font-weight: 500;
                                font-size: 22px;

                                @media (width < 768px) {
                                    font-size: 16px;
                                }
                            }

                            .specification__column {
                                padding: 16px 0;
                                border-bottom: 1px solid #EDE6E0;
                                font-size: 14px;
                                letter-spacing: 0.011em;


                                .title {
                                    font-weight: 500;
                                    font-size: 14px;
                                    margin-bottom: 8px;
                                }

                                .link-text {
                                    font-weight: 500;
                                    font-size: 14px;
                                    position: relative;
                                    padding-right: 20px;
                                    display: inline-block;
                                    margin-top: 8px;

                                    &:before {
                                        position: absolute;
                                        top: 50%;
                                        right: 0;
                                        content: "";
                                        background: url("../img/recommend_result_story-icon.svg");
                                        width: 16px;
                                        height: 16px;
                                        transform: translate(0, -50%);
                                        background-size: contain;
                                    }

                                    & a {
                                        cursor: pointer;
                                        color: #D5C1B8;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            .other-products {
                width: 100%;
                background: #fff;
                border: 1px solid #EDE6E0;

                @media (width < 768px) {
                    width: auto;
                    margin: 0 12px;
                }

                .other-products__title {
                    font-size: 24px;
                    line-height: 150%;
                    text-align: center;
                    padding: 16px 0;
                    border-bottom: 2px solid #EDE6E0
                }

                .other-products__list {
                    display: flex;
                    flex-wrap: wrap;
                    row-gap: 32px;
                    padding: 32px;

                    @media (width < 768px) {
                        flex-flow: column;
                        padding: 24px 12px;
                    }

                    .other-products__item {
                        width: calc((100% / 4) - 24px);
                        margin-right: 32px;

                        @media (width < 768px) {
                            width: 100%;
                            margin-right: 0;
                        }

                        &:nth-child(4n) {
                            @media (width >= 768px) {
                                margin-right: 0;
                            }
                        }

                        & img {
                            display: block;
                            margin-bottom: 12px;
                        }

                        .title {
                            font-weight: 500;
                            font-size: 16px;
                            line-height: 150%;
                            letter-spacing: 0.014em;
                            margin-bottom: 10px;
                        }

                        .price {
                            font-weight: 500;
                            font-size: 14px;
                            line-height: 150%;
                            letter-spacing: 0.014em;
                        }
                    }
                }
            }
        }

        .modal {
            /*
               記念品送り先選択モーダル
            */
            &.modal-sending-selection {
                .modal-content {
                    width: 848px;
                    display: block;
                    padding: 0;
                    text-align: left;
                    overflow: auto;
                    max-height: 80%;

                    @media (width < 768px) {
                        width: 100%;
                        height: 100%;
                        max-height: 100%;
                        padding-bottom: 120px;
                    }

                    .close-modal {
                        top: 14px;
                        right: 12px;

                        /* カンプは丸背景なしで細い✕だけを置く（当たり判定の36pxはそのまま）。
                           共通CSS（common.css）の丸背景は他の30箇所以上のモーダルが使っているので、
                           ここだけモーダル単位で打ち消す */
                        background: none;

                        &:before {
                            width: 18px;
                            height: 18px;
                            background-image: url("../img/modal_close_thin_icon.svg");
                        }
                    }

                    .modal__head {
                        padding: 12px 24px;
                        font-size: 20px;
                        line-height: 150%;
                        font-weight: 400;

                        @media (width < 768px) {
                            padding: 20px 12px;
                            border-bottom: 1px solid #EDE6E0;
                            font-weight: 500;
                            font-size: 16px;
                            text-align: center;
                        }
                    }

                    .modal__detail {
                        font-size: 14px;
                        line-height: 20px;
                        letter-spacing: 0.014em;
                        text-align: center;

                        .item-color {
                            display: flex;
                            align-items: center;
                            padding: 16px 24px;
                            margin-bottom: 12px;

                            @media (width < 768px) {
                                padding: 12px;
                                margin-bottom: 0;
                            }

                            .item-color__title {
                                font-size: 14px;
                                line-height: 24px;
                                letter-spacing: 0.014em;

                                & span {
                                    margin: 0 4px;
                                }
                            }

                            .item-color__name, .item-option__name {
                                font-size: 14px;
                                line-height: 24px;
                                letter-spacing: 0.014em;
                                position: relative;

                                &:before {
                                    content: "";
                                    position: absolute;
                                    background: url('../img/gifts_sidebar_icon.svg');
                                    width: 16px;
                                    height: 16px;
                                    top: 50%;
                                    right: 8px;
                                    display: inline-block;
                                    transform: translate(0, -50%);
                                    transition: transform 0.3s ease;

                                    @media (width < 768px) {
                                    }
                                }

                                & select {
                                    color: #6E767D;
                                    font-size: 14px;
                                    line-height: 24px;
                                    letter-spacing: 0.014em;
                                    padding: 10px 8px;
                                    width: 200px;
                                    height: 44px;
                                    border: 1px solid #EDE6E0;
                                    border-radius: 4px;
                                    background: none;
                                    outline: none;
                                    appearance: none; /* デフォルトの矢印を非表示 */
                                    -webkit-appearance: none;
                                    -moz-appearance: none;
                                    cursor: pointer;

                                    @media (width < 768px) {
                                    }
                                }
                            }
                        }

                        .tab-container {
                            .tabs {
                                display: flex;
                                gap: 6px;
                                padding-left: 24px;
                                margin-bottom: -1px;

                                @media (width < 768px) {
                                    padding-left: 12px;
                                }

                                .tab-button {
                                    transition: background 0.3s ease;
                                    font-size: 14px;
                                    line-height: 24px;
                                    letter-spacing: 0.014em;
                                    border-top: 1px solid #EDE6E0;
                                    border-left: 1px solid #EDE6E0;
                                    border-right: 1px solid #EDE6E0;
                                    border-bottom: none;
                                    margin-bottom: 1px;
                                    border-radius: 4px 4px 0 0;
                                    padding: 10px 14px;
                                    height: 44px;
                                    background: none;
                                    color: #6E767D;

                                    &.active {
                                        background: #D5C1B8;
                                        border: none;
                                        font-weight: 700;
                                        color: #fff;
                                    }
                                }
                            }

                            .tab-content {
                                display: none;
                                padding: 16px 24px;
                                border-top: 1px solid #EDE6E0;

                                @media (width < 768px) {
                                    padding: 16px 12px 0;
                                }

                                &.active {
                                    display: block;
                                }

                                .lead {
                                    font-size: 14px;
                                    line-height: 24px;
                                    letter-spacing: 0.014em;
                                    margin-bottom: 12px;
                                    text-align: left;
                                }

                                .select-content {
                                    .select-content__inner {
                                        border: 1px solid #EDE6E0;
                                        border-radius: 4px;

                                        @media (width < 768px) {
                                            border: none;
                                        }

                                        .select-list {
                                            width: 100%;
                                            text-align: left;

                                            .select-list__heading {
                                                font-weight: 500;
                                                font-size: 12px;
                                                line-height: 24px;
                                                letter-spacing: 0.014em;
                                                color: #12171A99;
                                                display: flex;
                                                align-items: center;
                                                border-bottom: 1px solid #EDE6E0;

                                                .select,
                                                .name,
                                                .group,
                                                .status {
                                                    padding: 4px 16px;
                                                }

                                                .select {
                                                    width: 57px;
                                                }

                                                .name,
                                                .group {
                                                    width: 281px;
                                                }

                                                .status {
                                                    width: 179px;
                                                }
                                            }

                                            .select-list__sort {
                                                display: none;

                                                @media (width < 768px) {
                                                    font-size: 14px;
                                                    line-height: 150%;
                                                    text-align: center;
                                                    cursor: pointer;
                                                    align-items: center;
                                                    gap: 10px;
                                                    position: relative;
                                                    width: 100%;
                                                    max-width: 127px;
                                                    display: flex;
                                                    padding: 8px 28px 8px 10px;
                                                    float: right;
                                                }

                                                &:before {
                                                    content: "";
                                                    position: absolute;
                                                    top: 50%;
                                                    right: 6px;
                                                    transform: translate(0, -50%);
                                                    background: url("../img/recommend_down_icon.svg");
                                                    width: 12px;
                                                    height: 12px;
                                                }

                                                .no {
                                                    font-size: 10px;
                                                    line-height: 100%;
                                                    letter-spacing: 0.011em;
                                                    background: #EDE6E0;
                                                    width: 22px;
                                                    height: 22px;
                                                    display: flex;
                                                    align-items: center;
                                                    justify-content: center;
                                                }
                                            }

                                            .select-list__search {
                                                @media (width < 768px) {
                                                    clear: both;
                                                    border-top: 1px solid #EDE6E0;
                                                }

                                                .list {
                                                    display: flex;
                                                    justify-content: flex-end;
                                                    border-bottom: 1px solid #EDE6E0;

                                                    @media (width < 768px) {
                                                        padding-left: 0;
                                                        padding-bottom: 12px;
                                                    }

                                                    .item {
                                                        font-size: 14px;
                                                        line-height: 24px;
                                                        letter-spacing: 0.014em;
                                                        position: relative;
                                                        padding: 8px;

                                                        @media (width < 768px) {
                                                            padding: 0;
                                                        }

                                                        .popup-button {
                                                            color: #6E767D;
                                                            font-size: 14px;
                                                            line-height: 24px;
                                                            letter-spacing: 0.014em;
                                                            padding: 8px 24px 8px 8px;
                                                            width: 100%;
                                                            height: 44px;
                                                            border: 1px solid #EDE6E0;
                                                            border-radius: 4px;
                                                            background: none;
                                                            cursor: pointer;
                                                        }

                                                        .popup-menu {
                                                            z-index: 1;
                                                            position: absolute;
                                                            left: 7px;
                                                            top: 54px;
                                                            background: white;
                                                            border: 1px solid #EDE6E0;
                                                            border-radius: 4px;
                                                            width: 266px;
                                                            box-shadow: 0 2px 12px 0 #0000001A, 0 5px 8px 0 #00000005, 0 2px 4px 0 #00000003;
                                                            opacity: 0;
                                                            transform: translateY(-10px);
                                                            transition: opacity 0.3s ease-out, transform 0.3s ease-out;
                                                            pointer-events: none;

                                                            /* ポップアップの表示 */
                                                            &.active {
                                                                opacity: 1;
                                                                transform: translateY(0);
                                                                pointer-events: auto;
                                                            }

                                                            .select-list {
                                                                .select-item {
                                                                    width: 100%;
                                                                    padding: 10px 12px;
                                                                    display: flex;
                                                                    align-items: center;

                                                                    .label {
                                                                        position: relative;

                                                                        & input[type="radio"] {
                                                                            display: none;

                                                                            &:checked ~ span::before {
                                                                                background: url("../img/gifts_check_icon.svg") no-repeat center;
                                                                                background-color: #D5C1B8;
                                                                                border: none;
                                                                            }
                                                                        }

                                                                        & span {
                                                                            position: relative;
                                                                            display: flex;
                                                                            align-items: center;

                                                                            &::before {
                                                                                content: "";
                                                                                width: 20px;
                                                                                height: 20px;
                                                                                margin-right: 8px;
                                                                                border: 1px solid #12171A33;
                                                                                border-radius: 4px;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }

                                                        & select {
                                                            color: #6E767D;
                                                            font-size: 14px;
                                                            line-height: 24px;
                                                            letter-spacing: 0.014em;
                                                            padding: 8px 24px 8px 8px;
                                                            width: 100%;
                                                            height: 44px;
                                                            border: 1px solid #EDE6E0;
                                                            border-radius: 4px;
                                                            background: none;
                                                            outline: none;
                                                            appearance: none;
                                                            -webkit-appearance: none;
                                                            -moz-appearance: none;
                                                            cursor: pointer;
                                                        }

                                                        &.item-search {
                                                            width: 281px;

                                                            @media (width < 768px) {
                                                                width: 70%;
                                                            }

                                                            .item-search__wrap {
                                                                border: 1px solid #EDE6E0;
                                                                border-radius: 4px;
                                                                display: flex;
                                                                align-items: center;
                                                                justify-content: space-between;
                                                                padding: 0 16px;

                                                                & input {
                                                                    color: #6E767D;
                                                                    width: 85%;
                                                                    height: 44px;
                                                                    font-size: 14px;
                                                                    line-height: 24px;
                                                                    letter-spacing: 0.014em;
                                                                    background: none;
                                                                    border: none;
                                                                    outline: none;

                                                                    @media (width < 768px) {
                                                                        width: 88%;
                                                                        height: 36px;
                                                                    }

                                                                    &::placeholder {
                                                                        opacity: 0.4;
                                                                    }
                                                                }

                                                                .search-button {
                                                                    background: none;
                                                                    border: none;
                                                                    width: 20px;
                                                                    height: 20px;
                                                                    padding: 0;
                                                                    cursor: pointer;
                                                                }
                                                            }
                                                        }

                                                        &.item-group {
                                                            width: 281px;

                                                            @media (width < 768px) {
                                                                display: none;
                                                            }

                                                            &:before {
                                                                content: "";
                                                                position: absolute;
                                                                background: url("../img/gifts_sidebar_icon.svg");
                                                                width: 16px;
                                                                height: 16px;
                                                                top: 50%;
                                                                right: 16px;
                                                                display: inline-block;
                                                                transform: translate(0, -50%);
                                                            }
                                                        }

                                                        &.item-status {
                                                            width: 179px;

                                                            @media (width < 768px) {
                                                                display: none;
                                                            }

                                                            &:before {
                                                                content: "";
                                                                position: absolute;
                                                                background: url("../img/gifts_sidebar_icon.svg");
                                                                width: 16px;
                                                                height: 16px;
                                                                top: 50%;
                                                                right: 16px;
                                                                display: inline-block;
                                                                transform: translate(0, -50%);
                                                            }

                                                            .popup-menu {
                                                                width: 163px;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            .input-checkbox {
                                                display: none;

                                                &:checked + .text::before {
                                                    background: url("../img/gifts_check_icon.svg") no-repeat center;
                                                    background-color: #D5C1B8;
                                                    border-color: #D5C1B8 !important;
                                                    background-size: 16px;
                                                }
                                            }
                                            /* 最終行の白背景が枠の角丸をふさぐので、一覧側で下だけ丸めて切り抜く。
                                               絞り込みのポップアップは .select-list__search 側にあるので巻き込まない */
                                            .select-list__list {
                                                @media (width >= 768px) {
                                                    border-radius: 0 0 4px 4px;
                                                    overflow: hidden;
                                                }
                                            }

                                            .select-list__search, .select-list__list {
                                                @media (width < 768px) {
                                                    border-left: 1px solid #EDE6E0;
                                                    border-right: 1px solid #EDE6E0;
                                                }

                                                .list, .unit {
                                                    font-size: 14px;
                                                    line-height: 24px;
                                                    letter-spacing: 0.014em;
                                                    /* カンプでは行だけ白く抜く（見出し行はモーダル地のまま） */
                                                    background: #fff;
                                                    border-bottom: 1px solid #EDE6E0;
                                                    display: flex;
                                                    align-items: center;

                                                    @media (width < 768px) {
                                                        justify-content: space-between;
                                                        padding: 12px;
                                                    }

                                                    /* 一覧の最終行だけ枠線と二重になるので下線を消す。
                                                       検索・絞り込み行(.list)は .select-list__search の唯一の子で
                                                       :last-child に巻き込まれ、1人目との間の線が消えていたため .unit に限定する */
                                                    &.unit:last-child {
                                                        @media (width >= 768px) {
                                                            border: none;
                                                        }
                                                    }

                                                    .sp-wrap {
                                                        display: flex;
                                                        align-items: center;

                                                        @media (width < 768px) {
                                                            justify-content: space-between;
                                                        }

                                                        .unit__item {
                                                            display: flex;

                                                            @media (width < 768px) {
                                                                flex-flow: column;
                                                                width: 100%;
                                                                max-width: 200px;
                                                            }

                                                            .name,
                                                            .group {
                                                                width: 281px;
                                                                padding: 4px 16px;

                                                                @media (width < 768px) {
                                                                    width: auto;
                                                                    padding: 0;
                                                                }
                                                            }

                                                            .name {
                                                                @media (width < 768px) {
                                                                    margin-bottom: 2px;
                                                                    order: 2;
                                                                }
                                                            }

                                                            .group {
                                                                @media (width < 768px) {
                                                                    font-size: 12px;
                                                                    order: 1;
                                                                }
                                                            }
                                                        }
                                                    }

                                                    .select {
                                                        width: 57px;
                                                        height: 57px;
                                                        padding: 4px 16px;
                                                        display: flex;
                                                        align-items: center;

                                                        @media (width < 768px) {
                                                            width: 20px;
                                                            height: 20px;
                                                            margin-right: 8px;
                                                            padding: 0;
                                                        }

                                                        &.check-all-wrapper {
                                                            .label {
                                                                /* 検索・絞り込み行のチェックボックスはPCでは出さない。
                                                                   「選択」列と幅を揃える余白としてセル(57px)だけ残す。
                                                                   SPは「一括選択」のラベル付きで操作として成立しているので残す */
                                                                @media (width >= 768px) {
                                                                    display: none;
                                                                }

                                                                & span {
                                                                    @media (width < 768px) {
                                                                        width: 57px;
                                                                    }
                                                                }
                                                            }
                                                        }

                                                        .input-checkbox {
                                                            display: none;

                                                            &:checked + .label::before {
                                                                background: url("../img/gifts_check_icon.svg") no-repeat center;
                                                                background-color: #D5C1B8;
                                                                background-size: 16px;
                                                                border: none;
                                                            }
                                                        }

                                                        .label {
                                                            display: inline-flex;
                                                            align-items: center;
                                                            cursor: pointer;
                                                            font-size: 14px;
                                                            line-height: 20px;
                                                            letter-spacing: 0.014em;

                                                            &:before {
                                                                content: "";
                                                                display: inline-block;
                                                                width: 20px;
                                                                height: 20px;
                                                                margin-right: 8px;
                                                                border: 1px solid #12171A33;
                                                                border-radius: 4px;
                                                            }
                                                        }
                                                    }

                                                    .status {
                                                        width: 179px;
                                                        position: relative;
                                                        padding: 16px 16px 16px 42px;

                                                        @media (width < 768px) {
                                                            width: auto;
                                                            padding: 0 0 0 20px;
                                                        }

                                                        &:before {
                                                            content: "";
                                                            background: url("../img/gifts_status_icon.svg") no-repeat center;
                                                            background-size: contain;
                                                            width: 18px;
                                                            height: 18px;
                                                            position: absolute;
                                                            top: 50%;
                                                            left: 16px;
                                                            transform: translate(0, -50%);

                                                            @media (width < 768px) {
                                                                width: 16px;
                                                                height: 16px;
                                                                left: 0;
                                                            }
                                                        }

                                                        &.active {
                                                            &:before {
                                                                background: url("../img/gifts_status_active_icon.svg") no-repeat center;
                                                                background-size: contain;
                                                            }
                                                        }
                                                    }

                                                    /* 在庫確認中 */
                                                    .status[data-guest-status-id="3"]:before,
                                                    .status[data-group-status-id="3"]:before,
                                                    .status[data-parent-status-id="3"]:before {
                                                        background-image: url("../img/gifts_status_icon.svg");
                                                    }

                                                    /* 納品可能 */
                                                    .status[data-guest-status-id="4"]:before,
                                                    .status[data-group-status-id="4"]:before,
                                                    .status[data-parent-status-id="4"]:before {
                                                        background-image: url("../img/gifts_status_icon.svg");
                                                    }

                                                    /* 注文確定 */
                                                    .status[data-guest-status-id="5"]:before,
                                                    .status[data-group-status-id="5"]:before,
                                                    .status[data-parent-status-id="5"]:before {
                                                        background-image: url("../img/order_confirmed_icon.svg");
                                                    }
                                                }

                                            }
                                        }

                                        .quantity-section {
                                            margin: 12px 0 0 28px;
                                            width: 100%;
                                            text-align: left;

                                            .quantity-section__title {
                                                display: inline-block;
                                                font-weight: 500;
                                                font-size: 12px;
                                                line-height: 125%;
                                                letter-spacing: 0.011em;
                                                padding: 4px 0;
                                                border-bottom: 1px solid #6E767D;
                                                margin-bottom: 12px;
                                            }

                                            .quantity-section__selector {
                                                display: flex;
                                                align-items: center;
                                                justify-content: space-between;
                                                border: 1px solid #12171A33;
                                                border-radius: 4px;
                                                width: 134px;
                                                height: 38px;

                                                & button {
                                                    width: 38px;
                                                    height: 38px;
                                                    font-size: 18px;
                                                    border: none;
                                                    background: none;
                                                    cursor: pointer;
                                                    display: flex;
                                                    align-items: center;
                                                    justify-content: center;

                                                    &.decrease {
                                                        border-right: 1px solid #12171A33;
                                                    }

                                                    &.increase {
                                                        border-left: 1px solid #12171A33;
                                                    }

                                                    & img {
                                                        width: 18px;
                                                        height: 18px;
                                                    }
                                                }

                                                & input {
                                                    font-size: 20px;
                                                    line-height: 100%;
                                                    letter-spacing: 0.014em;
                                                    text-align: center;
                                                    color: #6E767D;
                                                    border: none;

                                                    /* デフォルトのスピンボタンを非表示 */
                                                    &[type="number"]::-webkit-outer-spin-button,
                                                    &[type="number"]::-webkit-inner-spin-button {
                                                        -webkit-appearance: none;
                                                        margin: 0;
                                                    }

                                                    &[type="number"] {
                                                        -moz-appearance:textfield;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    /* 参列者の追加。カンプでは一覧の枠の外に置かれた幅いっぱいのボタンで、
                                       押すと同じ位置に入力フォームが入れ替わりで現れる。
                                       一覧との間隔はカンプ実測の12px */
                                    .guest-add {
                                        margin-top: 12px;

                                        /* ＋ボタンもフォームも display:flex を持つため、hidden 属性（UAスタイル）
                                           だけでは消えない。出し分けに使うので明示的に打ち消す */
                                        .guest-add__toggle[hidden],
                                        .guest-add__form[hidden] {
                                            display: none;
                                        }

                                        /* カンプ実測（button / Secondary / sm）: 高さHug30px = padding 6px + アイコン18px + 6px */
                                        .guest-add__toggle {
                                            width: 100%;
                                            display: flex;
                                            align-items: center;
                                            justify-content: center;
                                            gap: 8px;
                                            padding: 6px 16px 6px 12px;
                                            border: 1px solid #EDE6E0;
                                            border-radius: 2px;
                                            background: #fff;
                                            cursor: pointer;

                                            &:before {
                                                content: "";
                                                flex-shrink: 0;
                                                width: 18px;
                                                height: 18px;
                                                background: url("../img/gifts_plus_icon.svg") no-repeat center;
                                                background-size: contain;
                                            }
                                        }

                                        /* カンプ実測: 高さ56px固定 / border 1px #EDE6E0 / 角丸2px */
                                        /* カンプは [入力セル Fill/padding 8px 16px][セレクトセル Fill/padding 8px]
                                           [ボタンセル Hug 214px/padding 16px] の3セル構成。一覧の列とは揃えない。
                                           セル間の間隔（16+8=24px 等）は各子要素の margin で再現する */
                                        .guest-add__form {
                                            display: flex;
                                            align-items: center;
                                            height: 56px;
                                            border: 1px solid #EDE6E0;
                                            border-radius: 2px;
                                            background: #fff;

                                            /* SPはセレクト→入力→ボタンの縦積み。
                                               カンプはカード padding 12px 0 + 行セル padding 8px 16px 等の入れ子。
                                               展開した実効値: 上下20 / 左右16、行間16 */
                                            @media (width < 768px) {
                                                height: auto;
                                                flex-wrap: wrap;
                                                gap: 16px;
                                                padding: 20px 16px;
                                            }
                                        }

                                        /* カンプ実測: 高さ40px / 角丸4px / border 1px #EDE6E0。
                                           幅はどちらも Fill（残り幅を等分） */
                                        .guest-add__name,
                                        .guest-add__group {
                                            height: 40px;
                                            border: 1px solid #EDE6E0;
                                            border-radius: 4px;
                                            background: #fff;
                                            color: #12171A;
                                            font-size: 14px;
                                            line-height: 24px;
                                            letter-spacing: 0.014em;
                                            outline: none;
                                        }

                                        .guest-add__name {
                                            /* 入力セルの padding 16px を margin で再現 */
                                            flex: 1 1 0;
                                            min-width: 0;
                                            margin: 0 16px;
                                            padding: 0 16px;

                                            &::placeholder {
                                                color: #6E767D;
                                                opacity: 0.4;
                                            }

                                            /* SPは1行を占有 */
                                            @media (width < 768px) {
                                                flex: 1 1 100%;
                                                margin: 0;
                                            }
                                        }

                                        .guest-add__group {
                                            /* セレクトセルの padding 8px を margin で再現 */
                                            flex: 1 1 0;
                                            min-width: 0;
                                            margin: 0 8px;
                                            padding: 0 40px 0 16px;

                                            /* SPは1行を占有し、カンプ準拠で入力欄より上に置く */
                                            @media (width < 768px) {
                                                flex: 1 1 100%;
                                                margin: 0;
                                                order: -1;
                                            }

                                            appearance: none;
                                            -webkit-appearance: none;
                                            -moz-appearance: none;
                                            background-image: url("../img/gifts_sidebar_icon.svg");
                                            background-repeat: no-repeat;
                                            background-position: right 16px center;
                                            background-size: 16px 16px;
                                            cursor: pointer;
                                        }

                                        /* キャンセルと保存の並び。
                                           ボタンセルの padding 16px を margin で再現。ボタン間は form_button の gap 6px */
                                        .guest-add__actions {
                                            display: flex;
                                            align-items: center;
                                            gap: 6px;
                                            flex: 0 0 auto;
                                            margin: 0 16px;

                                            /* SPは折り返した最終行に内容幅のまま右寄せ。
                                               入力欄との間はカンプ実効24px（gap 16 + 8） */
                                            @media (width < 768px) {
                                                width: 100%;
                                                justify-content: flex-end;
                                                margin: 8px 0 0;
                                            }
                                        }

                                        .guest-add__cancel {
                                            width: auto;
                                            /* 保存は枠なしで padding 6px。こちらは .default-button の
                                               枠1pxぶん上下を削らないと高さが36pxに揃わない */
                                            padding: 5px 12px;
                                            white-space: nowrap;
                                        }

                                        .guest-add__save {
                                            width: auto;
                                            /* line-height 24px と合わせて高さ36px */
                                            padding: 6px 12px;
                                            white-space: nowrap;
                                        }
                                    }
                                }

                                &.tab-group {
                                    .select-content {
                                        .select-content__inner {
                                            .select-list {
                                                .select-list__list {
                                                    .unit {
                                                        .sp-wrap {
                                                            .unit__item {
                                                                .name {
                                                                    display: flex;
                                                                    align-items: center;

                                                                    .name__list {
                                                                        display: inline-block;
                                                                        max-width: 196px; /* 省略される幅を指定 */
                                                                        white-space: nowrap;
                                                                        overflow: hidden;
                                                                        text-overflow: ellipsis;
                                                                        margin-right: 8px;
                                                                    }

                                                                    .name__more {
                                                                        flex-shrink: 0; /* 常に表示されるようにする */
                                                                    }

                                                                    @media (width < 768px) {
                                                                        order: 1;
                                                                        font-size: 12px;
                                                                    }
                                                                }

                                                                .group {
                                                                    @media (width < 768px) {
                                                                        order: 2;
                                                                        font-size: 14px;
                                                                    }
                                                                }

                                                                .pc-hide {
                                                                    @media (width >= 768px) {
                                                                        display: none;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    .buttons {
                        display: flex;
                        align-items: center;
                        justify-content: flex-end;
                        gap: 24px;
                        padding: 12px 24px;
                        border-top: 1px solid #EDE6E0;
                        background: #F7F4EF;

                        @media (width < 768px) {
                            flex-flow: column;
                            gap: 10px;
                            padding: 12px 16px;
                            position: fixed;
                            bottom: 0;
                            width: 100%;
                        }

                        .button {
                            width: 174px;
                            height: 36px;
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            padding: 6px 0;

                            @media (width < 768px) {
                                width: 100%;
                                height: 48px;
                            }
                        }

                        .text {
                            font-weight: 500;
                            font-size: 12px;
                            line-height: 150%;
                            letter-spacing: 0.014em;

                            @media (width < 768px) {
                                font-weight: 400;
                                font-size: 14px;
                                display: flex;
                                align-items: center;
                            }

                            .no {
                                font-size: 24px;
                                line-height: 24px;

                                @media (width < 768px) {
                                    font-weight: 400;
                                }
                            }

                            .subject {
                                margin: 0 4px;

                                @media (width < 768px) {
                                    margin: 0 8px;
                                }
                            }
                        }
                    }
                }
            }

            /* 絞り込みモーダル */
            &.modal-sort {
                align-items: flex-end;

                .modal-content {
                    width: 100%;
                    border-radius: 4px 4px 0 0;
                    display: block;
                    padding: 0;

                    .close-modal {
                        top: 14px;
                        right: 12px;
                    }

                    .modal-sort__head {
                        font-weight: 500;
                        font-size: 16px;
                        line-height: 24px;
                        letter-spacing: 0.014em;
                        text-align: center;
                        padding: 20px 12px;
                    }

                    .modal-sort__detail {
                        background: #FFFFFF;
                        padding: 16px 12px;
                        border-top: 1px solid #EDE6E0;

                        .modal-sort__detail-inner {
                            border: 1px solid #EDE6E0;
                            padding: 8px;

                            &:first-child {
                                margin-bottom: 24px;
                            }

                            .modal-sort__title {
                                font-weight: 400;
                                font-size: 16px;
                                line-height: 150%;
                                letter-spacing: 0.014em;
                                margin-bottom: 8px;
                                text-align: left;
                            }

                            .modal-sort__list {
                                display: flex;
                                flex-wrap: wrap;
                                gap: 8px;

                                .modal-sort__radio {
                                    font-size: 14px;
                                    line-height: 100%;
                                    letter-spacing: 0.011em;

                                    & span {
                                        display: inline-block;
                                        padding: 6px 12px;
                                        transition: all 0.2s ease;
                                    }

                                    & input {
                                        display: none;

                                        /* 選択時のスタイル */
                                        &:checked + span {
                                            background: #EDE6E0;
                                            border-radius: 2px;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    /* 引菓子 / 縁起物 / プチギフトからの商品詳細ページ */
    &.celebratory-product {
        padding: 24px 16px 0;

        @media (width < 768px) {
            padding: 0;
        }

        .container {
            .quantity-selector {
                display: flex;
                align-items: center;
                justify-content: space-between;
                border: 1px solid #12171A33;
                border-radius: 4px;
                width: 176px;
                height: 38px;

                & button {
                    width: 38px;
                    height: 38px;
                    font-size: 18px;
                    border: none;
                    background: none;
                    cursor: pointer;
                    display: flex;
                    align-items: center;
                    justify-content: center;

                    &.decrease {
                        border-right: 1px solid #12171A33;
                    }

                    &.increase {
                        border-left: 1px solid #12171A33;
                    }

                    & img {
                        width: 18px;
                        height: 18px;
                    }
                }

                & input {
                    flex: 0 0 84px;
                    width: 84px;
                    font-size: 20px;
                    line-height: 100%;
                    letter-spacing: 0.014em;
                    text-align: center;
                    color: #6E767D;
                    border: none;

                    /* デフォルトのスピンボタンを非表示 */
                    &[type="number"]::-webkit-outer-spin-button,
                    &[type="number"]::-webkit-inner-spin-button {
                        -webkit-appearance: none;
                        margin: 0;
                    }

                    &[type="number"] {
                        -moz-appearance:textfield;
                    }
                }
            }

            .button-area {
                @media (width < 768px) {
                    padding: 0 12px;
                }

                .button {
                    width: 351px;
                    height: 50px;
                    margin: 32px auto 0;
                    display: block;

                    @media (width < 768px) {
                        width: 100%;
                        margin: 24px 0 0;
                    }
                }
            }
        }
    }
}

/* ============================================================
   AIでメッセージを試すモーダル（商品詳細）
   /gift/favors「AIにお願いする」ウィザード（gifts.css の .tab-content__message 配下）を
   モーダルに移植したもの。アコーディオン関連は不要のため除外。
   「仕上がりの例」ポップオーバーはモーダル上端で切れないよう下向きに開く（favor版は上向き）
   ============================================================ */
.main.product .modal.modal-ai-message {
    /* カンプ実測（Frame 2609412）: 幅600px。padding はヘッダー(Frame 2609228)と
       本文(Frame 2609229)がそれぞれ持つため、外枠では持たせない。 */
    .modal-content {
        display: block;
        text-align: left;
        width: 600px;
        /* 生成文が長いと中身が縦に伸びるため、上限を超えたぶんは内部スクロールになる。
           85%だと④のボタンのすぐ下で折り返して .msg-ai の padding-bottom(32px) が
           隠れることが多かったので、上下の余白を詰めて表示できる高さを稼ぐ */
        max-height: 95%;
        overflow: auto;
        padding: 0;

        @media (width < 768px) {
            width: 100%;
            height: 100%;
            max-height: 100%;
        }

        .close-modal {
            /* ヘッダーの縦中央（上padding24px + コンテンツ36pxの中央）に 24px の✕を置く */
            top: 30px;
            right: 24px;
            width: 24px;
            height: 24px;
            background: none;

            /* カンプは丸背景なしの「✕」のみ（既存の灰色丸アイコンを打ち消す） */
            &::before {
                content: "✕";
                background: none;
                width: auto;
                height: auto;
                font-size: 22px;
                line-height: 1;
                color: #D5C1B8;
            }
        }
    }

    /* ヘッダー（Frame 2609228）: Height Hug 72px = padding 24px + 行36px + padding 12px */
    .modal__head {
        font-size: 20px;
        font-weight: 500;
        line-height: 36px;
        color: #6E767D;
        margin-bottom: 0;
        padding: 24px 24px 12px;
        border-bottom: 1px solid #EDE6E0;
    }

    /* 本文（Frame 2609229）: padding 12px 24px 32px / リード文とステッパーの間 24px */
    .msg-ai {
        display: flex;
        flex-direction: column;
        gap: 24px;
        /* PCの左右は48px。本文幅 600-96=504px、ステップ本文はさらに40pxインデントされるので
           カンプの464pxになる。ヘッダー(.modal__head)は24pxのままで揃えない */
        padding: 12px 48px 32px;

        @media (width < 768px) {
            /* スマホは画面が狭いので左右は24pxのまま本文幅を優先する。
               全画面表示なので、最下部のボタンが隠れないよう下にも余裕を持たせる */
            padding: 12px 24px 120px;
        }
    }

    .msg-ai__lead {
        font-size: 14px;
        line-height: 1.7;
        color: #6E767D;
        margin-bottom: 0;
    }

    /* --- 縦型ステッパー --- */
    .msg-steps {
        list-style: none;
        margin: 0;
        padding: 0;
        counter-reset: msgstep;

        .msg-steps__item {
            position: relative;
            padding-bottom: 8px;
            counter-increment: msgstep;

            /* ステップ間をつなぐ縦線（最後以外）。丸(28px)の中心＝left:14pxに来るよう transform で正確に揃える */
            &:not(:last-child)::before {
                content: "";
                position: absolute;
                left: 14px;
                transform: translateX(-50%);
                top: 14px;
                bottom: 0;
                width: 1px;
                background: #EDE6E0;
                z-index: 0;
            }

            .msg-steps__head {
                display: flex;
                align-items: center;
                gap: 12px;
            }

            .msg-steps__num {
                position: relative;
                z-index: 1;
                flex-shrink: 0;
                width: 28px;
                height: 28px;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 12px;
                line-height: 1;
                background: #fff;
                border: 1px solid #EDE6E0;
                color: #6E767D;

                /* ステップ番号は表示中のステップだけを数える（B分岐で結びつきを隠すと自動繰り上がり） */
                &::before {
                    content: counter(msgstep);
                }
            }

            .msg-steps__label {
                font-size: 14px;
                font-weight: 500;
                line-height: 24px;
                letter-spacing: 0.014em;
                color: #6E767D;
            }

            /* 完了ステップに畳んで表示する選択内容（例「：想いを紡いで贈る」） */
            .msg-steps__value {
                font-weight: 700;
                color: #6E767D;
            }

            /* 自由記述ステップの「任意」バッジ。ラベルとの12pxは .msg-steps__head の gap がそのまま効く。
               未着手・完了のあいだは出さず、そのステップに来ている間だけ表示する（is-active で解除） */
            .msg-steps__optional {
                flex-shrink: 0;
                display: none;
                align-items: center;
                justify-content: center;
                padding: 2px 4px;
                border-radius: 2px;
                background: #ABABAB;
                color: #fff;
                font-size: 12px;
                font-weight: 500;
                line-height: 14px;
                letter-spacing: 0.014em;
                white-space: nowrap;
            }

            /* 実施中ステップ */
            &.is-active {
                .msg-steps__num {
                    background: #D5C1B8;
                    border-color: #D5C1B8;
                    color: #fff;
                }

                .msg-steps__label {
                    color: #AC828A;
                    font-weight: 700;
                }

                .msg-steps__optional {
                    display: inline-flex;
                }

                .msg-steps__body {
                    display: block;
                }
            }

            /* 完了ステップ（選んだ内容を畳んで表示）。丸は未着手と同じ白地・グレー枠のまま（カンプ準拠） */
            &.is-done {
                .msg-steps__label {
                    color: #6E767D;
                }
            }

            /* この分岐で使わないステップ（B選択時の結びつき等） */
            &.is-hidden {
                display: none;
            }
        }

        /* ステップ本体（アクティブなステップのみ表示＝アコーディオン）
           左インデント＝丸(28px) + ギャップ12px（.msg-steps__head の gap と同じ）で丸から12px揃える */
        .msg-steps__body {
            display: none;
            padding: 0 0 4px 40px;
        }
    }

    .msg-step__question {
        font-size: 14px;
        line-height: 1.6;
        color: #6E767D;
        margin-bottom: 12px;
    }

    /* --- 方向性の選択カード --- */
    .msg-choice {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
        margin-bottom: 8px;
        background: #fff;
        border: 1px solid #EDE6E0;
        border-radius: 6px;
        cursor: pointer;
        transition: border-color 0.2s ease;

        &.is-selected {
            border-color: #D5C1B8;
        }

        input[type="radio"] {
            display: none;
        }

        .msg-choice__radio {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            margin-top: 2px;
            border: 1px solid #12171A33;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        input[type="radio"]:checked + .msg-choice__radio {
            border-color: #D5C1B8;

            &::after {
                content: "";
                width: 12px;
                height: 12px;
                background: #D5C1B8;
                border-radius: 50%;
            }
        }

        .msg-choice__body {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .msg-choice__title {
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 14px;
            font-weight: 700;
            line-height: 16px;
            letter-spacing: 0.014em;
            color: #6E767D;
        }

        .msg-choice__info {
            display: inline-block;
            width: 14px;
            height: 14px;
            background: url("../img/gifts_ai_choice_help_icon.svg") no-repeat center;
            background-size: contain;
            cursor: pointer;

            &:focus-visible {
                outline: 2px solid #D5C1B8;
                outline-offset: 2px;
                border-radius: 2px;
            }
        }

        .msg-choice__info-wrap {
            position: relative;
            display: inline-flex;
        }

        /* favor版と違い下向きに開く（モーダル先頭付近のステップ①で上に開くと .modal-content の
           スクロール上端で切れるため） */
        .msg-choice__popover {
            position: absolute;
            left: 50%;
            top: calc(100% + 16px);
            transform: translateX(-50%);
            z-index: 2;
            width: 240px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            background: #FFFFFF;
            border-radius: 8px;
            box-shadow: 0 2px 12px 0 #0000001A, 0 5px 8px 0 #00000005, 0 2px 4px 0 #00000003;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
            text-align: left;
            cursor: default;

            &.active {
                opacity: 1;
                pointer-events: auto;
            }

            /* 吹き出しの矢印（上向き＝アイコンを指す） */
            &::after {
                content: "";
                position: absolute;
                bottom: 100%;
                left: 50%;
                transform: translateX(-50%);
                width: 0;
                height: 0;
                border-left: 8px solid transparent;
                border-right: 8px solid transparent;
                border-bottom: 8px solid #FFFFFF;
            }
        }

        .msg-choice__popover-title {
            font-size: 14px;
            font-weight: 700;
            line-height: 22px;
            color: #6E767D;
        }

        .msg-choice__popover-text {
            font-size: 12px;
            font-weight: 400;
            line-height: 22px;
            color: #6E767D;
        }

        .msg-choice__desc {
            font-size: 12px;
            line-height: 1.6;
            color: #6E767D;
        }
    }

    /* --- アクションボタン（右寄せ・.button を土台に縮小） --- */
    .msg-step__actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 14px;

        /* カンプのボタンは高さ36px。Figmaの枠線は内側に引かれるので、枠線を持つ
           .default-button は上下paddingを1pxずつ削って 5+24+5+1+1=36 に合わせる
           （枠線の無い .active-button は 6+24+6=36 のまま） */
        .button {
            width: auto;
            margin-top: 0;
            padding: 5px 12px;
        }

        .button.active-button {
            padding: 6px 12px;
        }

        /* 「リセット」だけ左端へ逃がす（カンプでは行が space-between）。
           padding は左右非対称：左にアイコンが入るぶん右を広く取って見た目の重心を合わせる。
           カンプの 12px / 16px から枠線1pxずつを引いて 11px / 15px（幅 11+18+8+57+15+2=111px） */
        .msg-ai__reset {
            margin-right: auto;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 5px 15px 5px 11px;

            &::before {
                content: "";
                flex-shrink: 0;
                width: 18px;
                height: 18px;
                background: url("../img/gifts_ai_reset_icon.svg") no-repeat center;
            }
        }

        @media (width < 768px) {
            /* 横幅が足りずボタン内のラベルが折り返して行が3行に化けるのを止める */
            .button {
                white-space: nowrap;
            }

            /* スマホのリセットはアイコンのみ（カンプ: text off / Fixed 36×36 / padding 6px） */
            .msg-ai__reset {
                flex-shrink: 0;
                width: 36px;
                height: 36px;
                padding: 6px;
                justify-content: center;
                gap: 0;
            }

            .msg-ai__reset-text {
                display: none;
            }
        }

        /* 未ログインは「保存して会員登録」へ一本化するため、2つのボタンを
           縦に積んで本文幅いっぱいに広げる（カンプ準拠）。
           上の横並び前提の指定（右寄せ／リセットの左逃がし／SPのアイコンのみ化）を打ち消す。
           & を使って詳細度を1つ上げているので、メディアクエリ内の打ち消しも効く */
        &.msg-step__actions--guest {
            flex-direction: column;
            align-items: stretch;
            /* カンプ: 下書き欄との間は24px。.msg-draft__field の margin-bottom 16px と
               隣接兄弟で相殺されるので、24 を指定すればそのまま24pxになる。
               ボタン同士は6px（横並びの8pxから詰める） */
            margin-top: 24px;
            gap: 6px;

            .button {
                width: 100%;
            }

            .msg-ai__reset {
                margin-right: 0;
                justify-content: center;
            }

            @media (width < 768px) {
                /* 縦積みなので折り返してよい（横並び前提の nowrap を戻す）。
                   「商品とメッセージを保存（無料登録）」はSP幅だと1行に収まらない */
                .button {
                    white-space: normal;
                }

                /* SPでもアイコンのみ 36×36 には縮めず、幅いっぱいのまま文字を出す */
                .msg-ai__reset {
                    width: 100%;
                    height: auto;
                    padding: 5px 15px 5px 11px;
                    gap: 8px;
                }

                .msg-ai__reset-text {
                    display: inline;
                }
            }
        }
    }

    /* カンプ: リセットの下は32px。.msg-ai の padding-bottom がちょうど32pxなので、
       間に挟まる .msg-steps__item(8px) と .msg-steps__body(4px) の下余白を
       未ログインのときだけ落として32pxちょうどにする。
       下書きは常に最後のステップなので、ステップ間の間隔には影響しない */
    .msg-steps__item:has(.msg-step__actions--guest) {
        padding-bottom: 0;

        .msg-steps__body {
            padding-bottom: 0;
        }
    }

    /* --- 自由記述テキストエリア --- */
    .msg-freetext__input {
        width: 100%;
        min-height: 100px;
        border: 1px solid #EDE6E0;
        border-radius: 6px;
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.6;
        color: #6E767D;
        resize: none;

        &::placeholder {
            opacity: 0.4;
        }
    }

    /* --- ④下書きの確認：生成中ローディング／結果 --- */
    .msg-draft__loading {
        text-align: center;
        padding: 12px 0 4px;
    }

    .msg-draft__loading-text {
        font-size: 13px;
        line-height: 1.9;
        color: #6E767D;
        margin-bottom: 8px;
    }

    /* 軌道スピナー（gifts.css の msg-draft__spinner と同一・アセット不要の純CSS） */
    .msg-draft__spinner {
        position: relative;
        width: 60px;
        height: 60px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;

        .leo {
            position: absolute;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

        .blue-orbit {
            width: 47px;
            height: 47px;
            border: 1px solid #AC828A;
            animation: product-msg-spin3D 3s linear 0.2s infinite;
        }

        .green-orbit {
            width: 34px;
            height: 34px;
            border: 1px solid #D5C1B8;
            animation: product-msg-spin3D 2s linear 0s infinite;
        }

        .red-orbit {
            width: 24px;
            height: 24px;
            border: 1px solid #6E767D;
            animation: product-msg-spin3D 1s linear 0s infinite;
        }

        .white-orbit {
            width: 15px;
            height: 15px;
            border: 1px solid #ffffff;
            animation: product-msg-spin3D 10s linear 0s infinite;
        }

        .w1 { transform: rotate3d(1, 1, 1, 90deg); }
        .w2 { transform: rotate3d(1, 2, 0.5, 90deg); }
        .w3 { transform: rotate3d(0.5, 1, 2, 90deg); }
    }

    /* 結果は既定で非表示。draft が .is-ready のときローディング↔結果を入れ替える */
    .msg-draft__result {
        display: none;
    }

    .msg-steps__item[data-step="draft"].is-ready .msg-draft__loading {
        display: none;
    }

    .msg-steps__item[data-step="draft"].is-ready .msg-draft__result {
        display: block;
    }

    .msg-draft__field {
        margin-bottom: 16px;

        .msg-draft__label {
            font-weight: 500;
            font-size: 14px;
            line-height: 125%;
            letter-spacing: 0.011em;
            padding-bottom: 4px;
            display: inline-block;
        }

        &:first-child .msg-draft__label {
            padding-top: 14px;
        }

        .msg-draft__textarea {
            width: 100%;
            min-height: 110px;
            /* 高さは内容に応じて可変。JS側で scrollHeight に合わせて都度リサイズする */
            overflow-y: hidden;
            border: 1px solid #EDE6E0;
            border-radius: 6px;
            padding: 12px 14px;
            font-size: 14px;
            line-height: 1.6;
            color: #6E767D;
            resize: none;
        }
    }
}

/* 軌道スピナーの3D回転（gifts.css と同名・同内容＝両方読み込まれるページでも実害なし） */
@keyframes product-msg-spin3D {
    from { transform: rotate3d(.5, .5, .5, 360deg); }
    to { transform: rotate3d(0deg); }
}

