#flowchart-wrapper {
    position: relative;
    margin: 2rem auto;
    width: 100%;
}

#flowchart-wrapper .flowchart-container {
    position: relative;
    transform-origin: 0 0;
    background-color: transparent; 
    overflow: visible; 
    margin: 0 auto;
}

/* フロー要素（ボックス） */
#flowchart-wrapper .flow-element {
    box-sizing: border-box;
    transition: all 0.3s ease;
    width: 260px;
    height: 90px;
    border-width: 2px;
    z-index: 20; /* ポップアップより手前（または同等） */
    background-color: #fff;
    border-radius: 4px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#flowchart-wrapper .flow-element:hover {
    transform: scale(1.02); /* 少しだけ拡大 */
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
    border-color: #1976D2 !important; /* ホバー時は青枠強調 */
    color: #1976D2 !important;
    z-index: 30;
}

/* 共通ポップアップ基本スタイル */
#flowchart-wrapper .flow-popup-image,
#flowchart-wrapper .flow-popup-text {
    display: none;
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 25; /* ボックスより手前、または裏 */
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none; 
}

/* --- 左側：画像ポップアップ --- */
#flowchart-wrapper .flow-popup-image {
    width: 220px;
    padding: 6px; /* 写真の枠風 */
    border: 1px solid #e0e0e0;
}

#flowchart-wrapper .flow-popup-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

/* 画像側のしっぽ（右向き） */
#flowchart-wrapper .flow-popup-image::after {
    content: "";
    position: absolute;
    top: 40px;
    right: -8px; /* 右外側 */
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #fff; /* 背景色 */
    filter: drop-shadow(2px 0 1px rgba(0,0,0,0.05)); /* 影を少し */
}

/* --- 右側：テキストポップアップ --- */
#flowchart-wrapper .flow-popup-text {
    width: 280px;
    padding: 16px 20px;
    border: 1px solid #1976D2; /* 青枠で強調 */
}

#flowchart-wrapper .flow-popup-text .popup-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: #07223F;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.4;
}

#flowchart-wrapper .flow-popup-text .popup-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
}

/* テキスト側のしっぽ（左向き） */
#flowchart-wrapper .flow-popup-text::after {
    content: "";
    position: absolute;
    top: 35px;
    left: -8px; /* 左外側 */
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #1976D2; /* 枠線色 */
}
/* 枠内塗りつぶし用 */
#flowchart-wrapper .flow-popup-text::before {
    content: "";
    position: absolute;
    top: 36px;
    left: -6px;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 7px solid #fff; 
    z-index: 1;
}

/* アクティブ時のアニメーション */
#flowchart-wrapper .flow-popup-image.active,
#flowchart-wrapper .flow-popup-text.active {
    display: block;
    opacity: 1;
}

/* 左側アニメーション（右へスライド） */
#flowchart-wrapper .flow-popup-image.active {
    animation: slideInLeft 0.3s ease forwards;
}
/* 右側アニメーション（左へスライド） */
#flowchart-wrapper .flow-popup-text.active {
    animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

.icon-wrap svg {
    stroke: currentColor; 
}



.flowchart-container.is-mobile .flow-popup-image {
    left: 0 !important;
    right: 0;
    margin: auto;
    z-index: 9999 !important;
    position: fixed !important;
    top: 140px !important;
}
.flowchart-container.is-mobile .flow-popup-text {
    left: 0 !important;
    right: 0;
    margin: auto;
    z-index: 9999 !important;
    position: fixed !important;
    top: 320px !important;
}
#flowchart-wrapper .flowchart-container.is-mobile .flow-popup-image::after,
#flowchart-wrapper .flowchart-container.is-mobile .flow-popup-text::before,
#flowchart-wrapper .flowchart-container.is-mobile .flow-popup-text::after {
	content:none!important;
}
.flow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
}

.flow-overlay::before {
    content: "";
    position: absolute;
    top: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 2px solid #fff;
}

.flow-overlay::after {
    content: "×"; 
    position: absolute;
    top: 73px;
    right: 20px;
    width: 40px;
    height: 40px;
    line-height: 36px;
    text-align: center;
    color: #fff;
    font-size: 30px;
    font-family: Arial, sans-serif;
    pointer-events: none;
}
.flow-popup-image.is-empty {
    display: none !important;
}