/* CSS variables */
:root {
    --bg: #f9f9f9;
    --card: #ffffff;
    --accent: #3498db;
    --accent-light: #e8f0f7; /* 新規追加: アセントカラーの薄いバージョン */
    --text: #333;
    --muted: #777;
    --tooltip-bg: #fff;
    --tooltip-border: #ddd;
    --radius: 8px; /* 新しいページに合わせて少し変更 */
    --panel-bg: rgba(0,0,0,0.65); /* glossary-modal の overlay 用に移動 */
}

html, body { height: 100%; }

body {
    font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    background-color: var(--bg);
    margin: 0 auto;
    max-width: 960px;
    padding: 20px;
    line-height: 1.8;
    color: var(--text);
}
h1 {
    color: #2c3e50;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
    text-align: center;
    margin-bottom: 30px;
}
h2 {
    color: #2c3e50;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
    margin-bottom: 25px;
    font-size: 1.5em;
}
h3 {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--accent); /* これまでの歩みページでh3のcolorが設定されていなかったため、汎用的にaccentを適用 */
}
section { /* これまでの歩みページでセクションごとのマージンを指定 */
    margin-bottom: 40px;
}
.section { /* 以前のページで使用されていたsectionのスタイルをクラスセレクタに変更 */
    margin-bottom: 40px;
    padding: 20px;
    background-color: var(--card);
    border-left: 6px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.problem-section, .cause-section, .process-section, .solution-section, .block-item {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    border: 1px solid #e0e0e0;
}
/* 旧ページ用 */
.problem-section h3, .cause-section h3, .process-section h3, .solution-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
    margin-bottom: 10px;
    font-size: 1.1em;
}
/* 新ページ用 */
.block-item h4 {
    font-size: 1.1em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

.flow-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}
.flow-wrapper {
    margin-bottom: 20px;
    width: 80%;
    max-width: 600px;
    text-align: center;
}
.flow-step {
    background-color: #e8f0f7;
    border: 1px solid #a7d9f7;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    position: relative;
    text-align: left;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.flow-step strong {
    display: block;
    font-size: 1.1em;
    color: #2c3e50;
    margin-bottom: 5px;
}
.flow-step .example, .example {
    display: block;
    font-size: 0.95em;
    color: #666;
    line-height: 1.4;
    margin-top: 10px;
    padding-left: 10px;
    border-left: 2px solid var(--accent);
    background-color: rgba(0,0,0,0.02);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding-top: 5px;
    padding-bottom: 5px;
}
.step-info {
    background-color: var(--card);
    border: 1px dashed var(--accent);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-top: 15px;
    text-align: left;
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.step-info strong {
    color: var(--accent);
    font-size: 1em;
    display: block;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(52,152,219,0.2);
    padding-bottom: 5px;
}
.step-info p {
    margin: 5px 0;
    color: var(--muted);
}
.step-info p strong {
    color: var(--text);
    font-size: 1em;
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    display: inline;
}
.arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--accent);
    margin: 10px auto;
}
ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 10px;
}
ul li {
    position: relative;
    padding-left: 0;
    margin-bottom: 8px;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.summary-box {
    background-color: var(--card);
    border: 2px solid var(--accent);
    padding: 25px;
    border-radius: var(--radius);
    margin-top: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.summary-box h2 {
    color: #2c3e50;
    border-bottom: 1px solid #ccc;
    margin-top: 0;
}
.related-link {
    text-align: center;
    margin: 30px 0;
    padding: 15px;
    background-color: #e8f0f7;
    border-radius: var(--radius);
    border: 1px solid #a7d9f7;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.related-link p {
    margin: 0;
    font-size: 1.1em;
    color: #2c3e50;
}
.date-block { /* これまでの歩みページ専用のスタイル */
    background-color: var(--card);
    border-left: 6px solid var(--accent);
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 4px; /* これまでの歩みページのスタイルを維持 */
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    font-size: 0.9em;
    color: var(--muted);
    border-top: 1px solid #eee;
    background-color: var(--bg);
}

/* ----- Glossary Styles ----- */
.gloss-term {
    color: #0b63a3;
    border-bottom: 1px dashed rgba(11,99,163,0.6);
    cursor: help;
    position: relative;
    padding: 0 2px;
    border-radius: 2px;
    text-decoration: none;
}
.gloss-term:focus {
    outline: 2px solid rgba(52,152,219,0.25);
    outline-offset: 2px;
}

/* Tooltip (Desktop) */
.gloss-tooltip {
    position: absolute;
    z-index: 40;
    min-width: 240px; /* こちらのページで指定されていたmin-widthを使用 */
    max-width: 360px;
    background: var(--tooltip-bg);
    color: var(--text);
    border: 1px solid var(--tooltip-border);
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    font-size: 0.95rem;
    line-height: 1.5;
    display: none;
    top: 100%; /* Tooltip position adjustment */
    left: 0; /* Tooltip position adjustment */
    margin-top: 8px; /* Tooltip position adjustment */
    text-align: left; /* Tooltip text alignment */
    white-space: normal; /* Tooltip text wrapping */
}
.gloss-tooltip strong {
    display: block; /* Tooltip内のstrongタグの表示形式をブロック要素に */
    margin-bottom: 5px; /* 下部マージン */
    color: #2c3e50; /* 色指定 */
}
.gloss-tooltip::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: var(--tooltip-bg);
    border-left: 1px solid var(--tooltip-border);
    border-top: 1px solid var(--tooltip-border);
    left: 12px;
    top: -6px;
}
.gloss-term.show .gloss-tooltip {
    display: block;
}

/* Mobile / Full Detail Modal */
#glossary-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 90;
}
#glossary-modal .overlay {
    position: absolute;
    inset: 0;
    background: var(--panel-bg); /* 変数を使用 */
    backdrop-filter: blur(2px);
    cursor: pointer;
}
#glossary-modal .dialog {
    position: relative;
    background: var(--card);
    width: min(720px, 94%);
    max-height: 86vh;
    overflow: auto;
    border-radius: 12px;
    padding: 20px;
    z-index: 95;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
#glossary-modal .dialog h3 {
    margin-top: 0;
    color: #2c3e50; /* 以前のページと合わせた色指定 */
    border-bottom: 1px solid #ccc; /* 以前のページと合わせた区切り線 */
    padding-bottom: 10px; /* 以前のページと合わせたパディング */
    margin-bottom: 15px; /* 以前のページと合わせたマージン */
}
#glossary-modal .dialog p { /* 以前のページと合わせたスタイル */
    line-height: 1.6;
    color: #555;
}
#glossary-modal .close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: transparent;
    border: none;
    font-size: 1.8rem; /* 以前のページと合わせた大きさに */
    cursor: pointer;
    color: var(--muted);
    line-height: 1; /* Adjust line-height for clean '✕' */
    padding: 0; /* Remove padding */
}
#glossary-modal .close:hover,
#glossary-modal .close:focus {
    color: #000;
}

/* Media Queries */
@media (max-width: 720px) {
    .gloss-tooltip {
        min-width: 200px; /* 以前のページで指定されていたmin-widthを使用 */
        max-width: 260px;
    }
    body { /* 以前のページと合わせたモバイル調整 */
        padding: 15px;
    }
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.3em;
    }
    h3 {
        font-size: 1.1em;
    }
    .section, .problem-section, .cause-section, .process-section, .solution-section, .block-item, .date-block { /* date-blockも追加 */
        padding: 10px 15px;
    }
    ul {
        padding-left: 15px;
    }
    .step-info {
        padding: 12px 15px;
        font-size: 0.85em;
    }
}

/* Hide tooltips on devices that don't support hover */
@media (hover: none) {
    .gloss-tooltip {
        display: none !important;
    }
}

/* Hide modal on devices that support hover (unless explicitly clicked) */
@media (hover: hover) {
    #glossary-modal {
        display: none !important;
    }
}

/* 自己正当化の原因セクションの視覚化スタイル */
.cause-visual {
    display: flex;
    flex-direction: column;
    gap: 30px; /* 要素間のスペース */
    align-items: center;
    margin-top: 30px;
}

.cause-card {
    background-color: var(--card);
    border: 1px solid #e0e0e0;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    width: 90%;
    max-width: 500px;
    text-align: left;
    position: relative;
}

.cause-card h5 {
    font-size: 1.2em;
    color: var(--accent);
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent-light);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
}

.cause-card h5::before {
    content: '→'; /* 矢印アイコン */
    font-size: 1.2em;
    margin-right: 10px;
    color: var(--accent);
}

.cause-card .origin-text {
    font-size: 0.95em;
    color: var(--text);
    margin-bottom: 15px;
    line-height: 1.6;
}

.cause-card .consequence-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cause-card .consequence-list li {
    background-color: var(--accent-light);
    border-left: 4px solid var(--accent);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #2c3e50;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.cause-card .consequence-list li::before {
    content: '●'; /* 点アイコン */
    color: var(--accent);
    font-size: 0.8em;
    margin-right: 8px;
    line-height: 1; /* アイコンの縦位置調整 */
}

.cause-card .consequence-list li:last-child {
    margin-bottom: 0;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid #ccc; /* 灰色系の矢印 */
    margin: 20px auto;
}

.trauma-section {
    background-color: #fcf8e3; /* 黄色系の背景で注意を引く */
    border-left: 6px solid #f0ad4e; /* オレンジ系のボーダー */
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    width: 90%;
    max-width: 600px;
    text-align: left;
    margin-top: 30px;
}

.trauma-section h4 {
    color: #f0ad4e; /* オレンジ系の色 */
    margin-top: 0;
    font-size: 1.3em;
    border-bottom: 1px dashed #f0ad4e;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.trauma-section .impact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trauma-section .impact-list li {
    background-color: #fcf3d9; /* 背景より少し薄い色 */
    border-left: 4px solid #f0ad4e;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.95em;
    color: #555;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

.trauma-section .impact-list li::before {
    content: '⚠'; /* 注意アイコン */
    color: #f0ad4e;
    font-size: 1.1em;
    margin-right: 8px;
    line-height: 1;
}

.trauma-section .impact-list li:last-child {
    margin-bottom: 0;
}

@media (max-width: 720px) {
    .cause-card, .trauma-section {
        width: 100%; /* モバイルでは幅をいっぱいに */
        padding: 15px;
    }
    .cause-card h5, .trauma-section h4 {
        font-size: 1.1em;
    }
    .cause-card .origin-text, .cause-card .consequence-list li,
    .trauma-section .impact-list li {
        font-size: 0.85em;
    }
}