/* =============================================
   women-page: iPad 横表示チャット UI  v3
   – 横向き iPad フレーム内でスクロール
   – IntersectionObserver で順次表示
   ============================================= */

/* ---------- タブ ---------- */
.wm-tabs {
    display: flex;
    justify-content: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin: 0 auto 2rem;
    max-width: 960px;
    padding: 0 1rem;
}

.wm-tabs__btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.1rem;
    border: 2px solid #ddd;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    transition: border-color .25s, box-shadow .25s;
    font-size: .92rem;
}

.wm-tabs__btn.is-active {
    border-color: var(--c, #0e7a3a);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .10);
}

.wm-tabs__avatar {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--c, #0e7a3a);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.wm-tabs__info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    text-align: left;
}

.wm-tabs__info small {
    font-size: .72rem;
    color: #777;
}

.wm-message__image {
    display: flex;
    justify-content: center;
}

.wm-message__image img {
    max-width: 420px;
    width: 100%;
}

/* ---------- スレッド ---------- */
.wm-thread {
    display: none;
    max-width: 740px;
    margin: 0 auto;
    padding: 0 1rem;
}

.wm-thread.is-active {
    display: block;
}

/* ==========================================================
   iPad 横表示フレーム
   ========================================================== */
.wm-ipad {
    --wm-device-ratio: 4 / 3;
    position: relative;
    display: flex;
    width: 100%;
    aspect-ratio: var(--wm-device-ratio);
    background: #1d1d1f;
    border-radius: 18px;
    padding: 10px 28px 10px 36px;
    box-sizing: border-box;
    box-shadow: 0 8px 36px rgba(0, 0, 0, .22), inset 0 0 0 2px #3a3a3c;
    margin: 0 auto;
    max-width: 640px;
}

.wm-ipad::before,
.wm-ipad::after {
    content: "";
    position: absolute;
    top: -3px;
    height: 3px;
    background: linear-gradient(90deg, #5a5a5c, #2f2f31);
    border-radius: 3px;
}

.wm-ipad::before {
    left: 46px;
    width: 42px;
}

.wm-ipad::after {
    left: 100px;
    width: 74px;
}

/* フロントカメラ（左ベゼル中央） */
.wm-ipad__camera {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2c2c2e;
    border: 1.5px solid #3a3a3c;
}

/* スクリーン全体 */
.wm-ipad__screen {
    background: #f2f2f6;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.wm-ipad__screen::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 7px;
    width: 110px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(29, 29, 31, .18);
    z-index: 3;
    pointer-events: none;
}

/* ---------- ステータスバー ---------- */
.wm-ipad__statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .2rem .7rem;
    font-size: .6rem;
    font-weight: 600;
    color: #1d1d1f;
    background: #f8f8fa;
    flex-shrink: 0;
}

.wm-ipad__statusbar-icons {
    display: flex;
    gap: .35rem;
    color: #1d1d1f;
}

/* ---------- ツールバー（連絡先） ---------- */
.wm-ipad__toolbar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .8rem;
    background: #f8f8fa;
    border-bottom: 1px solid #d1d1d6;
    flex-shrink: 0;
}

.wm-ipad__toolbar-avatar {
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--c, #0e7a3a);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
}

.wm-ipad__toolbar-name {
    font-weight: 700;
    font-size: .85rem;
    color: #1d1d1f;
}

.wm-ipad__toolbar-dept {
    font-size: .65rem;
    color: #888;
    margin-left: auto;
}

.wm-ipad__toolbar-expand {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-left: .65rem;
    padding: .42rem .72rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d4f91, #13386a);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.wm-ipad__toolbar-expand:hover,
.wm-ipad__toolbar-expand:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(19, 56, 106, .24);
}

.wm-ipad__toolbar-expand svg {
    flex-shrink: 0;
}

/* ---------- チャットスクロール領域 ---------- */
.wm-chat {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: #e9e9ee;
    scroll-behavior: smooth;
}

/* スクロールバー */
.wm-chat::-webkit-scrollbar {
    width: 5px;
}

.wm-chat::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.wm-chat::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- メッセージ行 ---------- */
.wm-msg {
    display: flex;
    align-items: flex-end;
    gap: .45rem;
    max-width: 74%;
}

.wm-msg--q {
    align-self: flex-start;
}

.wm-msg--a {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* アバター */
.wm-msg__av {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: .55rem;
    font-weight: 700;
    color: #fff;
}

.wm-msg__av--q {
    background: #555;
}

.wm-msg__av--a {
    background: var(--c, #0e7a3a);
}

/* バブル */
.wm-msg__bubble {
    padding: .58rem .9rem;
    border-radius: 16px;
    font-size: .84rem;
    line-height: 1.7;
    word-break: break-word;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}

.wm-msg--q .wm-msg__bubble {
    background: #fff;
    color: #1d1d1f;
    border-bottom-left-radius: 4px;
}

.wm-msg--a .wm-msg__bubble {
    background: #2f7d4f;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.wm-msg__bubble p {
    margin: 0;
}

/* ---------- 入力バー ---------- */
.wm-ipad__inputbar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .6rem;
    background: #f8f8fa;
    border-top: 1px solid #d1d1d6;
    flex-shrink: 0;
}

.wm-ipad__inputbar-field {
    flex: 1;
    padding: .3rem .6rem;
    border: 1px solid #c7c7cc;
    border-radius: 16px;
    font-size: .75rem;
    color: #aaa;
    background: #fff;
}

.wm-ipad__inputbar-send {
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: #34c759;
    color: #fff;
    flex-shrink: 0;
}

/* ---------- アウトロ ---------- */
.wm-outro {
    text-align: center;
    margin: 2.5rem auto 0;
    max-width: 600px;
    font-size: 1rem;
    line-height: 1.8;
    color: #444;
}

/* ---------- IntersectionObserver アニメーション ---------- */
.wm-animated .wm-msg {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .4s ease, transform .4s ease;
}

.wm-animated .wm-msg.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 全画面モーダル ---------- */
.wm-modal[hidden] {
    display: none;
}

.wm-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.wm-modal__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(43, 103, 173, .24), transparent 42%),
        rgba(8, 13, 23, .72);
    backdrop-filter: blur(10px);
}

.wm-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    height: min(92vh, 920px);
    padding: 1.1rem;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(247, 250, 255, .96), rgba(233, 239, 247, .94));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.wm-modal__topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .2rem .1rem 1rem;
}

.wm-modal__eyebrow {
    margin: 0;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #5e7390;
}

.wm-modal__title {
    margin: 0;
    font-size: clamp(1.05rem, 1.1vw + .9rem, 1.5rem);
    color: #16253a;
}

.wm-modal__close {
    margin-left: auto;
    display: inline-grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border: 0;
    border-radius: 50%;
    background: rgba(22, 37, 58, .08);
    color: #16253a;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.wm-modal__close:hover,
.wm-modal__close:focus-visible {
    background: rgba(22, 37, 58, .14);
    transform: rotate(90deg);
}

.wm-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wm-modal__body .wm-ipad {
    width: min(100%, calc((92vh - 10rem) * (4 / 3)));
    max-width: 100%;
    height: auto;
    padding: 18px 26px;
    border-radius: 34px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .18), inset 0 0 0 2px #3a3a3c;
}

.wm-modal__body .wm-ipad__screen {
    height: 100%;
}

.wm-modal__body .wm-ipad__toolbar-expand {
    display: none;
}

.wm-modal__body .wm-chat {
    min-height: 0;
    padding: 1.4rem 1.5rem;
}

.wm-modal__body .wm-msg {
    max-width: min(62%, 780px);
}

.wm-modal .wm-msg {
    opacity: 1;
    transform: none;
}

body.wm-modal-open {
    overflow: hidden;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 820px) and (min-width: 481px) {
    .wm-thread {
        max-width: 540px;
    }

    .wm-ipad {
        --wm-device-ratio: 3 / 4;
        max-width: 432px;
        padding: 18px 16px 18px;
        border-radius: 28px;
        box-shadow: 0 18px 44px rgba(0, 0, 0, .24), inset 0 0 0 1.5px #424245;
    }

    .wm-ipad::before,
    .wm-ipad::after {
        display: none;
    }

    .wm-ipad__camera {
        display: block;
        left: 50%;
        top: 8px;
        width: 9px;
        height: 9px;
        transform: translateX(-50%);
    }

    .wm-ipad__screen {
        border-radius: 18px;
    }

    .wm-ipad__screen::after {
        width: 86px;
        bottom: 8px;
    }

    .wm-ipad__statusbar {
        padding: .55rem 1rem .3rem;
        font-size: .62rem;
    }

    .wm-ipad__toolbar {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: .35rem .55rem;
        padding: .55rem .9rem;
        align-items: center;
    }

    .wm-ipad__toolbar-name {
        font-size: .9rem;
    }

    .wm-ipad__toolbar-dept {
        grid-column: 2 / 3;
        margin-left: 0;
        font-size: .68rem;
    }

    .wm-ipad__toolbar-expand {
        grid-column: 3 / 4;
        grid-row: 1 / 3;
        align-self: center;
        margin-left: 0;
        padding: .48rem;
    }

    .wm-ipad__toolbar-expand span {
        display: none;
    }

    .wm-chat {
        padding: 1rem .9rem;
    }

    .wm-msg {
        max-width: 90%;
    }

    .wm-msg__bubble {
        font-size: .86rem;
        padding: .56rem .82rem;
    }

    .wm-modal {
        padding: .7rem;
    }

    .wm-modal__dialog {
        height: min(94vh, 920px);
        padding: .85rem;
        border-radius: 22px;
    }

    .wm-modal__topbar {
        padding-bottom: .75rem;
    }

    .wm-modal__body .wm-ipad {
        width: min(100%, calc((94vh - 7rem) * (3 / 4)));
        max-width: 100%;
        height: auto;
        padding: 16px 14px 18px;
        border-radius: 28px;
    }

    .wm-modal__body .wm-chat {
        padding: 1rem .95rem;
    }

    .wm-modal__body .wm-msg {
        max-width: 86%;
    }
}

@media (max-width: 480px) {
    .wm-tabs {
        gap: .4rem;
    }

    .wm-tabs__btn {
        padding: .4rem .7rem;
        font-size: .82rem;
    }

    .wm-tabs__info small {
        display: none;
    }

    .wm-ipad {
        --wm-device-ratio: 10 / 18.5;
        max-width: 292px;
        padding: 10px 8px 12px;
        border-radius: 34px;
        box-shadow: 0 14px 38px rgba(0, 0, 0, .24), inset 0 0 0 1.5px #424245;
    }

    .wm-ipad::before,
    .wm-ipad::after {
        display: none;
    }

    .wm-ipad__camera {
        display: block;
        left: 50%;
        top: 11px;
        width: 54px;
        height: 16px;
        transform: translateX(-50%);
        border-radius: 0 0 14px 14px;
        background: #111;
        border: 0;
        z-index: 5;
    }

    .wm-chat {
        padding: .85rem .7rem;
    }

    .wm-msg {
        max-width: 92%;
    }

    .wm-ipad__screen {
        border-radius: 26px;
    }

    .wm-ipad__screen::after {
        width: 92px;
        bottom: 8px;
        height: 4px;
        background: rgba(29, 29, 31, .22);
    }

    .wm-ipad__statusbar {
        padding: .45rem .9rem .2rem;
        font-size: .62rem;
    }

    .wm-ipad__toolbar {
        padding: .45rem .75rem;
    }

    .wm-ipad__toolbar-dept {
        display: none;
    }

    .wm-ipad__toolbar-expand {
        margin-left: auto;
    }

    .wm-ipad__inputbar {
        padding: .35rem .55rem .55rem;
    }

    .wm-modal {
        padding: 0;
    }

    .wm-modal__dialog {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: .7rem .6rem .85rem;
    }

    .wm-modal__topbar {
        gap: .55rem;
        align-items: flex-start;
    }

    .wm-modal__eyebrow {
        font-size: .64rem;
    }

    .wm-modal__title {
        font-size: 1rem;
        line-height: 1.4;
    }

    .wm-modal__close {
        width: 2.35rem;
        height: 2.35rem;
    }

    .wm-modal__body .wm-ipad {
        width: min(100%, calc((100vh - 7rem) * (10 / 18.5)));
        max-width: 100%;
        height: auto;
        padding: 10px 8px 12px;
        border-radius: 30px;
    }

    .wm-modal__body .wm-chat {
        padding: .9rem .75rem;
    }

    .wm-modal__body .wm-msg {
        max-width: 92%;
    }
}